L0Debug - Fix scratch offset calculation

- euRatio should only affect EUs offsets - not thread offsets

Resolves: NEO-7520

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2022-11-17 13:38:40 +00:00
committed by Compute-Runtime-Automation
parent 54db9fddb7
commit e0370d25b9
2 changed files with 10 additions and 6 deletions

View File

@@ -278,12 +278,12 @@ size_t DebugSession::getPerThreadScratchOffset(size_t ptss, EuThread::ThreadId t
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily); const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
uint32_t threadEuRatio = hwInfoConfig.getThreadEuRatioForScratch(hwInfo); uint32_t threadEuRatio = hwInfoConfig.getThreadEuRatioForScratch(hwInfo);
uint32_t multiplyFactor = 1;
if (threadEuRatio / numThreadsPerEu > 1) { if (threadEuRatio / numThreadsPerEu > 1) {
ptss *= threadEuRatio / numThreadsPerEu; multiplyFactor = threadEuRatio / numThreadsPerEu;
} }
auto threadOffset = (((threadId.slice * numSubslicesPerSlice + threadId.subslice) * numEuPerSubslice + threadId.eu) * numThreadsPerEu + threadId.thread) * ptss; auto threadOffset = (((threadId.slice * numSubslicesPerSlice + threadId.subslice) * numEuPerSubslice + threadId.eu) * numThreadsPerEu * multiplyFactor + threadId.thread) * ptss;
return threadOffset; return threadOffset;
} }

View File

@@ -36,9 +36,10 @@ PVCTEST_F(PVCDebugSession, givenPVCRevId3WhenGettingPerThreadScratchOffsetThenPe
EuThread::ThreadId thread0Eu0 = {0, 0, 0, 0, 0}; EuThread::ThreadId thread0Eu0 = {0, 0, 0, 0, 0};
EuThread::ThreadId thread0Eu1 = {0, 0, 0, 1, 0}; EuThread::ThreadId thread0Eu1 = {0, 0, 0, 1, 0};
EuThread::ThreadId thread2Subslice1 = {0, 0, 1, 0, 2}; EuThread::ThreadId thread2Subslice1 = {0, 0, 1, 0, 2};
EuThread::ThreadId thread2EuLastSubslice1 = {0, 0, 1, hwInfo.gtSystemInfo.MaxEuPerSubSlice - 1, 2};
const uint32_t ptss = 128; const uint32_t ptss = 128;
const uint32_t adjustedPtss = hwInfoConfig.getThreadEuRatioForScratch(hwInfo) / numThreadsPerEu * ptss; const uint32_t ratio = hwInfoConfig.getThreadEuRatioForScratch(hwInfo) / numThreadsPerEu;
EXPECT_EQ(2u, hwInfoConfig.getThreadEuRatioForScratch(hwInfo) / numThreadsPerEu); EXPECT_EQ(2u, hwInfoConfig.getThreadEuRatioForScratch(hwInfo) / numThreadsPerEu);
@@ -46,8 +47,11 @@ PVCTEST_F(PVCDebugSession, givenPVCRevId3WhenGettingPerThreadScratchOffsetThenPe
EXPECT_EQ(0u, offset); EXPECT_EQ(0u, offset);
offset = debugSession->getPerThreadScratchOffset(ptss, thread0Eu1); offset = debugSession->getPerThreadScratchOffset(ptss, thread0Eu1);
EXPECT_EQ(adjustedPtss * numThreadsPerEu, offset); EXPECT_EQ(ptss * numThreadsPerEu * ratio, offset);
offset = debugSession->getPerThreadScratchOffset(ptss, thread2Subslice1); offset = debugSession->getPerThreadScratchOffset(ptss, thread2Subslice1);
EXPECT_EQ(2 * adjustedPtss + adjustedPtss * hwInfo.gtSystemInfo.MaxEuPerSubSlice * numThreadsPerEu, offset); EXPECT_EQ((thread2Subslice1.subslice * hwInfo.gtSystemInfo.MaxEuPerSubSlice * numThreadsPerEu * ratio + thread2Subslice1.thread) * ptss, offset);
offset = debugSession->getPerThreadScratchOffset(ptss, thread2EuLastSubslice1);
EXPECT_EQ(((thread2EuLastSubslice1.subslice * hwInfo.gtSystemInfo.MaxEuPerSubSlice + thread2EuLastSubslice1.eu) * numThreadsPerEu * ratio + thread2EuLastSubslice1.thread) * ptss, offset);
} }