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 , Linkage ], []> {
4- spirv.func @linkage_attr_test_kernel () " DontInline" attributes {} {
5- %uchar_0 = spirv.Constant 0 : i8
6- %ushort_1 = spirv.Constant 1 : i16
7- %uint_0 = spirv.Constant 0 : i32
8- spirv.FunctionCall @outside.func.with.linkage (%uchar_0 ):(i8 ) -> ()
9- spirv.Return
10- }
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 , Int8 , Int16 ], []> {
119 // CHECK: linkage_attributes = #spirv.linkage_attributes<linkage_name = "outside.func", linkage_type = <Import>>
1210 spirv.func @outside.func.with.linkage (%arg0 : i8 ) -> () " Pure" attributes {
1311 linkage_attributes =#spirv.linkage_attributes <
1412 linkage_name =" outside.func" ,
1513 linkage_type =<Import >
1614 >
1715 }
16+ spirv.func @linkage_attr_test_kernel () " DontInline" attributes {} {
17+ %uchar_0 = spirv.Constant 0 : i8
18+ %ushort_1 = spirv.Constant 1 : i16
19+ %uint_0 = spirv.Constant 0 : i32
20+ spirv.FunctionCall @outside.func.with.linkage (%uchar_0 ):(i8 ) -> ()
21+ spirv.Return
22+ }
1823 spirv.func @inside.func () -> () " Pure" attributes {} {spirv.Return }
1924}
2025
2126// -----
2227
2328spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce <v1.0 ,
24- [Shader , PhysicalStorageBufferAddresses ], [SPV_KHR_physical_storage_buffer ]> {
29+ [Shader , PhysicalStorageBufferAddresses , Linkage ], [SPV_KHR_physical_storage_buffer ]> {
2530 // CHECK-LABEL: spirv.func @func_arg_decoration_aliased(%{{.*}}: !spirv.ptr<i32, PhysicalStorageBuffer> {spirv.decoration = #spirv.decoration<Aliased>})
2631 spirv.func @func_arg_decoration_aliased (
2732 %arg0 : !spirv.ptr <i32 , PhysicalStorageBuffer > { spirv.decoration = #spirv.decoration <Aliased > }
@@ -33,7 +38,7 @@ spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce<v1.0,
3338// -----
3439
3540spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce <v1.0 ,
36- [Shader , PhysicalStorageBufferAddresses ], [SPV_KHR_physical_storage_buffer ]> {
41+ [Shader , PhysicalStorageBufferAddresses , Linkage ], [SPV_KHR_physical_storage_buffer ]> {
3742 // CHECK-LABEL: spirv.func @func_arg_decoration_restrict(%{{.*}}: !spirv.ptr<i32, PhysicalStorageBuffer> {spirv.decoration = #spirv.decoration<Restrict>})
3843 spirv.func @func_arg_decoration_restrict (
3944 %arg0 : !spirv.ptr <i32 ,PhysicalStorageBuffer > { spirv.decoration = #spirv.decoration <Restrict > }
@@ -45,7 +50,7 @@ spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce<v1.0,
4550// -----
4651
4752spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce <v1.0 ,
48- [Shader , PhysicalStorageBufferAddresses ], [SPV_KHR_physical_storage_buffer ]> {
53+ [Shader , PhysicalStorageBufferAddresses , Linkage , GenericPointer ], [SPV_KHR_physical_storage_buffer ]> {
4954 // CHECK-LABEL: spirv.func @func_arg_decoration_aliased_pointer(%{{.*}}: !spirv.ptr<!spirv.ptr<i32, PhysicalStorageBuffer>, Generic> {spirv.decoration = #spirv.decoration<AliasedPointer>})
5055 spirv.func @func_arg_decoration_aliased_pointer (
5156 %arg0 : !spirv.ptr <!spirv.ptr <i32 ,PhysicalStorageBuffer >, Generic > { spirv.decoration = #spirv.decoration <AliasedPointer > }
@@ -57,7 +62,7 @@ spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce<v1.0,
5762// -----
5863
5964spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce <v1.0 ,
60- [Shader , PhysicalStorageBufferAddresses ], [SPV_KHR_physical_storage_buffer ]> {
65+ [Shader , PhysicalStorageBufferAddresses , Linkage , GenericPointer ], [SPV_KHR_physical_storage_buffer ]> {
6166 // CHECK-LABEL: spirv.func @func_arg_decoration_restrict_pointer(%{{.*}}: !spirv.ptr<!spirv.ptr<i32, PhysicalStorageBuffer>, Generic> {spirv.decoration = #spirv.decoration<RestrictPointer>})
6267 spirv.func @func_arg_decoration_restrict_pointer (
6368 %arg0 : !spirv.ptr <!spirv.ptr <i32 ,PhysicalStorageBuffer >, Generic > { spirv.decoration = #spirv.decoration <RestrictPointer > }
@@ -69,7 +74,7 @@ spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce<v1.0,
6974// -----
7075
7176spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce <v1.0 ,
72- [Shader , PhysicalStorageBufferAddresses ], [SPV_KHR_physical_storage_buffer ]> {
77+ [Shader , PhysicalStorageBufferAddresses , Linkage ], [SPV_KHR_physical_storage_buffer ]> {
7378 // CHECK-LABEL: spirv.func @fn1(%{{.*}}: i32, %{{.*}}: !spirv.ptr<i32, PhysicalStorageBuffer> {spirv.decoration = #spirv.decoration<Aliased>})
7479 spirv.func @fn1 (
7580 %arg0: i32 ,
0 commit comments