Repository navigation
Conversation
New "sk" HGEMM policy: one workgroup per N slab with the full K, fp32 partials reduced in LDS, no split-K scratch. Retune ten N=6144 K=2048 rows (M <= 32) to it: 1.08-1.27x per call on MI355X.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
NOT READY FOR HUMAN REVIEWPR 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 |
The DMA voffset is a single 32-bit VGPR and the offset is cast to a signed i32, so a tensor-based descriptor wraps once n0 * k * 2 passes 2 GiB and the load reads whatever is mapped there. Fold n0 into the 64-bit base, make the voffset slab-relative, and bound the descriptor with num_records so an offset bug returns zeros instead of faulting. Also reject host tensors up front -- the launch hands the kernel raw pointers, so a CPU a/b/out was a GPU memory fault, not a Python error.
Raw arith/scf/index plumbing becomes fx values and plain Python control flow: constant_vector -> fx.Vector.filled, index_cast -> fx.Int32/Int64, truncf -> .to(), cmpi + scf.IfOp -> if. The three raw boundaries that stay -- the DMA inline asm, the mfma intrinsic and the LDS buffer_ops addressing -- are the hand-scheduled parts that have no builder form, and the module docstring now says so. .ir_value() appears only where one of them needs an unwrapped operand. No functional change: 44 benchmark rows reproduce with err 0, the 7 policy rejects and the 2 GiB weight case still pass.
Upstream added a gfx1250-strict target; keep both it and the skinny policy in the kernel-name regex and the two dispatch sites.
The AOT GEMM module now replays each tuned row through the public gemm_a16w16 entry (ROCm#6956), so it no longer dispatches on a per-kernel kind. Drop the skinny registration it needed: tuned_gemm already routes a psk row into flydsl_hgemm, which the replay reaches on its own.
[FlyDSL] Add skinny A16W16 policy for GLM-5.2 o_proj decode on gfx950
Motivation
At decode M a GEMM's cost is streaming its weight once. For the GLM-5.2 o_proj shape (N=6144, K=2048, TP8) the
current rows run M <= 32 at 7.6-8.5 us per call on MI355X, about 3.3 TB/s.
Technical Details
aiter/ops/flydsl/kernels/gemm_a16w16_skinny_gfx950.py: each workgroup owns oneblock_n-columnslab of C with the full K;
k_waveswaves stream K through wave-private LDS rings (global->LDS DMA, nobarrier in the K loop); the partials are summed once in fp32 in LDS. No split-K scratch, semaphore or atomic.
bf16 only, no bias, gfx950 only; unsupported inputs raise.
skon the existing kernel-name schema(
t<block_m>x<block_n>x<block_k>x<stages>_ks1_w1x1x<k_waves>_..._psk), sotuned_gemm,flydsl_hgemmand theAOT pass (new
hgemm_skinnykind) take it. Other policies take the same path as before.same shape, so its decode changes too) and M=6/10/12/24 in the GLM-5 table (added in [FlyDSL] Tune the GLM-5.2 decode shapes for gfx950 #5328). No row is added
or removed.
Test Plan
op_tests/test_flydsl_hgemm.py: newskcases (every block_m tier, m below block_m, a slab count that is not amultiple of the 8 XCDs, other slab widths and K), eager and CUDA-graph replay against fp32; unsupported inputs
must raise.
test_config_shape_collision,test_a16w16_tuned_config_lookup, AOT on the ten rows.run_perftest, rotated cold weights, device time).calls) at M=1-32.
weight sets per shape, one CUDA graph, both tables in one process, ABBA, 6 samples per arm, medians, plus a
same-table control.
Test Result
Decode step (bf16 GEMMs only), medians:
Same-table control: -0.15% to +0.40%. From conc=6 the verify M (36-60) is above the retuned rows; TP4 runs
o_proj at K=4096, which this PR does not touch.
Per call (cold weights): M=1-16 1.19-1.27x, M=17-32 1.08-1.19x, M=33-64 unchanged.
Numerics unchanged: on both the old rows and the skinny rows 99.97-100% of outputs equal the fp32 result rounded
to bf16, at most 0.01% are more than one ulp away, and outputs are bit-identical over 20 runs.
All tests pass:
skcases error ratio 0 eager and under graph replay, collision guard 22 OK, lookup tests 3passed, AOT 10/10. Only the ten keys change: the 895 FlyDSL kernel names shared with main parse identically and
the 5778 other AOT jobs are identical.
op_tests/flydsl_tests/test_gemm_a16w16.pyfails atassert out.is_contiguous()identically on main.Submission Checklist