mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
Fill devices from api thread
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5c1c96fa94
commit
b0ec436b3e
@@ -157,6 +157,23 @@ bool DebugSession::areRequestedThreadsStopped(ze_device_thread_t thread) {
|
|||||||
return requestedThreadsStopped;
|
return requestedThreadsStopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebugSession::fillDevicesFromThread(ze_device_thread_t thread, std::vector<uint8_t> &devices) {
|
||||||
|
auto deviceCount = std::max(1u, connectedDevice->getNEODevice()->getNumSubDevices());
|
||||||
|
UNRECOVERABLE_IF(devices.size() < deviceCount);
|
||||||
|
|
||||||
|
uint32_t deviceIndex = 0;
|
||||||
|
convertToPhysical(thread, deviceIndex);
|
||||||
|
bool singleDevice = (thread.slice != UINT32_MAX && deviceCount > 1) || deviceCount == 1;
|
||||||
|
|
||||||
|
if (singleDevice) {
|
||||||
|
devices[deviceIndex] = 1;
|
||||||
|
} else {
|
||||||
|
for (uint32_t i = 0; i < deviceCount; i++) {
|
||||||
|
devices[i] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool DebugSession::isBindlessSystemRoutine() {
|
bool DebugSession::isBindlessSystemRoutine() {
|
||||||
if (debugArea.reserved1 &= 1) {
|
if (debugArea.reserved1 &= 1) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ struct DebugSession : _zet_debug_session_handle_t {
|
|||||||
virtual bool isBindlessSystemRoutine();
|
virtual bool isBindlessSystemRoutine();
|
||||||
virtual bool readModuleDebugArea() = 0;
|
virtual bool readModuleDebugArea() = 0;
|
||||||
|
|
||||||
|
void fillDevicesFromThread(ze_device_thread_t thread, std::vector<uint8_t> &devices);
|
||||||
|
|
||||||
std::vector<EuThread::ThreadId> getSingleThreadsForDevice(uint32_t deviceIndex, 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;
|
DebugAreaHeader debugArea;
|
||||||
|
|||||||
@@ -372,6 +372,20 @@ TEST(DebugSession, givenSomeStoppedThreadsWhenAreRequestedThreadsStoppedCalledTh
|
|||||||
EXPECT_FALSE(sessionMock->areRequestedThreadsStopped(apiThread));
|
EXPECT_FALSE(sessionMock->areRequestedThreadsStopped(apiThread));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(DebugSession, givenApiThreadAndSingleTileWhenFillingDevicesThenVectorEntryIsSet) {
|
||||||
|
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||||
|
NEO::Device *neoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||||
|
Mock<L0::DeviceImp> deviceImp(neoDevice, neoDevice->getExecutionEnvironment());
|
||||||
|
auto debugSession = std::make_unique<DebugSessionMock>(zet_debug_config_t{0x1234}, &deviceImp);
|
||||||
|
|
||||||
|
ze_device_thread_t thread = {hwInfo.gtSystemInfo.SliceCount - 1, hwInfo.gtSystemInfo.SubSliceCount - 1, 0, 0};
|
||||||
|
|
||||||
|
std::vector<uint8_t> devices(1);
|
||||||
|
debugSession->fillDevicesFromThread(thread, devices);
|
||||||
|
|
||||||
|
EXPECT_EQ(1u, devices[0]);
|
||||||
|
}
|
||||||
|
|
||||||
using DebugSessionMultiTile = Test<MultipleDevicesWithCustomHwInfo>;
|
using DebugSessionMultiTile = Test<MultipleDevicesWithCustomHwInfo>;
|
||||||
|
|
||||||
TEST_F(DebugSessionMultiTile, givenApiThreadAndMultipleTilesWhenConvertingToPhysicalThenCorrectValueReturned) {
|
TEST_F(DebugSessionMultiTile, givenApiThreadAndMultipleTilesWhenConvertingToPhysicalThenCorrectValueReturned) {
|
||||||
@@ -462,5 +476,32 @@ TEST_F(DebugSessionMultiTile, WhenConvertingToThreadIdAndBackThenCorrectThreadId
|
|||||||
EXPECT_EQ(thread.thread, apiThread.thread);
|
EXPECT_EQ(thread.thread, apiThread.thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DebugSessionMultiTile, givenApiThreadAndMultiTileWhenFillingDevicesThenVectorEntriesAreSet) {
|
||||||
|
L0::Device *device = driverHandle->devices[0];
|
||||||
|
|
||||||
|
auto debugSession = std::make_unique<DebugSessionMock>(zet_debug_config_t{0x1234}, device);
|
||||||
|
|
||||||
|
ze_device_thread_t thread = {UINT32_MAX, 0, 0, 0};
|
||||||
|
|
||||||
|
std::vector<uint8_t> devices(numSubDevices);
|
||||||
|
debugSession->fillDevicesFromThread(thread, devices);
|
||||||
|
|
||||||
|
EXPECT_EQ(1u, devices[0]);
|
||||||
|
EXPECT_EQ(1u, devices[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DebugSessionMultiTile, givenApiThreadAndSingleTileWhenFillingDevicesThenVectorEntryIsSet) {
|
||||||
|
L0::Device *device = driverHandle->devices[0];
|
||||||
|
|
||||||
|
auto debugSession = std::make_unique<DebugSessionMock>(zet_debug_config_t{0x1234}, device);
|
||||||
|
|
||||||
|
ze_device_thread_t thread = {sliceCount * numSubDevices - 1, 0, 0, 0};
|
||||||
|
|
||||||
|
std::vector<uint8_t> devices(numSubDevices);
|
||||||
|
debugSession->fillDevicesFromThread(thread, devices);
|
||||||
|
|
||||||
|
EXPECT_EQ(0u, devices[0]);
|
||||||
|
EXPECT_EQ(1u, devices[1]);
|
||||||
|
}
|
||||||
} // namespace ult
|
} // namespace ult
|
||||||
} // namespace L0
|
} // namespace L0
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class OsInterfaceWithDebugAttach : public NEO::OSInterface {
|
|||||||
struct DebugSessionMock : public L0::DebugSession {
|
struct DebugSessionMock : public L0::DebugSession {
|
||||||
using L0::DebugSession::allThreads;
|
using L0::DebugSession::allThreads;
|
||||||
using L0::DebugSession::debugArea;
|
using L0::DebugSession::debugArea;
|
||||||
|
using L0::DebugSession::fillDevicesFromThread;
|
||||||
using L0::DebugSession::getSingleThreadsForDevice;
|
using L0::DebugSession::getSingleThreadsForDevice;
|
||||||
using L0::DebugSession::isBindlessSystemRoutine;
|
using L0::DebugSession::isBindlessSystemRoutine;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user