[Mlir-commits] [mlir] [mlir][acc] Add LegalizeDataValues support for DeclareEnterOp (PR #138008)
Razvan Lupusoru
llvmlistbot at llvm.org
Wed Apr 30 12:38:08 PDT 2025
================
@@ -71,7 +72,54 @@ static void replaceAllUsesInAccComputeRegionsWith(Value orig, Value replacement,
}
template <typename Op>
-static void collectAndReplaceInRegion(Op &op, bool hostToDevice) {
+static void replaceAllUsesInUnstructuredComputeRegionWith(
+ Op &op, llvm::SmallVector<std::pair<Value, Value>> &values,
+ DominanceInfo &domInfo, PostDominanceInfo &postDomInfo) {
+
+ Operation *exitOp = op.getOperation();
+ if constexpr (std::is_same_v<Op, acc::DeclareEnterOp>) {
+ // For declare enter/exit pairs, verify there is exactly one exit op using
+ // the token
+ if (!op.getToken().hasOneUse())
----------------
razvanlupusoru wrote:
This is too restrictive since from a language perspective multiple exits are allowed - and a dialect may choose to permit that. I think the algorithm here should collect all of the `declare_exit`'s and ensure that the replaced use post-dominates one of them.
https://github.com/llvm/llvm-project/pull/138008
More information about the Mlir-commits
mailing list