Skip to content

Commit d2d2ad6

Browse files
author
root
committed
Port gfx950 short_max + dead_block_trim (dispatch-only) onto Robin base
1 parent c6c30d8 commit d2d2ad6

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

‎aiter/ops/flydsl/topk_per_row_decode.py‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
_SHORT_MAX_PARAMS = {
3535
# arch: (base, slope, cap)
3636
"gfx942": (16384, 1536, 40960),
37-
"gfx950": (24576, 1792, 57344),
37+
"gfx950": (18432, 1536, 40960),
3838
}
3939

4040

@@ -127,6 +127,23 @@ 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).
139+
trim_on = _env_int("FLYDSL_TOPK_TIERED_TRIM", 1 if arch == "gfx950" else 0)
140+
if trim_on and max_model_len > tiered_short_max and num_rows * 32 <= cu_count * 2:
141+
if max_model_len <= _TIERED_MID_MAX:
142+
max_active_parts = tiered_mid_cap_default
143+
else:
144+
max_active_parts = max(tiered_mid_cap_default, tiered_long_cap_default)
145+
blocks_per_row = max(2, min(blocks_per_row, max_active_parts))
146+
130147
return dict(
131148
blocks_per_row=blocks_per_row,
132149
bits_per_pass=bits_per_pass,

0 commit comments

Comments
 (0)