Repository navigation
[HIP] [FlyDSL] [CI] Add tunable HGEMM K-stagger and B streaming loads - #7546
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
Conflicts: - gemm_a16w16_gfx950.py: keep the fp32 split-K workspace, the one-counter get_split_k_buffers(stream, device) and the up-front kernarg loads; take main's capture_scoped_cache, kernarg preload hints, k_stagger and b_non_temporal. - aot/flydsl/gemm.py: take main's replay-based AOT build (ROCm#6956), which launches through the runtime and so needs no HGEMM-specific arguments. - glm5/kimik3/minimax_m3_eagle tables: rows are merged one by one. Where both sides changed a row, main's row is kept: glm5 2624x6144 M=1/2/4/6/8 use the skinny kernel (ROCm#6427), and kimik3 64x20480x7168 uses the band-stream kernel (ROCm#7546). Neither uses split-K; both are exact and repeatable. - test_graph_alloc.py: call get_split_k_buffers(s, dev), which no longer takes split_k. Co-authored-by: Claude <[email protected]> Signed-off-by: Andreas Karatzas <[email protected]>
…#7546) * [FlyDSL] Add tunable HGEMM K-stagger and B streaming loads * [FlyDSL] Close Kimi decode gap with band-stream dispatch and retuning * [FlyDSL] Preserve strided HGEMM inputs and audit legacy config compatibility * [FlyDSL] Focus HGEMM reporting on measured AITER speedups * [CI] Retry transient build-image pulls before wheel compilation
…ws on gfx950 (#8915) The rows of 6016 x 7168 and of 6288 x 7168 at 1, 2, 4, 8, 16 and 32 rows name the same tile with _bnt. They are older than the option (#5145, #6019 and #5903; the option is #7546), so the tuner never raced it for them. A decode step reads the weights of every layer once, and the tuner measures that: run_perftest gives every timed launch its own copy of the tensors. MI355X, one GPU, FlyDSL 0.5.3, the tuner's method (10 warm-up and 101 timed eager launches), 3 runs per kernel, the two kernels alternate, median, microseconds, row today -> _bnt: 1 x 6016 x 7168 16.31 -> 15.40 2 x 6016 x 7168 16.39 -> 15.53 4 x 6016 x 7168 16.46 -> 15.70 8 x 6016 x 7168 16.62 -> 16.02 16 x 6016 x 7168 17.93 -> 17.20 32 x 6016 x 7168 18.30 -> 16.93 1 x 6288 x 7168 16.78 -> 15.63 2 x 6288 x 7168 16.96 -> 15.57 4 x 6288 x 7168 17.00 -> 15.68 8 x 6288 x 7168 17.33 -> 16.27 16 x 6288 x 7168 18.34 -> 17.46 32 x 6288 x 7168 20.41 -> 19.68 That is 3.6 % to 8.2 % less time per launch. The six rows of 6016 x 7168 and the row of 32 x 6288 x 7168 were measured on main b4d0133. The other five rows were measured in a second session, on main 8b6b4b4 with those seven rows changed. solidx is the index of the new name in the tuner catalog; us, err_ratio, tflops and bw are the _bnt measurements. tgemm.mm selects these rows for 1 to 32 rows of both shapes. A caller that launches one weight tensor back to back while it fits the last-level cache can get slower. Measured with one weight tensor: +7.7 % for 32 x 6288 x 7168, +11.5 % and +12.8 % for 16 x 6016 x 7168, -3.9 % and -2.8 % for 32 x 6016 x 7168. The other nine rows were not measured in that state. Signed-off-by: Jin Pan <[email protected]>
Summary
Improve gfx950 BF16 decode HGEMM performance with:
bs) decode policy with staged LDS DMA and a 64-column aligned main panel plus an XCD-grouped strip.No new documentation, report files or custom benchmark script. Tests extend the existing AITER test files. Existing copyright, license notices and brief source attribution are preserved in the source.
Performance
Speedup = PR-before AITER time / updated AITER time.
Baseline:
e1763addecdb2ea25be0c9d0af2a96fb3f62cf80.Measured implementation:
0525143b64ec2c535a86df297a1941818fa5444d; subsequent source edits are comments/docstrings only (executable ASTs verified unchanged); the latest commit changes CI image acquisition only.Hardware/software: gfx950 with 256 CUs, BF16 inputs/output, Torch 2.10.0 / ROCm 7.2.4, FlyDSL 0.4.2. Both versions run the real
gemm_a16w16_outtuned dispatch with preallocated outputs. Each graph rotates through at least 512 MiB of weights. Compilation/reference checks are outside timing; no profiler or clock changes. Independent processes run in base/head/head/base order, five readings per shape per process, using the median of ten samples per arm.These are complete operator-dispatch improvements, including the tuned policy selection—not an attribution of the entire gain to K-stagger alone.
Range: 1.08x–1.40x. Geometric mean across these 16 points: 1.26x.
The standalone K-stagger prototype, before integration, also showed 1.042x / 1.035x at M=16/32, N=18432, K=1536 with the existing tuned tiles unchanged; independent repeats confirmed the benefit. Other shapes can regress with stagger, so the generic default remains off.
Performance claims cover the listed workload and measurement mode only; no end-to-end model speedup is asserted.
Testing and compatibility
op_tests/test_flydsl_hgemm.pycompleted, including FT/HTI memory-option boundaries, split/slice-K, exact K-coverage checks, output guards, band-stream M tiers, changed-input Graph replay, real tuned dispatch and skinny checks.git diff --checkpassed locally.The GPU inventory/codegen audit ran at
0f673f4;0525143changed only the new bs branch's normalization and tests, leaving legacy FT/HTI/sk kernel code unchanged. The later source cleanup is comment/docstring-only, and the latest CI-only change leaves kernel code and tests unchanged.Run the shipped tests:
CI image-pull failure and fix
The Python 3.12 wheel job failed before the build container started: the
Docker Hub manifest request returned
429 Too Many Requests, anddocker runexited 125. The same failure reproduced on a failed-jobs rerun. The test gate
then failed because the required wheel was unavailable; downstream GPU tests
were skipped, not passed.
The CI-only fix reuses an already-present build image, otherwise calls the
repository's existing pull-retry helper with five attempts and 60-second
delays. The build then uses
--pull=neverso there is no second implicitregistry request. The image tag, fork-secret restrictions, compilation
failure propagation and test gate remain unchanged. Persistent pull failure
still fails the job.
Local workflow-step simulations passed: cached image (zero pulls), transient
429 (recovery on attempt three), persistent failure (five attempts, no build),
and genuine build failure (original exit code propagated, no build retry).
YAML parsing and shell syntax checks passed. The new wheel job actually retried
all five pulls and received HTTP 429 every time; compilation and downstream GPU
tests have still not started. CI remains blocked by sustained Docker Hub
throttling, not fixed by the retry mitigation.
The runner needs the approved build image preloaded, an approved registry
cache/mirror, or a securely authenticated image pull outside untrusted PR execution
before retrying the wheel job. Fork secrets must not be exposed and the test gate
must not be bypassed.
Failed pull job: https://github.com/ROCm/aiter/actions/runs/42170667921/job/127738002339
PR Self-Review
Reviewed revision
8998457c21069e57b1eb02c6f89f94044ffd9e21Behavior and intent
Add optional memory-side tuning to general HGEMM and a constrained streaming decode policy, restore missing candidate coverage, and activate validated configurations through 21 existing tuned rows. Preserve legacy names and old FT/HTI/sk defaults. The band policy uses BF16 inputs/output with FP32 accumulation and no cross-workgroup reduction; it is not a universal replacement for generic HGEMM.
Validation and unverified scope
The performance table is a fresh AITER-before/after measurement using the actual tuned dispatch, separate baseline/head trees and ABBA process order. Correctness and compatibility coverage is listed above: 2737 old gfx950 configurations, 256 replacement-row M cases, 8 strided cases, 42 host/configuration tests and 3000 stress launches. Source cleanup edits have unchanged executable ASTs; host/configuration tests were rerun. The latest CI image-acquisition change passed the four simulated success/failure cases described below. Other-GPU runtime, full AOT generation and model-level results are not claimed.
PR-specific question
Which architecture, dtype and shape boundaries select the changed path, and what invariant prevents unsupported inputs from reaching it?
Generic non-default memory options require gfx950 FT/HTI or a validated bs configuration; they are rejected on gfx1250/skinny. Existing generic DMA, shape and K-tail validation remains.
The bs policy requires a 256-CU gfx950 device,
1 <= M <= 128,(N,K)=(18432,1536)or(20480,7168), BF16 two-dimensional A/B on the same CUDA device, no bias, BF16 output, split_k=k_waves=1, group_m=0 and a supported tile/stage/wave tier. Public input normalization precedes launch on the selected stream. The band wrapper checks actual dimensions, alignment and output contiguity; name parsing checks compatible architecture/dtype/configuration fields. Invalid inputs raise rather than reach the kernel.Changed op tests
op_tests/test_flydsl_hgemm.py: standard AITER@benchmarkcandidate loop withrun_perftest,checkAllclose, us/TFLOPS/TB/s/err and markdown summaries. New cases cover K-wrap/split/HTI boundaries, band-stream M tiers, guards and changed-input graphs. Actual tuned/preallocated-output and strided-input checks verify behavior that direct arithmetic tests cannot establish.op_tests/tuning_tests/test_a16w16_tuned_config_lookup.py: verifies missing-candidate fixes, band boundaries, all persisted-name defaults/round-trips, parameter forwarding, gfx1250 host routing, and bs normalization/stream forwarding. These host catalog/API invariants are distinct from GPU arithmetic tests.Dependencies and documentation
No new third-party dependency or documentation file. Uses existing AITER launch utilities and the pinned FlyDSL version.