mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
fix: serialize constructBcsEngine
Related-To: NEO-15630 Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
59f8e8352f
commit
9a82e3439a
@@ -348,40 +348,47 @@ CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelec
|
||||
}
|
||||
|
||||
void CommandQueue::constructBcsEngine(bool internalUsage) {
|
||||
if (bcsAllowed && !bcsInitialized) {
|
||||
auto &gfxCoreHelper = device->getGfxCoreHelper();
|
||||
auto &neoDevice = device->getNearestGenericSubDevice(0)->getDevice();
|
||||
auto &selectorCopyEngine = neoDevice.getSelectorCopyEngine();
|
||||
auto bcsEngineType = EngineHelpers::getBcsEngineType(device->getRootDeviceEnvironment(), device->getDeviceBitfield(), selectorCopyEngine, internalUsage);
|
||||
auto bcsIndex = EngineHelpers::getBcsIndex(bcsEngineType);
|
||||
auto engineUsage = (internalUsage && gfxCoreHelper.preferInternalBcsEngine()) ? EngineUsage::internal : EngineUsage::regular;
|
||||
if (!bcsAllowed) {
|
||||
return;
|
||||
}
|
||||
if (!bcsInitialized) {
|
||||
const std::lock_guard lock{bcsInitMutex};
|
||||
|
||||
if (priority == QueuePriority::high) {
|
||||
auto hpBcs = neoDevice.getHpCopyEngine();
|
||||
if (!bcsInitialized) {
|
||||
auto &gfxCoreHelper = device->getGfxCoreHelper();
|
||||
auto &neoDevice = device->getNearestGenericSubDevice(0)->getDevice();
|
||||
auto &selectorCopyEngine = neoDevice.getSelectorCopyEngine();
|
||||
auto bcsEngineType = EngineHelpers::getBcsEngineType(device->getRootDeviceEnvironment(), device->getDeviceBitfield(), selectorCopyEngine, internalUsage);
|
||||
auto bcsIndex = EngineHelpers::getBcsIndex(bcsEngineType);
|
||||
auto engineUsage = (internalUsage && gfxCoreHelper.preferInternalBcsEngine()) ? EngineUsage::internal : EngineUsage::regular;
|
||||
|
||||
if (hpBcs) {
|
||||
bcsEngineType = hpBcs->getEngineType();
|
||||
engineUsage = EngineUsage::highPriority;
|
||||
bcsIndex = EngineHelpers::getBcsIndex(bcsEngineType);
|
||||
bcsEngines[bcsIndex] = hpBcs;
|
||||
}
|
||||
}
|
||||
if (priority == QueuePriority::high) {
|
||||
auto hpBcs = neoDevice.getHpCopyEngine();
|
||||
|
||||
if (bcsEngines[bcsIndex] == nullptr) {
|
||||
bcsEngines[bcsIndex] = neoDevice.tryGetEngine(bcsEngineType, engineUsage);
|
||||
}
|
||||
|
||||
if (bcsEngines[bcsIndex]) {
|
||||
bcsQueueEngineType = bcsEngineType;
|
||||
|
||||
if (gfxCoreHelper.areSecondaryContextsSupported() && !internalUsage) {
|
||||
tryAssignSecondaryEngine(device->getDevice(), bcsEngines[bcsIndex], {bcsEngineType, engineUsage});
|
||||
if (hpBcs) {
|
||||
bcsEngineType = hpBcs->getEngineType();
|
||||
engineUsage = EngineUsage::highPriority;
|
||||
bcsIndex = EngineHelpers::getBcsIndex(bcsEngineType);
|
||||
bcsEngines[bcsIndex] = hpBcs;
|
||||
}
|
||||
}
|
||||
|
||||
bcsEngines[bcsIndex]->osContext->ensureContextInitialized(false);
|
||||
bcsEngines[bcsIndex]->commandStreamReceiver->initDirectSubmission();
|
||||
if (bcsEngines[bcsIndex] == nullptr) {
|
||||
bcsEngines[bcsIndex] = neoDevice.tryGetEngine(bcsEngineType, engineUsage);
|
||||
}
|
||||
|
||||
if (bcsEngines[bcsIndex]) {
|
||||
bcsQueueEngineType = bcsEngineType;
|
||||
|
||||
if (gfxCoreHelper.areSecondaryContextsSupported() && !internalUsage) {
|
||||
tryAssignSecondaryEngine(device->getDevice(), bcsEngines[bcsIndex], {bcsEngineType, engineUsage});
|
||||
}
|
||||
|
||||
bcsEngines[bcsIndex]->osContext->ensureContextInitialized(false);
|
||||
bcsEngines[bcsIndex]->commandStreamReceiver->initDirectSubmission();
|
||||
}
|
||||
bcsInitialized = true;
|
||||
}
|
||||
bcsInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "opencl/source/helpers/properties_helper.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
|
||||
@@ -509,6 +510,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||
mutable EngineControl *gpgpuEngine = nullptr;
|
||||
std::array<EngineControl *, bcsInfoMaskSize> bcsEngines = {};
|
||||
std::optional<aub_stream::EngineType> bcsQueueEngineType{};
|
||||
std::mutex bcsInitMutex;
|
||||
size_t bcsEngineCount = bcsInfoMaskSize;
|
||||
|
||||
cl_command_queue_properties commandQueueProperties = 0;
|
||||
|
||||
@@ -167,7 +167,7 @@ int BinaryEncoder::processBinary(const std::vector<std::string> &ptmFileLines, s
|
||||
std::stringstream ss(ptmFileLines[deviceMarker]);
|
||||
ss.ignore(32, ' ');
|
||||
ss.ignore(32, ' ');
|
||||
uint32_t gfxCore = 0;
|
||||
int32_t gfxCore = 0;
|
||||
ss >> gfxCore;
|
||||
iga->setGfxCore(static_cast<GFXCORE_FAMILY>(gfxCore));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user