Skip to content

Commit 538ff68

Browse files
committed
Error for kernels using images with unsupported channel types
1 parent 13e0d80 commit 538ff68

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,6 +2218,17 @@ pi_result cuda_piextKernelSetArgMemObj(pi_kernel kernel, pi_uint32 arg_index,
22182218
try {
22192219
pi_mem arg_mem = *arg_value;
22202220
if (arg_mem->mem_type_ == _pi_mem::mem_type::surface) {
2221+
CUDA_ARRAY3D_DESCRIPTOR arrayDesc;
2222+
PI_CHECK_ERROR(cuArray3DGetDescriptor(
2223+
&arrayDesc, arg_mem->mem_.surface_mem_.get_array()));
2224+
if (arrayDesc.Format != CU_AD_FORMAT_UNSIGNED_INT32 &&
2225+
arrayDesc.Format != CU_AD_FORMAT_SIGNED_INT32 &&
2226+
arrayDesc.Format != CU_AD_FORMAT_HALF &&
2227+
arrayDesc.Format != CU_AD_FORMAT_FLOAT) {
2228+
cl::sycl::detail::pi::die(
2229+
"PI CUDA kernels only support images with channel types int32, "
2230+
"uint32, float, and half.");
2231+
}
22212232
CUsurfObject cuSurf = arg_mem->mem_.surface_mem_.get_surface();
22222233
kernel->set_kernel_arg(arg_index, sizeof(cuSurf), (void *)&cuSurf);
22232234
} else {

0 commit comments

Comments
 (0)