mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
L0 debug - Fix thread creation for windows DSS
Signed-off-by: Yates, Brandon <brandon.yates@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
518016f20f
commit
3724807eed
@@ -7,7 +7,11 @@
|
||||
|
||||
template <>
|
||||
void L0HwHelperHw<Family>::getAttentionBitmaskForSingleThreads(const std::vector<EuThread::ThreadId> &threads, const NEO::HardwareInfo &hwInfo, std::unique_ptr<uint8_t[]> &bitmask, size_t &bitmaskSize) const {
|
||||
const uint32_t numSubslicesPerSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported;
|
||||
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 numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount);
|
||||
const uint32_t bytesPerEu = alignUp(numThreadsPerEu, 8) / 8;
|
||||
const uint32_t numEuPerSubslice = std::min(hwInfo.gtSystemInfo.MaxEuPerSubSlice, 8u);
|
||||
@@ -36,7 +40,12 @@ void L0HwHelperHw<Family>::getAttentionBitmaskForSingleThreads(const std::vector
|
||||
|
||||
template <>
|
||||
std::vector<EuThread::ThreadId> L0HwHelperHw<Family>::getThreadsFromAttentionBitmask(const NEO::HardwareInfo &hwInfo, uint32_t tile, const uint8_t *bitmask, const size_t bitmaskSize) const {
|
||||
const uint32_t numSubslicesPerSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported;
|
||||
|
||||
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 = std::min(hwInfo.gtSystemInfo.MaxEuPerSubSlice, 8u);
|
||||
const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount);
|
||||
const uint32_t bytesPerEu = alignUp(numThreadsPerEu, 8) / 8;
|
||||
|
||||
@@ -377,6 +377,58 @@ HWTEST_F(L0HwHelperTest, givenBitmaskWithAttentionBitsForHalfOfThreadsWhenGettin
|
||||
using PlatformsWithFusedEus = IsWithinGfxCore<IGFX_GEN12LP_CORE, IGFX_XE_HPG_CORE>;
|
||||
using L0HwHelperFusedEuTest = ::testing::Test;
|
||||
|
||||
HWTEST2_F(L0HwHelperTest, givenBitmaskWithAttentionBitsWithDSSWhenGettingThreadsThenSingleCorrectThreadReturned, PlatformsWithFusedEus) {
|
||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||
auto &l0HwHelper = L0::L0HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
hwInfo.gtSystemInfo.MaxEuPerSubSlice = 8;
|
||||
hwInfo.gtSystemInfo.MaxSubSlicesSupported = 64;
|
||||
hwInfo.gtSystemInfo.MaxDualSubSlicesSupported = 32;
|
||||
|
||||
std::unique_ptr<uint8_t[]> bitmask;
|
||||
size_t size = 0;
|
||||
|
||||
uint32_t subsliceID = 3;
|
||||
|
||||
std::vector<EuThread::ThreadId> threadsWithAtt;
|
||||
threadsWithAtt.push_back({0, 0, subsliceID, 8, 0});
|
||||
|
||||
l0HwHelper.getAttentionBitmaskForSingleThreads(threadsWithAtt, hwInfo, bitmask, size);
|
||||
|
||||
auto threads = l0HwHelper.getThreadsFromAttentionBitmask(hwInfo, 0, bitmask.get(), size);
|
||||
|
||||
ASSERT_EQ(2u, threads.size());
|
||||
|
||||
EXPECT_EQ(0u, threads[0].slice);
|
||||
EXPECT_EQ(subsliceID, threads[0].subslice);
|
||||
EXPECT_EQ(8u, threads[0].eu);
|
||||
EXPECT_EQ(0u, threads[0].thread);
|
||||
EXPECT_EQ(0u, threads[0].tileIndex);
|
||||
|
||||
EXPECT_EQ(0u, threads[1].slice);
|
||||
EXPECT_EQ(subsliceID, threads[1].subslice);
|
||||
EXPECT_EQ(12u, threads[1].eu);
|
||||
EXPECT_EQ(0u, threads[1].thread);
|
||||
EXPECT_EQ(0u, threads[1].tileIndex);
|
||||
|
||||
hwInfo.gtSystemInfo.MaxDualSubSlicesSupported = 0;
|
||||
l0HwHelper.getAttentionBitmaskForSingleThreads(threadsWithAtt, hwInfo, bitmask, size);
|
||||
|
||||
threads = l0HwHelper.getThreadsFromAttentionBitmask(hwInfo, 0, bitmask.get(), size);
|
||||
|
||||
ASSERT_EQ(2u, threads.size());
|
||||
EXPECT_EQ(0u, threads[0].slice);
|
||||
EXPECT_EQ(subsliceID, threads[0].subslice);
|
||||
EXPECT_EQ(8u, threads[0].eu);
|
||||
EXPECT_EQ(0u, threads[0].thread);
|
||||
EXPECT_EQ(0u, threads[0].tileIndex);
|
||||
|
||||
EXPECT_EQ(0u, threads[1].slice);
|
||||
EXPECT_EQ(subsliceID, threads[1].subslice);
|
||||
EXPECT_EQ(12u, threads[1].eu);
|
||||
EXPECT_EQ(0u, threads[1].thread);
|
||||
EXPECT_EQ(0u, threads[1].tileIndex);
|
||||
}
|
||||
|
||||
HWTEST2_F(L0HwHelperFusedEuTest, givenDynamicallyPopulatesSliceInfoGreaterThanMaxSlicesSupportedThenBitmasksAreCorrect, PlatformsWithFusedEus) {
|
||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||
auto &l0HwHelper = L0::L0HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user