mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-27 15:53:13 +08:00
fix: Reduce code duplicity by reusing closeConnection
Related-To: NEO-11188 Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8c1f0836ae
commit
c5a76cac3a
@@ -126,7 +126,6 @@ std::unique_ptr<uint64_t[]> DebugSessionLinux::getInternalEvent() {
|
||||
|
||||
void DebugSessionLinux::closeAsyncThread() {
|
||||
asyncThread.close();
|
||||
internalEventThread.close();
|
||||
}
|
||||
|
||||
bool DebugSessionLinux::checkForceExceptionBit(uint64_t memoryHandle, EuThread::ThreadId threadId, uint32_t *cr0, const SIP::regset_desc *regDesc) {
|
||||
@@ -918,4 +917,39 @@ ze_result_t DebugSessionLinux::acknowledgeEvent(const zet_debug_event_t *event)
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
||||
bool DebugSessionLinux::closeConnection() {
|
||||
closeAsyncThread();
|
||||
closeInternalEventsThread();
|
||||
|
||||
if (clientHandle != invalidClientHandle) {
|
||||
auto numTiles = std::max(1u, connectedDevice->getNEODevice()->getNumSubDevices());
|
||||
for (uint32_t tileIndex = 0; tileIndex < numTiles; tileIndex++) {
|
||||
for (const auto &eventToAck : eventsToAck) {
|
||||
auto moduleHandle = eventToAck.second;
|
||||
ackModuleEvents(tileIndex, moduleHandle);
|
||||
}
|
||||
cleanRootSessionAfterDetach(tileIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return closeFd();
|
||||
}
|
||||
|
||||
void DebugSessionLinux::cleanRootSessionAfterDetach(uint32_t deviceIndex) {
|
||||
auto connection = getClientConnection(clientHandle).get();
|
||||
|
||||
for (const auto &isa : connection->isaMap[deviceIndex]) {
|
||||
|
||||
// zebin modules do not store ackEvents per ISA
|
||||
UNRECOVERABLE_IF(isa.second->ackEvents.size() > 0 && isa.second->perKernelModule == false);
|
||||
|
||||
for (auto &event : isa.second->ackEvents) {
|
||||
eventAckIoctl(event);
|
||||
}
|
||||
|
||||
isa.second->ackEvents.clear();
|
||||
isa.second->moduleLoadEventAck = true;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user