Repository navigation
[Codegen][CPU] Lower RISC-V V f16 vfmacc, vfwmacc, and Zvfhmin inner_tiled MMA. - #25000
Merged
devtbi merged 4 commits intoOct 21, 2026
Merged
Conversation
TMahlatini
requested review from
AGindinson,
Manewing,
devtbi,
egebeysel,
hanhanW,
jschuhmacher,
phemashekar and
schuermans-roofline
as code owners
October 6, 2026 22:38
3 of 4 tasks
Manewing
reviewed
Oct 9, 2026
…tiled MMA. Native Zvfh f16×f16→f16 lowers to llvm.riscv.vfmacc. f16×f16→f32 with +zvfh lowers to llvm.riscv.vfwmacc. +zvfhmin widens to f32 vfmacc: CASTF32 for an f32 accumulator, and extf/truncf around the accumulator for an f16 accumulator. +zvfh implies +zvfhmin, and the native paths win when both are legal. Towards iree-org#24311 Signed-off-by: Terence <[email protected]> Co-authored-by: Cursor <[email protected]>
Signed-off-by: Terence <[email protected]>
The WIDENF32 extf/truncf around the accumulator is lossy, so hoisting it across K skips per-K f16 rounding. Honoring --iree-llvmcpu-skip-intermediate-roundings=false is tracked in iree-org#25058. Signed-off-by: Terence <[email protected]> Co-authored-by: Cursor <[email protected]>
…sts. Write the RVV f16 inner_tiled test ops with the `<...>` inherent-attribute syntax from iree-org#24983 so they parse. Signed-off-by: Terence <[email protected]> Co-authored-by: Cursor <[email protected]>
TMahlatini
force-pushed
the
users/tmahlatini/inner-tiled-rvv-f16
branch
from
October 15, 2026 17:39
675a4ed to
904d457
Compare
Manewing
approved these changes
Oct 19, 2026
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.
Lowers the RISC-V V f16
inner_tiledMMA paths. Native f16 enums are already on main from #24858. This adds lowering, the wideningvfwmacc.vfpair, and the+zvfhmin-only fallbacks. All of them reuselowerRiscvVFmaccLikeand the hoisted accumulator legalization from #24933. Tile N isvlen/8.+zvfh+zvfhminonlyllvm.riscv.vfmacc(MMA_RISCV_V_VFMACC_*_F16_F16)extfthe accumulator to f32, f32vfmacc,truncfback (*_F16_F16_WIDENF32)llvm.riscv.vfwmacc(MMA_RISCV_V_VFWMACC_*_F32_F16)extfboth panels, then f32vfmacc(*_F32_F16_CASTF32)+zvfhimplies+zvfhmin. When both are legal, the earlier enum wins: nativevfmaccfor an f16 accumulator,vfwmaccfor an f32 accumulator. At VLEN=256 the cost model picksintrinsics_m14 (native), 7 (vfwmacc), and 6 (both+zvfhminpaths). CASTF32 and WIDENF32 bill the widened f32 vector operand as f32.Performance is tracked on #24932. On the X60 (VLEN=256), 1-thread inner_tiled is faster than the mmt4d ukernel for native f16 and
vfwmacc. The 4-thread and 8-thread large shapes are still slower. Native f16 is non-wideningvfmacc; the f16 ukernel widens withvfwmacc, so that ratio is not the same instruction sequence.vfwmaccis the closer comparison.Assisted-by: Cursor
Towards #24311