| 35 | namespace amd { |
| 36 | |
| 37 | HostQueue::HostQueue(Context& context, Device& device, cl_command_queue_properties props, |
| 38 | uint queueRTCUs, Priority priority, const std::vector<uint32_t>& cuMask) |
| 39 | : CommandQueue(context, device, props, device.info().queueProperties_, queueRTCUs, priority, |
| 40 | cuMask), |
| 41 | lastEnqueueCommand_(nullptr), |
| 42 | head_(nullptr), |
| 43 | tail_(nullptr), |
| 44 | isActive_(false), |
| 45 | sync_policy_(amd::SyncPolicy::Auto) { |
| 46 | if (GPU_FORCE_QUEUE_PROFILING) { |
| 47 | properties().set(CL_QUEUE_PROFILING_ENABLE); |
| 48 | } |
| 49 | if (AMD_DIRECT_DISPATCH) { |
| 50 | // Initialize the queue |
| 51 | thread_.Init(this); |
| 52 | } else { |
| 53 | if (thread_.state() >= Thread::INITIALIZED) { |
| 54 | ScopedLock sl(queueLock_); |
| 55 | thread_.start(this); |
| 56 | // wait for HostQueue::loop() to update acceptingCommands_ as true |
| 57 | while (!thread_.acceptingCommands_) { |
| 58 | queueLock_.wait(); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | bool HostQueue::terminate() { |
| 65 | // incase of force destroy skip checking on the last command |