Skip to content

Commit c0a6c7c

Browse files
HIP: drop the RDNA3.5 q8_0 J=64 -> J=96 widening
The widening existed because J=64 was several times slower for q8_0, but that was the generic ntx=2 schedule which rows_per_warp() no longer selects for block quants. With J=64 healthy the widening only pads 64 valid columns into a 96-wide tile. Cosmos-Reason2-8B Q8_0, llama-bench -p 512 -r 3 on gfx1151: ubatch 64 (J 96 -> 64): 883.1 -> 1118.5 t/s (+26.7%) ubatch 96 (J 96, same): 1151.4 -> 1147.2 t/s (-0.4%) ubatch 128 (J 128, same): 1416.1 -> 1398.1 t/s (-1.3%) MoE keeps its own widening, which is untested here and unchanged. test-backend-ops MUL_MAT: 1484/1484. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 2a6e364 commit c0a6c7c

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

ggml/src/ggml-cuda/mmq.cuh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,20 +1822,21 @@ static bool mmq_rdna35_dual_wg_eligible(const ggml_type type) {
18221822

18231823
// J values that measure faster on RDNA3.5 than the width the occupancy rule picks.
18241824
//
1825-
// J=64 is 6-7x slower than the neighbouring widths for q8_0; the other types stay within
1826-
// 1.05x of their best there and keep it. For MoE the compacted per-expert grid already supplies
1827-
// the parallelism that column tiling supplies for a dense GEMM, so anything above a 32-wide tile
1828-
// only adds padding - q8_0 excepted, whose narrow tiles are slow.
1825+
// Dense shapes now keep the width the occupancy rule picks: q8_0 used to be widened from
1826+
// J=64 to J=96 because J=64 was several times slower, but that was the generic ntx=2
1827+
// schedule, which rows_per_warp() no longer selects for block quants. Without the widening
1828+
// q8_0 avoids padding 64 valid columns into a 96-wide tile and is 27% faster there.
1829+
//
1830+
// For MoE the compacted per-expert grid already supplies the parallelism that column tiling
1831+
// supplies for a dense GEMM, so anything above a 32-wide tile only adds padding - q8_0
1832+
// excepted, whose narrow tiles are slow.
18291833
static int mmq_rdna35_tuned_J(const ggml_type type, const bool moe, const int J_occupancy) {
18301834
if (moe) {
18311835
if (type == GGML_TYPE_Q8_0) {
18321836
return J_occupancy > 32 ? 96 : J_occupancy;
18331837
}
18341838
return J_occupancy < 32 ? J_occupancy : 32;
18351839
}
1836-
if (J_occupancy == 64 && type == GGML_TYPE_Q8_0) {
1837-
return 96;
1838-
}
18391840
return J_occupancy;
18401841
}
18411842
#endif // GGML_USE_HIP

0 commit comments

Comments
 (0)