[Mlir-commits] [mlir] [mlir][scf][transform] Add scope op & transform (PR #87352)
Gil Rapaport
llvmlistbot at llvm.org
Thu Apr 18 05:37:57 PDT 2024
================
@@ -931,6 +931,28 @@ def ReduceReturnOp :
let hasVerifier = 1;
}
+def ScopeOp : SCF_Op<"scope",
+ [AutomaticAllocationScope,
+ RecursiveMemoryEffects,
+ IsolatedFromAbove,
+ SingleBlockImplicitTerminator<"scf::YieldOp">]> {
+ let summary = "isolated code scope";
+ let description = [{
+ This op models an executed-once region, similar to `execute_region`
+ except it's isolated from above, which facilitates local scoping of
+ code without resorting to function outlining.
----------------
aniragil wrote:
Sure, some background:
This patch is a draft following a C4ML'24 discussion regarding the proposed transform, which facilitates trying transformation sequences on a limited scope without resorting to function outlining or cloning large portions of the IR using transform.alternatives. This transform requires an isolated-from-above op which can temporarily encapsulate the to-be-transformed part of the code.
The scope op was put in the scf dialect mainly since the transform dialect doesn't allow adding non-transform ops (perhaps it should?). However, a EuroLLVM'24 [round table](https://discourse.llvm.org/t/notes-from-the-mlir-upstream-round-table-eurollvm-2024/78374) brought up potential other use cases for such an op, so I'll split it into its own patch to keep the discussions separate.
https://github.com/llvm/llvm-project/pull/87352
More information about the Mlir-commits
mailing list