Skip to content

[MLIR Opt] Automatic memory layout transformations (AoSoA and conflict padding) #667

Closed

Description

@godofecht

Implement Array of Structs of Arrays (AoSoA) tiling and conflict-free memory padding.

Problem & Goal

Naive Array of Structures (AoS) causes expensive gather/scatter vector instructions. Power-of-two matrix strides cause 4K aliasing on CPUs and shared memory bank conflicts on GPUs.

Key Deliverables

  • Implement AoSoA memory layout transformations at the memref level.
  • Automatically insert compile-time padding for 2D/3D tile strides to eliminate GPU shared memory bank conflicts and CPU cache set aliasing.
  • Implement swizzled memory indexing for contiguous SIMD loads on non-major dimensions.

Activity

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

    @godofecht
    ContributorAuthor

    Incremental step merged in #891: automatic AoSoA layout canonicalization (structural IR rewrite, not text editing) with a --no-aosoa opt-out, benchmark, and tests. 210 MLIR/transpiler tests pass. Conflict-padding for cache-line alignment remains.

  3. godofecht commented on Sep 12, 2026

    @godofecht
    ContributorAuthor

    Maintenance note (2026-09-12): #891 merged an incremental AoSoA layout canonicalization at 121bf59c343321f7555ef58d0b65cca43d81d5c4, including a --no-aosoa opt-out plus focused benchmark/unit coverage. This does not appear to complete the full issue: conflict-padding for GPU shared-memory / CPU cache-set aliasing and swizzled indexing for non-major-dimension contiguous SIMD loads remain explicit deliverables. Keeping #667 open is correct; next work should target those remaining transforms and validate them locally.

  4. godofecht commented on Oct 2, 2026

    @godofecht
    ContributorAuthor

    Added PR #1217 with direct AoSoA padding coverage. The existing four-element Particle fixture now asserts memref<5xf32> under the opt-in padding mode, alongside the non-power-of-two swizzle check.

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