Assign BCS at first blit enqueue

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2022-04-25 11:06:41 +00:00
committed by Compute-Runtime-Automation
parent 4f7a225baf
commit 82d1962aba
8 changed files with 91 additions and 22 deletions

View File

@ -73,19 +73,22 @@ CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_pr
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
bool bcsAllowed = hwInfoConfig->isBlitterFullySupported(hwInfo) &&
hwHelper.isSubDeviceEngineSupported(hwInfo, device->getDeviceBitfield(), aub_stream::EngineType::ENGINE_BCS);
bcsAllowed = hwInfoConfig->isBlitterFullySupported(hwInfo) &&
hwHelper.isSubDeviceEngineSupported(hwInfo, device->getDeviceBitfield(), aub_stream::EngineType::ENGINE_BCS);
if (bcsAllowed || device->getDefaultEngine().commandStreamReceiver->peekTimestampPacketWriteEnabled()) {
timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
deferredTimestampPackets = std::make_unique<TimestampPacketContainer>();
}
if (bcsAllowed) {
auto &neoDevice = device->getNearestGenericSubDevice(0)->getDevice();
auto &selectorCopyEngine = neoDevice.getSelectorCopyEngine();
auto bcsEngineType = EngineHelpers::getBcsEngineType(hwInfo, device->getDeviceBitfield(), selectorCopyEngine, internalUsage);
bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)] = neoDevice.tryGetEngine(bcsEngineType, EngineUsage::Regular);
bcsEngineTypes.push_back(bcsEngineType);
auto deferCmdQBcsInitialization = hwInfo.featureTable.ftrBcsInfo.count() > 1u;
if (DebugManager.flags.DeferCmdQBcsInitialization.get() != -1) {
deferCmdQBcsInitialization = DebugManager.flags.DeferCmdQBcsInitialization.get();
}
if (!deferCmdQBcsInitialization) {
this->initializeBcsEngine(internalUsage);
}
}
@ -181,7 +184,8 @@ CommandStreamReceiver &CommandQueue::getGpgpuCommandStreamReceiver() const {
return *gpgpuEngine->commandStreamReceiver;
}
CommandStreamReceiver *CommandQueue::getBcsCommandStreamReceiver(aub_stream::EngineType bcsEngineType) const {
CommandStreamReceiver *CommandQueue::getBcsCommandStreamReceiver(aub_stream::EngineType bcsEngineType) {
initializeBcsEngine(isSpecial());
const EngineControl *engine = this->bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)];
if (engine == nullptr) {
return nullptr;
@ -190,7 +194,8 @@ CommandStreamReceiver *CommandQueue::getBcsCommandStreamReceiver(aub_stream::Eng
}
}
CommandStreamReceiver *CommandQueue::getBcsForAuxTranslation() const {
CommandStreamReceiver *CommandQueue::getBcsForAuxTranslation() {
initializeBcsEngine(isSpecial());
for (const EngineControl *engine : this->bcsEngines) {
if (engine != nullptr) {
return engine->commandStreamReceiver;
@ -199,7 +204,8 @@ CommandStreamReceiver *CommandQueue::getBcsForAuxTranslation() const {
return nullptr;
}
CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelectionArgs &args) const {
CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelectionArgs &args) {
initializeBcsEngine(isSpecial());
if (isCopyOnly) {
return *getBcsCommandStreamReceiver(bcsEngineTypes[0]);
}
@ -267,6 +273,21 @@ CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelec
return *selectedCsr;
}
void CommandQueue::initializeBcsEngine(bool internalUsage) {
if (bcsAllowed && !bcsInitialized) {
auto &neoDevice = device->getNearestGenericSubDevice(0)->getDevice();
auto &selectorCopyEngine = neoDevice.getSelectorCopyEngine();
auto bcsEngineType = EngineHelpers::getBcsEngineType(device->getHardwareInfo(), device->getDeviceBitfield(), selectorCopyEngine, internalUsage);
bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)] = neoDevice.tryGetEngine(bcsEngineType, EngineUsage::Regular);
bcsEngineTypes.push_back(bcsEngineType);
bcsInitialized = true;
if (bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)]) {
bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)]->osContext->ensureContextInitialized();
bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)]->commandStreamReceiver->initDirectSubmission();
}
}
}
Device &CommandQueue::getDevice() const noexcept {
return device->getDevice();
}
@ -280,7 +301,7 @@ volatile uint32_t *CommandQueue::getHwTagAddress() const {
return getGpgpuCommandStreamReceiver().getTagAddress();
}
bool CommandQueue::isCompleted(uint32_t gpgpuTaskCount, CopyEngineState bcsState) const {
bool CommandQueue::isCompleted(uint32_t gpgpuTaskCount, CopyEngineState bcsState) {
DEBUG_BREAK_IF(getHwTag() == CompletionStamp::notReady);
if (getGpgpuCommandStreamReceiver().testTaskCountReady(getHwTagAddress(), gpgpuTaskCount)) {
@ -1028,6 +1049,7 @@ void CommandQueue::overrideEngine(aub_stream::EngineType engineType, EngineUsage
timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
deferredTimestampPackets = std::make_unique<TimestampPacketContainer>();
isCopyOnly = true;
bcsInitialized = true;
} else {
gpgpuEngine = &device->getEngine(engineType, engineUsage);
}