-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
5 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
test_conformance/spirv_new/spirv_asm/spv1.4/usersemantic_decoratestring.spvasm32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
39 changes: 39 additions & 0 deletions
39
test_conformance/spirv_new/spirv_asm/spv1.4/usersemantic_decoratestring.spvasm64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
39 changes: 39 additions & 0 deletions
39
test_conformance/spirv_new/spirv_asm/spv1.4/usersemantic_memberdecoratestring.spvasm32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
43 changes: 43 additions & 0 deletions
43
test_conformance/spirv_new/spirv_asm/spv1.4/usersemantic_memberdecoratestring.spvasm64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters