feat(hipblaslt): add skinny MXFP8 TN GEMMs (m or n <= 4) on gfx950 #14512
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #14512"
general
weight: 0.35
yzhang93
JIRA ID: AIHPBLAS-5259, AIHPBLAS-5669, AIHPBLAS-5670
Motivation
The generic MXFP8 kernels serve LLM decode GEMMs, where one extent is 1 to
4, poorly: their tiles are wide in both dimensions, so most of the work is
padding. This adds five skinny MXFP8 TN custom kernels for gfx950 and routes
the decode shapes to them. While testing them, two host/client bugs that
affect all architectures were found and are fixed here (see Bug fixes).
Technical Details
Kernels: five custom kernels for gfx950 (f8 E4M3 A/B, E8M0 32-block
HostPreSwizzle scales, bf16 C/D, f32 compute and f32 alpha/beta). Four are
scaled-MFMA persistent kernels that require min(m, n) <= 4 and one is a VALU
kernel that only takes skinny n (m > 4, n < 5). Each reduces all of K inside
one workgroup in a fixed order, so all five declare uniformSummationOrder and
are selected in hipBLASLt's default mode. They take a 96-byte kernarg segment
with byte leading strides, have no split-K (GlobalSplitU 1), launch a
TilesXYBatch grid and require batch 1. The .s files are generated out of
tree; the m, n and k kernarg names in their metadata were renamed to m_size,
n_size and k_size (some LLVM versions parse a bare n as a YAML boolean) and
the custom.config produced by AddCustomConfig from the Tensile test YAMLs was
appended. No instruction was edited: the s_nop 11 after the last tail MFMA
already gives the 12 wait states the scaled MFMA needs on gfx950. Each .s
starts with a header listing these edits, the constraints the predicates
encode and the num_records invariant below.
Routing: an Equality shard routes 138 (m, n, batch 1, k) keys, the 74 decode
shapes and their mirrors minus 5 shapes an earlier tuning round found faster
on the generic kernels. It is the output of one TensileLite LibraryLogic run
with every solution fully validated on every size, with two hand edits: its
geometry and Assert keys were aligned with each kernel's embedded
custom.config (which wins at runtime; a test checks they agree), and
AssertMXScalesPreSwizzled was added. Problems outside the shard, with K not a
multiple of 32, batched, or with bias, activation or a scale-alpha vector run
the generic kernels.
Other constraints:
MXScalesPreSwizzled predicate rejects packed scales. hipBLASLt already
refuses plain 32-block scales (--scaleA 3 --scaleB 3) before solution
predicates run, so the predicate is defense in depth.
run past the end of K. This is safe only because each kernel builds its
buffer SRDs with a num_records that never exceeds the tensor extent and the
hardware range-checks soffset against it. The K predicates are not
tightened.
other gfx950 chip ids, such as 0x75a3 (MI355X), through
SUPPORTED_CHIP_ID_FALLBACKS. Both chip ids were exercised (see Test
Result). A later gfx950_idXXXX/ logic file for the same ProblemType would
shadow the shard; a unit test fails if one is added.
Host support:
divisibility), AssertTensorBytesLessThan (2^31 for these kernels, also
bounding the leading stride) and AssertMXScalesPreSwizzled predicates, in
Python and C++.
the solution its own ProblemType that rejects such problems, while the logic
file's shared ProblemType stays unchanged; custom.config is read once per
solution.
MFMA kernels require min(m, n) <= 4.
declared in the logic file.
AssertAnySizeLessThan and AssertMXScalesPreSwizzled.
Bug fixes: both are host/client code and apply to all architectures, not just
gfx950.
tensilelite/src/ContractionSolution.cpp (generateCustomCall), were computed
as a float product, which rounds to 24 bits and corrupted leading
dimensions above 2^24, and were silently truncated to the kernarg type.
They are now computed in integers and a value that does not fit the
declared kernarg type throws.
(tensilelite/client/src/DataInitialization.cpp and Rotating.cpp), the
rotating buffer sized every problem's copies from the pristine buffers of
the largest problem, so smaller problems did not get the number of rotating
copies their own size calls for. The copies are now sized per problem,
while the first slot still holds the pristine inputs. The slot count is not
capped by maxRotatingBufferNum, which is unknown when the inputs are
allocated.
Known bugs: nine beta != 0 shapes (AIHPBLAS-5511, not shard keys) stay
quarantined in known_bugs.yaml until the C-load over-read fix lands (#15501,
to be confirmed). Review by 2026-12-15. These nine cases are not among the 42
skinny gtests reported below.
Snapshots: two .ambr files changed, +37/-0, additions only; nothing was
removed or altered. These changes are intended, and as the characterization
README requires, each is explained here.
validParameters key roster and structure gain 5 keys, AssertAnySizeLessThan,
AssertMXScalesPreSwizzled, AssertStrideAMultiple, AssertStrideBMultiple and
AssertTensorBytesLessThan, each recorded as type int, value -1 (the skip
sentinel). They were added in Common/ValidParameters.py as registry entries,
not solution defaults, which is why only the key roster and structure
snapshots move.
snapshots, test_assert_multiple_map_invalid_raises[negative] and
[zero_after_skip], pinning the messages of the new
checkAssertMultipleMapIsValid.
Tests: a Tensile test YAML per kernel, matmul gtests (routed shapes in both
orientations, alpha 1/beta 0 and alpha 1.5/beta 0.5, padded ldc, and
fallbacks for shapes outside the shard, batch 2, bias and activation), a
row-uniformity gtest case per routed kernel and orientation, and C++ and
Python unit tests for the predicates, the shard (including its consistency
with the kernels' custom.config), the .s headers and the kernel metadata.
Regression tests for the two bug fixes, in tensilelite/tests/CustomKernel_test.cpp
and RotatingBuffer_test.cpp:
dimension 16,777,219 for BF16 and 2^26+4 for FP8).
Mode1NoBeta).
Performance (gfx950, hipblaslt-bench, 50 iterations and 15 cold iterations,
speedup over a build without these kernels) over the 74 decode shapes:
geomean 1.62x, median 1.45x, min 0.99x. The 69 shapes that run a skinny
kernel: geomean 1.68x, median 1.48x, min 1.03x, max 3.35x (1792x2x5120); the
other 5 run the generic kernels in both builds.
Test Plan
HIP_VISIBLE_DEVICES=0 ./hipblaslt-test --gtest_filter='matmul_skinny_mxfp8'.The build used was
make -j16 hipblaslt-test hipblaslt-test-data tensilelite-device-librariesin build/release (gfx950, TENSILELITE_LOGIC_FILTER=F8).
CLICOLOR_FORCE unset:
pytest -m unit -n4 -q -p no:cacheprovider tensilelite/Tests/unit.pytest -q -p no:cacheprovider tensilelite/Tests/unit/test_skinny_mxfp8_logic.py -k test_shard_wins_every_key.TENSILELITE_BUILD_TESTING=ON and run CustomKernelTest.ByteStrides and
RotatingBufferSizing.
quick suite (temporary override in therock-multi-arch-ci.yml), so it does not
run the new skinny gtests; Math CI is the real evidence. For deeper coverage,
dispatch the workflow manually with linux_amdgpu_families=gfx950,
windows_amdgpu_families=none, pr_labels=test:hipblaslt,test_filter:comprehensive.
A test_filter: PR label will not work because the per-family override wins.
in tensilelite/tests. Whether the tensilelite C++ tests run in a shared
lane is not confirmed by me; the codecov/project/TensileLite-CPP check
suggests they do.
Test Result
Local MI355X run, binary built from HEAD fa6e453385c at the time of writing
(hipblaslt git version fa6e453385c; the SHA changes if the branch is amended
or rebased):
0 failed, 0 skipped. The 9 beta != 0 cases quarantined in known_bugs.yaml are
not among the 42.
Math CI precheckin ran all 42 matmul_skinny_mxfp8 cases on an MI350X (0x75a0)
and passed. Together with the MI355X run, both chip ids are covered; the shard
lists DeviceNames [Device 75a0] and serves other chip ids through fallbacks.
Nothing else is claimed about Math CI.
Python unit suite: 16044 passed, 20 failed, 806 snapshots passed in a
single-process run (24 failed and 16040 passed with FORCE_COLOR set, because
ANSI codes break 4 CLI help tests). The same 20 fail identically on clean
local develop 02433ce8085 (run in a temporary worktree), so none are
attributable to this branch. They are environment-related on my machine and
expected to pass in CI, which I have not confirmed:
blocked).
cases (console script not installed in the venv).
(not root-caused; environment).
Targeted: test_skinny_mxfp8_logic.py::test_shard_wins_every_key_it_shares_with_an_equality_file_of_its_library
passes (1 passed) on this branch.
C++ regression tests, HIP_VISIBLE_DEVICES=0, tensilelite-tests built with
TENSILELITE_BUILD_TESTING=ON, with the fix hunks reverted in a temporary
worktree and the regression tests kept:
- ByteStridesAreExactBeyondTheFloatMantissa fails: C/D bytes 33554440
instead of 33554438; A/B bytes 67108864 instead of 67108868.
- ByteStridesMustFitTheirKernelArgumentType fails: emits 2147483648 where
2147483646 is expected, the EXPECT_THROWs throw nothing, and the uint32
stride is 0 instead of 4294967294.
- RotatingBufferSizing Mode0Beta fails with
Rotating buffer size: 0 is not, thenenough for rotating buffer size: 114688 * 9 = 1032192
std::runtime_error.
- RotatingBufferSizing Mode1NoBeta segfaults (exit 139).
Coverage (Codecov, head fa6e453 against base 02433ce): patch coverage is
85.48% and project coverage is 78.05%, a change of 0.03%. The uncovered patch
lines are in ContractionSolution.cpp (13), DataInitialization.cpp (9) and
Rotating.cpp (1); the Python files are fully covered. Codecov reports CI as
passed.
Submission Checklist
Risk level
Medium.
keys with a fallback to the generic kernels.
computation now throws if a value does not fit the kernarg type, and client
rotating buffer sizing changes.
review by 2026-12-15).
🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>