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 ], []> {
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 ], []> {
9+ // CHECK: spirv.func @outside.func.with.linkage(i8) "Pure" attributes
10+ // CHECK: linkage_attributes = #spirv.linkage_attributes<linkage_name = "outside.func", linkage_type = <Import>>
11+ // CHECK: spirv.func @linkage_attr_test_kernel() "DontInline" {
12+ // CHECK: spirv.func @inside.func() "Pure" {
413 spirv.func @linkage_attr_test_kernel () " DontInline" attributes {} {
514 %uchar_0 = spirv.Constant 0 : i8
615 %ushort_1 = spirv.Constant 1 : i16
716 %uint_0 = spirv.Constant 0 : i32
817 spirv.FunctionCall @outside.func.with.linkage (%uchar_0 ):(i8 ) -> ()
918 spirv.Return
1019 }
11- // CHECK: linkage_attributes = #spirv.linkage_attributes<linkage_name = "outside.func", linkage_type = <Import>>
1220 spirv.func @outside.func.with.linkage (%arg0 : i8 ) -> () " Pure" attributes {
1321 linkage_attributes =#spirv.linkage_attributes <
1422 linkage_name =" outside.func" ,
@@ -21,7 +29,7 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Linkage], []> {
2129// -----
2230
2331spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce <v1.0 ,
24- [Shader , PhysicalStorageBufferAddresses ], [SPV_KHR_physical_storage_buffer ]> {
32+ [Shader , PhysicalStorageBufferAddresses , Linkage ], [SPV_KHR_physical_storage_buffer ]> {
2533 // CHECK-LABEL: spirv.func @func_arg_decoration_aliased(%{{.*}}: !spirv.ptr<i32, PhysicalStorageBuffer> {spirv.decoration = #spirv.decoration<Aliased>})
2634 spirv.func @func_arg_decoration_aliased (
2735 %arg0 : !spirv.ptr <i32 , PhysicalStorageBuffer > { spirv.decoration = #spirv.decoration <Aliased > }
@@ -33,7 +41,7 @@ spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce<v1.0,
3341// -----
3442
3543spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce <v1.0 ,
36- [Shader , PhysicalStorageBufferAddresses ], [SPV_KHR_physical_storage_buffer ]> {
44+ [Shader , PhysicalStorageBufferAddresses , Linkage ], [SPV_KHR_physical_storage_buffer ]> {
3745 // CHECK-LABEL: spirv.func @func_arg_decoration_restrict(%{{.*}}: !spirv.ptr<i32, PhysicalStorageBuffer> {spirv.decoration = #spirv.decoration<Restrict>})
3846 spirv.func @func_arg_decoration_restrict (
3947 %arg0 : !spirv.ptr <i32 ,PhysicalStorageBuffer > { spirv.decoration = #spirv.decoration <Restrict > }
@@ -45,7 +53,7 @@ spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce<v1.0,
4553// -----
4654
4755spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce <v1.0 ,
48- [Shader , PhysicalStorageBufferAddresses ], [SPV_KHR_physical_storage_buffer ]> {
56+ [Shader , PhysicalStorageBufferAddresses , Linkage , GenericPointer ], [SPV_KHR_physical_storage_buffer ]> {
4957 // CHECK-LABEL: spirv.func @func_arg_decoration_aliased_pointer(%{{.*}}: !spirv.ptr<!spirv.ptr<i32, PhysicalStorageBuffer>, Generic> {spirv.decoration = #spirv.decoration<AliasedPointer>})
5058 spirv.func @func_arg_decoration_aliased_pointer (
5159 %arg0 : !spirv.ptr <!spirv.ptr <i32 ,PhysicalStorageBuffer >, Generic > { spirv.decoration = #spirv.decoration <AliasedPointer > }
@@ -57,7 +65,7 @@ spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce<v1.0,
5765// -----
5866
5967spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce <v1.0 ,
60- [Shader , PhysicalStorageBufferAddresses ], [SPV_KHR_physical_storage_buffer ]> {
68+ [Shader , PhysicalStorageBufferAddresses , Linkage , GenericPointer ], [SPV_KHR_physical_storage_buffer ]> {
6169 // CHECK-LABEL: spirv.func @func_arg_decoration_restrict_pointer(%{{.*}}: !spirv.ptr<!spirv.ptr<i32, PhysicalStorageBuffer>, Generic> {spirv.decoration = #spirv.decoration<RestrictPointer>})
6270 spirv.func @func_arg_decoration_restrict_pointer (
6371 %arg0 : !spirv.ptr <!spirv.ptr <i32 ,PhysicalStorageBuffer >, Generic > { spirv.decoration = #spirv.decoration <RestrictPointer > }
@@ -69,7 +77,7 @@ spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce<v1.0,
6977// -----
7078
7179spirv.module PhysicalStorageBuffer64 GLSL450 requires #spirv.vce <v1.0 ,
72- [Shader , PhysicalStorageBufferAddresses ], [SPV_KHR_physical_storage_buffer ]> {
80+ [Shader , PhysicalStorageBufferAddresses , Linkage ], [SPV_KHR_physical_storage_buffer ]> {
7381 // CHECK-LABEL: spirv.func @fn1(%{{.*}}: i32, %{{.*}}: !spirv.ptr<i32, PhysicalStorageBuffer> {spirv.decoration = #spirv.decoration<Aliased>})
7482 spirv.func @fn1 (
7583 %arg0: i32 ,
0 commit comments