@@ -127,15 +127,16 @@ def _default_kernel_config(
127127 short_max_rows = _next_pow2 (num_rows )
128128 tiered_short_max = min (cap , base + short_max_rows * slope )
129129
130- # Dead-block trim (gfx950 only; dispatch-only port of Step 4 Stage 17). The grid is
131- # (blocks_per_row, num_rows) but real workers per row = min(blocks_per_row, tier_cap);
132- # the excess return immediately yet still occupy co-resident slots ("dead" blocks).
133- # Trim blocks_per_row down to that cap: active_parts (a min) is unchanged, so results
134- # are identical and only wasted scheduling is cut. Applied only when the FULL padded
135- # grid (32*num_rows) already fits one co-resident wave (cu_count*occ, occ=2 -> num_rows
136- # <= 16); beyond that the extra blocks help hide latency (left to batch cap, Phase B).
137- # bpr stays >= 2 here (the bpr==1 grid=1 fold needs kernel bpr=1 support -> Phase B).
138- # Env FLYDSL_TOPK_TIERED_TRIM (0/1) overrides. gfx942 frozen (default 0).
130+ # Dead-block trim (gfx950 only). The launch grid is (blocks_per_row, num_rows) but
131+ # the real workers per row = min(blocks_per_row, tier_cap); the excess workgroups
132+ # return immediately yet still occupy co-resident slots ("dead" blocks). Trimming
133+ # blocks_per_row down to that cap leaves active_parts (a min) unchanged, so results
134+ # are identical and only wasted scheduling is cut. Applied only when the full padded
135+ # grid (32*num_rows) already fits one co-resident wave (cu_count*occ, occ=2 ->
136+ # num_rows <= 16); beyond that the extra blocks help hide latency, so those are left
137+ # to the batch co-resident cap. blocks_per_row stays >= 2 here (the bpr==1 grid=1
138+ # fold requires the kernel's single-workgroup launch path). Env
139+ # FLYDSL_TOPK_TIERED_TRIM (0/1) overrides; gfx942 is untouched (default 0).
139140 trim_on = _env_int ("FLYDSL_TOPK_TIERED_TRIM" , 1 if arch == "gfx950" else 0 )
140141 if trim_on and max_model_len > tiered_short_max and num_rows * 32 <= cu_count * 2 :
141142 if max_model_len <= _TIERED_MID_MAX :
0 commit comments