dylanyunlon
ca3697f4b0
[ENGINE] CCCL SmemResource pattern: pre-allocate staging buffers in V2 paged attention
Eliminates per-decode-step torch.full/torch.zeros GPU allocations that cause
OOM after thousands of generation steps (case_truncation max_tokens=8192).
Three allocation sites replaced with staging buffer .fill_()/.zero_() reuse:
- scores_padded: torch.full([H, padded_len], -inf) → _staging_scores slice
- v_padded_kv: torch.zeros([kv_h, padded_len, d]) → _staging_v_kv slice
- v_padded: torch.zeros([H, padded_len, d]) → _staging_v slice
Pattern from CCCL cub/detail/warpspeed/resource/smem_resource.cuh:
SmemResource pre-allocates stageCount buffers, nextStage() cycles through them.
PyTorch translation: allocate once at function entry, slice per step.
2026-08-07 04:37:44 +00:00
..
2026-07-30 16:06:20 +00:00
2026-07-30 16:06:20 +00:00
2026-07-30 16:06:20 +00:00
2026-08-06 07:01:14 +00:00
2026-07-30 16:06:20 +00:00
2026-08-05 08:24:43 +00:00
2026-07-30 16:06:20 +00:00
2026-07-30 16:06:20 +00:00
2026-08-05 08:24:43 +00:00
2026-08-06 06:33:26 +00:00
2026-08-07 01:59:18 +00:00
2026-08-07 04:37:44 +00:00
2026-08-06 06:10:56 +00:00
2026-08-06 07:01:14 +00:00
2026-07-30 16:06:20 +00:00
2026-08-07 02:46:46 +00:00
2026-07-30 16:06:20 +00:00
2026-08-06 03:02:29 +00:00
2026-07-30 16:06:20 +00:00
2026-08-05 08:36:52 +00:00
2026-08-06 02:55:51 +00:00
2026-07-30 16:06:20 +00:00
2026-07-30 16:06:20 +00:00
2026-07-30 16:06:20 +00:00
2026-08-05 08:36:52 +00:00
2026-08-07 02:01:23 +00:00
2026-08-07 01:54:52 +00:00