Skip to content

[Codegen][CPU] Add e2e matmul tests for the inner_tiled lowering path. - #24492

Merged
bjacob merged 2 commits into
mainfrom
users/bjacob/cpu-inner-tiled-e2e-tests-take-two
May 15, 2026
Merged

bjacob merged 2 commits into
mainfrom
users/bjacob/cpu-inner-tiled-e2e-tests-take-two

Conversation

@bjacob

@bjacob bjacob commented May 14, 2026

Copy link
Copy Markdown
Collaborator

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.

@bjacob bjacob mentioned this pull request May 14, 2026
25 of 28 tasks
@bjacob
bjacob marked this pull request as ready for review May 14, 2026 20:43
@bjacob
bjacob force-pushed the users/bjacob/cpu-hoist-inner-tiled-acc-reshapes branch from 4700ab6 to 721339b Compare May 15, 2026 14:04
@bjacob
bjacob force-pushed the users/bjacob/cpu-inner-tiled-e2e-tests-take-two branch from 0b648ae to 7a841a0 Compare May 15, 2026 14:04
@bjacob
bjacob force-pushed the users/bjacob/cpu-hoist-inner-tiled-acc-reshapes branch from 721339b to 1b21938 Compare May 15, 2026 15:54
@bjacob
bjacob force-pushed the users/bjacob/cpu-inner-tiled-e2e-tests-take-two branch from 7a841a0 to 12c8a26 Compare May 15, 2026 15:54
@bjacob
bjacob force-pushed the users/bjacob/cpu-hoist-inner-tiled-acc-reshapes branch from 1b21938 to faa3f21 Compare May 15, 2026 16:02
@bjacob
bjacob force-pushed the users/bjacob/cpu-inner-tiled-e2e-tests-take-two branch from 12c8a26 to cdfe54f Compare May 15, 2026 16:02
bjacob added 2 commits May 15, 2026 13:06
Mirrors the GPU pipeline (`buildLLVMGPUCodegenPassPipeline` adds this
pass right before `UnrollToIntrinsicsPass`). Before this change, on
CPU the reshape ops left around `iree_codegen.inner_tiled` sat
between the K-reduction loop's `scf.for` iter args and the op's
accumulator operand, so the per-tile `HoistableConversionOp` pairs
that the inner_tiled lowering wraps around its ACC
distribute/reassemble couldn't satisfy
`HoistConversionFromLoopPattern`'s strict iter-arg match. They
failed to hoist, got inlined in place, and
`EliminateHoistableConversions` fired a `hoistable_conversion was
not hoisted or cancelled; inlining in place` remark on every CPU
matmul build using the inner_tiled path.

Running `HoistInnerTiledAccReshapes` before
`LLVMCPUVirtualVectorLoweringPass` wraps the prefix/suffix reshape
ops (transpose, shape_cast, broadcast) around the inner_tiled as
`acc_reshape_to_intrinsic` / `acc_reshape_from_intrinsic` hoistable
conversions and runs the elimination over them. The reshapes hoist
out of the K loop, the inner_tiled's accumulator is fed directly by
the iter arg, and the per-tile conversion pairs emitted later in
the vector lowering see direct iter-arg inputs and hoist cleanly.

Progress towards #24323.

Signed-off-by: Benoit Jacob <[email protected]>
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
bjacob force-pushed the users/bjacob/cpu-hoist-inner-tiled-acc-reshapes branch from faa3f21 to 57bbcbc Compare May 15, 2026 17:06
@bjacob
bjacob force-pushed the users/bjacob/cpu-inner-tiled-e2e-tests-take-two branch from cdfe54f to b8a97ce Compare May 15, 2026 17:06
Base automatically changed from users/bjacob/cpu-hoist-inner-tiled-acc-reshapes to main May 15, 2026 19:38
@bjacob
bjacob merged commit cff4b04 into main May 15, 2026
60 of 62 checks passed
@bjacob
bjacob deleted the users/bjacob/cpu-inner-tiled-e2e-tests-take-two branch May 15, 2026 19:38
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants