fix: set debugSurface in subdevices
Related-To: NEO-10681 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
parent
571d703135
commit
c4306a13b2
|
@ -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();
|
||||
|
|
|
@ -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 = {};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_memory_operations_handler.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace NEO {
|
||||
class CommandStreamReceiver;
|
||||
class DriverInfo;
|
||||
|
@ -37,6 +39,10 @@ struct MockSubDevice : public SubDevice {
|
|||
using SubDevice::getGlobalMemorySize;
|
||||
using SubDevice::SubDevice;
|
||||
|
||||
~MockSubDevice() override {
|
||||
EXPECT_EQ(nullptr, this->getDebugSurface());
|
||||
}
|
||||
|
||||
std::unique_ptr<CommandStreamReceiver> createCommandStreamReceiver() const override {
|
||||
return std::unique_ptr<CommandStreamReceiver>(createCommandStreamReceiverFunc(*executionEnvironment, getRootDeviceIndex(), getDeviceBitfield()));
|
||||
}
|
||||
|
@ -50,6 +56,7 @@ class MockDevice : public RootDevice {
|
|||
public:
|
||||
using Device::addEngineToEngineGroup;
|
||||
using Device::allEngines;
|
||||
using Device::allocateDebugSurface;
|
||||
using Device::commandStreamReceivers;
|
||||
using Device::createDeviceInternals;
|
||||
using Device::createEngine;
|
||||
|
|
|
@ -1153,6 +1153,21 @@ TEST(Device, givenDifferentEngineTypesWhenIsSecondaryContextEngineTypeCalledThen
|
|||
}
|
||||
}
|
||||
|
||||
TEST(Device, whenAllocateDebugSurfaceIsCalledThenEachSubDeviceContainsCorrectDebugSurface) {
|
||||
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
debugManager.flags.CreateMultipleSubDevices.set(4);
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
|
||||
size_t size = 8u;
|
||||
device->allocateDebugSurface(size);
|
||||
auto *debugSurface = device->getDebugSurface();
|
||||
|
||||
for (auto *subDevice : device->getSubDevices()) {
|
||||
EXPECT_EQ(debugSurface, subDevice->getDebugSurface());
|
||||
}
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenCCSEngineAndContextGroupSizeEnabledWhenCreatingEngineThenItsContextHasContextGroupFlagSet) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
const uint32_t contextGroupSize = 8;
|
||||
|
|
Loading…
Reference in New Issue