[Mlir-commits] [mlir] [mlir][SPIR-V] Guard update-vce pass against ops exceeding target max version (PR #212939)

Igor Wodiany llvmlistbot at llvm.org
Tue Aug 4 09:51:07 PDT 2026


================
@@ -42,6 +42,25 @@ spirv.module Logical GLSL450 attributes {
   }
 }
 
+// -----
+
+// Test rejecting an op whose max version is below what the target
+// environment allows.
+// spirv.AtomicCompareExchangeWeak is only available up to v1.3.
+
+spirv.module Logical GLSL450 attributes {
+  spirv.target_env = #spirv.target_env<
+    #spirv.vce<v1.6, [Kernel], []>, #spirv.resource_limits<>>
+} {
+  spirv.func @atomic_compare_exchange_weak(%ptr : !spirv.ptr<i32, Workgroup>, %value : i32, %comparator : i32) -> i32 "None" {
+    // expected-error @+1 {{'spirv.AtomicCompareExchangeWeak' requires max version v1.3 but target environment allows up to v1.6}}
----------------
IgWod wrote:

```suggestion
    // expected-error @+1 {{'spirv.AtomicCompareExchangeWeak' is missing after version 1.3 but target environment is 1.6}}
```

What do you think?

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


More information about the Mlir-commits mailing list