Roofline Bound
Compute arithmetic intensity and the attainable ceiling, and decide whether a kernel is compute- or bandwidth-bound. A free ML coding interview task on NudgeCode: write it in Python and check it with tests in your browser. Medium · GPU, Roofline, Performance · from GPU Hardware and Architecture.
Implement gemm_intensity(m, n, k, bytes_per_elem) = 2mnk / (bytes_per_elem·(mk+kn+mn)) and roofline(flops, bytes_moved, peak_tflops, bandwidth_tbs) returning a dict with intensity, ridge (= peak / bandwidth), attainable_tflops (= min(peak, bandwidth × intensity)) and bound ('compute' when intensity >= ridge, else 'memory').