mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 17:13:29 +08:00
L0 Debug- Create generic topologyMap interface
Move Linux DebugSession thread conversion functions up to DebugSessionImp to allow reuse in windows implementation Signed-off-by: Yates, Brandon <brandon.yates@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
453cd97c14
commit
44894c1fdf
@@ -1835,78 +1835,6 @@ uint64_t DebugSessionLinux::getContextStateSaveAreaGpuVa(uint64_t memoryHandle)
|
||||
return bindInfo->second.gpuVa;
|
||||
}
|
||||
|
||||
uint32_t DebugSessionLinux::getDeviceIndexFromApiThread(ze_device_thread_t thread) {
|
||||
auto deviceBitfield = connectedDevice->getNEODevice()->getDeviceBitfield();
|
||||
uint32_t deviceIndex = Math::log2(static_cast<uint32_t>(deviceBitfield.to_ulong()));
|
||||
auto deviceCount = std::max(1u, connectedDevice->getNEODevice()->getNumSubDevices());
|
||||
const auto &topologyMap = DrmHelper::getTopologyMap(connectedDevice);
|
||||
|
||||
if (connectedDevice->getNEODevice()->isSubDevice()) {
|
||||
return deviceIndex;
|
||||
}
|
||||
|
||||
if (deviceCount > 1) {
|
||||
|
||||
if (thread.slice == UINT32_MAX) {
|
||||
deviceIndex = UINT32_MAX;
|
||||
} else {
|
||||
uint32_t sliceId = thread.slice;
|
||||
for (uint32_t i = 0; i < topologyMap.size(); i++) {
|
||||
if (deviceBitfield.test(i)) {
|
||||
if (sliceId < topologyMap.at(i).sliceIndices.size()) {
|
||||
deviceIndex = i;
|
||||
}
|
||||
sliceId = sliceId - static_cast<uint32_t>(topologyMap.at(i).sliceIndices.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return deviceIndex;
|
||||
}
|
||||
|
||||
ze_device_thread_t DebugSessionLinux::convertToPhysicalWithinDevice(ze_device_thread_t thread, uint32_t deviceIndex) {
|
||||
auto deviceImp = static_cast<DeviceImp *>(connectedDevice);
|
||||
const auto &topologyMap = DrmHelper::getTopologyMap(connectedDevice);
|
||||
|
||||
// set slice for single slice config to allow subslice remapping
|
||||
auto mapping = topologyMap.find(deviceIndex);
|
||||
if (thread.slice == UINT32_MAX && mapping != topologyMap.end() && mapping->second.sliceIndices.size() == 1) {
|
||||
thread.slice = 0;
|
||||
}
|
||||
|
||||
if (thread.slice != UINT32_MAX) {
|
||||
if (thread.subslice != UINT32_MAX) {
|
||||
deviceImp->toPhysicalSliceId(topologyMap, thread.slice, thread.subslice, deviceIndex);
|
||||
} else {
|
||||
uint32_t dummy = 0;
|
||||
deviceImp->toPhysicalSliceId(topologyMap, thread.slice, dummy, deviceIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
EuThread::ThreadId DebugSessionLinux::convertToThreadId(ze_device_thread_t thread) {
|
||||
auto deviceImp = static_cast<DeviceImp *>(connectedDevice);
|
||||
UNRECOVERABLE_IF(!DebugSession::isSingleThread(thread));
|
||||
|
||||
uint32_t deviceIndex = 0;
|
||||
deviceImp->toPhysicalSliceId(DrmHelper::getTopologyMap(connectedDevice), thread.slice, thread.subslice, deviceIndex);
|
||||
|
||||
EuThread::ThreadId threadId(deviceIndex, thread.slice, thread.subslice, thread.eu, thread.thread);
|
||||
return threadId;
|
||||
}
|
||||
|
||||
ze_device_thread_t DebugSessionLinux::convertToApi(EuThread::ThreadId threadId) {
|
||||
auto deviceImp = static_cast<DeviceImp *>(connectedDevice);
|
||||
|
||||
ze_device_thread_t thread = {static_cast<uint32_t>(threadId.slice), static_cast<uint32_t>(threadId.subslice), static_cast<uint32_t>(threadId.eu), static_cast<uint32_t>(threadId.thread)};
|
||||
deviceImp->toApiSliceId(DrmHelper::getTopologyMap(connectedDevice), thread.slice, thread.subslice, threadId.tileIndex);
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
void TileDebugSessionLinux::readStateSaveAreaHeader() {
|
||||
|
||||
const auto header = rootDebugSession->getStateSaveAreaHeader();
|
||||
|
||||
Reference in New Issue
Block a user