[Mlir-commits] [mlir] [milr][gpu] Make barrier elimination address-space aware (PR #178101)
Jakub Kuderski
llvmlistbot at llvm.org
Tue Jan 27 11:51:05 PST 2026
================
@@ -78,14 +78,132 @@ static void addAllValuelessEffects(
effects.emplace_back(MemoryEffects::Effect::get<MemoryEffects::Free>());
}
+/// Looks through known "view-like" ops to find the base memref.
+static Value getBase(Value v) {
+ while (true) {
+ Operation *definingOp = v.getDefiningOp();
+ if (!definingOp)
+ break;
+
+ bool shouldContinue = TypeSwitch<Operation *, bool>(v.getDefiningOp())
+ .Case([&](ViewLikeOpInterface op) {
+ v = op.getViewSource();
+ return true;
+ })
+ .Case([&](memref::TransposeOp op) {
+ v = op.getIn();
+ return true;
+ })
+ .Default(false);
+ if (!shouldContinue)
+ break;
+ }
+ return v;
+}
+
+/// Returns `true` if accesses to the given memory space could potentially be
+/// fenced by a barrier synchoronizing on the given `fencedAddressSpaces`. If
+/// the set of address spaces is not given, it is equal to all possible address
+/// spaces. Memory spaces that are not `#gpu.address_space` are deemed to
+/// overlap with all GPU address spaces.
----------------
kuhar wrote:
```suggestion
/// Returns `true` if accesses to the given memory space could potentially be
/// fenced by a barrier synchronizing on the given `fencedAddressSpaces`. If
/// the set of address spaces is not given, it is equal to all possible address
/// spaces. Memory spaces that are not `#gpu.address_space` are deemed to
/// overlap with all GPU address spaces.
```
https://github.com/llvm/llvm-project/pull/178101
More information about the Mlir-commits
mailing list