-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for cl_khr_expect_assume (#1888)
* initial support for cl_khr_expect_assume Tests expect with 64-bit SPIR-V binaries. * add support for assume testing with 64-bit binaries * add 32-bit SPIR-V files * fix formatting * address review comments
- Loading branch information
Showing
11 changed files
with
931 additions
and
0 deletions.
There are no files selected for viewing
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,37 @@ | ||
; SPIR-V | ||
; Version: 1.0 | ||
; Generator: Khronos LLVM/SPIR-V Translator; 14 | ||
; Bound: 22 | ||
; Schema: 0 | ||
OpCapability Addresses | ||
OpCapability Linkage | ||
OpCapability Kernel | ||
OpCapability ExpectAssumeKHR | ||
OpExtension "SPV_KHR_expect_assume" | ||
%1 = OpExtInstImport "OpenCL.std" | ||
OpMemoryModel Physical32 OpenCL | ||
OpEntryPoint Kernel %test_assume "test_assume" %gl_GlobalInvocationID | ||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId | ||
OpDecorate %gl_GlobalInvocationID Constant | ||
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import | ||
%void = OpTypeVoid | ||
%bool = OpTypeBool | ||
%uint = OpTypeInt 32 0 | ||
%v3uint = OpTypeVector %uint 3 | ||
%uint_0 = OpConstantNull %uint | ||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint | ||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint | ||
%functype = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint | ||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input | ||
%test_assume = OpFunction %void None %functype | ||
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint | ||
%value = OpFunctionParameter %uint | ||
%13 = OpLabel | ||
%test = OpSGreaterThan %bool %value %uint_0 | ||
OpAssumeTrueKHR %test | ||
%global_id = OpLoad %v3uint %gl_GlobalInvocationID Aligned 32 | ||
%gid_0 = OpCompositeExtract %uint %global_id 0 | ||
%dst_gid_0 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %gid_0 | ||
OpStore %dst_gid_0 %value 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
; SPIR-V | ||
; Version: 1.0 | ||
; Generator: Khronos LLVM/SPIR-V Translator; 14 | ||
; Bound: 22 | ||
; Schema: 0 | ||
OpCapability Addresses | ||
OpCapability Linkage | ||
OpCapability Kernel | ||
OpCapability Int64 | ||
OpCapability ExpectAssumeKHR | ||
OpExtension "SPV_KHR_expect_assume" | ||
%1 = OpExtInstImport "OpenCL.std" | ||
OpMemoryModel Physical64 OpenCL | ||
OpEntryPoint Kernel %test_assume "test_assume" %gl_GlobalInvocationID | ||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId | ||
OpDecorate %gl_GlobalInvocationID Constant | ||
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import | ||
%void = OpTypeVoid | ||
%bool = OpTypeBool | ||
%uint = OpTypeInt 32 0 | ||
%ulong = OpTypeInt 64 0 | ||
%v3ulong = OpTypeVector %ulong 3 | ||
%uint_0 = OpConstantNull %uint | ||
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong | ||
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint | ||
%functype = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint | ||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input | ||
%test_assume = OpFunction %void None %functype | ||
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint | ||
%value = OpFunctionParameter %uint | ||
%13 = OpLabel | ||
%test = OpSGreaterThan %bool %value %uint_0 | ||
OpAssumeTrueKHR %test | ||
%global_id = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 32 | ||
%gid_0 = OpCompositeExtract %ulong %global_id 0 | ||
%dst_gid_0 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %gid_0 | ||
OpStore %dst_gid_0 %value 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
; SPIR-V | ||
; Version: 1.0 | ||
; Generator: Khronos LLVM/SPIR-V Translator; 14 | ||
; Bound: 58 | ||
; Schema: 0 | ||
OpCapability Addresses | ||
OpCapability Linkage | ||
OpCapability Kernel | ||
OpCapability Vector16 | ||
OpCapability Int8 | ||
OpCapability ExpectAssumeKHR | ||
OpExtension "SPV_KHR_expect_assume" | ||
%1 = OpExtInstImport "OpenCL.std" | ||
OpMemoryModel Physical32 OpenCL | ||
OpEntryPoint Kernel %expect_char "expect_char" | ||
OpSource OpenCL_C 102000 | ||
OpDecorate %dst FuncParamAttr NoCapture | ||
OpDecorate %dst Alignment 64 | ||
%void = OpTypeVoid | ||
%uchar = OpTypeInt 8 0 | ||
%uchar2 = OpTypeVector %uchar 2 | ||
%uchar3 = OpTypeVector %uchar 3 | ||
%uchar4 = OpTypeVector %uchar 4 | ||
%uchar8 = OpTypeVector %uchar 8 | ||
%uchar16 = OpTypeVector %uchar 16 | ||
%uint = OpTypeInt 32 0 | ||
%uchar_0 = OpConstantNull %uchar | ||
%uchar2_0 = OpConstantNull %uchar2 | ||
%uchar3_0 = OpConstantNull %uchar3 | ||
%uchar4_0 = OpConstantNull %uchar4 | ||
%uchar8_0 = OpConstantNull %uchar8 | ||
%uchar16_0 = OpConstantNull %uchar16 | ||
%index_1 = OpConstant %uint 1 | ||
%index_2 = OpConstant %uint 2 | ||
%index_3 = OpConstant %uint 3 | ||
%index_4 = OpConstant %uint 4 | ||
%index_5 = OpConstant %uint 5 | ||
%_ptr_CrossWorkgroup_uchar16 = OpTypePointer CrossWorkgroup %uchar16 | ||
%6 = OpTypeFunction %void %_ptr_CrossWorkgroup_uchar16 %uchar | ||
%expect_char = OpFunction %void None %6 | ||
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uchar16 | ||
%value = OpFunctionParameter %uchar | ||
%10 = OpLabel | ||
; setup | ||
%value_vec = OpCompositeInsert %uchar2 %value %uchar2_0 0 | ||
; scalar expect: | ||
; char v1e = __builtin_expect(value, 0); | ||
; dst[0] = (char16)(v1e, 0, ...); | ||
%v1e = OpExpectKHR %uchar %value %uchar_0 | ||
%v1v16 = OpCompositeInsert %uchar16 %v1e %uchar16_0 0 | ||
OpStore %dst %v1v16 Aligned 64 | ||
; vec2 expect: | ||
; char2 v2 = (char2)(value); | ||
; char2 v2e = __builtin_expect(v2, 0); | ||
; dst[1] = (char16)(v2e, 0, ...); | ||
%v2 = OpVectorShuffle %uchar2 %value_vec %value_vec 0 0 | ||
%v2e = OpExpectKHR %uchar2 %v2 %uchar2_0 | ||
%v2v16 = OpVectorShuffle %uchar16 %v2e %uchar2_0 0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 | ||
%dst_1 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar16 %dst %index_1 | ||
OpStore %dst_1 %v2v16 Aligned 64 | ||
; vec3 expect | ||
%v3 = OpVectorShuffle %uchar3 %value_vec %value_vec 0 0 0 | ||
%v3e = OpExpectKHR %uchar3 %v3 %uchar3_0 | ||
%v3v16 = OpVectorShuffle %uchar16 %v3e %uchar2_0 0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 | ||
%dst_2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar16 %dst %index_2 | ||
OpStore %dst_2 %v3v16 Aligned 64 | ||
; vec4 expect | ||
%v4 = OpVectorShuffle %uchar4 %value_vec %value_vec 0 0 0 0 | ||
%v4e = OpExpectKHR %uchar4 %v4 %uchar4_0 | ||
%v4v16 = OpVectorShuffle %uchar16 %v4e %uchar2_0 0 1 2 3 4 4 4 4 4 4 4 4 4 4 4 4 | ||
%dst_3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar16 %dst %index_3 | ||
OpStore %dst_3 %v4v16 Aligned 64 | ||
; vec8 expect | ||
%v8 = OpVectorShuffle %uchar8 %value_vec %value_vec 0 0 0 0 0 0 0 0 | ||
%v8e = OpExpectKHR %uchar8 %v8 %uchar8_0 | ||
%v8v16 = OpVectorShuffle %uchar16 %v8e %uchar2_0 0 1 2 3 4 5 6 7 8 8 8 8 8 8 8 8 | ||
%dst_4 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar16 %dst %index_4 | ||
OpStore %dst_4 %v8v16 Aligned 64 | ||
; vec16 expect | ||
%v16 = OpVectorShuffle %uchar16 %value_vec %value_vec 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
%v16e = OpExpectKHR %uchar16 %v16 %uchar16_0 | ||
%dst_5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar16 %dst %index_5 | ||
OpStore %dst_5 %v16e Aligned 64 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
; SPIR-V | ||
; Version: 1.0 | ||
; Generator: Khronos LLVM/SPIR-V Translator; 14 | ||
; Bound: 58 | ||
; Schema: 0 | ||
OpCapability Addresses | ||
OpCapability Linkage | ||
OpCapability Kernel | ||
OpCapability Vector16 | ||
OpCapability Int8 | ||
OpCapability Int64 | ||
OpCapability ExpectAssumeKHR | ||
OpExtension "SPV_KHR_expect_assume" | ||
%1 = OpExtInstImport "OpenCL.std" | ||
OpMemoryModel Physical64 OpenCL | ||
OpEntryPoint Kernel %expect_char "expect_char" | ||
OpSource OpenCL_C 102000 | ||
OpDecorate %dst FuncParamAttr NoCapture | ||
OpDecorate %dst Alignment 64 | ||
%void = OpTypeVoid | ||
%uchar = OpTypeInt 8 0 | ||
%uchar2 = OpTypeVector %uchar 2 | ||
%uchar3 = OpTypeVector %uchar 3 | ||
%uchar4 = OpTypeVector %uchar 4 | ||
%uchar8 = OpTypeVector %uchar 8 | ||
%uchar16 = OpTypeVector %uchar 16 | ||
%ulong = OpTypeInt 64 0 | ||
%uchar_0 = OpConstantNull %uchar | ||
%uchar2_0 = OpConstantNull %uchar2 | ||
%uchar3_0 = OpConstantNull %uchar3 | ||
%uchar4_0 = OpConstantNull %uchar4 | ||
%uchar8_0 = OpConstantNull %uchar8 | ||
%uchar16_0 = OpConstantNull %uchar16 | ||
%index_1 = OpConstant %ulong 1 | ||
%index_2 = OpConstant %ulong 2 | ||
%index_3 = OpConstant %ulong 3 | ||
%index_4 = OpConstant %ulong 4 | ||
%index_5 = OpConstant %ulong 5 | ||
%_ptr_CrossWorkgroup_uchar16 = OpTypePointer CrossWorkgroup %uchar16 | ||
%6 = OpTypeFunction %void %_ptr_CrossWorkgroup_uchar16 %uchar | ||
%expect_char = OpFunction %void None %6 | ||
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uchar16 | ||
%value = OpFunctionParameter %uchar | ||
%10 = OpLabel | ||
; setup | ||
%value_vec = OpCompositeInsert %uchar2 %value %uchar2_0 0 | ||
; scalar expect: | ||
; char v1e = __builtin_expect(value, 0); | ||
; dst[0] = (char16)(v1e, 0, ...); | ||
%v1e = OpExpectKHR %uchar %value %uchar_0 | ||
%v1v16 = OpCompositeInsert %uchar16 %v1e %uchar16_0 0 | ||
OpStore %dst %v1v16 Aligned 64 | ||
; vec2 expect: | ||
; char2 v2 = (char2)(value); | ||
; char2 v2e = __builtin_expect(v2, 0); | ||
; dst[1] = (char16)(v2e, 0, ...); | ||
%v2 = OpVectorShuffle %uchar2 %value_vec %value_vec 0 0 | ||
%v2e = OpExpectKHR %uchar2 %v2 %uchar2_0 | ||
%v2v16 = OpVectorShuffle %uchar16 %v2e %uchar2_0 0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 | ||
%dst_1 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar16 %dst %index_1 | ||
OpStore %dst_1 %v2v16 Aligned 64 | ||
; vec3 expect | ||
%v3 = OpVectorShuffle %uchar3 %value_vec %value_vec 0 0 0 | ||
%v3e = OpExpectKHR %uchar3 %v3 %uchar3_0 | ||
%v3v16 = OpVectorShuffle %uchar16 %v3e %uchar2_0 0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 | ||
%dst_2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar16 %dst %index_2 | ||
OpStore %dst_2 %v3v16 Aligned 64 | ||
; vec4 expect | ||
%v4 = OpVectorShuffle %uchar4 %value_vec %value_vec 0 0 0 0 | ||
%v4e = OpExpectKHR %uchar4 %v4 %uchar4_0 | ||
%v4v16 = OpVectorShuffle %uchar16 %v4e %uchar2_0 0 1 2 3 4 4 4 4 4 4 4 4 4 4 4 4 | ||
%dst_3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar16 %dst %index_3 | ||
OpStore %dst_3 %v4v16 Aligned 64 | ||
; vec8 expect | ||
%v8 = OpVectorShuffle %uchar8 %value_vec %value_vec 0 0 0 0 0 0 0 0 | ||
%v8e = OpExpectKHR %uchar8 %v8 %uchar8_0 | ||
%v8v16 = OpVectorShuffle %uchar16 %v8e %uchar2_0 0 1 2 3 4 5 6 7 8 8 8 8 8 8 8 8 | ||
%dst_4 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar16 %dst %index_4 | ||
OpStore %dst_4 %v8v16 Aligned 64 | ||
; vec16 expect | ||
%v16 = OpVectorShuffle %uchar16 %value_vec %value_vec 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
%v16e = OpExpectKHR %uchar16 %v16 %uchar16_0 | ||
%dst_5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uchar16 %dst %index_5 | ||
OpStore %dst_5 %v16e Aligned 64 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
; SPIR-V | ||
; Version: 1.0 | ||
; Generator: Khronos LLVM/SPIR-V Translator; 14 | ||
; Bound: 58 | ||
; Schema: 0 | ||
OpCapability Addresses | ||
OpCapability Linkage | ||
OpCapability Kernel | ||
OpCapability Vector16 | ||
OpCapability ExpectAssumeKHR | ||
OpExtension "SPV_KHR_expect_assume" | ||
%1 = OpExtInstImport "OpenCL.std" | ||
OpMemoryModel Physical32 OpenCL | ||
OpEntryPoint Kernel %expect_int "expect_int" | ||
OpSource OpenCL_C 102000 | ||
OpDecorate %dst FuncParamAttr NoCapture | ||
OpDecorate %dst Alignment 64 | ||
%void = OpTypeVoid | ||
%uint = OpTypeInt 32 0 | ||
%uint2 = OpTypeVector %uint 2 | ||
%uint3 = OpTypeVector %uint 3 | ||
%uint4 = OpTypeVector %uint 4 | ||
%uint8 = OpTypeVector %uint 8 | ||
%uint16 = OpTypeVector %uint 16 | ||
%uint_0 = OpConstantNull %uint | ||
%uint2_0 = OpConstantNull %uint2 | ||
%uint3_0 = OpConstantNull %uint3 | ||
%uint4_0 = OpConstantNull %uint4 | ||
%uint8_0 = OpConstantNull %uint8 | ||
%uint16_0 = OpConstantNull %uint16 | ||
%index_1 = OpConstant %uint 1 | ||
%index_2 = OpConstant %uint 2 | ||
%index_3 = OpConstant %uint 3 | ||
%index_4 = OpConstant %uint 4 | ||
%index_5 = OpConstant %uint 5 | ||
%_ptr_CrossWorkgroup_uint16 = OpTypePointer CrossWorkgroup %uint16 | ||
%6 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint16 %uint | ||
%expect_int = OpFunction %void None %6 | ||
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint16 | ||
%value = OpFunctionParameter %uint | ||
%10 = OpLabel | ||
; setup | ||
%value_vec = OpCompositeInsert %uint2 %value %uint2_0 0 | ||
; scalar expect: | ||
; int v1e = __builtin_expect(value, 0); | ||
; dst[0] = (int16)(v1e, 0, ...); | ||
%v1e = OpExpectKHR %uint %value %uint_0 | ||
%v1v16 = OpCompositeInsert %uint16 %v1e %uint16_0 0 | ||
OpStore %dst %v1v16 Aligned 64 | ||
; vec2 expect: | ||
; int2 v2 = (int2)(value); | ||
; int2 v2e = __builtin_expect(v2, 0); | ||
; dst[1] = (int16)(v2e, 0, ...); | ||
%v2 = OpVectorShuffle %uint2 %value_vec %value_vec 0 0 | ||
%v2e = OpExpectKHR %uint2 %v2 %uint2_0 | ||
%v2v16 = OpVectorShuffle %uint16 %v2e %uint2_0 0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 | ||
%dst_1 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint16 %dst %index_1 | ||
OpStore %dst_1 %v2v16 Aligned 64 | ||
; vec3 expect | ||
%v3 = OpVectorShuffle %uint3 %value_vec %value_vec 0 0 0 | ||
%v3e = OpExpectKHR %uint3 %v3 %uint3_0 | ||
%v3v16 = OpVectorShuffle %uint16 %v3e %uint2_0 0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 | ||
%dst_2 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint16 %dst %index_2 | ||
OpStore %dst_2 %v3v16 Aligned 64 | ||
; vec4 expect | ||
%v4 = OpVectorShuffle %uint4 %value_vec %value_vec 0 0 0 0 | ||
%v4e = OpExpectKHR %uint4 %v4 %uint4_0 | ||
%v4v16 = OpVectorShuffle %uint16 %v4e %uint2_0 0 1 2 3 4 4 4 4 4 4 4 4 4 4 4 4 | ||
%dst_3 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint16 %dst %index_3 | ||
OpStore %dst_3 %v4v16 Aligned 64 | ||
; vec8 expect | ||
%v8 = OpVectorShuffle %uint8 %value_vec %value_vec 0 0 0 0 0 0 0 0 | ||
%v8e = OpExpectKHR %uint8 %v8 %uint8_0 | ||
%v8v16 = OpVectorShuffle %uint16 %v8e %uint2_0 0 1 2 3 4 5 6 7 8 8 8 8 8 8 8 8 | ||
%dst_4 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint16 %dst %index_4 | ||
OpStore %dst_4 %v8v16 Aligned 64 | ||
; vec16 expect | ||
%v16 = OpVectorShuffle %uint16 %value_vec %value_vec 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
%v16e = OpExpectKHR %uint16 %v16 %uint16_0 | ||
%dst_5 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint16 %dst %index_5 | ||
OpStore %dst_5 %v16e Aligned 64 | ||
OpReturn | ||
OpFunctionEnd |
Oops, something went wrong.