SWDEV-290160 - Switch to global HSA signals

Runtime can't assign internal HSA signals for HIP events, because
HIP application can destroy the HIP stream or signal reuse may
occur internally. Switch to global HSA signals for HIP events.

Change-Id: Ieaea2d6b039e492b2e7c5112782a8f4e601e50a1
This commit is contained in:
German Andryeyev
2021-06-18 17:07:40 -04:00
committed by Maneesh Gupta
parent b5b1ccc990
commit ce8dad2ecc
7 changed files with 162 additions and 120 deletions
+19
View File
@@ -77,6 +77,21 @@ class VirtualDevice;
class PrintfDbg;
class IProDevice;
struct ProfilingSignal : public amd::HeapObject {
hsa_signal_t signal_; //!< HSA signal to track profiling information
Timestamp* ts_; //!< Timestamp object associated with the signal
HwQueueEngine engine_; //!< Engine used with this signal
bool done_; //!< True if signal is done
amd::Monitor lock_; //!< Signal lock for update
ProfilingSignal()
: ts_(nullptr)
, engine_(HwQueueEngine::Compute)
, done_(true)
, lock_("Signal Ops Lock", true)
{ signal_.handle = 0; }
amd::Monitor& LockSignalOps() { return lock_; }
};
class Sampler : public device::Sampler {
public:
//! Constructor
@@ -237,6 +252,7 @@ class NullDevice : public amd::Device {
cl_set_device_clock_mode_output_amd* pSetClockModeOutput) { return true; }
virtual bool IsHwEventReady(const amd::Event& event, bool wait = false) const { return false; }
virtual void ReleaseGlobalSignal(void* signal) const {}
protected:
//! Initialize compiler instance and handle
@@ -405,6 +421,7 @@ class Device : public NullDevice {
cl_set_device_clock_mode_output_amd* pSetClockModeOutput);
virtual bool IsHwEventReady(const amd::Event& event, bool wait = false) const;
virtual void ReleaseGlobalSignal(void* signal) const;
//! Allocate host memory in terms of numa policy set by user
void* hostNumaAlloc(size_t size, size_t alignment, bool atomics = false) const;
@@ -505,6 +522,8 @@ class Device : public NullDevice {
virtual amd::Memory* GetArenaMemObj(const void* ptr, size_t& offset);
ProfilingSignal* GetGlobalSignal(Timestamp* ts) const;
private:
bool create();