01-kernel-fusion showed fusion cuts memory traffic dramatically. That's not automatically the same thing as "makes the computation faster" — a computation's actual speed is limited by whichever resource (compute throughput or memory bandwidth) it exhausts first, and cutting memory traffic only helps when memory bandwidth was the actual bottleneck to begin with.
Implement arithmetic_intensity(flops, bytes_moved), ridge_point(peak_flops_per_sec, peak_bytes_per_sec), is_memory_bound(...), and achievable_flops_per_sec(...) — together, the classic "roofline model" for predicting a computation's actual achievable throughput on given hardware.
arithmetic_intensity returns flops / bytes_moved (FLOPs per byte of memory traffic).ridge_point returns peak_flops_per_sec / peak_bytes_per_sec — the intensity at which compute and memory bandwidth saturate simultaneously.is_memory_bound returns True iff the computation's own intensity is strictly below the hardware's ridge point.achievable_flops_per_sec returns min(peak_flops_per_sec, arithmetic_intensity * peak_bytes_per_sec).Open one at a time. Each gives away a little more than the last.
Both arithmetic_intensity and ridge_point are simple ratios — flops/bytes_moved for one, peak_compute/peak_bandwidth for the other. Comparing the two ratios directly tells you which resource runs out first.
achievable_flops_per_sec is a min of two competing ceilings: the hardware's raw compute ceiling (peak_flops_per_sec), and what the memory system can actually feed the compute units at this intensity (arithmetic_intensity * peak_bytes_per_sec) — whichever is smaller is the real bottleneck.
No results yet
Run your code to check it against the examples, or submit to run every test.