|
34 | 34 | _SHORT_MAX_PARAMS = { |
35 | 35 | # arch: (base, slope, cap) |
36 | 36 | "gfx942": (16384, 1536, 40960), |
37 | | - "gfx950": (24576, 1792, 57344), |
| 37 | + "gfx950": (18432, 1536, 40960), |
38 | 38 | } |
39 | 39 |
|
40 | 40 |
|
@@ -127,6 +127,23 @@ def _default_kernel_config( |
127 | 127 | short_max_rows = _next_pow2(num_rows) |
128 | 128 | tiered_short_max = min(cap, base + short_max_rows * slope) |
129 | 129 |
|
| 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 | + |
130 | 147 | return dict( |
131 | 148 | blocks_per_row=blocks_per_row, |
132 | 149 | bits_per_pass=bits_per_pass, |
|
0 commit comments