Store bcsEngine in an std::vector in OpenCL CommandQUeue

Related-To: NEO-6057
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2021-09-24 16:32:20 +00:00
committed by Compute-Runtime-Automation
parent eccebfb49d
commit c910a58aa0
14 changed files with 111 additions and 62 deletions

View File

@@ -18,7 +18,7 @@
namespace NEO {
class MockCommandQueue : public CommandQueue {
public:
using CommandQueue::bcsEngine;
using CommandQueue::bcsEngines;
using CommandQueue::blitEnqueueAllowed;
using CommandQueue::blitEnqueueImageAllowed;
using CommandQueue::blitEnqueuePreferred;
@@ -36,6 +36,22 @@ class MockCommandQueue : public CommandQueue {
using CommandQueue::throttle;
using CommandQueue::timestampPacketContainer;
void clearBcsEngines() {
std::fill(bcsEngines.begin(), bcsEngines.end(), nullptr);
}
void insertBcsEngine(aub_stream::EngineType bcsEngineType) {
const auto index = NEO::EngineHelpers::getBcsIndex(bcsEngineType);
const auto engine = &getDevice().getEngine(bcsEngineType, EngineUsage::Regular);
bcsEngines[index] = engine;
}
size_t countBcsEngines() const {
return std::count_if(bcsEngines.begin(), bcsEngines.end(), [](const EngineControl *engine) {
return engine != nullptr;
});
}
void setProfilingEnabled() {
commandQueueProperties |= CL_QUEUE_PROFILING_ENABLE;
}
@@ -198,7 +214,7 @@ class MockCommandQueueHw : public CommandQueueHw<GfxFamily> {
using BaseClass = CommandQueueHw<GfxFamily>;
public:
using BaseClass::bcsEngine;
using BaseClass::bcsEngines;
using BaseClass::bcsState;
using BaseClass::blitEnqueueAllowed;
using BaseClass::commandQueueProperties;
@@ -218,6 +234,10 @@ class MockCommandQueueHw : public CommandQueueHw<GfxFamily> {
cl_queue_properties *properties) : BaseClass(context, device, properties, false) {
}
void clearBcsEngines() {
std::fill(bcsEngines.begin(), bcsEngines.end(), nullptr);
}
cl_int flush() override {
flushCalled = true;
return BaseClass::flush();