Skip to main content

Module profile

Module profile 

Source
Expand description

Per-kernel GPU time, for finding where time goes (NUVEC_PROFILE=1).

While enabled, array evaluation commits every dispatch in a command buffer of its own and waits for it, and each completed command buffer’s GPU time (Metal’s GPU start and end timestamps) is added to its kernel’s total. Commands then never overlap (nor wait for one another on the GPU), so totals show each kernel’s cost alone, not the overlapped wall time. NUVEC_PROFILE=shapes keeps each grid size (threads per dimension) apart. The GPU idles between command buffers, so its clocks drop: absolute times are inflated (most for short kernels); compare shares and orders of magnitude, and measure throughput with the benchmarks.

Functions§

enabled
Whether profiling is on (NUVEC_PROFILE set to anything but 0, read once).
report
(kernel, dispatches, GPU seconds) recorded so far, most expensive first.
reset
Forgets everything recorded so far.