[Mlir-commits] [mlir] [mlir][scf] scf.for support inline which contains affine map op. (PR #124082)
lonely eagle
llvmlistbot at llvm.org
Thu Jan 23 00:24:03 PST 2025
================
@@ -133,8 +133,9 @@ def ExecuteRegionOp : SCF_Op<"execute_region", [
// ForOp
//===----------------------------------------------------------------------===//
-def ForOp : SCF_Op<"for",
- [AutomaticAllocationScope, DeclareOpInterfaceMethods<LoopLikeOpInterface,
+def ForOp : SCF_Op<"for", [
+ AffineScope, AutomaticAllocationScope,
+ DeclareOpInterfaceMethods<LoopLikeOpInterface,
----------------
linuxlonelyeagle wrote:
I think `AffineScope` should not be introduced in the loop. In the loop, the `SSA value` generated each time may change, so it is very likely that they are not valid symbols. For example, if a function returns an Index type, the `SSA value` will change. In addition, the value of the passed parameter, such as `memref<?x?xf32>`, `memref.dim` may also change after the function call is completed. Introducing `AffineScope` here will make all the above values become valid symbols.
The key to the problem should be that your function is in the top level of AffineScope, and the values inside it are all valid symbols, but after being inlined, it is placed in the for loop and they become illegal symbols.
Maybe you should run your function through a `lower-affine` pass before inlining it.
https://github.com/llvm/llvm-project/pull/124082
More information about the Mlir-commits
mailing list