Remove getAnyBcs() method

Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2021-11-04 14:48:13 +00:00
committed by Compute-Runtime-Automation
parent 78609cd9f5
commit b8a03cdea1
4 changed files with 11 additions and 10 deletions

View File

@@ -89,6 +89,7 @@ CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_pr
auto &selectorCopyEngine = neoDevice.getSelectorCopyEngine(); auto &selectorCopyEngine = neoDevice.getSelectorCopyEngine();
auto bcsEngineType = EngineHelpers::getBcsEngineType(hwInfo, device->getDeviceBitfield(), selectorCopyEngine, internalUsage); auto bcsEngineType = EngineHelpers::getBcsEngineType(hwInfo, device->getDeviceBitfield(), selectorCopyEngine, internalUsage);
bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)] = neoDevice.tryGetEngine(bcsEngineType, EngineUsage::Regular); bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)] = neoDevice.tryGetEngine(bcsEngineType, EngineUsage::Regular);
bcsEngineTypes.push_back(bcsEngineType);
} }
} }
@@ -142,7 +143,7 @@ CommandStreamReceiver *CommandQueue::getBcsCommandStreamReceiver(aub_stream::Eng
} }
} }
CommandStreamReceiver *CommandQueue::getAnyBcs() const { CommandStreamReceiver *CommandQueue::getBcsForAuxTranslation() const {
for (const EngineControl *engine : this->bcsEngines) { for (const EngineControl *engine : this->bcsEngines) {
if (engine != nullptr) { if (engine != nullptr) {
return engine->commandStreamReceiver; return engine->commandStreamReceiver;
@@ -151,13 +152,9 @@ CommandStreamReceiver *CommandQueue::getAnyBcs() const {
return nullptr; return nullptr;
} }
CommandStreamReceiver *CommandQueue::getBcsForAuxTranslation() const {
return getAnyBcs();
}
CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelectionArgs &args) const { CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelectionArgs &args) const {
if (isCopyOnly) { if (isCopyOnly) {
return *getAnyBcs(); return *getBcsCommandStreamReceiver(bcsEngineTypes[0]);
} }
if (!blitEnqueueAllowed(args)) { if (!blitEnqueueAllowed(args)) {
@@ -193,8 +190,8 @@ CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelec
CommandStreamReceiver *selectedCsr = nullptr; CommandStreamReceiver *selectedCsr = nullptr;
if (preferBcs) { if (preferBcs) {
selectedCsr = getBcsCommandStreamReceiver(preferredBcsEngineType); selectedCsr = getBcsCommandStreamReceiver(preferredBcsEngineType);
if (selectedCsr == nullptr) { if (selectedCsr == nullptr && !bcsEngineTypes.empty()) {
selectedCsr = getAnyBcs(); selectedCsr = getBcsCommandStreamReceiver(bcsEngineTypes[0]);
} }
} }
if (selectedCsr == nullptr) { if (selectedCsr == nullptr) {
@@ -928,6 +925,7 @@ void CommandQueue::overrideEngine(aub_stream::EngineType engineType, EngineUsage
if (isEngineCopyOnly) { if (isEngineCopyOnly) {
std::fill(bcsEngines.begin(), bcsEngines.end(), nullptr); std::fill(bcsEngines.begin(), bcsEngines.end(), nullptr);
bcsEngines[EngineHelpers::getBcsIndex(engineType)] = &device->getEngine(engineType, EngineUsage::Regular); bcsEngines[EngineHelpers::getBcsIndex(engineType)] = &device->getEngine(engineType, EngineUsage::Regular);
bcsEngineTypes = {engineType};
timestampPacketContainer = std::make_unique<TimestampPacketContainer>(); timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
deferredTimestampPackets = std::make_unique<TimestampPacketContainer>(); deferredTimestampPackets = std::make_unique<TimestampPacketContainer>();
isCopyOnly = true; isCopyOnly = true;

View File

@@ -232,7 +232,6 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
MOCKABLE_VIRTUAL CommandStreamReceiver &getGpgpuCommandStreamReceiver() const; MOCKABLE_VIRTUAL CommandStreamReceiver &getGpgpuCommandStreamReceiver() const;
CommandStreamReceiver *getBcsCommandStreamReceiver(aub_stream::EngineType bcsEngineType) const; CommandStreamReceiver *getBcsCommandStreamReceiver(aub_stream::EngineType bcsEngineType) const;
CommandStreamReceiver *getAnyBcs() const;
CommandStreamReceiver *getBcsForAuxTranslation() const; CommandStreamReceiver *getBcsForAuxTranslation() const;
MOCKABLE_VIRTUAL CommandStreamReceiver &selectCsrForBuiltinOperation(const CsrSelectionArgs &args) const; MOCKABLE_VIRTUAL CommandStreamReceiver &selectCsrForBuiltinOperation(const CsrSelectionArgs &args) const;
Device &getDevice() const noexcept; Device &getDevice() const noexcept;
@@ -374,6 +373,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
ClDevice *device = nullptr; ClDevice *device = nullptr;
EngineControl *gpgpuEngine = nullptr; EngineControl *gpgpuEngine = nullptr;
std::array<EngineControl *, bcsInfoMaskSize> bcsEngines = {}; std::array<EngineControl *, bcsInfoMaskSize> bcsEngines = {};
std::vector<aub_stream::EngineType> bcsEngineTypes = {};
cl_command_queue_properties commandQueueProperties = 0; cl_command_queue_properties commandQueueProperties = 0;
std::vector<uint64_t> propertiesVector; std::vector<uint64_t> propertiesVector;

View File

@@ -207,7 +207,7 @@ HWTEST_F(EnqueueHandlerTest, givenBlitPropertyWhenEnqueueIsBlockedThenRegisterBl
Surface *surfaces[] = {nullptr}; Surface *surfaces[] = {nullptr};
mockCmdQ->enqueueBlocked(CL_COMMAND_READ_BUFFER, surfaces, size_t(0), multiDispatchInfo, timestampPacketDependencies, mockCmdQ->enqueueBlocked(CL_COMMAND_READ_BUFFER, surfaces, size_t(0), multiDispatchInfo, timestampPacketDependencies,
blockedCommandsData, enqueuePropertiesForBlitEnqueue, eventsRequest, blockedCommandsData, enqueuePropertiesForBlitEnqueue, eventsRequest,
eventBuilder, std::unique_ptr<PrintfHandler>(nullptr), mockCmdQ->getAnyBcs()); eventBuilder, std::unique_ptr<PrintfHandler>(nullptr), mockCmdQ->getBcsForAuxTranslation());
EXPECT_TRUE(blockedCommandsDataForBlitEnqueue->blitEnqueue); EXPECT_TRUE(blockedCommandsDataForBlitEnqueue->blitEnqueue);
EXPECT_EQ(blitProperties.srcAllocation, blockedCommandsDataForBlitEnqueue->blitPropertiesContainer.begin()->srcAllocation); EXPECT_EQ(blitProperties.srcAllocation, blockedCommandsDataForBlitEnqueue->blitPropertiesContainer.begin()->srcAllocation);
EXPECT_EQ(blitProperties.dstAllocation, blockedCommandsDataForBlitEnqueue->blitPropertiesContainer.begin()->dstAllocation); EXPECT_EQ(blitProperties.dstAllocation, blockedCommandsDataForBlitEnqueue->blitPropertiesContainer.begin()->dstAllocation);

View File

@@ -19,6 +19,7 @@ namespace NEO {
class MockCommandQueue : public CommandQueue { class MockCommandQueue : public CommandQueue {
public: public:
using CommandQueue::bcsEngines; using CommandQueue::bcsEngines;
using CommandQueue::bcsEngineTypes;
using CommandQueue::blitEnqueueAllowed; using CommandQueue::blitEnqueueAllowed;
using CommandQueue::blitEnqueueImageAllowed; using CommandQueue::blitEnqueueImageAllowed;
using CommandQueue::bufferCpuCopyAllowed; using CommandQueue::bufferCpuCopyAllowed;
@@ -37,12 +38,14 @@ class MockCommandQueue : public CommandQueue {
void clearBcsEngines() { void clearBcsEngines() {
std::fill(bcsEngines.begin(), bcsEngines.end(), nullptr); std::fill(bcsEngines.begin(), bcsEngines.end(), nullptr);
bcsEngineTypes.clear();
} }
void insertBcsEngine(aub_stream::EngineType bcsEngineType) { void insertBcsEngine(aub_stream::EngineType bcsEngineType) {
const auto index = NEO::EngineHelpers::getBcsIndex(bcsEngineType); const auto index = NEO::EngineHelpers::getBcsIndex(bcsEngineType);
const auto engine = &getDevice().getEngine(bcsEngineType, EngineUsage::Regular); const auto engine = &getDevice().getEngine(bcsEngineType, EngineUsage::Regular);
bcsEngines[index] = engine; bcsEngines[index] = engine;
bcsEngineTypes.push_back(bcsEngineType);
} }
size_t countBcsEngines() const { size_t countBcsEngines() const {