Allocate debugSurface per RootDevice

subdevices should use RootDevice's debugSurface Allocation

Change-Id: I83a725ab574e33dc045f0a25715de682d1dc5efc
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2020-06-15 17:29:24 +02:00
committed by sys_ocldev
parent 1618a25d71
commit de2cce1238
7 changed files with 58 additions and 34 deletions

View File

@@ -96,7 +96,7 @@ ze_result_t Mock<DriverHandle>::doFreeMem(const void *ptr) {
void Mock<DriverHandle>::setupDevices(std::vector<std::unique_ptr<NEO::Device>> neoDevices) {
this->numDevices = static_cast<uint32_t>(neoDevices.size());
for (auto &neoDevice : neoDevices) {
auto device = Device::create(this, neoDevice.release(), std::numeric_limits<uint32_t>::max());
auto device = Device::create(this, neoDevice.release(), std::numeric_limits<uint32_t>::max(), false);
this->devices.push_back(device);
}
}

View File

@@ -76,7 +76,7 @@ HWTEST_F(TestBuiltinFunctionsLibImpl, givenInitFunctionWhenBultinsTableConstainN
HWTEST_F(TestBuiltinFunctionsLibImpl, givenCompilerInterfaceWhenCreateDeviceAndImageSupportedThenBuiltinsImageFunctionsAreLoaded) {
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->compilerInterface.reset(new NEO::MockCompilerInterface());
std::unique_ptr<L0::Device> testDevice(Device::create(device->getDriverHandle(), neoDevice, std::numeric_limits<uint32_t>::max()));
std::unique_ptr<L0::Device> testDevice(Device::create(device->getDriverHandle(), neoDevice, std::numeric_limits<uint32_t>::max(), false));
if (device->getHwInfo().capabilityTable.supportsImages) {
for (uint32_t builtId = 0; builtId < static_cast<uint32_t>(ImageBuiltin::COUNT); builtId++) {
@@ -87,7 +87,7 @@ HWTEST_F(TestBuiltinFunctionsLibImpl, givenCompilerInterfaceWhenCreateDeviceAndI
HWTEST_F(TestBuiltinFunctionsLibImpl, givenCompilerInterfaceWhenCreateDeviceThenBuiltinsFunctionsAreLoaded) {
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->compilerInterface.reset(new NEO::MockCompilerInterface());
std::unique_ptr<L0::Device> testDevice(Device::create(device->getDriverHandle(), neoDevice, std::numeric_limits<uint32_t>::max()));
std::unique_ptr<L0::Device> testDevice(Device::create(device->getDriverHandle(), neoDevice, std::numeric_limits<uint32_t>::max(), false));
for (uint32_t builtId = 0; builtId < static_cast<uint32_t>(Builtin::COUNT); builtId++) {
EXPECT_NE(nullptr, testDevice->getBuiltinFunctionsLib()->getFunction(static_cast<L0::Builtin>(builtId)));

View File

@@ -372,8 +372,6 @@ class MockDriverHandle : public L0::DriverHandleImp {
HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryCopyRegionCalledThenAppendMemoryCopyWithappendMemoryCopyWithBliterCalled, Platforms) {
MockCommandList<gfxCoreFamily> cmdList;
cmdList.initialize(device, true);
MockDriverHandle driverHandle;
device->setDriverHandle(&driverHandle);
void *srcPtr = reinterpret_cast<void *>(0x1234);
void *dstPtr = reinterpret_cast<void *>(0x2345);
ze_copy_region_t dstRegion = {};
@@ -385,8 +383,6 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenMemoryCopyRegionCalledThenAppen
HWTEST2_F(CommandListCreate, givenCommandListAnd3DWhbufferenMemoryCopyRegionCalledThenCopyKernel3DCalled, Platforms) {
MockCommandList<gfxCoreFamily> cmdList;
cmdList.initialize(device, false);
MockDriverHandle driverHandle;
device->setDriverHandle(&driverHandle);
void *srcPtr = reinterpret_cast<void *>(0x1234);
void *dstPtr = reinterpret_cast<void *>(0x2345);
ze_copy_region_t dstRegion = {4, 4, 4, 2, 2, 2};
@@ -468,8 +464,6 @@ HWTEST2_F(AppendMemoryCopy, givenCommandListAndHostPointersWhenMemoryCopyCalledT
HWTEST2_F(CommandListCreate, givenCommandListAnd2DWhbufferenMemoryCopyRegionCalledThenCopyKernel2DCalled, Platforms) {
MockCommandList<gfxCoreFamily> cmdList;
cmdList.initialize(device, false);
MockDriverHandle driverHandle;
device->setDriverHandle(&driverHandle);
void *srcPtr = reinterpret_cast<void *>(0x1234);
void *dstPtr = reinterpret_cast<void *>(0x2345);
ze_copy_region_t dstRegion = {4, 4, 0, 2, 2, 1};
@@ -664,8 +658,8 @@ HWTEST2_F(CommandListCreate, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBl
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
using XY_COLOR_BLT = typename GfxFamily::XY_COLOR_BLT;
MockCommandListForMemFill<gfxCoreFamily> commandList;
MockDriverHandle driverHandle;
device->setDriverHandle(&driverHandle);
MockDriverHandle driverHandleMock;
device->setDriverHandle(&driverHandleMock);
commandList.initialize(device, true);
uint16_t pattern = 1;
void *ptr = reinterpret_cast<void *>(0x1234);
@@ -675,6 +669,7 @@ HWTEST2_F(CommandListCreate, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBl
cmdList, ptrOffset(commandList.commandContainer.getCommandStream()->getCpuBase(), 0), commandList.commandContainer.getCommandStream()->getUsed()));
auto itor = find<XY_COLOR_BLT *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itor);
device->setDriverHandle(driverHandle.get());
}
using ImageSupport = IsWithinProducts<IGFX_SKYLAKE, IGFX_TIGERLAKE_LP>;
@@ -682,9 +677,6 @@ using ImageSupport = IsWithinProducts<IGFX_SKYLAKE, IGFX_TIGERLAKE_LP>;
HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyFromMemoryToImageThenBlitImageCopyCalled, ImageSupport) {
MockCommandList<gfxCoreFamily> cmdList;
cmdList.initialize(device, true);
MockDriverHandle driverHandle;
device->setDriverHandle(&driverHandle);
void *srcPtr = reinterpret_cast<void *>(0x1234);
ze_image_desc_t zeDesc = {};
@@ -699,9 +691,6 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyFromMemoryToImageThenBl
HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyFromImageToMemoryThenBlitImageCopyCalled, ImageSupport) {
MockCommandList<gfxCoreFamily> cmdList;
cmdList.initialize(device, true);
MockDriverHandle driverHandle;
device->setDriverHandle(&driverHandle);
void *dstPtr = reinterpret_cast<void *>(0x1234);
ze_image_desc_t zeDesc = {};
@@ -716,9 +705,6 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyFromImageToMemoryThenBl
HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyFromImageToImageThenBlitImageCopyCalled, ImageSupport) {
MockCommandList<gfxCoreFamily> cmdList;
cmdList.initialize(device, true);
MockDriverHandle driverHandle;
device->setDriverHandle(&driverHandle);
ze_image_desc_t zeDesc = {};
auto imageHWSrc = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();

View File

@@ -9,6 +9,7 @@
#include "shared/source/gen_common/reg_configs/reg_configs_common.h"
#include "shared/source/helpers/preamble.h"
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
#include "test.h"
@@ -76,5 +77,28 @@ TEST_F(DeviceWithDebuggerEnabledTest, givenDebuggingEnabledWhenDeviceIsCreatedTh
EXPECT_NE(nullptr, deviceL0->getDebugSurface());
}
struct TwoSubDevicesDebuggerEnabledTest : public ActiveDebuggerFixture, public ::testing::Test {
void SetUp() override { // NOLINT(readability-identifier-naming)
DebugManager.flags.CreateMultipleSubDevices.set(2);
VariableBackup<bool> mockDeviceFlagBackup(&MockDevice::createSingleDevice, false);
ActiveDebuggerFixture::SetUp();
}
void TearDown() override { // NOLINT(readability-identifier-naming)
ActiveDebuggerFixture::TearDown();
}
DebugManagerStateRestore restorer;
};
TEST_F(TwoSubDevicesDebuggerEnabledTest, givenDebuggingEnabledWhenSubDevicesAreCreatedThenDebugSurfaceFromRootDeviceIsSet) {
auto subDevice0 = static_cast<L0::DeviceImp *>(deviceL0)->subDevices[0];
auto subDevice1 = static_cast<L0::DeviceImp *>(deviceL0)->subDevices[1];
EXPECT_NE(nullptr, subDevice0->getDebugSurface());
EXPECT_NE(nullptr, subDevice1->getDebugSurface());
EXPECT_EQ(subDevice0->getDebugSurface(), subDevice1->getDebugSurface());
EXPECT_EQ(deviceL0->getDebugSurface(), subDevice0->getDebugSurface());
}
} // namespace ult
} // namespace L0