From 5ef2aa5d9efb54de6905d0aa14afc2b345a297f7 Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 11 Jun 2015 19:17:47 -0400 Subject: [PATCH] P4 to Git Change 1160575 by gandryey@gera-dev-w7 on 2015/06/11 18:31:59 ECR #304775 - Real time queue support - Add the new interface for the real time queue creation Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_command.cpp#10 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_device.cpp#58 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.hpp#90 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#246 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#511 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#144 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.cpp#91 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.hpp#48 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#33 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#14 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#20 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.hpp#15 edit --- opencl/api/opencl/amdocl/cl_command.cpp | 14 ++++++++++++-- opencl/api/opencl/amdocl/cl_device.cpp | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/opencl/api/opencl/amdocl/cl_command.cpp b/opencl/api/opencl/amdocl/cl_command.cpp index 5dc44b67c6..ee353076d6 100644 --- a/opencl/api/opencl/amdocl/cl_command.cpp +++ b/opencl/api/opencl/amdocl/cl_command.cpp @@ -87,6 +87,7 @@ RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueueWithProperties, ( } *p = reinterpret_cast(queue_properties); uint queueSize = amdDevice.info().queueOnDevicePreferredSize_; + uint queueRTCUs = 0; if (p != NULL) while(p->name != 0) { switch(p->name) { case CL_QUEUE_PROPERTIES: @@ -94,9 +95,13 @@ RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueueWithProperties, ( //properties = p->value.properties; properties = static_cast(p->value.raw); break; - case CL_QUEUE_SIZE: // Unimplemented + case CL_QUEUE_SIZE: queueSize = p->value.size; break; +#define CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD 0x404f + case CL_QUEUE_REAL_TIME_COMPUTE_UNITS_AMD: + queueRTCUs = p->value.size; + break; default: *not_null(errcode_ret) = CL_INVALID_QUEUE_PROPERTIES; LogWarning("invalid property name"); @@ -110,13 +115,18 @@ RUNTIME_ENTRY_RET(cl_command_queue, clCreateCommandQueueWithProperties, ( return (cl_command_queue) 0; } + if (queueRTCUs > amdDevice.info().numRTCUs_) { + *not_null(errcode_ret) = CL_INVALID_VALUE; + return (cl_command_queue) 0; + } + amd::CommandQueue* queue = NULL; { amd::ScopedLock lock(amdContext.lock()); // Check if the app creates a host queue if (!(properties & CL_QUEUE_ON_DEVICE)) { - queue = new amd::HostQueue(amdContext, amdDevice, properties); + queue = new amd::HostQueue(amdContext, amdDevice, properties, queueRTCUs); } else { // Is it a device default queue diff --git a/opencl/api/opencl/amdocl/cl_device.cpp b/opencl/api/opencl/amdocl/cl_device.cpp index c0778d554b..ce50acc300 100644 --- a/opencl/api/opencl/amdocl/cl_device.cpp +++ b/opencl/api/opencl/amdocl/cl_device.cpp @@ -652,6 +652,10 @@ RUNTIME_ENTRY(cl_int, clGetDeviceInfo, ( minor, param_value_size, param_value, param_value_size_ret); } CASE(CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD, numAsyncQueues_); +#define CL_DEVICE_MAX_REAL_TIME_COMPUTE_QUEUES_AMD 0x404D +#define CL_DEVICE_MAX_REAL_TIME_COMPUTE_UNITS_AMD 0x404E + CASE(CL_DEVICE_MAX_REAL_TIME_COMPUTE_QUEUES_AMD, numRTQueues_); + CASE(CL_DEVICE_MAX_REAL_TIME_COMPUTE_UNITS_AMD, numRTCUs_); default: break; }