mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-28 16:48:45 +08:00
Fix scratch offset calculation in DebugSession
- account for ThreadEuRatio when calculating per-thread scratch offset Related-To: NEO-6677 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2ae3f3e521
commit
933fbd4f63
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -209,6 +209,13 @@ size_t DebugSession::getPerThreadScratchOffset(size_t ptss, EuThread::ThreadId t
|
||||
const uint32_t numEuPerSubslice = hwInfo.gtSystemInfo.MaxEuPerSubSlice;
|
||||
const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount);
|
||||
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
uint32_t threadEuRatio = hwInfoConfig.getThreadEuRatioForScratch(hwInfo);
|
||||
|
||||
if (threadEuRatio / numThreadsPerEu > 1) {
|
||||
ptss *= threadEuRatio / numThreadsPerEu;
|
||||
}
|
||||
|
||||
auto threadOffset = (((threadId.slice * numSubslicesPerSlice + threadId.subslice) * numEuPerSubslice + threadId.eu) * numThreadsPerEu + threadId.thread) * ptss;
|
||||
return threadOffset;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_XE_HPC_CORE)
|
||||
add_subdirectories()
|
||||
endif()
|
||||
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_PVC)
|
||||
set(NEO_TOOLS_TESTS_XE_HPC_CORE_PVC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_debug_session_pvc.cpp
|
||||
)
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE ${NEO_TOOLS_TESTS_XE_HPC_CORE_PVC})
|
||||
endif()
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/core/test/unit_tests/mock.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_device.h"
|
||||
#include "level_zero/tools/test/unit_tests/sources/debug/mock_debug_session.h"
|
||||
|
||||
using namespace L0;
|
||||
|
||||
using PVCDebugSession = ::testing::Test;
|
||||
|
||||
PVCTEST_F(PVCDebugSession, givenPVCRevId3WhenGettingPerThreadScratchOffsetThenPerThreadScratchOffsetIsBasedOnThreadEuRatio) {
|
||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.platform.usRevId = 3;
|
||||
|
||||
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(productFamily);
|
||||
|
||||
NEO::Device *neoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
L0::ult::Mock<L0::DeviceImp> deviceImp(neoDevice, neoDevice->getExecutionEnvironment());
|
||||
auto debugSession = std::make_unique<L0::ult::DebugSessionMock>(zet_debug_config_t{0x1234}, &deviceImp);
|
||||
|
||||
const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount);
|
||||
|
||||
EuThread::ThreadId thread0Eu0 = {0, 0, 0, 0, 0};
|
||||
EuThread::ThreadId thread0Eu1 = {0, 0, 0, 1, 0};
|
||||
EuThread::ThreadId thread2Subslice1 = {0, 0, 1, 0, 2};
|
||||
|
||||
const uint32_t ptss = 128;
|
||||
const uint32_t adjustedPtss = hwInfoConfig.getThreadEuRatioForScratch(hwInfo) / numThreadsPerEu * ptss;
|
||||
|
||||
EXPECT_EQ(2u, hwInfoConfig.getThreadEuRatioForScratch(hwInfo) / numThreadsPerEu);
|
||||
|
||||
auto offset = debugSession->getPerThreadScratchOffset(ptss, thread0Eu0);
|
||||
EXPECT_EQ(0u, offset);
|
||||
|
||||
offset = debugSession->getPerThreadScratchOffset(ptss, thread0Eu1);
|
||||
EXPECT_EQ(adjustedPtss * numThreadsPerEu, offset);
|
||||
|
||||
offset = debugSession->getPerThreadScratchOffset(ptss, thread2Subslice1);
|
||||
EXPECT_EQ(2 * adjustedPtss + adjustedPtss * hwInfo.gtSystemInfo.MaxEuPerSubSlice * numThreadsPerEu, offset);
|
||||
}
|
||||
Reference in New Issue
Block a user