mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 00:09:02 +00:00
add test for cl_khr_spirv_linkonce_odr (#1226)
* initial version of the test with placeholders for linkonce_odr linkage * add OpExtension SPV_KHR_linkonce_odr extension * add check for extension * switch to actual LinkOnceODR linkage * fix formatting * add a test case to ensure a function with linkonce_odr is exported * add back the extension check * fix formatting * undo compiler optimization and actually add the call to function a
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos LLVM/SPIR-V Translator; 14
|
||||
; Bound: 27
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpExtension "SPV_KHR_linkonce_odr"
|
||||
OpMemoryModel Physical32 OpenCL
|
||||
OpEntryPoint Kernel %17 "test_linkonce_odr" %__spirv_BuiltInGlobalInvocationId
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
|
||||
OpDecorate %18 FuncParamAttr NoCapture
|
||||
OpDecorate %a LinkageAttributes "a" LinkOnceODR
|
||||
OpDecorate %b LinkageAttributes "b" Import
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%6 = OpTypeFunction %uint %uint
|
||||
%void = OpTypeVoid
|
||||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%16 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
|
||||
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input
|
||||
%b = OpFunction %uint None %6
|
||||
%8 = OpFunctionParameter %uint
|
||||
OpFunctionEnd
|
||||
%a = OpFunction %uint Pure %6
|
||||
%10 = OpFunctionParameter %uint
|
||||
%11 = OpLabel
|
||||
%13 = OpIAdd %uint %10 %uint_5
|
||||
OpReturnValue %13
|
||||
OpFunctionEnd
|
||||
%17 = OpFunction %void None %16
|
||||
%18 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
|
||||
%19 = OpLabel
|
||||
%20 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16
|
||||
%21 = OpCompositeExtract %uint %20 0
|
||||
%22 = OpFunctionCall %uint %a %21
|
||||
%23 = OpFunctionCall %uint %b %21
|
||||
%24 = OpIAdd %uint %22 %23
|
||||
%25 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %21
|
||||
OpStore %25 %24 Aligned 4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,51 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos LLVM/SPIR-V Translator; 14
|
||||
; Bound: 30
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpCapability Int64
|
||||
OpExtension "SPV_KHR_linkonce_odr"
|
||||
OpMemoryModel Physical64 OpenCL
|
||||
OpEntryPoint Kernel %18 "test_linkonce_odr" %__spirv_BuiltInGlobalInvocationId
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
|
||||
OpDecorate %19 FuncParamAttr NoCapture
|
||||
OpDecorate %a LinkageAttributes "a" LinkOnceODR
|
||||
OpDecorate %b LinkageAttributes "b" Import
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
|
||||
%ulong = OpTypeInt 64 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%v3ulong = OpTypeVector %ulong 3
|
||||
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
|
||||
%7 = OpTypeFunction %uint %uint
|
||||
%void = OpTypeVoid
|
||||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%17 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
|
||||
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input
|
||||
%b = OpFunction %uint None %7
|
||||
%9 = OpFunctionParameter %uint
|
||||
OpFunctionEnd
|
||||
%a = OpFunction %uint Pure %7
|
||||
%11 = OpFunctionParameter %uint
|
||||
%12 = OpLabel
|
||||
%14 = OpIAdd %uint %11 %uint_5
|
||||
OpReturnValue %14
|
||||
OpFunctionEnd
|
||||
%18 = OpFunction %void None %17
|
||||
%19 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
|
||||
%20 = OpLabel
|
||||
%21 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 32
|
||||
%22 = OpCompositeExtract %ulong %21 0
|
||||
%23 = OpUConvert %uint %22
|
||||
%24 = OpFunctionCall %uint %a %23
|
||||
%25 = OpFunctionCall %uint %b %23
|
||||
%26 = OpIAdd %uint %24 %25
|
||||
%27 = OpSConvert %ulong %23
|
||||
%28 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %27
|
||||
OpStore %28 %26 Aligned 4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,44 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos LLVM/SPIR-V Translator; 14
|
||||
; Bound: 27
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpExtension "SPV_KHR_linkonce_odr"
|
||||
OpMemoryModel Physical32 OpenCL
|
||||
OpEntryPoint Kernel %17 "test_linkonce_odr" %__spirv_BuiltInGlobalInvocationId
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
|
||||
OpDecorate %18 FuncParamAttr NoCapture
|
||||
OpDecorate %a LinkageAttributes "a" Import
|
||||
OpDecorate %b LinkageAttributes "b" Import
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%6 = OpTypeFunction %uint %uint
|
||||
%void = OpTypeVoid
|
||||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%16 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
|
||||
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input
|
||||
%b = OpFunction %uint None %6
|
||||
%8 = OpFunctionParameter %uint
|
||||
OpFunctionEnd
|
||||
%a = OpFunction %uint None %6
|
||||
%10 = OpFunctionParameter %uint
|
||||
OpFunctionEnd
|
||||
%17 = OpFunction %void None %16
|
||||
%18 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
|
||||
%19 = OpLabel
|
||||
%20 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 16
|
||||
%21 = OpCompositeExtract %uint %20 0
|
||||
%22 = OpFunctionCall %uint %a %21
|
||||
%23 = OpFunctionCall %uint %b %21
|
||||
%24 = OpIAdd %uint %22 %23
|
||||
%25 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %18 %21
|
||||
OpStore %25 %24 Aligned 4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,48 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos LLVM/SPIR-V Translator; 14
|
||||
; Bound: 30
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpCapability Int64
|
||||
OpExtension "SPV_KHR_linkonce_odr"
|
||||
OpMemoryModel Physical64 OpenCL
|
||||
OpEntryPoint Kernel %18 "test_linkonce_odr" %__spirv_BuiltInGlobalInvocationId
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
|
||||
OpDecorate %19 FuncParamAttr NoCapture
|
||||
OpDecorate %a LinkageAttributes "a" Import
|
||||
OpDecorate %b LinkageAttributes "b" Import
|
||||
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
|
||||
%ulong = OpTypeInt 64 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%v3ulong = OpTypeVector %ulong 3
|
||||
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
|
||||
%7 = OpTypeFunction %uint %uint
|
||||
%void = OpTypeVoid
|
||||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%17 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
|
||||
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input
|
||||
%b = OpFunction %uint None %7
|
||||
%9 = OpFunctionParameter %uint
|
||||
OpFunctionEnd
|
||||
%a = OpFunction %uint None %7
|
||||
%11 = OpFunctionParameter %uint
|
||||
OpFunctionEnd
|
||||
%18 = OpFunction %void None %17
|
||||
%19 = OpFunctionParameter %_ptr_CrossWorkgroup_uint
|
||||
%20 = OpLabel
|
||||
%21 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 32
|
||||
%22 = OpCompositeExtract %ulong %21 0
|
||||
%23 = OpUConvert %uint %22
|
||||
%24 = OpFunctionCall %uint %a %23
|
||||
%25 = OpFunctionCall %uint %b %23
|
||||
%26 = OpIAdd %uint %24 %25
|
||||
%27 = OpSConvert %ulong %23
|
||||
%28 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %19 %27
|
||||
OpStore %28 %26 Aligned 4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,28 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos LLVM/SPIR-V Translator; 14
|
||||
; Bound: 14
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpExtension "SPV_KHR_linkonce_odr"
|
||||
OpMemoryModel Physical32 OpenCL
|
||||
OpDecorate %a LinkageAttributes "a" LinkOnceODR
|
||||
OpDecorate %b LinkageAttributes "b" Export
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%3 = OpTypeFunction %uint %uint
|
||||
%a = OpFunction %uint Pure %3
|
||||
%5 = OpFunctionParameter %uint
|
||||
%6 = OpLabel
|
||||
%8 = OpIAdd %uint %5 %uint_5
|
||||
OpReturnValue %8
|
||||
OpFunctionEnd
|
||||
%b = OpFunction %uint Pure %3
|
||||
%10 = OpFunctionParameter %uint
|
||||
%11 = OpLabel
|
||||
%13 = OpISub %uint %uint_0 %10
|
||||
OpReturnValue %13
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,28 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos LLVM/SPIR-V Translator; 14
|
||||
; Bound: 14
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpExtension "SPV_KHR_linkonce_odr"
|
||||
OpMemoryModel Physical64 OpenCL
|
||||
OpDecorate %a LinkageAttributes "a" LinkOnceODR
|
||||
OpDecorate %b LinkageAttributes "b" Export
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%3 = OpTypeFunction %uint %uint
|
||||
%a = OpFunction %uint Pure %3
|
||||
%5 = OpFunctionParameter %uint
|
||||
%6 = OpLabel
|
||||
%8 = OpIAdd %uint %5 %uint_5
|
||||
OpReturnValue %8
|
||||
OpFunctionEnd
|
||||
%b = OpFunction %uint Pure %3
|
||||
%10 = OpFunctionParameter %uint
|
||||
%11 = OpLabel
|
||||
%13 = OpISub %uint %uint_0 %10
|
||||
OpReturnValue %13
|
||||
OpFunctionEnd
|
||||
Reference in New Issue
Block a user