Repository navigation
[FlyDSL] Enable FP8 FMHA split-K for short cached-prefix queries - #5508
Conversation
Allow automatic and explicit split-K when cross_seqlen is true and causal is false. Retain the existing restriction for other short-query modes. Cover query tile boundaries, packed empty entries, runtime scales, output/LSE buffers, and graph replay on gfx950.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags & labels: |
|
@coderfeli @binding7012 hi, could you help review again? |
|
Advisory review (static + hand-run; not a merge gate). Validation/Perf ran no GPU stage — reasons are on their lines below. Findings tagged Lets short (Sq<384) noncausal cross-sequence FP8 queries on gfx950 use split-KV attention — explicit num_kv_splits and the auto-split heuristic — instead of forcing split=1, and adds short-query split shapes to the FMHA tests. Review (advisory): 📝 [verified] The re-scoped rejection (causal with Sq<384 and explicit splits must raise ValueError) is pinned by no test — op_tests/test_flydsl_fmha.py has no pytest.raises case for the split-K gate, so a future edit could silently admit causal short-Q split-K against the docstring's stated contract. Reviewer should ask for one pytest.raises(ValueError) case, e.g. causal=True, Sq=70, Skv=16384, num_kv_splits=4. |
|
@zufayu Thanks for the review. Addressed the missing rejection test and the base/head timing evidence; I do not think the suggested CI label would validate the intended consumer yet.
B=1, Q=70, H=12, Dq=Dk=192, Dv=128, noncausal,
Each cell is the median of 7 rounds × 100 CUDA graph replays (700 timed calls per mode/shape/version), after 5 eager warmups and 5 graph warmups. Auto and explicit split=1 alternate order between rounds within each version. Includes attention + combine; quantization, reference checks and JIT compilation are outside timing. Base and head used separate JIT caches. Environment: gfx950, PyTorch 2.10.0 / ROCm 7.2.4, FlyDSL 0.3.2. The new commit only adds the rejection test; timed kernel code is unchanged. Validation: 27 passed, including output/LSE reference checks, variable-length inputs, custom scales and graph replay. Black/Ruff passed. python -m pytest -q op_tests/test_flydsl_fmha.py \
-k 'split_kv_cross_length or short_causal_split_kv_rejected or softmax_scale_varlen or softmax_scale_graph_replay' |
Adds split-K support for short queries (
Q < 384) in noncausal cross-sequence FP8 FMHA, with automatic and explicit split selection.Measured on gfx950: B=1, Q=70, H=12, Dq=Dk=192, Dv=128,
return_lse=True. Both versions use automatic split selection.246efe910)38f239361)Median of 7 rounds × 100 CUDA graph replays per mode, after 5 warmups. Includes attention and split combine; excludes quantization and JIT compilation. PyTorch 2.10.0 / ROCm 7.2.4, FlyDSL 0.3.2.
Accuracy validation: 27 targeted GPU tests passed in
op_tests/test_flydsl_fmha.py, covering short-query splits, output/LSE references, variable-length inputs, custom softmax scales, graph replay, and rejection of causal short-query split-K. Black and Ruff passed.