diff --git a/opencl/api/opencl/amdocl/cl_program.cpp b/opencl/api/opencl/amdocl/cl_program.cpp index f6a4eead80..f0b3831df4 100644 --- a/opencl/api/opencl/amdocl/cl_program.cpp +++ b/opencl/api/opencl/amdocl/cl_program.cpp @@ -1534,18 +1534,18 @@ RUNTIME_ENTRY(cl_int, clSetKernelArg, return CL_INVALID_ARG_INDEX; } - as_amd(kernel)->parameters().reset(static_cast(arg_index)); - const amd::KernelParameterDescriptor& desc = signature.at(arg_index); const bool is_local = desc.size_ == 0; if (((arg_value == NULL) && !is_local && (desc.type_ != T_POINTER)) || ((arg_value != NULL) && is_local)) { + as_amd(kernel)->parameters().reset(static_cast(arg_index)); return CL_INVALID_ARG_VALUE; } if (!is_local && (desc.type_ == T_POINTER) && (arg_value != NULL)) { cl_mem memObj = *static_cast(arg_value); amd::RuntimeObject* pObject = as_amd(memObj); if (NULL != memObj && amd::RuntimeObject::ObjectTypeMemory != pObject->objectType()) { + as_amd(kernel)->parameters().reset(static_cast(arg_index)); return CL_INVALID_MEM_OBJECT; } } else if ((desc.type_ == T_SAMPLER) && !is_valid(*static_cast(arg_value))) { @@ -1553,13 +1553,16 @@ RUNTIME_ENTRY(cl_int, clSetKernelArg, } else if (desc.type_ == T_QUEUE) { cl_command_queue queue = *static_cast(arg_value); if (!is_valid(queue)) { + as_amd(kernel)->parameters().reset(static_cast(arg_index)); return CL_INVALID_DEVICE_QUEUE; } if (NULL == as_amd(queue)->asDeviceQueue()) { + as_amd(kernel)->parameters().reset(static_cast(arg_index)); return CL_INVALID_DEVICE_QUEUE; } } if ((!is_local && (arg_size != desc.size_)) || (is_local && (arg_size == 0))) { + as_amd(kernel)->parameters().reset(static_cast(arg_index)); return CL_INVALID_ARG_SIZE; } diff --git a/opencl/api/opencl/amdocl/cl_svm.cpp b/opencl/api/opencl/amdocl/cl_svm.cpp index 9703cf5953..a4f8847ad3 100644 --- a/opencl/api/opencl/amdocl/cl_svm.cpp +++ b/opencl/api/opencl/amdocl/cl_svm.cpp @@ -908,11 +908,10 @@ RUNTIME_ENTRY(cl_int, clSetKernelArgSVMPointer, const amd::KernelParameterDescriptor& desc = signature.at(arg_index); if (desc.type_ != T_POINTER || !(desc.addressQualifier_ & (CL_KERNEL_ARG_ADDRESS_GLOBAL | CL_KERNEL_ARG_ADDRESS_CONSTANT))) { + as_amd(kernel)->parameters().reset(static_cast(arg_index)); return CL_INVALID_ARG_VALUE; } - as_amd(kernel)->parameters().reset(static_cast(arg_index)); - //! @todo We need to check that the alignment of \a arg_value. For instance, // if the argument is of type 'global float4*', then \a arg_value must be // aligned to sizeof(float4*). Note that desc.size_ contains the size of the