Skip to content

[MLIR Opt] Polyhedral loop transformations via affine and linalg dialects #665

Closed

Description

@godofecht

Implement polyhedral loop nest transformations and Linalg structured operations.

Problem & Goal

C compilers rely on heuristic loop passes that fail across complex structs and non-trivial access strides.
Using MLIR affine and linalg dialects enables exact Presburger relation dependency analysis, multi-level loop tiling, loop skewing, interchange, and operator fusion.

Key Deliverables

  • Lower Flow loops and tensor operators to linalg.generic and affine.for nests.
  • Enable algebraic operator fusion (fusing elementwise ops, broadcasts, and reductions into single-pass kernels).
  • Implement multi-level hierarchical tiling (L3 -> L2 -> L1 -> register tile).
  • Add benchmarks validating speedup on matrix and stencil operations.

Activity

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

    @godofecht
    ContributorAuthor

    Incremental step merged in #889: elementwise fusion pass (linalg-fuse-elementwise-ops) plus a generator hook emitting linalg.generic for elementwise loops, with a fusion benchmark. Full polyhedral tiling/skewing via the affine dialect remains.

  3. godofecht commented on Oct 2, 2026

    @godofecht
    ContributorAuthor

    Opened PR #1186 with the first native compiler slice: FLOWC_MLIR_AFFINE=1 lowers eligible static counted loops to affine.for. The default remains scf.for. Bootstrap fixed-point and three-generation self-host checks pass. Full polyhedral tiling, skewing, interchange, and fusion remain.

  4. godofecht commented on Oct 2, 2026

    @godofecht
    ContributorAuthor

    Opened #1221 with an opt-in --enable-affine-normalization pipeline flag and Flow-native coverage. The slice also fixes the pipeline tool import to use the tracked shared text module. Local suite passes 2/2.

  5. godofecht commented on Oct 2, 2026

    @godofecht
    ContributorAuthor

    Opened #1222 with opt-in affine loop unrolling and explicit factor validation. The Flow-native pipeline suite passes 4/4 locally.

  6. godofecht commented on Oct 3, 2026

    @godofecht
    ContributorAuthor

    PR #1311 merged at c5dc393. The Flow-native MLIR pipeline now exposes opt-in affine-parallelize coverage and documentation. The pass remains disabled by default.

  7. 8 remaining items

  8. godofecht commented on Oct 12, 2026

    @godofecht
    ContributorAuthor

    Completed by #1475. Added tests/mlir/affine_loop_fusion.flow, benchmarks/mlir_fusion/benchmark.flow, and recorded MLIR command goldens.

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