refactor: numThreadsPerEu

Signed-off-by: Radoslaw Jablonski <radoslaw.jablonski@intel.com>
This commit is contained in:
Radoslaw Jablonski
2025-08-20 17:36:09 +00:00
committed by Compute-Runtime-Automation
parent 26d9fa49cd
commit 393604ef80
61 changed files with 175 additions and 208 deletions

View File

@@ -107,7 +107,7 @@ TEST(DebugSessionTest, givenAllStoppedThreadsWhenInterruptCalledThenErrorNotAvai
auto sessionMock = std::make_unique<MockDebugSession>(config, &deviceImp);
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount; i++) {
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.NumThreadsPerEu; i++) {
EuThread::ThreadId thread(0, 0, 0, 0, i);
sessionMock->allThreads[thread]->stopThread(1u);
sessionMock->allThreads[thread]->reportAsStopped();
@@ -977,7 +977,7 @@ TEST(DebugSessionTest, givenSomeThreadsRunningWhenResumeCalledThenOnlyStoppedThr
ze_device_thread_t thread = {0, 0, 0, UINT32_MAX};
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount; i++) {
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.NumThreadsPerEu; i++) {
EuThread::ThreadId thread(0, 0, 0, 0, i);
sessionMock->allThreads[thread]->stopThread(1u);
sessionMock->allThreads[thread]->reportAsStopped();
@@ -989,9 +989,9 @@ TEST(DebugSessionTest, givenSomeThreadsRunningWhenResumeCalledThenOnlyStoppedThr
auto result = sessionMock->resume(thread);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount - 1u, sessionMock->resumeThreadCount);
EXPECT_EQ(hwInfo.gtSystemInfo.NumThreadsPerEu - 1u, sessionMock->resumeThreadCount);
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount; i++) {
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.NumThreadsPerEu; i++) {
EuThread::ThreadId thread(0, 0, 0, 0, i);
EXPECT_TRUE(sessionMock->allThreads[thread]->isRunning());
}
@@ -1018,7 +1018,7 @@ TEST(DebugSessionTest, givenStoppedThreadsWhenResumeAllCalledThenOnlyReportedSto
sessionMock->stateSaveAreaHeader.resize(size);
}
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount; i++) {
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.NumThreadsPerEu; i++) {
// set reportAsStopped threads from EU0
EuThread::ThreadId thread(0, 0, 0, 0, i);
sessionMock->allThreads[thread]->stopThread(1u);
@@ -1034,9 +1034,9 @@ TEST(DebugSessionTest, givenStoppedThreadsWhenResumeAllCalledThenOnlyReportedSto
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
// only threads from EU0 resumed
EXPECT_EQ(hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount, sessionMock->resumeThreadCount);
EXPECT_EQ(hwInfo.gtSystemInfo.NumThreadsPerEu, sessionMock->resumeThreadCount);
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount; i++) {
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.NumThreadsPerEu; i++) {
EuThread::ThreadId thread(0, 0, 0, 0, i);
EXPECT_TRUE(sessionMock->allThreads[thread]->isRunning());
@@ -1065,7 +1065,7 @@ TEST(DebugSessionTest, givenMultipleStoppedThreadsWhenResumeAllCalledThenStateSa
sessionMock->stateSaveAreaHeader.resize(size);
}
auto threadCount = hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount;
auto threadCount = hwInfo.gtSystemInfo.NumThreadsPerEu;
for (uint32_t i = 0; i < threadCount; i++) {
// set reportAsStopped threads from EU0
EuThread::ThreadId thread(0, 0, 0, 0, i);
@@ -1137,7 +1137,7 @@ TEST(DebugSessionTest, givenMultipleStoppedThreadsWhenResumeAllCalledThenStateSa
pStateSaveAreaHeader->regHeader.state_save_size * 16;
sessionMock->stateSaveAreaHeader.resize(size);
auto threadCount = hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount;
auto threadCount = hwInfo.gtSystemInfo.NumThreadsPerEu;
for (uint32_t i = 0; i < threadCount; i++) {
// set reportAsStopped threads from EU0
EuThread::ThreadId thread(0, 0, 0, 0, i);
@@ -1185,7 +1185,7 @@ TEST(DebugSessionTest, givenMultipleStoppedThreadsAndInvalidStateSaveAreaWhenRes
auto sessionMock = std::make_unique<MockDebugSession>(config, &deviceImp);
sessionMock->forceZeroStateSaveAreaSize = true;
auto threadCount = hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount;
auto threadCount = hwInfo.gtSystemInfo.NumThreadsPerEu;
for (uint32_t i = 0; i < threadCount; i++) {
EuThread::ThreadId thread(0, 0, 0, 0, i);
sessionMock->allThreads[thread]->stopThread(1u);

View File

@@ -225,7 +225,7 @@ TEST(DebugSession, givenAllThreadsWhenGettingSingleThreadsThenCorrectThreadsAreR
auto subslice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported - 1;
ze_device_thread_t physicalThread = {0, subslice, 2, UINT32_MAX};
const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount);
const uint32_t numThreadsPerEu = hwInfo.gtSystemInfo.NumThreadsPerEu;
auto threads = debugSession->getSingleThreadsForDevice(0, physicalThread, hwInfo);
@@ -398,7 +398,7 @@ TEST(DebugSession, givenAllStoppedThreadsWhenAreRequestedThreadsStoppedCalledThe
auto sessionMock = std::make_unique<DebugSessionMock>(config, &deviceImp);
sessionMock->initialize();
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount; i++) {
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.NumThreadsPerEu; i++) {
EuThread::ThreadId thread(0, 0, 0, 0, i);
sessionMock->allThreads[thread]->stopThread(1u);
sessionMock->allThreads[thread]->reportAsStopped();
@@ -418,7 +418,7 @@ TEST(DebugSession, givenSomeStoppedThreadsWhenAreRequestedThreadsStoppedCalledTh
auto sessionMock = std::make_unique<DebugSessionMock>(config, &deviceImp);
sessionMock->initialize();
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount; i++) {
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.NumThreadsPerEu; i++) {
EuThread::ThreadId thread(0, 0, 0, 0, i);
if (i % 2) {
sessionMock->allThreads[thread]->stopThread(1u);
@@ -477,7 +477,7 @@ TEST(DebugSession, givenDifferentCombinationsOfThreadsAndMemoryTypeCheckExpected
retVal = sessionMock->sanityMemAccessThreadCheck(thread, &desc);
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, retVal);
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount; i++) {
for (uint32_t i = 0; i < hwInfo.gtSystemInfo.NumThreadsPerEu; i++) {
EuThread::ThreadId thread(0, 0, 0, 0, i);
sessionMock->allThreads[thread]->stopThread(1u);
sessionMock->allThreads[thread]->reportAsStopped();
@@ -495,7 +495,7 @@ TEST(DebugSession, givenDifferentThreadsWhenGettingPerThreadScratchOffsetThenCor
auto &productHelper = neoDevice->getProductHelper();
const uint32_t multiplyFactor = productHelper.getThreadEuRatioForScratch(hwInfo) / 8u;
const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount) * multiplyFactor;
const uint32_t numThreadsPerEu = hwInfo.gtSystemInfo.NumThreadsPerEu * multiplyFactor;
EuThread::ThreadId thread0Eu0 = {0, 0, 0, 0, 0};
EuThread::ThreadId thread0Eu1 = {0, 0, 0, 1, 0};
EuThread::ThreadId thread2Subslice1 = {0, 0, 1, 0, 2};

View File

@@ -5762,12 +5762,12 @@ HWTEST_F(DebugApiLinuxTest, GivenErrorFromSynchronousAttScanWhenMultipleThreadsP
}
HWTEST2_F(DebugApiLinuxTest, GivenResumeWARequiredWhenCallingResumeThenWaIsAppliedToBitmask, IsAtMostXe2HpgCore) {
auto hwInfo = *NEO::defaultHwInfo.get();
zet_debug_config_t config = {};
config.pid = 0x1234;
auto &l0GfxCoreHelper = neoDevice->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
auto releaseHelper = neoDevice->getRootDeviceEnvironment().getReleaseHelper();
auto numBytesPerThread = releaseHelper ? Math::divideAndRoundUp(releaseHelper->getNumThreadsPerEu(), 8u) : 1u;
auto numBytesPerThread = Math::divideAndRoundUp(hwInfo.gtSystemInfo.NumThreadsPerEu, 8u);
auto sessionMock = std::make_unique<MockDebugSessionLinuxi915>(config, device, 10);
ASSERT_NE(nullptr, sessionMock);
SIP::version version = {2, 0, 0};

View File

@@ -29,7 +29,7 @@ PVCTEST_F(PVCDebugSession, givenPVCRevId3WhenGettingPerThreadScratchOffsetThenPe
L0::ult::MockDeviceImp deviceImp(neoDevice);
auto debugSession = std::make_unique<L0::ult::DebugSessionMock>(zet_debug_config_t{0x1234}, &deviceImp);
const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount);
const uint32_t numThreadsPerEu = hwInfo.gtSystemInfo.NumThreadsPerEu;
EuThread::ThreadId thread0Eu0 = {0, 0, 0, 0, 0};
EuThread::ThreadId thread0Eu1 = {0, 0, 0, 1, 0};
@@ -54,4 +54,4 @@ PVCTEST_F(PVCDebugSession, givenPVCRevId3WhenGettingPerThreadScratchOffsetThenPe
offset = debugSession->getPerThreadScratchOffset(ptss, thread2EuLastSubslice1);
EXPECT_EQ(((thread2EuLastSubslice1.subslice * hwInfo.gtSystemInfo.MaxEuPerSubSlice + thread2EuLastSubslice1.eu) * numThreadsPerEu * ratio + thread2EuLastSubslice1.thread) * ptss, offset);
}
}