[all-commits] [llvm/llvm-project] 8f4da2: [mlir][affine] Fix min simplification in makeCompo...

Fabian Mora via All-commits all-commits at lists.llvm.org
Tue Jun 24 04:55:35 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f4da2cbf055ec7b9b66d757afcba1b942385874
      https://github.com/llvm/llvm-project/commit/8f4da2cbf055ec7b9b66d757afcba1b942385874
  Author: Fabian Mora <fmora.dev at gmail.com>
  Date:   2025-06-24 (Tue, 24 Jun 2025)

  Changed paths:
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    A mlir/test/Transforms/make-composed-folded-affine-apply.mlir
    M mlir/test/lib/Transforms/TestTransformsOps.cpp
    M mlir/test/lib/Transforms/TestTransformsOps.td

  Log Message:
  -----------
  [mlir][affine] Fix min simplification in makeComposedAffineApply (#145376)

This patch fixes a bug discovered in the
`affine::makeComposedFoldedAffineApply` function when `composeAffineMin
== true`. The bug happened because the simplification assumed the
symbols appearing in the `affine.apply` op corresponded to symbols in
the `affine.min` op, and that's not always the case. For example:

```mlir
#map = affine_map<()[s0, s1] -> (s1)>
#map1 = affine_map<()[s0, s1] -> (s0 ceildiv s1)>
module {
  func.func @min_max_full_simplify() -> index {
    %0 = test.value_with_bounds {max = 64 : index, min = 32 : index}
    %1 = test.value_with_bounds {max = 64 : index, min = 32 : index}
    %2 = affine.min #map()[%0, %1]
    %3 = affine.apply #map1()[%2, %0]
    return %3 : index
  }
}
```

This patch also introduces the test `make_composed_folded_affine_apply`
transform operation to test this simplification. It also adds tests
ensuring we get correct behavior.

---------

Co-authored-by: Nicolas Vasilache <nico.vasilache at amd.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list