Repository navigation
Conversation
On +xsmtvdot, matmuls without an M dimension (vecmat, and matvec after the narrow-N transpose) materialize to mmt4d with a 1 x 4a x 2a layout, where a is the vmadot atom edge (4/8/16 for zvl256b/1024b/4096b): the resolver picks the IME tile a x 4a x 2a and drops M0. The riscv_64 ukernel had no tile for that shape, so these ops fell back to the generic tile function and issued no vmadot. Since the unit M dim is folded after QDQ conversion, M=1 QDQ matmuls take this path too (#25338). Add single-row xsmtvdot tiles 1x16x8 (zvl256b), 1x32x16 (zvl1024b) and 1x64x32 (zvl4096b). The LHS row is loaded into row 0 of the vmadot A operand and only row 0 of each accumulator group is used. The other A rows are left as they are: they only feed accumulator rows that are dropped, and broadcasting the row with vrgather was about 2x slower at VLEN=1024. Each K panel issues the same 4 vmadot as the 1x4-atom tile. Tests: mmt4d_test and mmt4d_benchmark cover M0=1 for xsmtvdot, and materialize_encoding_riscv.mlir pins the 1x16x8 and 1x32x16 layouts for vecmat and matvec. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Ege Beysel <[email protected]>
This branch has not been deployed
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.
On
+xsmtvdot, contractions without an M dimension (vecmat, and matvec after the narrow-N transpose) materialize tommt4dwith a1 x 4a x 2alayout, whereais the vmadot atom (4/8/16 for zvl256b/1024b/4096b). The riscv_64 ukernel had no tile for M0=1, so these ops fell back to the generic tile function and issued no vmadot. Since #25099 folds the unit M dim after the QDQ conversion, M=1 QDQ matmuls take this path too.This adds single-row xsmtvdot tiles
1x16x8(zvl256b),1x32x16(zvl1024b) and1x64x32(zvl4096b). The LHS row is loaded into row 0 of the vmadot A operand. The other rows only feed accumulator rows that are never stored, so they are left as they are. Broadcasting the row withvrgather, as the i8mm kernel does, measured about 2x slower at VLEN 1024. No compiler change is needed: the resolver already emits these layouts.Fixes #25338.
Performance
i8 vecmat/matvec with the weight as a parameter, so the weight pack is hoisted into the initializer.
iree-benchmark-module, median ms, main → this PR:+zvl256b,+xsmtvdot, cpus 0-3.+zvl1024b,+xsmtvdot, one 4-core cluster.The large shapes are DRAM-bound: one core already streams most of what a cluster delivers, so 4 threads gain little over 1.
Testing
mmt4d_testnow covers M0=1 for xsmtvdot; it passes on the K1.materialize_encoding_riscv.mlirpins the1x16x8and1x32x16layouts for vecmat and matvec.Assisted-by: Claude Code
🤖 Generated with Claude Code