[Mlir-commits] [mlir] 87de48d - [mlir][spirv] Add spirv validation for module.mlir target test (#153227)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Aug 14 04:45:59 PDT 2025
Author: Igor Wodiany
Date: 2025-08-14T12:45:55+01:00
New Revision: 87de48d11f512db76a2d0516bfb65adee2a11f7d
URL: https://github.com/llvm/llvm-project/commit/87de48d11f512db76a2d0516bfb65adee2a11f7d
DIFF: https://github.com/llvm/llvm-project/commit/87de48d11f512db76a2d0516bfb65adee2a11f7d.diff
LOG: [mlir][spirv] Add spirv validation for module.mlir target test (#153227)
Creating this patch as an example on using the new `mlir-translate`
flag. Eventually all tests will be updated to validate SPIR-V modules.
Added:
Modified:
mlir/test/Target/SPIRV/module.mlir
Removed:
################################################################################
diff --git a/mlir/test/Target/SPIRV/module.mlir b/mlir/test/Target/SPIRV/module.mlir
index dcdcab8097e41..d4000dfa53810 100644
--- a/mlir/test/Target/SPIRV/module.mlir
+++ b/mlir/test/Target/SPIRV/module.mlir
@@ -1,21 +1,29 @@
-// RUN: mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file %s | FileCheck %s
+// RUN: mlir-translate --no-implicit-module --test-spirv-roundtrip --split-input-file %s | FileCheck %s
+
+// REQUIRES: shell
+// 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 %{ ls %t/module*.spv | xargs -I{} spirv-val {} %}
// CHECK: spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
// CHECK-NEXT: spirv.func @foo() "Inline" {
// CHECK-NEXT: spirv.Return
// CHECK-NEXT: }
+// CHECK-NEXT: spirv.EntryPoint "Vertex" @foo
// CHECK-NEXT: }
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
spirv.func @foo() -> () "Inline" {
spirv.Return
}
+ spirv.EntryPoint "Vertex" @foo
}
// -----
// CHECK: v1.5
-spirv.module Logical GLSL450 requires #spirv.vce<v1.5, [Shader], []> {
+spirv.module Logical GLSL450 requires #spirv.vce<v1.5, [Shader, Linkage], []> {
}
// -----
@@ -26,13 +34,13 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.6, [Shader, Linkage], []> {
// -----
-// CHECK: [Shader, Float16]
-spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Float16], []> {
+// CHECK: [Shader, Float16, Linkage]
+spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Float16, Linkage], []> {
}
// -----
// CHECK: [SPV_KHR_float_controls, SPV_KHR_subgroup_vote]
-spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], [SPV_KHR_float_controls, SPV_KHR_subgroup_vote]> {
+spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Linkage], [SPV_KHR_float_controls, SPV_KHR_subgroup_vote]> {
}
More information about the Mlir-commits
mailing list