Arithmetic intensity is the ratio of FLOPs performed to bytes of memory accessed. It tells you whether a kernel is compute-bound or memory-bound on a given accelerator.
Signature: def arithmetic_intensity(flops: int, bytes_accessed: int) -> float
Return flops / bytes_accessed as a float.
Examples:
(M=128, N=128, K=128) in fp32: flops = 2 * 128**3, bytes = 3 * 128**2 * 4 (read A, B; write C) → ~21.33N fp32 elements: flops = N, bytes = 12 * N (read A, read B, write C) → ~0.083Math
Asked at
Test Results