L0 debug - Fix thread creation for windows DSS

Signed-off-by: Yates, Brandon <brandon.yates@intel.com>
This commit is contained in:
Yates, Brandon
2022-10-20 18:08:43 +00:00
committed by Compute-Runtime-Automation
parent 518016f20f
commit 3724807eed
4 changed files with 106 additions and 5 deletions

View File

@@ -31,13 +31,16 @@ void DebugSession::createEuThreads() {
bool isSubDevice = connectedDevice->getNEODevice()->isSubDevice();
auto &hwInfo = connectedDevice->getHwInfo();
const uint32_t numSubslicesPerSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported;
const uint32_t numEuPerSubslice = hwInfo.gtSystemInfo.MaxEuPerSubSlice;
const bool useDSS = (hwInfo.gtSystemInfo.MaxDualSubSlicesSupported > 0) &&
(hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxDualSubSlicesSupported) == 2
? true
: false;
const uint32_t numSubslicesPerSlice = (useDSS ? hwInfo.gtSystemInfo.MaxDualSubSlicesSupported : hwInfo.gtSystemInfo.MaxSubSlicesSupported) / hwInfo.gtSystemInfo.MaxSlicesSupported;
const uint32_t numEuPerSubslice = useDSS ? hwInfo.gtSystemInfo.MaxEuPerSubSlice * 2 : hwInfo.gtSystemInfo.MaxEuPerSubSlice;
const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount);
uint32_t subDeviceCount = std::max(1u, connectedDevice->getNEODevice()->getNumSubDevices());
UNRECOVERABLE_IF(isSubDevice && subDeviceCount > 1);
for (uint32_t tileIndex = 0; tileIndex < subDeviceCount; tileIndex++) {
if (isSubDevice || subDeviceCount == 1) {

View File

@@ -363,6 +363,43 @@ struct MockDebugSession : public L0::DebugSessionImp {
using DebugSessionTest = ::testing::Test;
TEST(DeviceWithDebugSessionTest, GivenDSSWhenCreatingThreadsThenAllThreadsHasCorrectValuesMapped) {
auto hwInfo = *NEO::defaultHwInfo;
hwInfo.gtSystemInfo.MaxEuPerSubSlice = 8;
hwInfo.gtSystemInfo.MaxSubSlicesSupported = 64;
hwInfo.gtSystemInfo.MaxDualSubSlicesSupported = 32;
NEO::MockDevice *neoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
Mock<L0::DeviceImp> deviceImp(neoDevice, neoDevice->getExecutionEnvironment());
auto sessionMock = std::make_unique<MockDebugSession>(zet_debug_config_t{0x1234}, &deviceImp);
const uint32_t numSubslicesPerSlice = hwInfo.gtSystemInfo.MaxDualSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported;
EXPECT_EQ(1u, sessionMock->allThreads.count(EuThread::ThreadId(0, 0, numSubslicesPerSlice - 1, 0, 0)));
EXPECT_EQ(0u, sessionMock->allThreads.count(EuThread::ThreadId(0, 0, numSubslicesPerSlice + 1, 0, 0)));
EXPECT_EQ(1u, sessionMock->allThreads.count(EuThread::ThreadId(0, 0, numSubslicesPerSlice - 1, 7, 0)));
EXPECT_EQ(1u, sessionMock->allThreads.count(EuThread::ThreadId(0, 0, numSubslicesPerSlice - 1, 15, 0)));
}
TEST(DeviceWithDebugSessionTest, GivenMaxDualSubslicesIsZeroWhenCreatingThreadsThenAllThreadsIsCorrectSize) {
auto hwInfo = *NEO::defaultHwInfo;
hwInfo.gtSystemInfo.MaxEuPerSubSlice = 8;
hwInfo.gtSystemInfo.MaxSubSlicesSupported = 64;
hwInfo.gtSystemInfo.MaxDualSubSlicesSupported = 0;
NEO::MockDevice *neoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
Mock<L0::DeviceImp> deviceImp(neoDevice, neoDevice->getExecutionEnvironment());
auto sessionMock = std::make_unique<MockDebugSession>(zet_debug_config_t{0x1234}, &deviceImp);
const uint32_t numSubslicesPerSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported;
EXPECT_EQ(1u, sessionMock->allThreads.count(EuThread::ThreadId(0, 0, numSubslicesPerSlice - 1, 0, 0)));
EXPECT_EQ(0u, sessionMock->allThreads.count(EuThread::ThreadId(0, 0, numSubslicesPerSlice + 1, 0, 0)));
}
TEST(DeviceWithDebugSessionTest, GivenDeviceWithDebugSessionWhenCallingReleaseResourcesThenCloseConnectionIsCalled) {
ze_result_t returnValue = ZE_RESULT_SUCCESS;
std::unique_ptr<DriverHandleImp> driverHandle(new DriverHandleImp);