Refactor getSingleThreads()
- return ThreadIds for chosen device index from ze_device_thread_t Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
parent
f6c8fb47bb
commit
a27b839976
|
@ -83,14 +83,14 @@ DebugSession::DebugSession(const zet_debug_config_t &config, Device *device) : c
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<ze_device_thread_t> DebugSession::getSingleThreads(ze_device_thread_t physicalThread, const NEO::HardwareInfo &hwInfo) {
|
||||
std::vector<EuThread::ThreadId> DebugSession::getSingleThreadsForDevice(uint32_t deviceIndex, ze_device_thread_t physicalThread, const NEO::HardwareInfo &hwInfo) {
|
||||
const uint32_t numSubslicesPerSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported;
|
||||
const uint32_t numEuPerSubslice = hwInfo.gtSystemInfo.MaxEuPerSubSlice;
|
||||
const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount);
|
||||
|
||||
UNRECOVERABLE_IF(numThreadsPerEu > 8);
|
||||
|
||||
std::vector<ze_device_thread_t> threads;
|
||||
std::vector<EuThread::ThreadId> threads;
|
||||
|
||||
const uint32_t slice = physicalThread.slice;
|
||||
const uint32_t subslice = physicalThread.subslice;
|
||||
|
@ -116,7 +116,7 @@ std::vector<ze_device_thread_t> DebugSession::getSingleThreads(ze_device_thread_
|
|||
if (thread != UINT32_MAX) {
|
||||
threadID = thread;
|
||||
}
|
||||
threads.push_back({sliceID, subsliceID, euID, threadID});
|
||||
threads.push_back({deviceIndex, sliceID, subsliceID, euID, threadID});
|
||||
|
||||
if (thread != UINT32_MAX) {
|
||||
break;
|
||||
|
@ -143,11 +143,10 @@ bool DebugSession::areRequestedThreadsStopped(ze_device_thread_t thread) {
|
|||
auto hwInfo = connectedDevice->getHwInfo();
|
||||
uint32_t deviceIndex = 0;
|
||||
auto physicalThread = convertToPhysical(thread, deviceIndex);
|
||||
auto singleThreads = getSingleThreads(physicalThread, hwInfo);
|
||||
auto singleThreads = getSingleThreadsForDevice(deviceIndex, physicalThread, hwInfo);
|
||||
bool requestedThreadsStopped = true;
|
||||
|
||||
for (auto &thread : singleThreads) {
|
||||
EuThread::ThreadId threadId = {deviceIndex, thread.slice, thread.subslice, thread.eu, thread.thread};
|
||||
for (auto &threadId : singleThreads) {
|
||||
|
||||
if (allThreads[threadId]->isStopped()) {
|
||||
continue;
|
||||
|
|
|
@ -80,7 +80,7 @@ struct DebugSession : _zet_debug_session_handle_t {
|
|||
virtual bool isBindlessSystemRoutine();
|
||||
virtual bool readModuleDebugArea() = 0;
|
||||
|
||||
std::vector<ze_device_thread_t> getSingleThreads(ze_device_thread_t physicalThread, const NEO::HardwareInfo &hwInfo);
|
||||
std::vector<EuThread::ThreadId> getSingleThreadsForDevice(uint32_t deviceIndex, ze_device_thread_t physicalThread, const NEO::HardwareInfo &hwInfo);
|
||||
|
||||
DebugAreaHeader debugArea;
|
||||
|
||||
|
|
|
@ -168,9 +168,11 @@ TEST(DebugSession, givenSingleThreadWhenGettingSingleThreadsThenCorrectThreadIsR
|
|||
auto subslice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported - 1;
|
||||
ze_device_thread_t physicalThread = {0, subslice, 2, 3};
|
||||
|
||||
auto threads = debugSession->getSingleThreads(physicalThread, hwInfo);
|
||||
auto threads = debugSession->getSingleThreadsForDevice(0, physicalThread, hwInfo);
|
||||
|
||||
EXPECT_EQ(1u, threads.size());
|
||||
|
||||
EXPECT_EQ(0u, threads[0].tileIndex);
|
||||
EXPECT_EQ(0u, threads[0].slice);
|
||||
EXPECT_EQ(subslice, threads[0].subslice);
|
||||
EXPECT_EQ(2u, threads[0].eu);
|
||||
|
@ -190,11 +192,12 @@ TEST(DebugSession, givenAllThreadsWhenGettingSingleThreadsThenCorrectThreadsAreR
|
|||
ze_device_thread_t physicalThread = {0, subslice, 2, UINT32_MAX};
|
||||
const uint32_t numThreadsPerEu = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount);
|
||||
|
||||
auto threads = debugSession->getSingleThreads(physicalThread, hwInfo);
|
||||
auto threads = debugSession->getSingleThreadsForDevice(0, physicalThread, hwInfo);
|
||||
|
||||
EXPECT_EQ(numThreadsPerEu, threads.size());
|
||||
|
||||
for (uint32_t i = 0; i < numThreadsPerEu; i++) {
|
||||
EXPECT_EQ(0u, threads[i].tileIndex);
|
||||
EXPECT_EQ(0u, threads[i].slice);
|
||||
EXPECT_EQ(subslice, threads[i].subslice);
|
||||
EXPECT_EQ(2u, threads[i].eu);
|
||||
|
@ -215,7 +218,7 @@ TEST(DebugSession, givenAllEUsWhenGettingSingleThreadsThenCorrectThreadsAreRetur
|
|||
ze_device_thread_t physicalThread = {0, subslice, UINT32_MAX, 0};
|
||||
const uint32_t numEuPerSubslice = hwInfo.gtSystemInfo.MaxEuPerSubSlice;
|
||||
|
||||
auto threads = debugSession->getSingleThreads(physicalThread, hwInfo);
|
||||
auto threads = debugSession->getSingleThreadsForDevice(0, physicalThread, hwInfo);
|
||||
|
||||
EXPECT_EQ(numEuPerSubslice, threads.size());
|
||||
|
||||
|
@ -239,7 +242,7 @@ TEST(DebugSession, givenAllSubslicesWhenGettingSingleThreadsThenCorrectThreadsAr
|
|||
ze_device_thread_t physicalThread = {0, UINT32_MAX, 0, 0};
|
||||
const uint32_t numSubslicesPerSlice = hwInfo.gtSystemInfo.MaxSubSlicesSupported / hwInfo.gtSystemInfo.MaxSlicesSupported;
|
||||
|
||||
auto threads = debugSession->getSingleThreads(physicalThread, hwInfo);
|
||||
auto threads = debugSession->getSingleThreadsForDevice(0, physicalThread, hwInfo);
|
||||
|
||||
EXPECT_EQ(numSubslicesPerSlice, threads.size());
|
||||
|
||||
|
@ -263,11 +266,12 @@ TEST(DebugSession, givenAllSlicesWhenGettingSingleThreadsThenCorrectThreadsAreRe
|
|||
ze_device_thread_t physicalThread = {UINT32_MAX, 0, 0, 0};
|
||||
const uint32_t numSlices = hwInfo.gtSystemInfo.MaxSlicesSupported;
|
||||
|
||||
auto threads = debugSession->getSingleThreads(physicalThread, hwInfo);
|
||||
auto threads = debugSession->getSingleThreadsForDevice(0, physicalThread, hwInfo);
|
||||
|
||||
EXPECT_EQ(numSlices, threads.size());
|
||||
|
||||
for (uint32_t i = 0; i < numSlices; i++) {
|
||||
EXPECT_EQ(0u, threads[i].tileIndex);
|
||||
EXPECT_EQ(i, threads[i].slice);
|
||||
EXPECT_EQ(0u, threads[i].subslice);
|
||||
EXPECT_EQ(0u, threads[i].eu);
|
||||
|
|
|
@ -26,7 +26,7 @@ class OsInterfaceWithDebugAttach : public NEO::OSInterface {
|
|||
struct DebugSessionMock : public L0::DebugSession {
|
||||
using L0::DebugSession::allThreads;
|
||||
using L0::DebugSession::debugArea;
|
||||
using L0::DebugSession::getSingleThreads;
|
||||
using L0::DebugSession::getSingleThreadsForDevice;
|
||||
using L0::DebugSession::isBindlessSystemRoutine;
|
||||
|
||||
DebugSessionMock(const zet_debug_config_t &config, L0::Device *device) : DebugSession(config, device), config(config){};
|
||||
|
|
Loading…
Reference in New Issue