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
[ROCm/clr commit: e919691665]
Этот коммит содержится в:
@@ -71,12 +71,7 @@ public:
|
||||
|
||||
//! Instantiate a new virtual device
|
||||
virtual device::VirtualDevice* createVirtualDevice(
|
||||
bool profiling,
|
||||
bool interopQueue
|
||||
#if cl_amd_open_video
|
||||
, void* calVideoProperties = NULL
|
||||
#endif // cl_amd_open_video
|
||||
, uint deviceQueueSize = 0
|
||||
amd::CommandQueue* queue = NULL
|
||||
)
|
||||
{
|
||||
VirtualCPU* virtualCpu = new VirtualCPU(*this);
|
||||
|
||||
@@ -550,6 +550,10 @@ struct Info : public amd::EmbeddedObject
|
||||
cl_uint gfxipVersion_;
|
||||
//! Number of available async queues
|
||||
cl_uint numAsyncQueues_;
|
||||
//! Number of available real time queues
|
||||
cl_uint numRTQueues_;
|
||||
//! Number of available real time compute units
|
||||
cl_uint numRTCUs_;
|
||||
//! Thread trace enable
|
||||
cl_bool threadTraceEnable_;
|
||||
|
||||
@@ -1577,12 +1581,7 @@ public:
|
||||
|
||||
//! Create a new virtual device environment.
|
||||
virtual device::VirtualDevice* createVirtualDevice(
|
||||
bool profiling,
|
||||
bool interopQueue
|
||||
#if cl_amd_open_video
|
||||
, void* calVideoProperties = NULL
|
||||
#endif // cl_amd_open_video
|
||||
, uint deviceQueueSize = 0
|
||||
CommandQueue* queue = NULL
|
||||
) = 0;
|
||||
|
||||
//! Compile the given source code.
|
||||
|
||||
@@ -543,6 +543,8 @@ void NullDevice::fillDeviceInfo(
|
||||
info_.localMemBanks_ = hwInfo()->localMemBanks_;
|
||||
info_.gfxipVersion_ = hwInfo()->gfxipVersion_;
|
||||
info_.numAsyncQueues_ = numComputeRings;
|
||||
info_.numRTQueues_ = 2;
|
||||
info_.numRTCUs_ = 4;
|
||||
info_.threadTraceEnable_ = settings().threadTraceEnable_;
|
||||
}
|
||||
}
|
||||
@@ -1091,14 +1093,31 @@ Device::initializeHeapResources()
|
||||
|
||||
device::VirtualDevice*
|
||||
Device::createVirtualDevice(
|
||||
bool profiling,
|
||||
bool interopQueue
|
||||
#if cl_amd_open_video
|
||||
, void* calVideoProperties
|
||||
#endif // cl_amd_open_video
|
||||
, uint deviceQueueSize
|
||||
amd::CommandQueue* queue
|
||||
)
|
||||
{
|
||||
bool profiling = false;
|
||||
bool interopQueue = false;
|
||||
uint rtCUs = 0;
|
||||
uint deviceQueueSize = 0;
|
||||
#if cl_amd_open_video
|
||||
void* calVideoProperties = NULL;
|
||||
#endif // cl_amd_open_video
|
||||
|
||||
if (queue != NULL) {
|
||||
profiling = queue->properties().test(CL_QUEUE_PROFILING_ENABLE);
|
||||
if (queue->asHostQueue() != NULL) {
|
||||
interopQueue = (0 != (queue->context().info().flags_ &
|
||||
(amd::Context::GLDeviceKhr |
|
||||
amd::Context::D3D10DeviceKhr |
|
||||
amd::Context::D3D11DeviceKhr)));
|
||||
rtCUs = queue->rtCUs();
|
||||
}
|
||||
else if (queue->asDeviceQueue() != NULL) {
|
||||
deviceQueueSize = queue->asDeviceQueue()->size();
|
||||
}
|
||||
}
|
||||
|
||||
// Not safe to add a queue. So lock the device
|
||||
amd::ScopedLock k(lockAsyncOps());
|
||||
amd::ScopedLock lock(vgpusAccess());
|
||||
|
||||
@@ -63,12 +63,7 @@ public:
|
||||
|
||||
//! Instantiate a new virtual device
|
||||
virtual device::VirtualDevice* createVirtualDevice(
|
||||
bool profiling,
|
||||
bool interopQueue
|
||||
#if cl_amd_open_video
|
||||
, void* calVideoProperties = NULL
|
||||
#endif // cl_amd_open_video
|
||||
, uint deviceQueueSize = 0
|
||||
amd::CommandQueue* queue = NULL
|
||||
) { return NULL; }
|
||||
|
||||
//! Compile the given source code.
|
||||
@@ -394,12 +389,7 @@ public:
|
||||
|
||||
//! Instantiate a new virtual device
|
||||
device::VirtualDevice* createVirtualDevice(
|
||||
bool profiling,
|
||||
bool interopQueue
|
||||
#if cl_amd_open_video
|
||||
, void* calVideoProperties = NULL
|
||||
#endif // cl_amd_open_video
|
||||
, uint deviceQueueSize = 0
|
||||
amd::CommandQueue* queue = NULL
|
||||
);
|
||||
|
||||
//! Memory allocation
|
||||
|
||||
@@ -648,15 +648,14 @@ Device::populateOCLDeviceConstants()
|
||||
}
|
||||
|
||||
device::VirtualDevice*
|
||||
Device::createVirtualDevice(
|
||||
bool profiling,
|
||||
bool interopQueue
|
||||
#if cl_amd_open_video
|
||||
, void *calVideoProperties
|
||||
#endif
|
||||
, uint deviceQueueSize
|
||||
)
|
||||
Device::createVirtualDevice(amd::CommandQueue* queue)
|
||||
{
|
||||
bool interopQueue = (queue != NULL) &&
|
||||
(0 != (queue->context().info().flags_ &
|
||||
(amd::Context::GLDeviceKhr |
|
||||
amd::Context::D3D10DeviceKhr |
|
||||
amd::Context::D3D11DeviceKhr)));
|
||||
|
||||
// Initialization of heap and other resources occur during the command
|
||||
// queue creation time.
|
||||
HsaQueueType type = kHsaQueueTypeCompute;
|
||||
@@ -884,7 +883,7 @@ Device::xferQueue() const
|
||||
// Create virtual device for internal memory transfer
|
||||
Device* thisDevice = const_cast<Device*>(this);
|
||||
thisDevice->xferQueue_ = reinterpret_cast<VirtualGPU*>(
|
||||
thisDevice->createVirtualDevice(false, false));
|
||||
thisDevice->createVirtualDevice());
|
||||
if (!xferQueue_) {
|
||||
LogError("Couldn't create the device transfer manager!");
|
||||
}
|
||||
|
||||
@@ -100,16 +100,7 @@ public:
|
||||
|
||||
//! Create a new virtual device environment.
|
||||
virtual device::VirtualDevice* createVirtualDevice(
|
||||
bool profiling,
|
||||
bool interopQueue
|
||||
#if cl_amd_open_video
|
||||
, void* calVideoProperties = NULL
|
||||
#endif // cl_amd_open_video
|
||||
, uint deviceQueueSize = 0
|
||||
) {
|
||||
ShouldNotReachHere();
|
||||
return NULL;
|
||||
};
|
||||
amd::CommandQueue* queue = NULL) { return NULL; }
|
||||
|
||||
virtual bool registerSvmMemory(void* ptr, size_t size) const {
|
||||
ShouldNotReachHere();
|
||||
@@ -252,12 +243,8 @@ public:
|
||||
|
||||
//! Instantiate a new virtual device
|
||||
virtual device::VirtualDevice *createVirtualDevice(
|
||||
bool profiling, bool interopQueue
|
||||
#if cl_amd_open_video
|
||||
, void *calVideoProperties = NULL
|
||||
#endif // cl_amd_open_vide
|
||||
, uint deviceQueueSize = 0
|
||||
);
|
||||
amd::CommandQueue* queue = NULL);
|
||||
|
||||
//! Construct an HSAIL program object from the ELF assuming it is valid
|
||||
virtual device::Program *createProgram(int oclVer = 120);
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
namespace amd {
|
||||
|
||||
HostQueue::HostQueue(
|
||||
Context& context, Device& device, cl_command_queue_properties properties
|
||||
Context& context, Device& device, cl_command_queue_properties properties, uint queueRTCUs
|
||||
#if cl_amd_open_video
|
||||
, void* calVideoProperties
|
||||
#endif // cl_amd_open_video
|
||||
)
|
||||
: CommandQueue(context, device, properties, device.info().queueProperties_
|
||||
| CL_QUEUE_COMMAND_INTERCEPT_ENABLE_AMD)
|
||||
| CL_QUEUE_COMMAND_INTERCEPT_ENABLE_AMD, queueRTCUs)
|
||||
#if cl_amd_open_video
|
||||
, calVideoProperties_(calVideoProperties)
|
||||
#endif // cl_amd_open_video
|
||||
@@ -182,14 +182,7 @@ DeviceQueue::create()
|
||||
const bool defaultDeviceQueue = properties().test(CL_QUEUE_ON_DEVICE_DEFAULT);
|
||||
bool result = false;
|
||||
|
||||
virtualDevice_ = device().createVirtualDevice(
|
||||
properties().test(CL_QUEUE_PROFILING_ENABLE),
|
||||
!InteropQueue
|
||||
#if cl_amd_open_video
|
||||
, NULL
|
||||
#endif // cl_amd_open_video
|
||||
, size_);
|
||||
|
||||
virtualDevice_ = device().createVirtualDevice(this);
|
||||
if (virtualDevice_ != NULL) {
|
||||
result = true;
|
||||
context().addDeviceQueue(device(), this, defaultDeviceQueue);
|
||||
|
||||
@@ -89,6 +89,9 @@ public:
|
||||
//! Returns DeviceQueue object
|
||||
virtual DeviceQueue* asDeviceQueue() { return NULL; }
|
||||
|
||||
//! Returns the number or requested real time CUs
|
||||
uint rtCUs() const { return rtCUs_; }
|
||||
|
||||
protected:
|
||||
//! CommandQueue constructor is protected
|
||||
//! to keep the CommandQueue class as a virtual interface
|
||||
@@ -96,14 +99,17 @@ protected:
|
||||
Context& context, //!< Context object
|
||||
Device& device, //!< Device object
|
||||
cl_command_queue_properties properties, //!< Queue properties
|
||||
cl_command_queue_properties propMask //!< Queue properties mask
|
||||
cl_command_queue_properties propMask, //!< Queue properties mask
|
||||
uint rtCUs = 0 //!< Avaialble real time compute units
|
||||
)
|
||||
: properties_(propMask, properties)
|
||||
, rtCUs_(rtCUs)
|
||||
, queueLock_("CommandQueue::queueLock")
|
||||
, device_(device)
|
||||
, context_(context) {}
|
||||
|
||||
Properties properties_; //!< Queue properties
|
||||
uint rtCUs_; //!< The number of used RT compute units
|
||||
Monitor queueLock_; //!< Lock protecting the queue
|
||||
Device& device_; //!< The device
|
||||
SharedReference<Context> context_; //!< The context of this command queue
|
||||
@@ -133,16 +139,7 @@ class HostQueue : public CommandQueue
|
||||
//! The command queue thread entry point.
|
||||
void run(void *data) {
|
||||
HostQueue* queue = static_cast<HostQueue*>(data);
|
||||
|
||||
bool interopQueue = (0 != (queue->context().info().flags_ & (Context::GLDeviceKhr | Context::D3D10DeviceKhr | Context::D3D11DeviceKhr)));
|
||||
|
||||
virtualDevice_ = queue->device().createVirtualDevice(
|
||||
queue->properties().test(CL_QUEUE_PROFILING_ENABLE),
|
||||
interopQueue
|
||||
#if cl_amd_open_video
|
||||
, queue->calVideoProperties_
|
||||
#endif // cl_amd_open_video
|
||||
);
|
||||
virtualDevice_ = queue->device().createVirtualDevice(queue);
|
||||
if (virtualDevice_ != NULL) {
|
||||
queue->loop(virtualDevice_);
|
||||
if (virtualDevice_->terminate()) {
|
||||
@@ -185,7 +182,8 @@ public:
|
||||
HostQueue(
|
||||
Context& context,
|
||||
Device& device,
|
||||
cl_command_queue_properties properties
|
||||
cl_command_queue_properties properties,
|
||||
uint queueRTCUs = 0
|
||||
#if cl_amd_open_video
|
||||
, void* calVideoProperties = NULL
|
||||
#endif // cl_amd_open_video
|
||||
|
||||
Ссылка в новой задаче
Block a user