Repository navigation
[Codegen][CPU] Add RISC-V V i8 CASTI16 inner_tiled MMA - #25357
Prajit-Rahul wants to merge 1 commit into
Conversation
Signed-off-by: Prajit-Rahul <[email protected]>
|
Hi @egebeysel, could you rerun the failed CI jobs? The Windows console tracing job stopped before the build because the ccache download was only 430 bytes and unzip couldn’t open it. Thanks! |
|
Done! Could you maybe add a few more shapes to the mix? Also, damn, why is I'll give this a review soon, sorry for the delay! |
|
May I ask you to re-run thee benchmarks with #25130? If we do not regress too much, I'll merge that one in real quick. |
|
Thanks @egebeysel for rerunning CI! I added three shapes and reran all seven on the Banana Pi F3 with and without #25130. I used the benchmark setup described above and matched the compiler thread-count hint to the runtime thread count in both sweeps. Across all 21 configurations, #25130 increased geometric mean The first two tables report Baseline (this PR)
Candidate (this PR plus #25130)
Change in
|
| Shape (M×N×K) | 1 thread | 4 threads | 8 threads |
|---|---|---|---|
| 64×64×64 | 0.0% | +2.8% | −5.8% |
| 256×256×256 | 0.0% | −6.4% | −5.8% |
| 81×41×19 | 0.0% | +1.8% | +8.6% |
| 540×516×332 | −1.3% | +14.4% | +16.5% |
| 128×128×128 | 0.0% | −5.3% | +1.8% |
| 512×512×352 | +9.1% | +1.1% | +0.5% |
| 512×16×512 | −0.5% | −9.5% | +2.1% |
Eight-thread dispatch profile for 540×516×332
Baseline inner_tiled vs. mmt4d. The main matmul dispatch took 1.65 ms with inner_tiled and 3.31 ms with mmt4d. The savings in that dispatch more than offset the higher input packing time (0.593 vs. 0.310 ms). The inner_tiled dispatch also used less total CPU time (12.9 vs. 19.0 ms) and had a higher CPU/wall ratio (7.82 vs. 5.74). The profile measures the MAC loop and output handling together.
Effect of #25130. The inner_tiled launch went from 1,326 workgroups to 13. Main-dispatch wall time rose from 1.65 to 2.03 ms, while total CPU time stayed near 13 ms and input packing time was nearly unchanged. The mmt4d control stayed at 17 workgroups, with main-dispatch wall time of 3.31 ms before and 3.33 ms after. The drop in the inner_tiled CPU/wall ratio from 7.82 to 6.40 is consistent with lower worker utilization after grouping more tiles per workgroup.
Added RISC-V V inner_tiled lowering for signed i8 × i8 → i32 matmul for RV64 with +v. The two tile orientations use VLEN / 8 lanes along M or N. Sign-extend the scalar and vector operands to i16 and accumulate into i32 with vwmacc.vx. Kept the accumulator scalable across K and accounted for the widened vector when choosing unroll factors.
Used Banana Pi F3 (SpaceMiT X60, VLEN 256), 10 repetitions per configuration. Ratios are mmt4d microkernel mean wall time divided by inner_tiled mean wall time.
Both paths used --iree-llvmcpu-vscale-range=4,4 with compiler distribution enabled. The 1-thread runs used local-sync, and the 4 and 8 thread runs used local-task. All timing runs preloaded rvv-prime.so to work around a first-use vl1r.v failure reproduced outside IREE on Linux 6.6.36-current-k1.
Towards #24932
Assisted-by: Codex