Gemini 4 Hydrogen 1.97×

Harness: Antigravity · switches: PYTORCH_CUDA_ALLOC_CONF=roundup_power2_divisions:16,garbage_collection_threshold:0.85 (VAE encoder channels_last: round 5's vae_model.encoder.to(memory_format=torch.channels_last) failed the interleaved-layout gate (2b), found by reverting changes one at a time; scored without that line, 1.97×)

Judged
1.97×
Tier
N1
Self-best
2.15×
Rounds
10
Hours
10.0
API cost
$53.0
Input tokens · 94.3% cached
224 M
Output tokens
2.4 M
Requests
1,396
Attention kernel swap (split by mask structure)
✓ hand-written Triton block-sparse GQA attention (blocks from span metadata), 2.630 → 2.13 s; mid-window recompiles (window spread 0.1946) fixed with do_not_specialize; round 10 bounding-box schedule + heaviest blocks first, attention microbenchmark 185.93 → 177.00 ms/step. No FlashAttention / FA3 in the log
Drop activation recompute (28 decoder layers)
partial: ViT removed; the decoder's last setting (round 5) still recomputes the first 8 layers. Round 3 kept 12 layers, 2.13 → 1.900 s, 133.84 GiB reserved; round 4 kept 6, round 5 back to 8 for allocator headroom. expandable_segments unavailable, cudaMallocAsync OOM
Intra-layer MoT fusion (routing / RMSNorm / RoPE / SwiGLU)
✓ round 4 permute-once MoT layout + Triton RMSNorm / SwiGLU / QK norm + RoPE + scatter / linear CE (with recompute at 6 layers, 1.900 → 1.464 s); round 5 the two token types passed as a tuple through 28 layers; round 6 unmasked vectorized SwiGLU (forward 0.785 → 0.263 ms, bitwise); round 8 gate+up in one GEMM
Optimizer, EMA, step start / end
✓ round 5 fused AdamW, .item() / nonzero syncs removed (~94 + 37 ms); EMA via lerp blocked by gate 3 in round 6 (−53.2σ), round 7 back to upstream and passed (2.0147×), round 8 a Triton EMA. Round 5's channels_last on the VAE encoder is not in the scored config (failed gate 2b; the score is a re-judge without that line); a VAE side-stream prototype hit a race with FSDP's input cast, reverted
Other main levers
FSDP forward prefetch + allocator settings (roundup_power2_divisions:16, GC threshold 0.85), with SwiGLU vectorization 1.3625 → 1.2858 s, 2.6 s spikes gone; ViT as one FSDP unit (round 8 full check 2.1361×); reduce-scatter averaging directly, _foreach_norm (round 9 1.2140 s)
Raw work log10 sections
0.0 hRound 1: Baseline Profiling
- Start time: 2026-11-19T18:16:00Z
- Action: Profile unchanged reference (/submission/bagel_sft) with bench.py profile --from 8 --iters 3 -> /tmp/r1/profile
- Results (profile.json & Chrome trace analysis on rank 0, steps 8..10):
  - Step wall times on rank 0: Step 8 = 2.7498 s (2684.7 ms trace span), Step 9 = 3.0138 s, Step 10 = 2.4052 s (2318.5 ms before post-opt exit). Peak allocated = 82.13 GiB (~58 GiB headroom), DataLoader __next__ = 0.11 ms (not IO bound), GPU active = 93.2%.
  - True NV18 NCCL time on the bottleneck rank (Step 9/10): ~70 ms ReduceScatter + 84 ms AllGather (mostly overlapped). Step 8 shows 1482.4 ms ReduceScatter wait because rank 0 had a lighter batch (6602 tokens) and stalled waiting for a peer rank running heavy attention.
  - Step 9 Breakdown (3013.8 ms span):
    - PostOpt+Data+VAE: span 46.6 ms (launches 128.4 ms of GPU kernels: cudnn_convolution 48.2 ms, native_group_norm 39.3 ms, EMA MT 19.1 ms); aten::item inside Bagel.forward blocks 115 ms waiting on VAE completion.
    - Forward: span 893.4 ms, compute 673.1 ms (GEMM 224.9, fmha_cutlassF 188.1, faF 3.2, IdxCat 66.7, Elem 169.3).
    - Backward: span 1969.2 ms, compute 1819.6 ms (GEMM 593.2, fmha_cutlassF recompute 181.5, fmha_cutlassB 505.4, faF 3.2, faB 10.0, IdxCat 163.9, Elem 380.9).
    - ClipGrad: 9.4 ms; Opt.step: 85.8 ms (MultiTensor 69.3, Elem 10.3, Red 3.3).
- Key Optimization Plan:
  1. Hotspot #1 (LLM Attention & Masking): Replace per-sample SM80 EFFICIENT_ATTENTION + 7x K/V repeat + per-layer float32->bf16 dense mask casts with a Hopper/Triton native-GQA block-sparse attention kernel + compact mask metadata derived in SimpleCustomBatch.cuda() (zero dense mask H2D transfer for fast path, zero straggler skew, exact on all interleaved layouts for Gate 2b).
  2. Hotspot #2 (Full Activation Checkpointing): Disable unnecessary checkpoint_wrapper layers using the ~58+ GiB free VRAM headroom (ViT, MLPconnector, most/all LLM decoder layers) to eliminate ~600-700 ms/step recompute + 58 backward AllGathers while preserving N0 exactness.
  3. Hotspot #3 (MoT Scatter/Gather & Elementwise Overhead): Eliminate repeated per-layer new_zeros / [idx] scatter/gather in Qwen2MoTDecoderLayer & PackedAttentionMoT, and fuse Qwen2RMSNorm, RoPE, and SwiGLU in Triton (plus check CrossEntropy).
  4. Hotspot #4 (VAE, Syncs, Collectives, Optimizer/EMA): Remove aten::item & aten::nonzero GPU syncs, fuse/coalesce logging syncs & collectives, use AdamW(fused=True), single-pass EMA update, and FSDP prefetch / VAE optimizations.
0.8 hRound 2: O(S) Span Attention Metadata + Triton Block-Sparse GQA FlashAttention
- Changes in /submission/bagel_sft:
  - data/data_utils.py (build_span_metadata_cpu), data/dataset_base.py (SimpleCustomBatch.cuda() post-digest metadata conversion + non_blocking=True transfers).
  - modeling/bagel/triton_attn.py (SpanAttnSchedule, _classify_grid_kernel, _pack_rows_kernel, _pack_cols_kernel, _fwd_kernel, _bwd_preprocess, _bwd_dq_kernel, _bwd_dkdv_perhead_kernel, _reduce_gqa_LHD_kernel with do_not_specialize + 16-aligned span_meta rows guaranteeing 1 compile per kernel for all sequence lengths).
  - modeling/bagel/bagel.py, modeling/bagel/qwen2_navit.py: single per-step build_span_schedule and native-GQA span_flash_attn dispatch.
- Catch & fix during benchmark: Initial time run hit 4 mid-run Triton recompilations (steps 5, 7, 11, 14) from varying L/nb_n divisibility and unaligned span_meta[1..3] row pointers (window_range 0.1946). Fixed with do_not_specialize on variable dims and 16-element row padding of span_meta (cache_entries == 1 verified across 15 diverse L values).
- Timing (bench.py time -> /tmp/r2_time):
  - s_per_step = 2.13 (windows [2.1101, 2.1499], window_range = 0.0187), speedup_vs_frozen_reference = 1.2346x, tokens_per_s = 19230, peak_memory_allocated_gib = 81.94.
- Quick Check (bench.py check --quick -> /tmp/r2_quick):
  - exact_items_ok = true, problems = [], status = NOT_BITWISE, layout_differs = false, peak_memory_allocated_gib = 81.92.
  - Git commit on opt recorded.
1.0 hRound 3: Selective Activation Checkpointing Removal
- Change: train/fsdp_utils.py:grad_checkpoint_check_fn removes CheckpointWrapper from all 26 SiglipEncoderLayer blocks, MLPconnector, and Qwen2MoTDecoderLayer layers 12–27 (layer_idx < 12 retained temporarily prior to Round 4 memory reductions).
- Timing (bench.py time -> /tmp/r3_time):
  - s_per_step = 1.9004 (windows [1.9174, 1.8834], window_range = 0.0179), speedup_vs_frozen_reference = 1.3837x, tokens_per_s = 21553, peak_memory_allocated_gib = 111.05, peak_memory_reserved_gib = 133.84.
  - Observation: +29.11 GiB allocated for 16 LLM layers + ViT + connector (~1.6-1.8 GiB/layer), plus ~22.8 GiB reserved allocator fragmentation (133.84 - 111.05), proving that Round 4 fused ops + chunked linear CE + expandable_segments:True are needed to reach K=0 cleanly.
1.6 hRound 4: Permute-Once MoT + Fused Triton Norms/RoPE/SwiGLU/LinearCE + Partial AC (`K=6`)
- Changes in /submission/bagel_sft:
  - modeling/bagel/triton_ops.py: Added single-compile deterministic (do_not_specialize, chunked BWD_CHUNKS=128 non-atomic backward reductions) Triton kernels: invert_perm, permute_rows_nograd, bijective_permute, fused_rmsnorm, fused_add_rmsnorm, fused_swiglu, fused_cat_add, fused_mot_qk_norm_rope_scatter, and fused_linear_cross_entropy (single pass for N<=2048, chunked chunk_size=2048 above 2048, returning float32 matching F.cross_entropy).
  - modeling/bagel/qwen2_navit.py: Permute-once MoT execution inside Qwen2Model.forward_train, Qwen2MoTDecoderLayer.forward_train, and PackedAttentionMoT.forward_train (falls back cleanly if mot_info is None).
  - modeling/bagel/bagel.py: Wired fused_linear_cross_entropy when last_hidden_state is CUDA bf16 and lm_head.bias is None.
  - train/fsdp_utils.py: Partial activation checkpointing (layer_idx < 6) balancing compute against allocator headroom (expandable_segments:True unsupported on this host; backend:cudaMallocAsync OOMed at step 15 under FSDP multi-stream record_stream).
- Timing (bench.py time -> /tmp/r4_time3, switches.json = {"environment": {}}):
  - s_per_step = 1.4637 (windows [1.4496, 1.4778], window_range = 0.0193), speedup_vs_frozen_reference = 1.7965x, tokens_per_s = 27985, peak_memory_allocated_gib = 107.50, peak_memory_reserved_gib = 133.79 (one late retry spike at step 52 = 2.6114 s).
- Quick Check (bench.py check --quick -> /tmp/r4_quick):
  - exact_items_ok = true, problems = [], status = NOT_BITWISE, layout_differs = false, peak_memory_allocated_gib = 106.75.
2.8 hRound 5: Tuple-Mode MoT + NHWC Triton-GN VAE + Async Coalesced Collectives + Sync Removal + Fused AdamW + Foreach EMA
- Changes in /submission/bagel_sft:
  - modeling/bagel/triton_ops.py: Hardened _FusedAddRMSNormFunc.backward (dh=None/dy=None safety), added bijective_permute_split, bijective_permute_cat, fused_dual_add, and coalesced NHWC triton_nhwc_group_norm (Chan parallel stats + swish fusion, single compile per (C, swish)).
  - modeling/bagel/qwen2_navit.py: Passed 2-tuple (x_u, x_g) through all 28 Qwen2MoTDecoderLayer layers in Qwen2Model.forward_train, avoiding per-layer cat/permute copies and 112 SliceBackward0 zero-fills.
  - data/dataset_base.py, modeling/bagel/bagel.py, modeling/bagel/modeling_utils.py: Precomputed vit_cu_seqlens, vit_max_seqlen, and mse_select_idx inside SimpleCustomBatch.cuda() post-digest, eliminating per-step aten::item (~94 ms) and aten::nonzero (~37 ms) GPU sync stalls; cached CPU TimestepEmbedder frequencies (torch.equal).
  - modeling/autoencoder.py: Switched no-grad inference AutoEncoder.encode to channels_last NHWC conv + triton_nhwc_group_norm + zero-copy NHWC AttnBlock + direct padded Downsample.
  - train/fsdp_utils.py, train/pretrain_unified_navit.py: Tuned partial AC to layer_idx < 8 (K=8) for allocator headroom, cached FSDP EMA flat-param pairs + torch._foreach_lerp_, enabled AdamW(..., fused=True), coalesced token counts into 1 async int64 AllReduce overlapped behind VAE+forward, coalesced logging/memory async AllReduces and removed redundant pre-log torch.cuda.synchronize().
- Quick Check (bench.py check --quick -> /tmp/r5_quick):
  - exact_items_ok = true, problems = [], status = NOT_BITWISE, layout_differs = false, optimizer = "torch.optim.adamw.AdamW".
- Timing (bench.py time -> /tmp/r5_time2):
  - s_per_step = 1.3625 (windows = [1.3622, 1.3629], window_range = 0.0006), speedup_vs_frozen_reference = 1.9300x, tokens_per_s = 30062, peak_memory_allocated_gib = 103.92, peak_memory_reserved_gib = 133.84 (still shows 2 isolated ~2.6s single-step spikes at steps 10 & 39; diagnosing in Round 6).
3.6 hRound 6: Vectorized Unmasked SwiGLU/DualAdd + FSDP `forward_prefetch` + CUDA Allocator Tuning
- Root causes diagnosed from Round 5 Chrome trace (/tmp/r5_prof, 1353.5 ms span):
  - 34.87 ms exposed cudaFree/GC stalls at 133.69 GiB reserved (30 GiB fragmentation gap over 103.92 GiB allocated).
  - 91.11 ms/step exposed AllGather (forward_prefetch=False).
  - Masked tl.load/tl.store in _swiglu_* (61.07 ms/step) and _dual_add_kernel disabled 128-bit vector loads.
- Changes:
  - modeling/bagel/triton_ops.py: Added N_FULL unmasked vectorized fast path to _swiglu_fwd_kernel (0.785 ms -> 0.263 ms, bitwise identical) & _swiglu_bwd_kernel (1.608 ms -> 0.481 ms, bitwise identical), and combined _dual_add_combined_kernel (0.254 ms -> 0.097 ms, bitwise identical). Verified compile cache count = 1 each.
  - train/fsdp_utils.py: Enabled forward_prefetch=True in fsdp_wrapper(...).
  - /submission/switches.json: Set PYTORCH_CUDA_ALLOC_CONF="roundup_power2_divisions:16,garbage_collection_threshold:0.85".
- Timing (bench.py time -> /tmp/r6_time):
  - s_per_step = 1.2858 (windows = [1.2949, 1.2766], window_range = 0.0142), speedup_vs_frozen_reference = 2.0451x, tokens_per_s = 31856, peak_memory_allocated_gib = 105.66, peak_memory_reserved_gib = 133.79 (zero 2.6s spikes across all 65 steps).
- Full Judge Verification (bench.py check -> /tmp/r6_check, stopped after Seed 1 report):
  - Gate 1 (timing): s_per_step = 1.2972 (windows = [1.3144, 1.2800], window_range = 0.0265 <= 0.06, ~2.027x), peak_alloc = 105.66 GiB, peak_res = 133.40 GiB.
  - Gate 2 (record): exact_items_ok = true.
  - Gate 2b (conform det & prod): BOTH PASS (verdict = "conforming"; R_N = 0.0317 <= 0.0420, R_J = 0.0261 <= 0.0420, R_B = 0.0140).
  - Gate 3 (traj Seed 1): 12/14 endpoints within (|z| <= 1.21 sigma; losses within 0.04 sigma!), ONLY disp_ema_s050_100 (-53.2 sigma) and disp_ema_s100_140 (-39.5 sigma) failed due to torch._foreach_lerp_ vs upstream torch._foreach_mul_ + _foreach_add_ fp32 rounding drift (measured 2.38e-5 per 10M weights over 10 identical steps with mul_+add_ vs 0.0 with lerp_, matching 0.0027 on 14.6B params against sigma_seed = 3.96e-5).
4.2 hRound 7: Restore Exact Upstream EMA Numerics (`_foreach_mul_` + `_foreach_add_`) & Full Check PASS
- Change: train/fsdp_utils.py:fsdp_ema_update keeps _EMA_PAIR_CACHE and avoids redundant .to(dtype=...) copies when dtypes already match, while executing exact upstream torch._foreach_mul_(ema_params, decay); torch._foreach_add_(ema_params, new_params, alpha=1 - decay) instead of _foreach_lerp_.
- Full Judge Verification (bench.py check --tree /submission/bagel_sft --config /submission/switches.json --out /tmp/r7_check):
  - Overall Status: PASS (Tier N1)
  - Gate 1 (benefit): s_per_step = 1.3052 s vs 2.6296 s ref (windows = [1.2985, 1.3119], window_range = 0.0103 <= 0.06), speedup = 2.0147x, tokens_per_s = 31382, peak_memory_allocated_gib = 105.66, peak_memory_reserved_gib = 133.76.
  - Gate 2 (record): exact_items_ok = true, problems = [], layout_differs = false, other_optimizer_steps = 0.
  - Gate 2b (conformance, det & prod): BOTH PASS (verdict = "conforming"; det R_N=0.0317, R_J=0.0261 <= 0.0420; prod R_N=0.0318, R_J=0.0261 <= 0.0417).
  - Gate 3 (trajectory, 150 steps, Seed 1): PASS (verdict = "equivalent" on Seed 1 alone — all 14/14 endpoints within, |z| <= 0.934 sigma; disp_ema_s050_100 = -0.012 sigma, disp_ema_s100_140 = -0.325 sigma).
6.9 hRound 8: Fused Stacked SwiGLU + SigLIP 2D RoPE + Fused VAE NHWC Kernels + Coalesced FSDP Wrapping + Triton FMA EMA
- Root causes diagnosed from Round 7 & intermediate trace analysis:
  - mlp.gate_proj.weight and mlp.up_proj.weight lie adjacent in FSDP FlatParameter (bias=False), permitting a single (N, 3584) x (3584, 37888) GEMM + strided SwiGLU forward/backward.
  - 26 SiglipEncoderLayer + MLPconnector + TimestepEmbedder FSDP units added ~28 extra AllGather/ReduceScatter/reshard boundaries in ViT+head.
  - VAE ResnetBlock & AttnBlock had separate conv bias adds, residual adds, nn.functional.pad, and 3 separate QKV convs; SigLIP 2D RoPE ran 10+ tensor ops per layer × 27 layers; foreach EMA launched 60 kernels.
  - Note: An initial Round 8 prototype adding an async vae_stream hit a race with FSDP._root_pre_forward._to_kwargs casting fp32 padded_latent -> bf16 before wait_event (mse blowup + allocator fragmentation); vae_stream was diagnosed via unit checks and reverted (vae_model.encode takes only ~17 ms/step synchronously).
- Changes in /submission/bagel_sft:
  - modeling/bagel/triton_ops.py: _reduce_partial_dw_kernel casts in-kernel (OutW.dtype.element_ty); removed .clone() in _FusedAddRMSNormFunc.backward; replaced zeros_like with empty for active shards in _FusedMotQKNormRoPEScatterFunc.backward; added triton_nhwc_group_norm(..., conv_bias=None), triton_nhwc_bias_add_inplace, triton_nhwc_res_add_bias, triton_nhwc_pad_br1; added _FusedStackedSwiGLUFunc (_strided_swiglu_fwd_kernel, _strided_swiglu_bwd_kernel, fused_mlp_gate_up_swiglu); added _FusedSiglip2DRoPEFunc (fused_siglip_2d_rope); added triton_ema_update_pairs (_ema_update_sep_kernel matching decay*e + (1-decay)*n numerically).
  - modeling/bagel/qwen2_navit.py, modeling/bagel/bagel.py: Added FusedLMHead(nn.Linear) delegating fused_linear_cross_entropy; wired fused_mlp_gate_up_swiglu in Qwen2MoTDecoderLayer.forward_train.
  - modeling/autoencoder.py: NHWC fused AttnBlock (w_qkv linear + SDPA + proj_out linear), ResnetBlock (fused conv_bias GN + triton_nhwc_res_add_bias), Downsample (triton_nhwc_pad_br1 + bias_add_inplace), Encoder.conv_in.
  - modeling/bagel/siglip_navit.py: Wired fused_siglip_2d_rope + guarded .to(torch.bfloat16) in SiglipFlashAttention2.forward.
  - train/fsdp_utils.py: Wrapped ViT at SiglipVisionTransformer granularity ({Qwen2DecoderLayer, Qwen2MoEDecoderLayer, Qwen2MoTDecoderLayer, SiglipVisionTransformer, PositionEmbedding, FusedLMHead}), removing 26 per-layer ViT FSDP units; switched EMA updates on CUDA fp32 flat params to triton_ema_update_pairs.
  - data/dataset_base.py: .pin_memory().to(device, non_blocking=True) for span_meta and mse_select_idx; GPU cumsum for vit_cu_seqlens.
- Full Judge Verification (bench.py check --tree /submission/bagel_sft --config /submission/switches.json --out /tmp/r8_check):
  - Overall Status: PASS (Tier N1)
  - Gate 1 (benefit): s_per_step = 1.2310 s vs 2.6296 s ref (windows = [1.2407, 1.2214], window_range = 0.0157 <= 0.06), speedup = 2.1361x, tokens_per_s = 33274, peak_memory_allocated_gib = 106.01.
  - Gate 2 (record): exact_items_ok = true, problems = [], other_optimizer_steps = 0.
  - Gate 2b (conformance, det & prod): BOTH PASS (verdict = "conforming"; det R_N=0.0549, R_J=0.0454 <= 0.0697, ratio_n=2.360 <= 3.0; prod R_N=0.0549, R_J=0.0454 <= 0.0696, ratio_n=2.365 <= 3.0).
  - Gate 3 (trajectory, 150 steps, Seed 1): PASS (verdict = "equivalent" on Seed 1 alone — 14/14 endpoints within, max |z| = 0.988 sigma; disp_ema_s050_100 = -0.004 sigma, disp_ema_s100_140 = -0.136 sigma).
7.7 hRound 9: FSDP `FULL_SHARD`+`ReduceOp.AVG`, Split/Cat Stream Decoupling, and `torch._foreach_norm`
- Root causes diagnosed from Round 8 FSDP microbenchmarks:
  - With num_replicate=1, num_shard=4 across 4 GPUs, HYBRID_SHARD still launches ReduceOp.SUM + explicit per-shard torch.div_(world_size) kernels in _post_backward_hook. Switching to FULL_SHARD (device_mesh=None) with a ReduceOp.AVG comm hook eliminates explicit post-reduction division kernels while preserving exact per-step gradient scaling.
  - Default FlatParamHandle._use_unsharded_views(as_params=False) binds SplitWithSizesBackward0 (CatArrayBatchedCopy) to _unshard_stream, serializing gradient concatenation against previous-layer backward AllGathers and stalling the default compute stream (364 ms -> 262 ms in 12-block FSDP microbenchmark). Routing as_params=False views onto root_state._post_backward_stream eliminates the stall without extra cross-stream autograd waits or extra peak VRAM.
  - fsdp_mod._get_grad_norm launched per-shard linalg.vector_norm kernels sequentially inside clip_grad_norm_; overriding _get_grad_norm (while preserving FSDP.clip_grad_norm_ itself for judge traj hook capture) uses single multi-tensor torch._foreach_norm(..., 2.0, dtype=torch.float32) (0.0 diff verified deterministically).
- Changes in /submission/bagel_sft:
  - train/fsdp_utils.py: Added _install_fsdp_runtime_optimizations(), _avg_reduce_scatter_hook, and updated fsdp_wrapper(...) (FULL_SHARD + ReduceOp.AVG when HYBRID_SHARD spans 1 x world_size).
- Timing (bench.py time -> /tmp/r9_time):
  - s_per_step = 1.2140 s vs 2.6296 s ref (windows = [1.2267, 1.2013], window_range = 0.0209 <= 0.06), speedup_vs_frozen_reference = 2.1661x, tokens_per_s = 33739, peak_memory_allocated_gib = 106.0, peak_memory_reserved_gib = 135.76.
- Gate Verification (bench.py check --n1 -> /tmp/r9_check):
  - Overall Status: PASS (Tier N1, Gates 0, 2b, 3).
  - Gate 2b (conformance, det & prod): BOTH PASS (verdict = "conforming"; det R_N=0.0549, R_J=0.0454 <= 0.0697, ratio_n=2.361 <= 3.0; prod R_N=0.0549, R_J=0.0454 <= 0.0698, ratio_n=2.359 <= 3.0).
  - Gate 3 (trajectory, 150 steps, Seed 1): PASS (verdict = "equivalent" on Seed 1 alone — 14/14 endpoints within, max |z| = 0.910 sigma; disp_ema_s050_100 = +0.018 sigma, disp_ema_s100_140 = -0.197 sigma).
9.0 hRound 10: Hierarchical Bounding-Box Span Schedule + Longest-Row/Col Work Scheduling (`triton_attn.py`)
- Changes in /submission/bagel_sft/modeling/bagel/triton_attn.py:
  - Added _block_bounds_kernel (min/max q_min/q_max/q_nid/k_nid per block) + hierarchical fast-accept/reject inside _classify_grid_kernel, avoiding full 64x64 mask evaluation on empty or uniform-span full tiles.
  - Emitted row_work/col_work in _pack_rows_kernel/_pack_cols_kernel and sorted row_order/col_order descending so heaviest blocks launch first across CTAs (_fwd_kernel, _bwd_dq_kernel with maxnreg=216, _bwd_dkdv_perhead_kernel with tl.dot(..., acc=...) live-range tightening).
  - Padded bnd inner dimension to 16-element alignment and split rwork/cwork so all 9 span attention kernels compile strictly once (cache_entries == 1) across arbitrary sequence lengths (det == 0.0).
- Benchmarks:
  - Controlled A/B single-step attention microbenchmark (L=10097 real packed layout, 28 bwd + 36 fwd + sched): 185.93 ms/step -> 177.00 ms/step (-8.93 ms/step; SCHED 0.328 -> 0.115 ms, FWD 1.057 -> 0.960 ms, BWD 5.269 -> 5.083 ms).
  - Pre-alignment bench.py time --paired (/tmp/r10_time): 1.2184 s/step (windows=[1.2315, 1.2053], 2.1544x vs paired ref 2.6249 s/step, peak_alloc=105.99 GiB). Gate check deferred to follow Round 11 FSDP + SigLIP/VAE optimizations.
↑ BAGEL SFT