mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 19:32:25 +08:00
Refactor DebugSession
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e11e00763a
commit
51967a4f67
@@ -56,7 +56,7 @@ ze_device_thread_t DebugSession::convertToApi(EuThread::ThreadId threadId) {
|
||||
return thread;
|
||||
}
|
||||
|
||||
RootDebugSession::RootDebugSession(const zet_debug_config_t &config, Device *device) : DebugSession(config, device) {
|
||||
DebugSession::DebugSession(const zet_debug_config_t &config, Device *device) : connectedDevice(device) {
|
||||
|
||||
if (connectedDevice) {
|
||||
auto hwInfo = connectedDevice->getHwInfo();
|
||||
@@ -83,7 +83,7 @@ RootDebugSession::RootDebugSession(const zet_debug_config_t &config, Device *dev
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<ze_device_thread_t> RootDebugSession::getSingleThreads(ze_device_thread_t physicalThread, const NEO::HardwareInfo &hwInfo) {
|
||||
std::vector<ze_device_thread_t> DebugSession::getSingleThreads(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);
|
||||
@@ -139,7 +139,7 @@ std::vector<ze_device_thread_t> RootDebugSession::getSingleThreads(ze_device_thr
|
||||
return threads;
|
||||
}
|
||||
|
||||
bool RootDebugSession::isBindlessSystemRoutine() {
|
||||
bool DebugSession::isBindlessSystemRoutine() {
|
||||
if (debugArea.reserved1 &= 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -73,27 +73,17 @@ struct DebugSession : _zet_debug_session_handle_t {
|
||||
virtual ze_device_thread_t convertToApi(EuThread::ThreadId threadId);
|
||||
|
||||
protected:
|
||||
DebugSession(const zet_debug_config_t &config, Device *device) : connectedDevice(device){};
|
||||
DebugSession(const zet_debug_config_t &config, Device *device);
|
||||
virtual void startAsyncThread() = 0;
|
||||
|
||||
virtual bool isBindlessSystemRoutine() = 0;
|
||||
|
||||
Device *connectedDevice = nullptr;
|
||||
};
|
||||
|
||||
struct RootDebugSession : DebugSession {
|
||||
virtual ~RootDebugSession() = default;
|
||||
RootDebugSession() = delete;
|
||||
|
||||
protected:
|
||||
RootDebugSession(const zet_debug_config_t &config, Device *device);
|
||||
|
||||
virtual bool isBindlessSystemRoutine();
|
||||
virtual bool readModuleDebugArea() = 0;
|
||||
|
||||
std::vector<ze_device_thread_t> getSingleThreads(ze_device_thread_t physicalThread, const NEO::HardwareInfo &hwInfo);
|
||||
bool isBindlessSystemRoutine() override;
|
||||
|
||||
DebugAreaHeader debugArea;
|
||||
|
||||
Device *connectedDevice = nullptr;
|
||||
std::map<uint64_t, std::unique_ptr<EuThread>> allThreads;
|
||||
};
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ TEST(DebugSession, givenThreadWhenCheckSingleThreadWithinDeviceThreadCalledThenT
|
||||
EXPECT_FALSE(DebugSession::checkSingleThreadWithinDeviceThread(thread, thread2));
|
||||
}
|
||||
|
||||
TEST(RootDebugSession, givenSingleThreadWhenGettingSingleThreadsThenCorrectThreadIsReturned) {
|
||||
TEST(DebugSession, givenSingleThreadWhenGettingSingleThreadsThenCorrectThreadIsReturned) {
|
||||
zet_debug_config_t config = {};
|
||||
config.pid = 0x1234;
|
||||
|
||||
@@ -177,7 +177,7 @@ TEST(RootDebugSession, givenSingleThreadWhenGettingSingleThreadsThenCorrectThrea
|
||||
EXPECT_EQ(3u, threads[0].thread);
|
||||
}
|
||||
|
||||
TEST(RootDebugSession, givenAllThreadsWhenGettingSingleThreadsThenCorrectThreadsAreReturned) {
|
||||
TEST(DebugSession, givenAllThreadsWhenGettingSingleThreadsThenCorrectThreadsAreReturned) {
|
||||
zet_debug_config_t config = {};
|
||||
config.pid = 0x1234;
|
||||
|
||||
@@ -202,7 +202,7 @@ TEST(RootDebugSession, givenAllThreadsWhenGettingSingleThreadsThenCorrectThreads
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RootDebugSession, givenAllEUsWhenGettingSingleThreadsThenCorrectThreadsAreReturned) {
|
||||
TEST(DebugSession, givenAllEUsWhenGettingSingleThreadsThenCorrectThreadsAreReturned) {
|
||||
zet_debug_config_t config = {};
|
||||
config.pid = 0x1234;
|
||||
|
||||
@@ -227,7 +227,7 @@ TEST(RootDebugSession, givenAllEUsWhenGettingSingleThreadsThenCorrectThreadsAreR
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RootDebugSession, givenAllSubslicesWhenGettingSingleThreadsThenCorrectThreadsAreReturned) {
|
||||
TEST(DebugSession, givenAllSubslicesWhenGettingSingleThreadsThenCorrectThreadsAreReturned) {
|
||||
zet_debug_config_t config = {};
|
||||
config.pid = 0x1234;
|
||||
|
||||
@@ -251,7 +251,7 @@ TEST(RootDebugSession, givenAllSubslicesWhenGettingSingleThreadsThenCorrectThrea
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RootDebugSession, givenAllSlicesWhenGettingSingleThreadsThenCorrectThreadsAreReturned) {
|
||||
TEST(DebugSession, givenAllSlicesWhenGettingSingleThreadsThenCorrectThreadsAreReturned) {
|
||||
zet_debug_config_t config = {};
|
||||
config.pid = 0x1234;
|
||||
|
||||
@@ -275,7 +275,7 @@ TEST(RootDebugSession, givenAllSlicesWhenGettingSingleThreadsThenCorrectThreadsA
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RootDebugSession, givenBindlessSystemRoutineWhenQueryingIsBindlessThenTrueReturned) {
|
||||
TEST(DebugSession, givenBindlessSystemRoutineWhenQueryingIsBindlessThenTrueReturned) {
|
||||
zet_debug_config_t config = {};
|
||||
config.pid = 0x1234;
|
||||
|
||||
@@ -289,7 +289,7 @@ TEST(RootDebugSession, givenBindlessSystemRoutineWhenQueryingIsBindlessThenTrueR
|
||||
EXPECT_TRUE(debugSession->isBindlessSystemRoutine());
|
||||
}
|
||||
|
||||
TEST(RootDebugSession, givenBindfulSystemRoutineWhenQueryingIsBindlessThenFalseReturned) {
|
||||
TEST(DebugSession, givenBindfulSystemRoutineWhenQueryingIsBindlessThenFalseReturned) {
|
||||
zet_debug_config_t config = {};
|
||||
config.pid = 0x1234;
|
||||
|
||||
@@ -303,7 +303,7 @@ TEST(RootDebugSession, givenBindfulSystemRoutineWhenQueryingIsBindlessThenFalseR
|
||||
EXPECT_FALSE(debugSession->isBindlessSystemRoutine());
|
||||
}
|
||||
|
||||
TEST(RootDebugSession, givenApiThreadAndSingleTileWhenConvertingThenCorrectValuesReturned) {
|
||||
TEST(DebugSession, givenApiThreadAndSingleTileWhenConvertingThenCorrectValuesReturned) {
|
||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||
NEO::Device *neoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
Mock<L0::DeviceImp> deviceImp(neoDevice, neoDevice->getExecutionEnvironment());
|
||||
|
||||
@@ -23,12 +23,12 @@ class OsInterfaceWithDebugAttach : public NEO::OSInterface {
|
||||
bool debugAttachAvailable = true;
|
||||
};
|
||||
|
||||
struct DebugSessionMock : public L0::RootDebugSession {
|
||||
using L0::RootDebugSession::debugArea;
|
||||
using L0::RootDebugSession::getSingleThreads;
|
||||
using L0::RootDebugSession::isBindlessSystemRoutine;
|
||||
struct DebugSessionMock : public L0::DebugSession {
|
||||
using L0::DebugSession::debugArea;
|
||||
using L0::DebugSession::getSingleThreads;
|
||||
using L0::DebugSession::isBindlessSystemRoutine;
|
||||
|
||||
DebugSessionMock(const zet_debug_config_t &config, L0::Device *device) : RootDebugSession(config, device), config(config){};
|
||||
DebugSessionMock(const zet_debug_config_t &config, L0::Device *device) : DebugSession(config, device), config(config){};
|
||||
bool closeConnection() override { return true; }
|
||||
ze_result_t initialize() override {
|
||||
if (config.pid == 0) {
|
||||
|
||||
Reference in New Issue
Block a user