Repository navigation
[Codegen][CPU] Materialize and lower RISC-V V inner_tiled MMA (f32, f16, bf16, i8) - #24926
TMahlatini wants to merge 2 commits into
Conversation
…F32). f32 and native f16 lower to llvm.riscv.vfmacc. CASTF32 (Zvfhmin) extends f16 panels to f32 and reuses that path. N is vlen/8. +zvfh implies +zvfhmin for CASTF32 selection. Signed-off-by: Terence <[email protected]> Co-authored-by: Cursor <[email protected]>
…ed MMA. bf16 lowers to llvm.riscv.vfwmaccbf16 (+zvfbfwma). i8 sign-extends i8m1 to i16m2 then vwmacc.vx into i32. N is vlen/8. Signed-off-by: Terence <[email protected]> Co-authored-by: Cursor <[email protected]>
|
cc @egebeysel |
|
Nice! Thanks for the patch. First things first, let's split this PR into multiple parts and handle all F16, F32, BF16, and INT8 in separate PRs. I have not yet looked at the implementation, though if you have any infrastructure/plumbing work that is required across data types, that could also be its own PR. Furthermore, we ideally want the performance of code generating with Lastly, I see that some of the e2e matmul tests are timing out. Take a look at: #24593 for a similar issue we had: we ran only a certain subset of all matmul shapes for rv64 on slow-running configurations. I'll take a look as soon as I can :) |
thanks, will decouple and take a look at #24593 |
## Summary Lowers RISC-V V f32 `inner_tiled` MMA (`MMA_RISCV_V_VFMACC_*_F32_F32`) to `llvm.riscv.vfmacc` (`vfmacc.vf`). Tile N is `vlen/8`. Introduces shared helper `lowerRiscvVFmaccLike`. This is the first stacked dtype PR from #24926 review. Performance will be tracked here #24932 Assisted-by: Cursor Towards: #24311 --------- Signed-off-by: Terence <[email protected]> Co-authored-by: Cursor <[email protected]>
#24858 added
vlenonDataTiledMMAAttrand f16inner_tiledmaterialization on RISC-V V, but did not lower to LLVM. This continues that work for #24311: more RVV MMA enums, encoding selection, and lowering ofiree_codegen.inner_tiledtollvm.call_intrinsic.One enum pair still covers every
+zvl*blength. Tile N isvlen/8(8VLs); the swapped sibling is the M↔N orientation. LHS is the scalar.vf/.vxoperand som_bcstcan fold, matching the mmt4d ukernels.vfmacc.vf+vllvm.riscv.vfmaccvfmacc.vf+zvfhllvm.riscv.vfmaccvfmacc.vf+zvfhmin(+zvfhimplies it)arith.extfthenllvm.riscv.vfmaccvfwmaccbf16.vf+zvfbfwmallvm.riscv.vfwmaccbf16vsext+vwmacc.vx+varith.extsi+llvm.riscv.vsext+llvm.riscv.vwmaccNative Zvfh still wins over CASTF32 when both are legal.
Towards #24311
Assisted-by: Cursor