perf(gfx11): optimize Qwen DFlash speculative verify - #695
Conversation
923cf7e to
2160d4c
Compare
Paired 10K-context verify HipGraph A/BFollow-up correcting the earlier split campaign: this run used six controlled technical-document prompts at approximately 11.5K model-context tokens. Each GPU ran the same three prompts serially with Graph off and then Graph on. Pinned configuration: Graph execution was explicitly proven:
All six pairs completed with identical generated-token counts, cycle counts, and tau between Graph off/on. Graph replay regressed every paired case by 0.34-1.22%, supporting the gfx1100 MQ4 default-off policy while retaining Case 3 is a reproducible workload-specific outlier in both arms ( |
Follow-up: 10K terminal-latency cliff isolated and fixedDuring the paired long-context validation, synthetic prompt #3 reported only 11.9 tok/s, while adding one trailing ASCII period to the same prompt reported 63.0 tok/s. This was reproducible and was not a verifier-kernel, HipGraph, or context-length threshold regression. Root causeThe original token trajectory encountered the terminal token in the middle of an 11-token speculative window ( Commit Correctness and performance evidence (gfx1100)
The clean run retained the same prompt MD5 ( A same-daemon two-request test ( Validation: |
|
Exact pushed-source confirmation ( |
|
Two notes from running the same verifier shape on 2x gfx1100 (qwen3.8-27b, Q8 KV, 16k-50k ctx):
|
|
@alpineQ Thanks, both observations are correct. The multi-row verifier sounds appropriate as a separate follow-up. Gating the I addressed the terminal-cache issue in
When a terminal consumes only a strict prefix of that window, it restores the
The final consumed token remains pending for the existing terminal flush. Exact-head gfx1100 validation used qwen3.6-27b, Q8 VMM, DFlash B=16,
The immediately following turn in the same daemon reported:
This preserves the fast completion behavior while removing the next-turn Validation:
|
39d032a to
127a562
Compare
|
@alpineQ Your measured >8K multi-row verifier now looks directly relevant to the long-context report in #693. If the offer still stands, could you please share the follow-up or diff for the gfx1100 R4/R8 variant, including the dispatch_attend gate you used? We are reproducing the qwen3.8-27B ~20.7K-context case locally and will independently validate R4/R8 against the current batched route for correctness, attend-step time, and end-to-end decode. |
|
Thanks — I split this out into one clean commit based directly on
The kernel entry points are I also fixed the two merge caveats from the experimental version:
I rebuilt and reran the clean commit on one RX 7900 XTX (
The conservative Fresh-process end-to-end DFlash A/B used the same clean daemon binary (
That is Static/unit validation also passed: This improves the verifier cost but does not solve the separate low-tau case: this fixture remains at |
|
Completed exact inventory against beta af39905:2160d4c1 and8e3e5210 are direct ancestors; a14510a is patch-equivalent to landed5225cfdee (git cherry marks applied). The only unique remaining commit127a5624 is stale generated maps. Thus all substantive #695 code is already integrated; no additional beta cherry-pick needed. The multi-row verifier c91f4b6 discussed here is a separate alpineQ branch, not part of this PR; it needs its own current-beta review and canonical XT fixture evidence. Keeping this PR on #730 close-on-promotion list. |
|
Done — I ported the R4/R8 follow-up onto current The rerun now uses the pinned canonical XT target, not the earlier lookalike:
Fresh-process route A/B (
That is +38.6% by median. All six samples retained The current-beta kernel oracle measured R4/R8 at One explicit caveat in #741: the canonical Redline PM4 kernel-bucket arm currently stops on |
|
@alpineQ Got it, thanks a lot for your work! I'd be happy to help port it to gfx1201. Do you have any plans for that yet? If so, I'll leave that part to you and provide help elsewhere.. |
|
Given that this PR was merged into beta, further work would be conducted in beta fork, so this would be turned off. |
|
@HUSRCF I'd be happy to, but I don't have any gfx1201 hardware, so please feel free to take the port |
Summary
Improve Qwen DFlash speculative verification on gfx11 by routing the B=16 full-attention workload through the batched flash/N64 path, and disable the gfx1100 MQ4 verify HipGraph by default where it does not provide a measurable benefit.
Changes
B=16,head_dim=128N64 attention route.HIPFIRE_VERIFY_GRAPH=1as an explicit diagnostic opt-in, but default gfx1100 MQ4 verify graph capture off.PM4 changes are intentionally excluded. The PM4 timeout quarantine fix is unrelated and should be reviewed separately.
Performance Evidence
Batched flash versus forced WMMA
On Precision (gfx1100), Qwen 27B, DFlash
B=16, and real LongBench thinking inputs around 28K–30K tokens:Acceptance and output lengths were materially the same. This is an end-to-end verifier comparison, not an isolated attention-kernel speedup claim.
HipGraph A/B
The verify graph path was confirmed to reach
mode=replayin diagnostic runs. On the same gfx11 workload, replay windows were approximately 2–5% slower than direct execution.Using the same three LongBench thinking prompts with
--max-tokens 32768:This is a neutral-to-slightly-negative result for graph capture at the current Qwen gfx1100 MQ4 shape. Graph remains available through
HIPFIRE_VERIFY_GRAPH=1for future diagnostics.Correctness
1e-3tolerance.Tests
All listed tests pass on Precision. Existing compiler warnings are unrelated unused/dead-code warnings.
Scope and Follow-up
This PR does not change long-context thresholds or disable DFlash for long inputs. The optimization is in the verifier and attention routing paths. A future change can revisit graph capture after reducing graph-external synchronization and dynamic-shape overhead.