[Mlir-commits] [mlir] Revert "[mlir][SPIR-V] Verify NonPrivatePointer requirement for MakePointer{Available, Visible}" (PR #225483)
Valentin Clement バレンタイン クレメン
llvmlistbot at llvm.org
Tue Sep 22 11:46:18 PDT 2026
https://github.com/clementval created https://github.com/llvm/llvm-project/pull/225483
Reverts llvm/llvm-project#213621
This is causing buildbot failure https://lab.llvm.org/buildbot/#/builders/157/builds/51250
>From 367b5bd93722474d32673e98305fe204701199a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?=
=?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?=
=?UTF-8?q?=E3=83=B3=29?= <clementval at gmail.com>
Date: Tue, 22 Sep 2026 11:45:44 -0700
Subject: [PATCH] =?UTF-8?q?Revert=20"[mlir][SPIR-V]=20Verify=20NonPrivateP?=
=?UTF-8?q?ointer=20requirement=20for=20MakePointer{A=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit df6eb20ffd22156a6d4fd54e36146d430c8a182a.
---
mlir/lib/Dialect/SPIRV/IR/MemoryOps.cpp | 54 +++-----------
mlir/test/Dialect/SPIRV/IR/memory-ops.mlir | 82 ----------------------
2 files changed, 8 insertions(+), 128 deletions(-)
diff --git a/mlir/lib/Dialect/SPIRV/IR/MemoryOps.cpp b/mlir/lib/Dialect/SPIRV/IR/MemoryOps.cpp
index ae7769c54f19fd..08d8b3beb82751 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 78dabf67ece35b..c58f22cea5a4b0 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>
More information about the Mlir-commits
mailing list