mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-24 15:59:03 +00:00
add testing for SPIR-V 1.5 (#2208)
fixes #2140 Adds testing for SPIR-V 1.5 features: * Adds a test for bitcasts between pointers and vectors of integers. Note, SPIR-V 1.5 only supports bitcasts to vectors of two 32-bit integers. Therefore, the SPIR-V 1.5 behavior will only be exercised on devices with 64-bit pointers. The test will run on devices with 32-bit pointers, but will instead bitcast to scalars. * Adds a test for OpGroupNonUniformBroadcast with a dynamic index. Note, this is not an exhaustive test, and only unsigned integer types are tested, to avoid duplicating testing for cl_khr_subgroup_ballot.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
; SPIR-V
|
||||
; Version: 1.5
|
||||
; Reference:
|
||||
; kernel void non_uniform_broadcast_dynamic_index_test(global uint* dst_base) {
|
||||
; uint id = get_global_id(0);
|
||||
; uint index = get_group_id(0);
|
||||
; uint value = sub_group_non_uniform_broadcast(id, index);
|
||||
; dst_base[id] = value;
|
||||
; }
|
||||
OpCapability Addresses
|
||||
OpCapability Kernel
|
||||
OpCapability GroupNonUniformBallot
|
||||
OpMemoryModel Physical32 OpenCL
|
||||
OpEntryPoint Kernel %kernel "non_uniform_broadcast_dynamic_index_test" %pglobalid %pgroupid
|
||||
OpDecorate %pglobalid BuiltIn GlobalInvocationId
|
||||
OpDecorate %pgroupid BuiltIn WorkgroupId
|
||||
%uint = OpTypeInt 32 0
|
||||
%sg_scope = OpConstant %uint 3
|
||||
%uint3 = OpTypeVector %uint 3
|
||||
%void = OpTypeVoid
|
||||
%iptr_uint3 = OpTypePointer Input %uint3
|
||||
%gptr_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%kernel_sig = OpTypeFunction %void %gptr_uint
|
||||
%pglobalid = OpVariable %iptr_uint3 Input
|
||||
%pgroupid = OpVariable %iptr_uint3 Input
|
||||
%kernel = OpFunction %void None %kernel_sig
|
||||
%dst_base = OpFunctionParameter %gptr_uint
|
||||
%entry = OpLabel
|
||||
%globalid = OpLoad %uint3 %pglobalid Aligned 32
|
||||
%id = OpCompositeExtract %uint %globalid 0
|
||||
%groupid = OpLoad %uint3 %pgroupid Aligned 32
|
||||
%index = OpCompositeExtract %uint %groupid 0
|
||||
%value = OpGroupNonUniformBroadcast %uint %sg_scope %id %index
|
||||
%dst = OpInBoundsPtrAccessChain %gptr_uint %dst_base %id
|
||||
OpStore %dst %value
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,41 @@
|
||||
; SPIR-V
|
||||
; Version: 1.5
|
||||
; Reference:
|
||||
; kernel void non_uniform_broadcast_dynamic_index_test(global uint* dst_base) {
|
||||
; uint id = get_global_id(0);
|
||||
; uint index = get_group_id(0);
|
||||
; uint value = sub_group_non_uniform_broadcast(id, index);
|
||||
; dst_base[id] = value;
|
||||
; }
|
||||
OpCapability Addresses
|
||||
OpCapability Kernel
|
||||
OpCapability Int64
|
||||
OpCapability GroupNonUniformBallot
|
||||
OpMemoryModel Physical64 OpenCL
|
||||
OpEntryPoint Kernel %kernel "non_uniform_broadcast_dynamic_index_test" %pglobalid %pgroupid
|
||||
OpDecorate %pglobalid BuiltIn GlobalInvocationId
|
||||
OpDecorate %pgroupid BuiltIn WorkgroupId
|
||||
%uint = OpTypeInt 32 0
|
||||
%sg_scope = OpConstant %uint 3
|
||||
%ulong = OpTypeInt 64 0
|
||||
%ulong3 = OpTypeVector %ulong 3
|
||||
%void = OpTypeVoid
|
||||
%iptr_ulong3 = OpTypePointer Input %ulong3
|
||||
%gptr_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%kernel_sig = OpTypeFunction %void %gptr_uint
|
||||
%pglobalid = OpVariable %iptr_ulong3 Input
|
||||
%pgroupid = OpVariable %iptr_ulong3 Input
|
||||
%kernel = OpFunction %void None %kernel_sig
|
||||
%dst_base = OpFunctionParameter %gptr_uint
|
||||
%entry = OpLabel
|
||||
%globalid = OpLoad %ulong3 %pglobalid Aligned 32
|
||||
%globalid0 = OpCompositeExtract %ulong %globalid 0
|
||||
%id = OpUConvert %uint %globalid0
|
||||
%groupid = OpLoad %ulong3 %pgroupid Aligned 32
|
||||
%groupid0 = OpCompositeExtract %ulong %groupid 0
|
||||
%index = OpUConvert %uint %groupid0
|
||||
%value = OpGroupNonUniformBroadcast %uint %sg_scope %id %index
|
||||
%dst = OpInBoundsPtrAccessChain %gptr_uint %dst_base %globalid0
|
||||
OpStore %dst %value
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,22 @@
|
||||
; SPIR-V
|
||||
; Version: 1.5
|
||||
OpCapability Addresses
|
||||
OpCapability Kernel
|
||||
OpMemoryModel Physical32 OpenCL
|
||||
OpEntryPoint Kernel %kernel "ptr_bitcast_test"
|
||||
%uint = OpTypeInt 32 0
|
||||
%void = OpTypeVoid
|
||||
%pptr_int = OpTypePointer Function %uint
|
||||
%gptr_uint = OpTypePointer CrossWorkgroup %uint
|
||||
%kernel_sig = OpTypeFunction %void %gptr_uint %gptr_uint
|
||||
%uint_42 = OpConstant %uint 42
|
||||
%kernel = OpFunction %void None %kernel_sig
|
||||
%dst_uint0 = OpFunctionParameter %gptr_uint
|
||||
%dst_uint1 = OpFunctionParameter %gptr_uint
|
||||
%entry = OpLabel
|
||||
%pvalue = OpVariable %pptr_int Function %uint_42
|
||||
%uint_ptr = OpBitcast %uint %pvalue
|
||||
OpStore %dst_uint0 %uint_ptr
|
||||
OpStore %dst_uint1 %uint_ptr
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,27 @@
|
||||
; SPIR-V
|
||||
; Version: 1.5
|
||||
OpCapability Addresses
|
||||
OpCapability Kernel
|
||||
OpCapability Int64
|
||||
OpMemoryModel Physical64 OpenCL
|
||||
OpEntryPoint Kernel %kernel "ptr_bitcast_test"
|
||||
%uint = OpTypeInt 32 0
|
||||
%ulong = OpTypeInt 64 0
|
||||
%uint2 = OpTypeVector %uint 2
|
||||
%void = OpTypeVoid
|
||||
%pptr_int = OpTypePointer Function %uint
|
||||
%gptr_ulong = OpTypePointer CrossWorkgroup %ulong
|
||||
%gptr_uint2 = OpTypePointer CrossWorkgroup %uint2
|
||||
%kernel_sig = OpTypeFunction %void %gptr_ulong %gptr_uint2
|
||||
%uint_42 = OpConstant %uint 42
|
||||
%kernel = OpFunction %void None %kernel_sig
|
||||
%dst_ulong = OpFunctionParameter %gptr_ulong
|
||||
%dst_uint2 = OpFunctionParameter %gptr_uint2
|
||||
%entry = OpLabel
|
||||
%pvalue = OpVariable %pptr_int Function %uint_42
|
||||
%ulong_ptr = OpBitcast %ulong %pvalue
|
||||
OpStore %dst_ulong %ulong_ptr
|
||||
%uint2_ptr = OpBitcast %uint2 %pvalue
|
||||
OpStore %dst_uint2 %uint2_ptr
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
Reference in New Issue
Block a user