11// RUN: mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file %s | FileCheck %s
22
3- spirv.module Logical GLSL450 requires #spirv.vce <v1.0 , [Shader ], []> {
3+ // RUN: %if spirv-tools %{ rm -rf %t %}
4+ // RUN: %if spirv-tools %{ mkdir %t %}
5+ // RUN: %if spirv-tools %{ mlir-translate --no-implicit-module --serialize-spirv --split-input-file --spirv-save-validation-files-with-prefix=%t/module %s %}
6+ // RUN: %if spirv-tools %{ spirv-val %t %}
7+
8+ spirv.module Logical GLSL450 requires #spirv.vce <v1.0 , [Shader , Linkage ], []> {
49 spirv.func @bit_cast (%arg0 : f32 ) " None" {
510 // CHECK: {{%.*}} = spirv.Bitcast {{%.*}} : f32 to i32
611 %0 = spirv.Bitcast %arg0 : f32 to i32
@@ -14,7 +19,7 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
1419
1520// -----
1621
17- spirv.module Logical GLSL450 requires #spirv.vce <v1.0 , [Shader ], []> {
22+ spirv.module Logical GLSL450 requires #spirv.vce <v1.0 , [Shader , Linkage , BFloat16TypeKHR , Float64 , Int64 ], [SPV_KHR_bfloat16 ]> {
1823 spirv.func @convert_f_to_s (%arg0 : f32 ) -> i32 " None" {
1924 // CHECK: {{%.*}} = spirv.ConvertFToS {{%.*}} : f32 to i32
2025 %0 = spirv.ConvertFToS %arg0 : f32 to i32
@@ -104,7 +109,7 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
104109
105110// -----
106111
107- spirv.module Logical GLSL450 requires #spirv.vce <v1.0 , [Kernel ], []> {
112+ spirv.module Physical64 OpenCL requires #spirv.vce <v1.0 , [Kernel , Linkage , GenericPointer ], []> {
108113 spirv.func @ptr_cast_to_generic (%arg0 : !spirv.ptr <f32 , CrossWorkgroup >) " None" {
109114 // CHECK: {{%.*}} = spirv.PtrCastToGeneric {{%.*}} : !spirv.ptr<f32, CrossWorkgroup> to !spirv.ptr<f32, Generic>
110115 %0 = spirv.PtrCastToGeneric %arg0 : !spirv.ptr <f32 , CrossWorkgroup > to !spirv.ptr <f32 , Generic >
@@ -124,7 +129,7 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Kernel], []> {
124129
125130// -----
126131
127- spirv.module Physical64 OpenCL requires #spirv.vce <v1.0 , [Kernel , Addresses ], []> {
132+ spirv.module Physical64 OpenCL requires #spirv.vce <v1.0 , [Kernel , Addresses , Linkage , GenericPointer , Int64 ], []> {
128133 spirv.func @covert_ptr_to_u (%arg0 : !spirv.ptr <i32 , Generic >) " None" {
129134 // CHECK: {{%.*}} = spirv.ConvertPtrToU {{%.*}} : !spirv.ptr<i32, Generic> to i32
130135 %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr <i32 , Generic > to i32
@@ -144,7 +149,7 @@ spirv.module Physical64 OpenCL requires #spirv.vce<v1.0, [Kernel, Addresses], []
144149
145150// -----
146151
147- spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce <v1.0 , [Kernel , Addresses , PhysicalStorageBufferAddresses ], []> {
152+ spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce <v1.0 , [Kernel , Addresses , PhysicalStorageBufferAddresses , Linkage ], [SPV_EXT_physical_storage_buffer ]> {
148153 spirv.func @covert_ptr_to_u_PhysicalStorageBuffer (%arg0 : !spirv.ptr <i32 , PhysicalStorageBuffer > { spirv.decoration = #spirv.decoration <Aliased >} ) " None" {
149154 // CHECK: {{%.*}} = spirv.ConvertPtrToU {{%.*}} : !spirv.ptr<i32, PhysicalStorageBuffer> to i32
150155 %0 = spirv.ConvertPtrToU %arg0 : !spirv.ptr <i32 , PhysicalStorageBuffer > to i32
@@ -154,7 +159,7 @@ spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce<v1.0, [Kernel, A
154159
155160// -----
156161
157- spirv.module Physical64 OpenCL requires #spirv.vce <v1.0 , [Kernel , Addresses ], []> {
162+ spirv.module Physical64 OpenCL requires #spirv.vce <v1.0 , [Kernel , Addresses , Linkage , GenericPointer , Int64 ], []> {
158163 spirv.func @covert_u_to_ptr (%arg0 : i32 ) " None" {
159164 // CHECK: {{%.*}} = spirv.ConvertUToPtr {{%.*}} : i32 to !spirv.ptr<i32, Generic>
160165 %0 = spirv.ConvertUToPtr %arg0 : i32 to !spirv.ptr <i32 , Generic >
@@ -174,7 +179,7 @@ spirv.module Physical64 OpenCL requires #spirv.vce<v1.0, [Kernel, Addresses], []
174179
175180// -----
176181
177- spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce <v1.0 , [Kernel , Addresses , PhysicalStorageBufferAddresses ], []> {
182+ spirv.module PhysicalStorageBuffer64 OpenCL requires #spirv.vce <v1.0 , [Kernel , Addresses , PhysicalStorageBufferAddresses , Linkage ], [SPV_EXT_physical_storage_buffer ]> {
178183 spirv.func @covert_u_to_ptr_PhysicalStorageBuffer (%arg0 : i32 ) " None" {
179184 // CHECK: {{%.*}} = spirv.ConvertUToPtr {{%.*}} : i32 to !spirv.ptr<i32, PhysicalStorageBuffer>
180185 %0 = spirv.ConvertUToPtr %arg0 : i32 to !spirv.ptr <i32 , PhysicalStorageBuffer >
0 commit comments