SWDEV-313306 - Clear external signals

Crash was due to the fact that external signal structure was stale even
after destroyign the command. That is because we skipped wait due to a
missing check.
Detect external signals and dispatch a barrier in ReleaseGpuMemoryFence.
Also clear external_signals_ at ProfilingBegin.

Change-Id: I991387edcfe928b511bf5e780988ee131321ed5a


[ROCm/clr commit: 3239222516]
This commit is contained in:
Saleel Kudchadker
2021-12-13 19:38:29 -08:00
rodzic 09b628c4e0
commit 42625f0527
2 zmienionych plików z 10 dodań i 1 usunięć
@@ -504,6 +504,7 @@ std::vector<hsa_signal_t>& VirtualGPU::HwQueueTracker::WaitingSignal(HwQueueEngi
}
external_signals_.clear();
}
// Return the array of waiting HSA signals
return waiting_signals_;
}
@@ -1003,7 +1004,7 @@ void VirtualGPU::ResetQueueStates() {
// ================================================================================================
bool VirtualGPU::releaseGpuMemoryFence(bool skip_cpu_wait) {
if (hasPendingDispatch_) {
if (hasPendingDispatch_ || !Barriers().IsExternalSignalListEmpty()) {
// Dispatch barrier packet into the queue
dispatchBarrierPacket(kBarrierPacketHeader);
hasPendingDispatch_ = false;
@@ -1276,6 +1277,7 @@ void VirtualGPU::profilingBegin(amd::Command& command, bool drmProfiling) {
}
if (AMD_DIRECT_DISPATCH) {
Barriers().ClearExternalSignals();
for (auto it = command.eventWaitList().begin(); it < command.eventWaitList().end(); ++it) {
void* hw_event = ((*it)->NotifyEvent() != nullptr) ?
(*it)->NotifyEvent()->HwEvent() : (*it)->HwEvent();
@@ -1302,6 +1304,7 @@ void VirtualGPU::profilingEnd(amd::Command& command) {
if (!timestamp_->HwProfiling()) {
timestamp_->end();
}
assert(Barriers().IsExternalSignalListEmpty());
command.setData(timestamp_);
timestamp_ = nullptr;
}
@@ -243,6 +243,12 @@ class VirtualGPU : public device::VirtualDevice {
//! Get the last active signal on the queue
ProfilingSignal* GetLastSignal() const { return signal_list_[current_id_]; }
//! Clear external signals
void ClearExternalSignals() { external_signals_.clear(); }
//! Empty check for external signals
bool IsExternalSignalListEmpty() const { return external_signals_.empty(); }
private:
//! Wait for the next active signal
void WaitNext() {