Repository navigation
Conversation
bjacob
force-pushed
the
users/bjacob/cpu-skip-data-tiling-generic-mma-single
branch
from
May 7, 2026 14:41
24f612b to
1c13744
Compare
bjacob
marked this pull request as ready for review
May 7, 2026 15:09
bjacob
requested review from
MaheshRavishankar,
Max191,
hanhanW,
jtuyls and
qedawkins
as code owners
May 7, 2026 15:09
25 of 28 tasks
hanhanW
reviewed
May 7, 2026
hanhanW
left a comment
Contributor
There was a problem hiding this comment.
Just some nits, overall looks good to me.
bjacob
force-pushed
the
users/bjacob/cpu-skip-data-tiling-generic-mma-single
branch
2 times, most recently
from
May 7, 2026 19:43
a778777 to
6a264ca
Compare
Adds two new `MMAIntrinsic` values, `MMA_GENERIC_SCALAR_1x1x1_REG8` and
`_REG16`, that the data-tiling cost model picks when no element-type-
specific intrinsic on the target supports the matmul's (LHS, RHS, ACC)
types. This intentionally breaks the "an MMAIntrinsic enum value pins
down a specific element-type triple" invariant in exchange for not
having to add one enum value per supported triple. Element types live
on new `DataTiledMMAAttr.{lhs,rhs,acc}_type` parameters, populated by
the cost model only when the chosen intrinsic is one of the polymorphic
variants.
The cost model picks `_REG16` on 64-bit ISAs (x86_64, AArch64, RISC-V)
and `_REG8` on 32-bit ISAs. The number is a register-budget for the
unroll heuristic — one element of any width occupies one register, but
the architectural register file the lowering ends up in (GPR or SIMD-
scalar lane) is up to LLVM. The budget is encoded in the low byte of
the enum value, so `chooseUnrolling` can read it back.
Since the intrinsic is 1×1×1, the operand tiles after `intrinsics_m` /
`intrinsics_n` / `intrinsics_k` are simple row-major (M, K) / (N, K) /
(M, N) — `linalg.mmt4d`-shaped. `DataTiledMMAAttr::buildUnderlyingOperations`
therefore short-circuits the swizzle/distribute pipeline for these
intrinsics and emits a single `vector.contract` directly, with
`arith.extf` / `arith.extsi` widening narrow LHS/RHS to ACC's element
type. For sub-byte LHS/RHS types `chooseUnrolling` also picks the
smallest power-of-two `intrinsics_k` such that K*lhsBits and K*rhsBits
are byte-aligned (e.g. K=2 for i4/f4, K=4 for f6, K=8 for i1).
Signed-off-by: Benoit Jacob <[email protected]>
Progress towards iree-org#24323
bjacob
force-pushed
the
users/bjacob/cpu-skip-data-tiling-generic-mma-single
branch
from
May 7, 2026 19:48
6a264ca to
698d160
Compare
hanhanW
approved these changes
May 7, 2026
bjacob
enabled auto-merge (squash)
May 7, 2026 20:01
bjacob
added a commit
that referenced
this pull request
May 12, 2026
Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards #24323. Signed-off-by: Benoit Jacob <[email protected]>
bjacob
added a commit
that referenced
this pull request
May 13, 2026
Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards #24323. Signed-off-by: Benoit Jacob <[email protected]>
bjacob
added a commit
that referenced
this pull request
May 14, 2026
Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards #24323. Signed-off-by: Benoit Jacob <[email protected]>
bjacob
added a commit
that referenced
this pull request
May 14, 2026
Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards #24323. Signed-off-by: Benoit Jacob <[email protected]>
bjacob
added a commit
that referenced
this pull request
May 14, 2026
Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards #24323. Signed-off-by: Benoit Jacob <[email protected]>
bjacob
added a commit
that referenced
this pull request
May 15, 2026
Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards #24323. Signed-off-by: Benoit Jacob <[email protected]>
bjacob
added a commit
that referenced
this pull request
May 15, 2026
Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards #24323. Signed-off-by: Benoit Jacob <[email protected]>
bjacob
added a commit
that referenced
this pull request
May 15, 2026
Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards #24323. Signed-off-by: Benoit Jacob <[email protected]>
bjacob
added a commit
that referenced
this pull request
May 15, 2026
Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards #24323. Signed-off-by: Benoit Jacob <[email protected]>
bjacob
added a commit
that referenced
this pull request
May 15, 2026
#24492) Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards #24323. --------- Signed-off-by: Benoit Jacob <[email protected]>
RattataKing
pushed a commit
to RattataKing/iree
that referenced
this pull request
May 27, 2026
…ree-org#24389) Adds two new `MMAIntrinsic` values, `MMA_GENERIC_SCALAR_1x1x1_REG8` and `_REG16`, that the data-tiling cost model picks when no element-type- specific intrinsic on the target supports the matmul's (LHS, RHS, ACC) types. This intentionally breaks the "an MMAIntrinsic enum value pins down a specific element-type triple" invariant in exchange for not having to add one enum value per supported triple. Element types live on new `DataTiledMMAAttr.{lhs,rhs,acc}_type` parameters, populated by the cost model only when the chosen intrinsic is one of the polymorphic variants. The cost model picks `_REG16` on 64-bit ISAs (x86_64, AArch64, RISC-V) and `_REG8` on 32-bit ISAs. The number is a register-budget for the unroll heuristic — one element of any width occupies one register, but the architectural register file the lowering ends up in (GPR or SIMD- scalar lane) is up to LLVM. The budget is encoded in the low byte of the enum value, so `chooseUnrolling` can read it back. Since the intrinsic is 1×1×1, the operand tiles after `intrinsics_m` / `intrinsics_n` / `intrinsics_k` are simple row-major (M, K) / (N, K) / (M, N) — `linalg.mmt4d`-shaped. `DataTiledMMAAttr::buildUnderlyingOperations` therefore short-circuits the swizzle/distribute pipeline for these intrinsics and emits a single `vector.contract` directly, with `arith.extf` / `arith.extsi` widening narrow LHS/RHS to ACC's element type. For sub-byte LHS/RHS types `chooseUnrolling` also picks the smallest power-of-two `intrinsics_k` such that K*lhsBits and K*rhsBits are byte-aligned (e.g. K=2 for i4/f4, K=4 for f6, K=8 for i1). Progress towards iree-org#24323
RattataKing
pushed a commit
to RattataKing/iree
that referenced
this pull request
May 27, 2026
iree-org#24492) Adds an `e2e_matmul_cpu_dt_inner_tiled_*` family that mirrors the existing legacy-path `e2e_matmul_cpu_dt_*` block (same type matrix: i8/i32, f32/f32, f64/f64, f16/f16, f16/f32, bf16/bf16, bf16/f32; same per-type x86 cpu-features variants; f64-demote guard; riscv/wasm tags) but with `--iree-opt-data-tiling --iree-llvmcpu-enable-inner-tiled`. Type×feature combos that match a hardware MMA intrinsic (e.g. f32/f32 on AVX2, bf16/f32 on AVX-512-BF16, i8/i32 on AVX-512-VNNI) exercise the new `iree_codegen.inner_tiled` lowering; the rest fall through to the type-polymorphic generic-scalar MMA (iree-org#24389), so this is a correctness check on data-tiling-enabled compilation either way. Shapes use the `default` set, except f64 (`small`, due to f64-demote handling). The prerequisite pre-transposed-enum PR is what lets us start at the full shape set rather than progressively widen. Progress towards iree-org#24323. --------- Signed-off-by: Benoit Jacob <[email protected]>
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.
Adds two new
MMAIntrinsicvalues,MMA_GENERIC_SCALAR_1x1x1_REG8and_REG16, that the data-tiling cost model picks when no element-type- specific intrinsic on the target supports the matmul's (LHS, RHS, ACC) types. This intentionally breaks the "an MMAIntrinsic enum value pins down a specific element-type triple" invariant in exchange for not having to add one enum value per supported triple. Element types live on newDataTiledMMAAttr.{lhs,rhs,acc}_typeparameters, populated by the cost model only when the chosen intrinsic is one of the polymorphic variants.The cost model picks
_REG16on 64-bit ISAs (x86_64, AArch64, RISC-V) and_REG8on 32-bit ISAs. The number is a register-budget for the unroll heuristic — one element of any width occupies one register, but the architectural register file the lowering ends up in (GPR or SIMD- scalar lane) is up to LLVM. The budget is encoded in the low byte of the enum value, sochooseUnrollingcan read it back.Since the intrinsic is 1×1×1, the operand tiles after
intrinsics_m/intrinsics_n/intrinsics_kare simple row-major (M, K) / (N, K) / (M, N) —linalg.mmt4d-shaped.DataTiledMMAAttr::buildUnderlyingOperationstherefore short-circuits the swizzle/distribute pipeline for these intrinsics and emits a singlevector.contractdirectly, witharith.extf/arith.extsiwidening narrow LHS/RHS to ACC's element type. For sub-byte LHS/RHS typeschooseUnrollingalso picks the smallest power-of-twointrinsics_ksuch that KlhsBits and KrhsBits are byte-aligned (e.g. K=2 for i4/f4, K=4 for f6, K=8 for i1).Progress towards #24323