mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Added cl_khr_fp16 extension support for test vector_times_scalar from spirv_new (#1757)
* Added cl_khr_fp16 support for vector_times_scalar from spirv_new (issue #142, spirv_new) * Logging correction
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos SPIR-V Tools Assembler; 0
|
||||
; Bound: 25
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpCapability Float16
|
||||
OpMemoryModel Physical32 OpenCL
|
||||
OpEntryPoint Kernel %1 "vector_times_scalar" %gl_GlobalInvocationID
|
||||
OpName %res "res"
|
||||
OpName %lhs "lhs"
|
||||
OpName %rhs "rhs"
|
||||
OpDecorate %5 FuncParamAttr NoCapture
|
||||
%5 = OpDecorationGroup
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %gl_GlobalInvocationID Constant
|
||||
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
|
||||
OpGroupDecorate %5 %res %lhs %rhs
|
||||
%uint = OpTypeInt 32 0
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
|
||||
%void = OpTypeVoid
|
||||
%half = OpTypeFloat 16
|
||||
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
|
||||
%v4half = OpTypeVector %half 4
|
||||
%_ptr_CrossWorkgroup_v4half = OpTypePointer CrossWorkgroup %v4half
|
||||
%15 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4half %_ptr_CrossWorkgroup_v4half %_ptr_CrossWorkgroup_half
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
|
||||
%1 = OpFunction %void None %15
|
||||
%res = OpFunctionParameter %_ptr_CrossWorkgroup_v4half
|
||||
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_v4half
|
||||
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_half
|
||||
%16 = OpLabel
|
||||
%17 = OpLoad %v3uint %gl_GlobalInvocationID Aligned 0
|
||||
%18 = OpCompositeExtract %uint %17 0
|
||||
%19 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4half %lhs %18
|
||||
%20 = OpLoad %v4half %19 Aligned 8
|
||||
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %rhs %18
|
||||
%22 = OpLoad %half %21 Aligned 2
|
||||
%23 = OpVectorTimesScalar %v4half %20 %22
|
||||
%24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4half %res %18
|
||||
OpStore %24 %23 Aligned 8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,50 @@
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos SPIR-V Tools Assembler; 0
|
||||
; Bound: 28
|
||||
; Schema: 0
|
||||
OpCapability Addresses
|
||||
OpCapability Linkage
|
||||
OpCapability Kernel
|
||||
OpCapability Int64
|
||||
OpCapability Float16
|
||||
OpMemoryModel Physical64 OpenCL
|
||||
OpEntryPoint Kernel %1 "vector_times_scalar" %gl_GlobalInvocationID
|
||||
OpName %res "res"
|
||||
OpName %lhs "lhs"
|
||||
OpName %rhs "rhs"
|
||||
OpDecorate %5 FuncParamAttr NoCapture
|
||||
%5 = OpDecorationGroup
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %gl_GlobalInvocationID Constant
|
||||
OpDecorate %gl_GlobalInvocationID LinkageAttributes "__spirv_GlobalInvocationId" Import
|
||||
OpGroupDecorate %5 %res %lhs %rhs
|
||||
%ulong = OpTypeInt 64 0
|
||||
%v3ulong = OpTypeVector %ulong 3
|
||||
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
|
||||
%ulong_32 = OpConstant %ulong 32
|
||||
%void = OpTypeVoid
|
||||
%half = OpTypeFloat 16
|
||||
%_ptr_CrossWorkgroup_half = OpTypePointer CrossWorkgroup %half
|
||||
%v4half = OpTypeVector %half 4
|
||||
%_ptr_CrossWorkgroup_v4half = OpTypePointer CrossWorkgroup %v4half
|
||||
%16 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4half %_ptr_CrossWorkgroup_v4half %_ptr_CrossWorkgroup_half
|
||||
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3ulong Input
|
||||
%1 = OpFunction %void None %16
|
||||
%res = OpFunctionParameter %_ptr_CrossWorkgroup_v4half
|
||||
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_v4half
|
||||
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_half
|
||||
%17 = OpLabel
|
||||
%18 = OpLoad %v3ulong %gl_GlobalInvocationID Aligned 0
|
||||
%19 = OpCompositeExtract %ulong %18 0
|
||||
%20 = OpShiftLeftLogical %ulong %19 %ulong_32
|
||||
%21 = OpShiftRightArithmetic %ulong %20 %ulong_32
|
||||
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4half %lhs %21
|
||||
%23 = OpLoad %v4half %22 Aligned 8
|
||||
%24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_half %rhs %21
|
||||
%25 = OpLoad %half %24 Aligned 2
|
||||
%26 = OpVectorTimesScalar %v4half %23 %25
|
||||
%27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4half %res %21
|
||||
OpStore %27 %26 Aligned 8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -17,6 +17,8 @@ or Khronos Conformance Test Source License Agreement as executed between Khronos
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
using half = cl_half;
|
||||
|
||||
template<typename Tv, typename Ts>
|
||||
int test_vector_times_scalar(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
@@ -32,6 +34,16 @@ int test_vector_times_scalar(cl_device_id deviceID,
|
||||
}
|
||||
}
|
||||
|
||||
if (std::string(Tname).find("half") != std::string::npos)
|
||||
{
|
||||
if (!is_extension_available(deviceID, "cl_khr_fp16"))
|
||||
{
|
||||
log_info("Extension cl_khr_fp16 not supported; skipping half "
|
||||
"tests.\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
cl_int err = CL_SUCCESS;
|
||||
int num = (int)h_lhs.size();
|
||||
size_t lhs_bytes = num * sizeof(Tv);
|
||||
@@ -171,5 +183,7 @@ int test_vector_times_scalar(cl_device_id deviceID,
|
||||
lhs, rhs); \
|
||||
}
|
||||
|
||||
|
||||
TEST_VECTOR_TIMES_SCALAR(float, 4)
|
||||
TEST_VECTOR_TIMES_SCALAR(double, 4)
|
||||
TEST_VECTOR_TIMES_SCALAR(half, 4)
|
||||
|
||||
@@ -43,6 +43,8 @@ VEC_NOT_EQ_FUNC(cl_float, 2)
|
||||
VEC_NOT_EQ_FUNC(cl_float, 4)
|
||||
VEC_NOT_EQ_FUNC(cl_double, 2)
|
||||
VEC_NOT_EQ_FUNC(cl_double, 4)
|
||||
VEC_NOT_EQ_FUNC(cl_half, 2)
|
||||
VEC_NOT_EQ_FUNC(cl_half, 4)
|
||||
|
||||
template<typename T>
|
||||
bool isNotEqual(const T &lhs, const T &rhs)
|
||||
@@ -109,6 +111,8 @@ GENRAND_REAL_FUNC(cl_float, 2)
|
||||
GENRAND_REAL_FUNC(cl_float, 4)
|
||||
GENRAND_REAL_FUNC(cl_double, 2)
|
||||
GENRAND_REAL_FUNC(cl_double, 4)
|
||||
GENRAND_REAL_FUNC(cl_half, 2)
|
||||
GENRAND_REAL_FUNC(cl_half, 4)
|
||||
|
||||
template<> inline cl_half genrandReal<cl_half>(RandomSeed &seed)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user