From affe06135da79335bfd5635b8f616ee5da7a1710 Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 23 May 2018 17:24:32 -0400 Subject: [PATCH] P4 to Git Change 1558704 by gandryey@gera-w8 on 2018/05/23 17:20:01 SWDEV-79445 - OCL generic changes and code clean-up - ABI clean-up. Stage 1: Separate kernel arguments and OCL objects. OCL objects will be passed in the new arrays of mem objects, samplers and device queue objects. The kernel arguments will contain GPU virtual addresses. http://ocltc.amd.com/reviews/r/14881/ Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_program.cpp#48 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#25 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#302 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpublit.cpp#129 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#323 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#128 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpumemory.hpp#51 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#417 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palblit.cpp#23 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#50 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palmemory.hpp#7 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#97 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.cpp#22 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocblit.hpp#9 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#28 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.hpp#12 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#51 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#86 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.cpp#26 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.hpp#20 edit --- opencl/api/opencl/amdocl/cl_program.cpp | 7 +++++-- opencl/api/opencl/amdocl/cl_svm.cpp | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) 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