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
import numpy as np
def recompute_vs_store(...):
pass
Premium problem
Free accounts include problems #1–20. Upgrade to unlock the editor, hidden test cases, and reference solutions for every problem.
Already premium?