fix: set debugSurface in subdevices

Related-To: NEO-10681

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2024-09-11 11:21:09 +00:00
committed by Compute-Runtime-Automation
parent 571d703135
commit c4306a13b2
5 changed files with 50 additions and 10 deletions

View File

@@ -272,15 +272,9 @@ void Device::initializeCommonResources() {
debugSurfaceSize = NEO::SipKernel::getSipKernel(*this, nullptr).getStateSaveAreaSize(this);
}
const bool allocateDebugSurface = getL0Debugger();
if (allocateDebugSurface) {
debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties(
{getRootDeviceIndex(), true,
debugSurfaceSize,
NEO::AllocationType::debugContextSaveArea,
false,
false,
getDeviceBitfield()});
const bool isDebugSurfaceRequired = getL0Debugger();
if (isDebugSurfaceRequired) {
allocateDebugSurface(debugSurfaceSize);
}
if (ApiSpecificConfig::isDeviceUsmPoolingEnabled() &&
@@ -467,7 +461,23 @@ void Device::createSecondaryContexts(const EngineControl &primaryEngine, Seconda
}
primaryEngine.osContext->setContextGroup(true);
};
}
void Device::allocateDebugSurface(size_t debugSurfaceSize) {
this->debugSurface = getMemoryManager()->allocateGraphicsMemoryWithProperties(
{getRootDeviceIndex(), true,
debugSurfaceSize,
NEO::AllocationType::debugContextSaveArea,
false,
false,
getDeviceBitfield()});
for (auto &subdevice : this->subdevices) {
if (subdevice) {
subdevice->debugSurface = this->debugSurface;
}
}
}
void Device::addEngineToEngineGroup(EngineControl &engine) {
auto &hardwareInfo = this->getHardwareInfo();

View File

@@ -255,6 +255,7 @@ class Device : public ReferenceTrackedObject<Device> {
void setAsEngineInstanced();
void finalizeRayTracing();
void createSecondaryContexts(const EngineControl &primaryEngine, SecondaryContexts &secondaryEnginesForType, uint32_t contextCount, uint32_t regularPriorityCount, uint32_t highPriorityContextCount);
void allocateDebugSurface(size_t debugSurfaceSize);
DeviceInfo deviceInfo = {};

View File

@@ -29,6 +29,13 @@ RootDevice::RootDevice(ExecutionEnvironment *executionEnvironment, uint32_t root
RootDevice::~RootDevice() {
if (getDebugSurface()) {
for (auto *subDevice : this->getSubDevices()) {
if (subDevice) {
subDevice->setDebugSurface(nullptr);
}
}
getMemoryManager()->freeGraphicsMemory(debugSurface);
debugSurface = nullptr;
}