@@ -115,6 +115,10 @@ def main() -> int:
115115 help = "verifier attn_implementation: 'eager' (default, exact "
116116 "repro) or 'sdpa'/'flash_attention_2' (memory-efficient "
117117 "prefill — required for long context, ADR 0015 item #1)." )
118+ ap .add_argument ("--skip-ar" , action = "store_true" ,
119+ help = "skip the native-AR baseline (its full DynamicCache "
120+ "dominates peak memory at long context); measure the "
121+ "restored-S5 path's true concurrency ceiling alone." )
118122 ap .add_argument ("--output" , default = None )
119123 args = ap .parse_args ()
120124
@@ -201,9 +205,15 @@ def recall(tokens, ans):
201205 ids_bt = torch .tensor ([s [0 ] for s in sel ], device = device )
202206 ans = [s [1 ] for s in sel ]
203207 # AR
204- g_ar , dt_ar = _ar_batched (verifier , ids_bt , args .gen_tokens , device , eos_ids )
205- ar_tps = (N * args .gen_tokens ) / dt_ar
206- ar_rec = sum (recall (g , a ) for g , a in zip (g_ar , ans )) / N
208+ if args .skip_ar :
209+ ar_tps , ar_rec = float ("nan" ), float ("nan" )
210+ else :
211+ g_ar , dt_ar = _ar_batched (verifier , ids_bt , args .gen_tokens , device , eos_ids )
212+ ar_tps = (N * args .gen_tokens ) / dt_ar
213+ ar_rec = sum (recall (g , a ) for g , a in zip (g_ar , ans )) / N
214+ if args .skip_ar :
215+ # isolate the restored-S5 path's peak (no AR cache in the high-water)
216+ torch .cuda .reset_peak_memory_stats (device )
207217 # restored S5
208218 cache , last = _restored_prefill_batched (restored , ids_bt , helpers )
209219 g_rs , dt_rs = _restored_decode_batched (verifier , cache , last ,
0 commit comments