[Mlir-commits] [mlir] Revert "[mlir][SPIR-V] Verify NonPrivatePointer requirement for MakePointer{Available, Visible}" (PR #225483)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 22 11:47:02 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Valentin Clement (バレンタイン クレメン) (clementval)

<details>
<summary>Changes</summary>

Reverts llvm/llvm-project#<!-- -->213621

This is causing buildbot failure https://lab.llvm.org/buildbot/#/builders/157/builds/51250

---
Full diff: https://github.com/llvm/llvm-project/pull/225483.diff


2 Files Affected:

- (modified) mlir/lib/Dialect/SPIRV/IR/MemoryOps.cpp (+8-46) 
- (modified) mlir/test/Dialect/SPIRV/IR/memory-ops.mlir (-82) 


``````````diff
diff --git a/mlir/lib/Dialect/SPIRV/IR/MemoryOps.cpp b/mlir/lib/Dialect/SPIRV/IR/MemoryOps.cpp
index ae7769c54f19f..08d8b3beb8275 100644
--- a/mlir/lib/Dialect/SPIRV/IR/MemoryOps.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/MemoryOps.cpp
@@ -196,35 +196,6 @@ static LogicalResult verifyMemoryAccessAttribute(MemoryOpTy memoryOp) {
            << memAccessAttr;
   }
 
-  // MakePointerAvailable applies to writes through the pointer, so it is
-  // invalid for Load (which only reads through it).
-  if (isa<LoadOp>(op) &&
-      spirv::bitEnumContainsAll(memAccess.getValue(),
-                                spirv::MemoryAccess::MakePointerAvailable)) {
-    return memoryOp.emitOpError(
-        "not compatible with memory operand 'MakePointerAvailable'");
-  }
-
-  // MakePointerVisible applies to reads through the pointer, so it is invalid
-  // for Store and for the Target operand of CopyMemory, both of which only
-  // write through it.
-  if (isa<StoreOp, CopyMemoryOp>(op) &&
-      spirv::bitEnumContainsAll(memAccess.getValue(),
-                                spirv::MemoryAccess::MakePointerVisible)) {
-    return memoryOp.emitOpError(
-        "not compatible with memory operand 'MakePointerVisible'");
-  }
-
-  if (spirv::bitEnumContainsAny(memAccess.getValue(),
-                                spirv::MemoryAccess::MakePointerAvailable |
-                                    spirv::MemoryAccess::MakePointerVisible) &&
-      !spirv::bitEnumContainsAll(memAccess.getValue(),
-                                 spirv::MemoryAccess::NonPrivatePointer)) {
-    return memoryOp.emitOpError(
-        "memory operand 'MakePointerAvailable' or 'MakePointerVisible' "
-        "requires 'NonPrivatePointer' to also be specified");
-  }
-
   if (spirv::bitEnumContainsAll(memAccess.getValue(),
                                 spirv::MemoryAccess::Aligned)) {
     if (!memoryOp.getAlignmentAttr()) {
@@ -268,23 +239,6 @@ static LogicalResult verifySourceMemoryAccessAttribute(MemoryOpTy memoryOp) {
            << memAccess;
   }
 
-  // The source mask applies to the read through the source pointer, so it
-  // cannot include MakePointerAvailable, which applies to writes.
-  if (spirv::bitEnumContainsAll(memAccess.getValue(),
-                                spirv::MemoryAccess::MakePointerAvailable)) {
-    return memoryOp.emitOpError(
-        "not compatible with memory operand 'MakePointerAvailable'");
-  }
-
-  if (spirv::bitEnumContainsAll(memAccess.getValue(),
-                                spirv::MemoryAccess::MakePointerVisible) &&
-      !spirv::bitEnumContainsAll(memAccess.getValue(),
-                                 spirv::MemoryAccess::NonPrivatePointer)) {
-    return memoryOp.emitOpError(
-        "memory operand 'MakePointerAvailable' or 'MakePointerVisible' "
-        "requires 'NonPrivatePointer' to also be specified");
-  }
-
   if (spirv::bitEnumContainsAll(memAccess.getValue(),
                                 spirv::MemoryAccess::Aligned)) {
     if (!memoryOp.getSourceAlignmentAttr()) {
@@ -588,6 +542,14 @@ LogicalResult CopyMemoryOp::verify() {
   if (failed(verifyMemoryAccessAttribute(*this)))
     return failure();
 
+  // TODO - According to the spec:
+  //
+  // If two masks are present, the first applies to Target and cannot include
+  // MakePointerVisible, and the second applies to Source and cannot include
+  // MakePointerAvailable.
+  //
+  // Add such verification here.
+
   return verifySourceMemoryAccessAttribute(*this);
 }
 
diff --git a/mlir/test/Dialect/SPIRV/IR/memory-ops.mlir b/mlir/test/Dialect/SPIRV/IR/memory-ops.mlir
index 78dabf67ece35..c58f22cea5a4b 100644
--- a/mlir/test/Dialect/SPIRV/IR/memory-ops.mlir
+++ b/mlir/test/Dialect/SPIRV/IR/memory-ops.mlir
@@ -202,32 +202,6 @@ func.func @volatile_aligned_load() -> () {
   return
 }
 
-// CHECK-LABEL: @make_pointer_visible_load
-func.func @make_pointer_visible_load() -> () {
-  %0 = spirv.Variable : !spirv.ptr<f32, Function>
-  // CHECK: spirv.Load "Function" %{{.*}} ["MakePointerVisible|NonPrivatePointer"] : f32
-  %1 = spirv.Load "Function" %0 ["MakePointerVisible|NonPrivatePointer"] : f32
-  return
-}
-
-// -----
-
-func.func @load_bad_operand() -> () {
-  %0 = spirv.Variable : !spirv.ptr<f32, Function>
-  // expected-error @+1 {{op not compatible with memory operand 'MakePointerAvailable'}}
-  %1 = spirv.Load "Function" %0 ["MakePointerAvailable|NonPrivatePointer"] : f32
-  return
-}
-
-// -----
-
-func.func @load_make_pointer_visible_missing_non_private() -> () {
-  %0 = spirv.Variable : !spirv.ptr<f32, Function>
-  // expected-error @+1 {{op memory operand 'MakePointerAvailable' or 'MakePointerVisible' requires 'NonPrivatePointer' to also be specified}}
-  %1 = spirv.Load "Function" %0 ["MakePointerVisible"] : f32
-  return
-}
-
 // -----
 
 // CHECK-LABEL: load_none_access
@@ -430,32 +404,6 @@ func.func @aligned_store(%arg0 : f32) -> () {
   return
 }
 
-// CHECK-LABEL: @make_pointer_available_store
-func.func @make_pointer_available_store(%arg0 : f32) -> () {
-  %0 = spirv.Variable : !spirv.ptr<f32, Function>
-  // CHECK: spirv.Store  "Function" %0, %arg0 ["MakePointerAvailable|NonPrivatePointer"] : f32
-  spirv.Store  "Function" %0, %arg0 ["MakePointerAvailable|NonPrivatePointer"] : f32
-  return
-}
-
-// -----
-
-func.func @store_bad_operand(%arg0 : f32) -> () {
-  %0 = spirv.Variable : !spirv.ptr<f32, Function>
-  // expected-error @+1 {{op not compatible with memory operand 'MakePointerVisible'}}
-  spirv.Store  "Function" %0, %arg0 ["MakePointerVisible|NonPrivatePointer"] : f32
-  return
-}
-
-// -----
-
-func.func @store_make_pointer_available_missing_non_private(%arg0 : f32) -> () {
-  %0 = spirv.Variable : !spirv.ptr<f32, Function>
-  // expected-error @+1 {{op memory operand 'MakePointerAvailable' or 'MakePointerVisible' requires 'NonPrivatePointer' to also be specified}}
-  spirv.Store  "Function" %0, %arg0 ["MakePointerAvailable"] : f32
-  return
-}
-
 // -----
 
 func.func @simple_store_missing_ptr_type(%arg0 : f32) -> () {
@@ -742,36 +690,6 @@ func.func @copy_memory_invalid_source_maa2() {
 
 // -----
 
-func.func @copy_memory_target_bad_operand() {
-  %0 = spirv.Variable : !spirv.ptr<f32, Function>
-  %1 = spirv.Variable : !spirv.ptr<f32, Function>
-  // expected-error @+1 {{op not compatible with memory operand 'MakePointerVisible'}}
-  "spirv.CopyMemory"(%0, %1) {memory_access=#spirv.memory_access<MakePointerVisible|NonPrivatePointer>} : (!spirv.ptr<f32, Function>, !spirv.ptr<f32, Function>) -> ()
-  spirv.Return
-}
-
-// -----
-
-func.func @copy_memory_source_bad_operand() {
-  %0 = spirv.Variable : !spirv.ptr<f32, Function>
-  %1 = spirv.Variable : !spirv.ptr<f32, Function>
-  // expected-error @+1 {{op not compatible with memory operand 'MakePointerAvailable'}}
-  "spirv.CopyMemory"(%0, %1) {source_memory_access=#spirv.memory_access<MakePointerAvailable|NonPrivatePointer>, memory_access=#spirv.memory_access<None>} : (!spirv.ptr<f32, Function>, !spirv.ptr<f32, Function>) -> ()
-  spirv.Return
-}
-
-// -----
-
-func.func @copy_memory_source_make_pointer_visible_missing_non_private() {
-  %0 = spirv.Variable : !spirv.ptr<f32, Function>
-  %1 = spirv.Variable : !spirv.ptr<f32, Function>
-  // expected-error @+1 {{op memory operand 'MakePointerAvailable' or 'MakePointerVisible' requires 'NonPrivatePointer' to also be specified}}
-  "spirv.CopyMemory"(%0, %1) {source_memory_access=#spirv.memory_access<MakePointerVisible>, memory_access=#spirv.memory_access<None>} : (!spirv.ptr<f32, Function>, !spirv.ptr<f32, Function>) -> ()
-  spirv.Return
-}
-
-// -----
-
 func.func @copy_memory_print_maa() {
   %0 = spirv.Variable : !spirv.ptr<f32, Function>
   %1 = spirv.Variable : !spirv.ptr<f32, Function>

``````````

</details>


https://github.com/llvm/llvm-project/pull/225483


More information about the Mlir-commits mailing list