mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 16:29:03 +00:00
add SPIR-V 1.4 testing for UserSemantic (#2053)
This PR adds targeted testing for more SPIR-V 1.4 features. Specifically, this PR adds testing for OpDecorateString, OpMemberDecorateString, and the UserSemantic decoration.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
; SPIR-V
|
||||
; Version: 1.4
|
||||
; Generator: Khronos LLVM/SPIR-V Translator; 14
|
||||
; Bound: 24
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpMemoryModel Physical32 OpenCL
|
||||
OpEntryPoint Kernel %usersemantic_test "usersemantic_test" %global_id
|
||||
OpDecorate %global_id LinkageAttributes "global_id" Import
|
||||
OpDecorate %global_id Constant
|
||||
OpDecorate %global_id BuiltIn GlobalInvocationId
|
||||
; Basic decoration:
|
||||
OpDecorateString %global_id UserSemantic "FOO"
|
||||
; Duplicate decorations are allowed as long as the string is different.
|
||||
OpDecorateString %global_id UserSemantic "BAR"
|
||||
; Try one more string with punctuation.
|
||||
OpDecorateString %global_id UserSemantic "FOO? BAR. BAZ!"
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%void = OpTypeVoid
|
||||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
|
||||
%global_id = OpVariable %_ptr_Input_v3uint Input
|
||||
%usersemantic_test = OpFunction %void None %9
|
||||
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
|
||||
%entry = OpLabel
|
||||
%index = OpLoad %v3uint %global_id Aligned 32
|
||||
%call = OpCompositeExtract %uint %index 0
|
||||
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %call
|
||||
OpStore %arrayidx %call Aligned 4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,39 @@
|
||||
; SPIR-V
|
||||
; Version: 1.4
|
||||
; Generator: Khronos LLVM/SPIR-V Translator; 14
|
||||
; Bound: 24
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpCapability Int64
|
||||
OpMemoryModel Physical64 OpenCL
|
||||
OpEntryPoint Kernel %usersemantic_test "usersemantic_test" %global_id
|
||||
OpDecorate %global_id LinkageAttributes "global_id" Import
|
||||
OpDecorate %global_id Constant
|
||||
OpDecorate %global_id BuiltIn GlobalInvocationId
|
||||
; Basic decoration:
|
||||
OpDecorateString %global_id UserSemantic "FOO"
|
||||
; Duplicate decorations are allowed as long as the string is different.
|
||||
OpDecorateString %global_id UserSemantic "BAR"
|
||||
; Try one more string with punctuation.
|
||||
OpDecorateString %global_id UserSemantic "FOO? BAR. BAZ!"
|
||||
%ulong = OpTypeInt 64 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3ulong = OpTypeVector %ulong 3
|
||||
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
|
||||
%void = OpTypeVoid
|
||||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%9 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
|
||||
%global_id = OpVariable %_ptr_Input_v3ulong Input
|
||||
%usersemantic_test = OpFunction %void None %9
|
||||
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
|
||||
%entry = OpLabel
|
||||
%index = OpLoad %v3ulong %global_id Aligned 32
|
||||
%call = OpCompositeExtract %ulong %index 0
|
||||
%conv = OpUConvert %uint %call
|
||||
%idxprom = OpSConvert %ulong %conv
|
||||
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %idxprom
|
||||
OpStore %arrayidx %conv Aligned 4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,39 @@
|
||||
; SPIR-V
|
||||
; Version: 1.4
|
||||
; Generator: Khronos LLVM/SPIR-V Translator; 14
|
||||
; Bound: 60
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpMemoryModel Physical32 OpenCL
|
||||
OpEntryPoint Kernel %kernel "usersemantic_test" %global_id
|
||||
OpDecorate %global_id LinkageAttributes "global_id" Import
|
||||
OpDecorate %global_id Constant
|
||||
OpDecorate %global_id BuiltIn GlobalInvocationId
|
||||
OpDecorate %s Alignment 4
|
||||
OpMemberDecorateString %struct 0 UserSemantic "foo"
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%void = OpTypeVoid
|
||||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%kernel_sig = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
|
||||
%struct = OpTypeStruct %uint
|
||||
%_ptr_Function_struct = OpTypePointer Function %struct
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%global_id = OpVariable %_ptr_Input_v3uint Input
|
||||
%kernel = OpFunction %void None %kernel_sig
|
||||
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
|
||||
%entry = OpLabel
|
||||
%s = OpVariable %_ptr_Function_struct Function
|
||||
%gid = OpLoad %v3uint %global_id Aligned 16
|
||||
%gid0 = OpCompositeExtract %uint %gid 0
|
||||
%x = OpInBoundsPtrAccessChain %_ptr_Function_uint %s %uint_0 %uint_0
|
||||
OpStore %x %gid0 Aligned 4
|
||||
%index = OpLoad %uint %x Aligned 4
|
||||
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %index
|
||||
OpStore %arrayidx %index Aligned 4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,43 @@
|
||||
; SPIR-V
|
||||
; Version: 1.4
|
||||
; Generator: Khronos LLVM/SPIR-V Translator; 14
|
||||
; Bound: 60
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpCapability Int64
|
||||
OpMemoryModel Physical64 OpenCL
|
||||
OpEntryPoint Kernel %kernel "usersemantic_test" %global_id
|
||||
OpDecorate %global_id LinkageAttributes "global_id" Import
|
||||
OpDecorate %global_id Constant
|
||||
OpDecorate %global_id BuiltIn GlobalInvocationId
|
||||
OpDecorate %s Alignment 4
|
||||
OpMemberDecorateString %struct 0 UserSemantic "foo"
|
||||
%ulong = OpTypeInt 64 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%v3ulong = OpTypeVector %ulong 3
|
||||
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
|
||||
%void = OpTypeVoid
|
||||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%kernel_sig = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
|
||||
%struct = OpTypeStruct %uint
|
||||
%_ptr_Function_struct = OpTypePointer Function %struct
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%global_id = OpVariable %_ptr_Input_v3ulong Input
|
||||
%kernel = OpFunction %void None %kernel_sig
|
||||
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
|
||||
%entry = OpLabel
|
||||
%s = OpVariable %_ptr_Function_struct Function
|
||||
%gid = OpLoad %v3ulong %global_id Aligned 32
|
||||
%gid0 = OpCompositeExtract %ulong %gid 0
|
||||
%conv = OpUConvert %uint %gid0
|
||||
%x = OpInBoundsPtrAccessChain %_ptr_Function_uint %s %uint_0 %uint_0
|
||||
OpStore %x %conv Aligned 4
|
||||
%index = OpLoad %uint %x Aligned 4
|
||||
%idxprom = OpSConvert %ulong %index
|
||||
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %idxprom
|
||||
OpStore %arrayidx %index Aligned 4
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
Reference in New Issue
Block a user