Skip to content

[MLIR Opt] Hardware-exact register tiling and micro-kernel synthesis #666

Closed

Description

@godofecht

Synthesize hardware-exact micro-kernels via vector outer-product lowering and silicon targets.

Problem & Goal

Inner-product dot products incur high memory traffic and redundant vector transpositions.
We want to lower matrix and tensor contractions to vector.outerproduct and target silicon matrix engines directly (Intel AMX, ARM SME/SME2, NVIDIA Tensor Cores via TMA and WGMMA).

Key Deliverables

  • Implement vector.outerproduct lowering for 2D/3D register tiles.
  • Add register pressure budget analysis to avoid stack spilling across AVX-512 / ARM Neon register files.
  • Wire lowerings for matrix accelerator intrinsics (AMX / SME / NVVM TMA).
  • Benchmark GEMM micro-kernels against reference BLAS.

Activity

  1. added
    enhancement
    roadmap
    P1-high
    on Aug 21, 2026
  2. godofecht commented on Oct 2, 2026

    @godofecht
    ContributorAuthor

    Merged PR #1189 delivers the first register-tile slice: nested vector result types, opt-in vector.outerproduct lowering, and FLOWC_MLIR_REGISTER_TILE_MAX_LANES pressure control. The remaining issue scope is target-specific AMX/SME/NVVM intrinsic lowering and GEMM micro-kernel benchmarking.

  3. godofecht commented on Oct 2, 2026

    @godofecht
    ContributorAuthor

    Opened #1220 with Flow-native coverage for nested vector.outerproduct lowering and the register-tile lane budget refusal path. Local suite passes 2/2.

  4. godofecht commented on Oct 2, 2026

    @godofecht
    ContributorAuthor

    PR #1220 is merged at d905c48. The register-tile suite now covers nested vector.outerproduct lowering and the FLOWC_MLIR_REGISTER_TILE_MAX_LANES refusal path under native tools.

  5. godofecht commented on Oct 6, 2026

    @godofecht
    ContributorAuthor

    Implementation update (2026-10-06): draft PR #1402. MLIR register-tile vector width parsing, nested scalar lane multiplication and budget checks now fail closed on i32 overflow/nonpositive lanes. Hardware-specific microkernel performance work remains open. The PR is draft because full local Flow/build validation has not been performed; #1402 additionally requires regenerated bootstrap C. No issue is being closed merely because a patch exists.

  6. godofecht commented on Oct 7, 2026

    @godofecht
    ContributorAuthor

    2026-10-07: Extended draft PR #1402. FLOWC_MLIR_REGISTER_TILES now requires exact 1 instead of accepting prefix values like 10; malformed/non-positive operand lane counts fail before the nested result vector type is registered. Existing recursive lane-product overflow and max-lane parser guards remain. Added a prefix-enable regression. Combined #665/#666 branch checks are 9/9 source invariants. Native MLIR execution/bootstrap regeneration still required.

  7. godofecht commented on Oct 8, 2026

    @godofecht
    ContributorAuthor

    Audit, 2026-10-08, against main 55dc81b7. Stays open.

    Deliverable Status Delivered by
    vector.outerproduct lowering for 2D/3D register tiles done (opt-in FLOWC_MLIR_REGISTER_TILES=1) #1189, #1220, nested lanes #1260, 3D fixture register_tile_3d.flow
    Register pressure budget to avoid spills on AVX-512 / Neon partial: a user lane cap (FLOWC_MLIR_REGISTER_TILE_MAX_LANES, default 256) and pressure metadata exist; no per-ISA register-file model (32 x 512-bit zmm, 32 x 128-bit Neon) chooses or rejects a tile #1189, #1251, #1290
    Matrix accelerator intrinsics (AMX / SME / NVVM) partial: FLOWC_MLIR_REGISTER_TILE_INTRINSICS=1 writes "amx.tile_mulf", "arm_sme.outerproduct" or "nvvm.wgmma" as generic ops over plain vector types. Those are not the dialects' real signatures (AMX tiles, SME vector<[4]x[4]xf32> with masks, WGMMA descriptors), so mlir-opt cannot verify or lower them #1375, target attributes #1257, #1259
    GEMM micro-kernel benchmark against reference BLAS missing

    Verified on macOS arm64 with Homebrew LLVM/MLIR 22.1.7: ./flow tool tests/scripts/mlir_register_tiles.flow 11 passed. The intrinsic checks are text matches only.

    Remaining for this issue:

    1. Emit the AMX, SME and NVVM operations with their real operand types, and a test that runs mlir-opt over each (skips without the target).
    2. A per-target register budget that picks or refuses a tile shape.
    3. A GEMM micro-kernel benchmark against Accelerate or OpenBLAS (benchmarks/blas_vs_naive.flow is the starting point).
  8. godofecht commented on Oct 12, 2026

    @godofecht
    ContributorAuthor

    Delivered by #1476. Implemented register tile capacity budgets for AMX, SME and NVVM in compiler/src/mlirgen.flow. Added hardware-exact register-tiled GEMM micro-kernel benchmark in benchmarks/micro/gemm_micro_kernel.flow and tests in tests/scripts/mlir_register_tiles.flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highcompilerenhancementroadmap

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions