Skip to content

Fix bench_qwen_gqa_prefill comparing every mode against itself - #87

Closed
lvyufeng wants to merge 1 commit into
masterfrom
fix/gqa-bench-mode-separation
Closed

lvyufeng wants to merge 1 commit into
masterfrom
fix/gqa-bench-mode-separation

Conversation

@lvyufeng

Copy link
Copy Markdown
Owner

Bug

The bench unset DSV4_QWEN_GQA_MMA_TILE for the base/long/flash modes, but in the dispatcher an unset variable means enabled:

const bool mma_enabled = mma_tile == nullptr || std::strcmp(mma_tile, "0") != 0;

MMA is also checked before flash and long, so all four modes ran the MMA kernel and the bench printed four identical rows. Any comparison drawn from it was a kernel against itself.

Fix

Set the variable to "0" for the other modes rather than unsetting it. The modes now separate, and the production default turns out to be 10.7x faster than the fallbacks it was silently being compared against:

mode rows=4096 offset=16384 offset=32768 offset=61440
base 532.9 ms 1011.9 ms 1846.7 ms
long 407.0 ms 770.5 ms 1405.5 ms
flash 400.5 ms 761.1 ms 1389.1 ms
mma 38.4 ms 71.1 ms 129.5 ms

Test plan

CUDA_VISIBLE_DEVICES=0 build/tests/bench_qwen_gqa_prefill — before the fix all four mode rows were identical to within noise; after it they differ as above. Bench-only change, no engine code touched.

The bench unset DSV4_QWEN_GQA_MMA_TILE for the base/long/flash modes,
but an unset variable means "enabled" in the dispatcher: mma_enabled is
`mma_tile == nullptr || strcmp(mma_tile, "0") != 0`. MMA is also checked
before flash and long, so all four modes ran the MMA kernel and printed
four identical rows.

Set the variable to "0" for the other modes instead. The four modes now
separate, and the production default is 10.7x faster than the fallbacks
it was silently being compared against:

  rows=4096 offset=61440   base 1846.7 ms   long 1405.5 ms
                          flash 1389.1 ms    mma  129.5 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant