TorchedUp
ProblemsPremium
TorchedUp
Recompute vs Store DecisionMedium
ProblemsPremium

Recompute vs Store Decision

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

  • Fetch time = activation_bytes / peak_bw
  • Recompute time = recompute_flops / peak_flops

Return 'recompute' if recompute time ≤ fetch time, otherwise 'store'.

Math

Asked at

Python (numpy)0/3 runs today

Test Results

○cheap recompute
○expensive recompute
○tied at break-even🔒 Premium
Advertisement