From 52fbf6473b9eabb5f969cc71f71c92c83885c7d5 Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Thu, 6 Dec 2018 09:21:28 +0100 Subject: [PATCH] Minor refactor of CommandQueue class Change-Id: Iab64ad133fe96402d9577b64380472729f0190a8 Signed-off-by: Dunajski, Bartosz --- runtime/command_queue/command_queue.cpp | 20 +++-------------- runtime/command_queue/command_queue.h | 30 ++++++++++++------------- runtime/helpers/queue_helpers.cpp | 3 ++- 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/runtime/command_queue/command_queue.cpp b/runtime/command_queue/command_queue.cpp index ac3ae07510..b0c02e4da7 100644 --- a/runtime/command_queue/command_queue.cpp +++ b/runtime/command_queue/command_queue.cpp @@ -54,22 +54,8 @@ CommandQueue *CommandQueue::create(Context *context, CommandQueue::CommandQueue() : CommandQueue(nullptr, nullptr, 0) { } -CommandQueue::CommandQueue(Context *context, - Device *deviceId, - const cl_queue_properties *properties) : taskCount(0), - taskLevel(0), - virtualEvent(nullptr), - context(context), - device(deviceId), - priority(QueuePriority::MEDIUM), - throttle(QueueThrottle::MEDIUM), - perfCountersEnabled(false), - perfCountersConfig(UINT32_MAX), - perfCountersUserRegistersNumber(0), - perfConfigurationData(nullptr), - perfCountersRegsCfgHandle(0), - perfCountersRegsCfgPending(false), - commandStream(nullptr) { +CommandQueue::CommandQueue(Context *context, Device *deviceId, const cl_queue_properties *properties) + : context(context), device(deviceId) { if (context) { context->incRefInternal(); } @@ -84,7 +70,7 @@ CommandQueue::CommandQueue(Context *context, } } - processProperties(); + processProperties(properties); } CommandQueue::~CommandQueue() { diff --git a/runtime/command_queue/command_queue.h b/runtime/command_queue/command_queue.h index 5b248c1b4d..7ec9db75d5 100644 --- a/runtime/command_queue/command_queue.h +++ b/runtime/command_queue/command_queue.h @@ -393,17 +393,17 @@ class CommandQueue : public BaseObject<_cl_command_queue> { MOCKABLE_VIRTUAL bool setupDebugSurface(Kernel *kernel); // taskCount of last task - uint32_t taskCount; + uint32_t taskCount = 0; // current taskLevel. Used for determining if a PIPE_CONTROL is needed. - uint32_t taskLevel; + uint32_t taskLevel = 0; std::unique_ptr flushStamp; - std::atomic latestTaskCountWaited{(uint32_t)-1}; + std::atomic latestTaskCountWaited{std::numeric_limits::max()}; // virtual event that holds last Enqueue information - Event *virtualEvent; + Event *virtualEvent = nullptr; protected: void *enqueueReadMemObjForMap(TransferProperties &transferProperties, EventsRequest &eventsRequest, cl_int &errcodeRet); @@ -418,26 +418,26 @@ class CommandQueue : public BaseObject<_cl_command_queue> { AuxTranslationDirection auxTranslationDirection); void obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes); - void processProperties(); + void processProperties(const cl_queue_properties *properties); Context *context = nullptr; Device *device = nullptr; EngineControl *engine = nullptr; - cl_command_queue_properties commandQueueProperties; + cl_command_queue_properties commandQueueProperties = 0; - QueuePriority priority; - QueueThrottle throttle; + QueuePriority priority = QueuePriority::MEDIUM; + QueueThrottle throttle = QueueThrottle::MEDIUM; uint32_t engineId = 0; - bool perfCountersEnabled; - cl_uint perfCountersConfig; - uint32_t perfCountersUserRegistersNumber; - InstrPmRegsCfg *perfConfigurationData; - uint32_t perfCountersRegsCfgHandle; - bool perfCountersRegsCfgPending; + bool perfCountersEnabled = false; + cl_uint perfCountersConfig = std::numeric_limits::max(); + uint32_t perfCountersUserRegistersNumber = 0; + InstrPmRegsCfg *perfConfigurationData = nullptr; + uint32_t perfCountersRegsCfgHandle = 0; + bool perfCountersRegsCfgPending = false; - LinearStream *commandStream; + LinearStream *commandStream = nullptr; bool mapDcFlushRequired = false; bool isSpecialCommandQueue = false; diff --git a/runtime/helpers/queue_helpers.cpp b/runtime/helpers/queue_helpers.cpp index e1de766165..2667198728 100644 --- a/runtime/helpers/queue_helpers.cpp +++ b/runtime/helpers/queue_helpers.cpp @@ -12,5 +12,6 @@ bool processExtraTokens(Device *&device, const cl_queue_properties *property) { return false; } -void CommandQueue::processProperties() {} +void CommandQueue::processProperties(const cl_queue_properties *properties) { +} } // namespace OCLRT