[TLE][PPU] Add INT8 AIU support to PPU0010 V1 lowering - #976
Open
July-h5kf3 wants to merge 3 commits into
Open
Conversation
July-h5kf3
requested review from
Galaxy1458,
menchunlei,
sunnycase and
zhzhcookie
as code owners
August 13, 2026 08:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
TLE promotes
tle.load(block_ptr, is_async=True)to PPU AIU asynchronous copies. The FP16/BF16 path already lowers through PPU0010 lowering V1, but the INT8 path did not have a complete B8 AIU data path.This is not a PPU0010 hardware limitation. The public ACTLIZE implementation provides direct evidence:
ppu.cp.async.aiu.bulk.tensor.shared.global.padz.swzl.2d.b8.MainloopPPUAiu<3>,DefaultGemm_AIU_Operand<int8_t, ...>, and S8 x S8 -> S32 tensor-core MMA.Moving PPU0010 to lowering V2 is not a valid workaround because V2 emits the unsupported
2d.tileinstruction form. This PR keeps the existing V1 dispatch and completes B8 support in V1.Root cause
The PPU0010 V1 lowering contained several related FP16 assumptions:
.b16suffix instead of selecting the instruction from the source element width.getPPUAIUV1SwizzledSharedPtrshard-coded FP16 geometry for the 32-byte slice, 16-byte vector, and 128-byte swizzle period.ldmatrixform and did not emit the native B8 TSM swizzle load.slice_id * cubeW * 32INT8 elements.ppu.st.global, while the accepted global-store mnemonic isst.global. Shared stores still requireppu.st.shared.Minimal reproducer
The following kernel loads both INT8 operands through TLE async block-pointer loads and executes S8 x S8 -> S32 GEMM:
Before this change, the INT8 path could not lower into a valid end-to-end B8 AIU GEMM. After the change it emits:
There is no BF16 fallback and no fallback to ordinary INT8 pointer loads.
Solution
Select
.b8or.b16for PPU0010 V1 async AIU copies from the operand element width.Make V1 shared-memory swizzle addressing element-width-aware:
Add the native
llvm.ppu.tsm.ld.swizzle.b32x4.p3i8shared-to-dot load for B8 operands.Use the INT8 K32 fragment width and apply the required shared-memory slice offset for later fragments.
Emit
st.globalfor global stores while preservingppu.st.sharedfor shared-memory stores.Add focused compile-time and device tests for B8 AIU load, native B8 shared-to-dot load, INT8 MMA, K32/K64/K128 paths, global-store spelling, and pipelined loads.
Validation
Code generation
The repaired path emits:
The tests also verify that:
.b16AIU copy is emitted for INT8;ldmatrixfallback is emitted;st.globaland notppu.st.global.Tests
git diff --checkDevice correctness is bit-exact against the Torch INT32 reference for:
The
128 x 128 x 128case was also bit-exact across 10 consecutive runs.Performance
The downstream operators consume pre-quantized
INT8 + FP32 scaleinputs. Quantization, graph capture, and output allocation are excluded from kernel timing. Measurements use CUDAGraph with 25 warmup replays and 100 measured replays. Speedups are geometric means across valid shapes.The following FlagGems BF16 baselines did not produce valid results and are excluded from the corresponding geometric means:
The MM comparison against FlagGems BF16 is amplified by anomalously slow small-N BF16 cases. The comparisons against the previous INT8/TLE path and Torch BF16 are more representative.
The downstream MM/BMM kernels and benchmark artifacts are performance evidence only and are not part of this PR.