Given an activation of size activation_bytes, decide whether to store it (and pay the HBM round-trip later) or recompute it from upstream (and pay extra FLOPs). Compare the two times and pick the cheaper option.
Signature: def recompute_vs_store(activation_bytes: int, recompute_flops: int, peak_flops: float, peak_bw: float) -> str
activation_bytes / peak_bwrecompute_flops / peak_flopsReturn 'recompute' if recompute time ≤ fetch time, otherwise 'store'.
Math
Asked at
Test Results