[Mlir-commits] [mlir] [mlir][SPIR-V] Enable spirv-val for OpDecorateId decoration tests (NFC) (PR #202591)

Arseniy Obolenskiy llvmlistbot at llvm.org
Tue Jun 9 05:34:12 PDT 2026


https://github.com/aobolensk created https://github.com/llvm/llvm-project/pull/202591

Run test through spirv-val and fix incorrect minimal versions and missing SPV_GOOGLE_hlsl_functionality1 extension requirement

v.1.2 is minimal for AlignmentId and MaxByteOffsetId, v1.4 and `SPV_GOOGLE_hlsl_functionality1` are needed for CounterBuffer

>From d5d45218166e50748790239941059b1e1be05775 Mon Sep 17 00:00:00 2001
From: Arseniy Obolenskiy <arseniy.obolenskiy at amd.com>
Date: Tue, 9 Jun 2026 14:28:52 +0200
Subject: [PATCH] [mlir][SPIR-V] Enable spirv-val for OpDecorateId decoration
 tests (NFC)

Run test through spirv-val and fix incorrect minimal versions and missing SPV_GOOGLE_hlsl_functionality1 extension requirement
---
 mlir/test/Target/SPIRV/decorations-id.mlir | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/mlir/test/Target/SPIRV/decorations-id.mlir b/mlir/test/Target/SPIRV/decorations-id.mlir
index dfd83319032d9..9a54e49a08ba8 100644
--- a/mlir/test/Target/SPIRV/decorations-id.mlir
+++ b/mlir/test/Target/SPIRV/decorations-id.mlir
@@ -1,10 +1,14 @@
 // RUN: mlir-translate --no-implicit-module --split-input-file --test-spirv-roundtrip %s | FileCheck %s
+// RUN: %if spirv-tools %{ rm -rf %t %}
+// RUN: %if spirv-tools %{ mkdir %t %}
+// RUN: %if spirv-tools %{ mlir-translate --no-implicit-module --serialize-spirv --split-input-file --spirv-save-validation-files-with-prefix=%t/module %s %}
+// RUN: %if spirv-tools %{ spirv-val %t %}
 
 // Round-trip tests for decorations whose operand is a SPIR-V <id>
 // (serialized as OpDecorateId, opcode 332).
 
 // AlignmentId references a specialization constant that supplies the alignment.
-spirv.module Logical OpenCL requires #spirv.vce<v1.0, [Kernel, Addresses, Linkage], []> {
+spirv.module Logical OpenCL requires #spirv.vce<v1.2, [Kernel, Addresses, Linkage], []> {
   // CHECK: spirv.SpecConstant @sc_align = 16
   // CHECK: alignment_id = @sc_align
   spirv.SpecConstant @sc_align = 16 : i32
@@ -14,7 +18,7 @@ spirv.module Logical OpenCL requires #spirv.vce<v1.0, [Kernel, Addresses, Linkag
 // -----
 
 // MaxByteOffsetId references a specialization constant.
-spirv.module Logical OpenCL requires #spirv.vce<v1.0, [Kernel, Addresses, Linkage], []> {
+spirv.module Logical OpenCL requires #spirv.vce<v1.2, [Kernel, Addresses, Linkage], []> {
   // CHECK: spirv.SpecConstant @sc_offset = 1024
   // CHECK: max_byte_offset_id = @sc_offset
   spirv.SpecConstant @sc_offset = 1024 : i32
@@ -24,7 +28,7 @@ spirv.module Logical OpenCL requires #spirv.vce<v1.0, [Kernel, Addresses, Linkag
 // -----
 
 // CounterBuffer references another global variable.
-spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Linkage], []> {
+spirv.module Logical GLSL450 requires #spirv.vce<v1.4, [Shader, Linkage], [SPV_GOOGLE_hlsl_functionality1]> {
   // CHECK: spirv.GlobalVariable @counter
   // CHECK: counter_buffer = @counter
   spirv.GlobalVariable @counter bind(0, 1) : !spirv.ptr<!spirv.struct<(!spirv.array<1 x i32, stride=4>[0])>, StorageBuffer>



More information about the Mlir-commits mailing list