Files
rocm-systems/rocclr/runtime/platform/commandqueue.cpp
T
foreman d0b51ccdbf P4 to Git Change 1161664 by rili@rili_opencl_stg on 2015/06/15 18:01:53
EPR #421679 - remove all source code related to open video

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/Makefile#3 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.cpp#15 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.def#5 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.h#7 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecode.rc#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVDecodeTypes.h#6 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVEncode.cpp#37 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVEncode.h#11 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OVEncodeTypes.h#16 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.cpp#6 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.def#3 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.h#5 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.rc#3 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.sln#5 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.vcxproj#11 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo.vcxproj.filters#3 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo_2008.sln#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/OpenVideo_2008.vcproj#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/atiumdva.cap#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build.bat#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build/Makefile#6 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build/Makefile.ov#18 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/build/Makefile.ovd#27 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/buildOV/Makefile#5 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/OpenVideo/res/OpenVideo.rc2#2 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/build/Makefile.api#113 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_common.hpp#17 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_context.cpp#43 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_device.cpp#59 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_open_video.cpp#35 delete
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_open_video_amd.h#20 delete
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.cpp#273 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.hpp#91 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuvirtual.cpp#24 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuvirtual.hpp#12 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#247 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#512 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#145 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#311 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.hpp#91 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#366 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#130 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp#73 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.h#45 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.cpp#92 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.hpp#49 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsavirtual.hpp#28 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#34 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#15 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsavirtual.hpp#20 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#78 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#21 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.hpp#16 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/object.hpp#15 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/video_session.hpp#13 delete
... //depot/stg/opencl/drivers/opencl/runtime/top.hpp#22 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#235 edit
2015-06-15 18:09:54 -04:00

189 righe
5.0 KiB
C++

//
// Copyright (c) 2012 Advanced Micro Devices, Inc. All rights reserved.
//
#include "commandqueue.hpp"
#include "thread/monitor.hpp"
#include "device/device.hpp"
#include "platform/context.hpp"
/*!
* \file commandQueue.cpp
* \brief Definitions for HostQueue object.
*
* \author Laurent Morichetti (laurent.morichetti@amd.com)
* \date October 2008
*/
namespace amd {
HostQueue::HostQueue(
Context& context, Device& device, cl_command_queue_properties properties, uint queueRTCUs
)
: CommandQueue(context, device, properties, device.info().queueProperties_
| CL_QUEUE_COMMAND_INTERCEPT_ENABLE_AMD, queueRTCUs)
{
if (thread_.state() >= Thread::INITIALIZED) {
ScopedLock sl(queueLock_);
thread_.start(this);
queueLock_.wait();
}
}
bool
HostQueue::terminate()
{
if (Os::isThreadAlive(thread_)) {
// Make sure all the commands are finished on the device.
finish();
// Kill the command queue loop.
thread_.acceptingCommands_ = false;
// Wake-up the command loop, so it can exit
flush();
// FIXME_lmoriche: fix termination handshake
while (thread_.state() < Thread::FINISHED) {
Os::yield();
}
}
if (Agent::shouldPostCommandQueueEvents()) {
Agent::postCommandQueueFree(as_cl(this->asCommandQueue()));
}
return true;
}
void
HostQueue::finish()
{
// Send a finish to make sure we finished all commands
Command* command = new Marker(*this, false);
if (command == NULL) {
return;
}
command->enqueue();
command->awaitCompletion();
command->release();
}
void
HostQueue::loop(device::VirtualDevice* virtualDevice)
{
cl_int (CL_CALLBACK * commandIntercept)(cl_event, cl_int *) =
properties().test(CL_QUEUE_COMMAND_INTERCEPT_ENABLE_AMD)
? context().info().commandIntercept_ : NULL;
// Notify the caller that the queue is ready to accept commands.
{
ScopedLock sl(queueLock_);
thread_.acceptingCommands_ = true;
queueLock_.notify();
}
// Create a command batch with all the commands present in the queue.
Command* head = NULL;
Command* tail = NULL;
while (true) {
// Get one command from the queue
Command* command = queue_.dequeue();
if (command == NULL) {
ScopedLock sl(queueLock_);
while ((command = queue_.dequeue()) == NULL) {
if (!thread_.acceptingCommands_) {
return;
}
queueLock_.wait();
}
}
command->retain();
// Process the command's event wait list.
const Command::EventWaitList& events = command->eventWaitList();
Command::EventWaitList::const_iterator it;
bool dependencyFailed = false;
for (it = events.begin(); it != events.end(); ++it) {
// Only wait if the command is enqueued into another queue.
if ((*it)->command().queue() != this) {
virtualDevice->flush(head, true);
tail = head = NULL;
dependencyFailed |= !(*it)->awaitCompletion();
}
}
// Insert the command to the linked list.
if (NULL == head) { //if the list is empty
head = tail = command;
}
else {
tail->setNext(command);
tail = command;
}
if (dependencyFailed) {
command->setStatus(CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST);
continue;
}
command->setStatus(CL_SUBMITTED);
cl_int result;
if ((commandIntercept != NULL) &&
commandIntercept(as_cl<Event>(command), &result)) {
// The command was handled by the callback.
command->setStatus(CL_RUNNING, command->profilingInfo().submitted_);
command->setStatus(result);
continue;
}
// Submit to the device queue.
command->submit(*virtualDevice);
//if we are in intercept mode or this is a user invisible marker command
if ((0 == command->type()) || (commandIntercept != NULL)) {
virtualDevice->flush(head);
tail = head = NULL;
}
} // while (true) {
}
void
HostQueue::append(Command& command)
{
// We retain the command here. It will be released when its status
// changes to CL_COMPLETE
command.retain();
command.setStatus(CL_QUEUED);
queue_.enqueue(&command);
}
DeviceQueue::~DeviceQueue()
{
delete virtualDevice_;
ScopedLock lock(context().lock());
context().removeDeviceQueue(device(), this);
}
bool
DeviceQueue::create()
{
static const bool InteropQueue = true;
const bool defaultDeviceQueue = properties().test(CL_QUEUE_ON_DEVICE_DEFAULT);
bool result = false;
virtualDevice_ = device().createVirtualDevice(this);
if (virtualDevice_ != NULL) {
result = true;
context().addDeviceQueue(device(), this, defaultDeviceQueue);
}
return result;
}
} //namespace amd {