SWDEV-430437,SWDEV-434702 - Split the streamset per device

Change-Id: If1bcca45825c9899462bb95ed6f637f5af806cc8
Bu işleme şunda yer alıyor:
Ioannis Assiouras
2024-02-06 00:34:35 +00:00
ebeveyn 1239309c90
işleme be2bdabb76
6 değiştirilmiş dosya ile 175 ekleme ve 144 silme
+19 -12
Dosyayı Görüntüle
@@ -306,15 +306,9 @@ public:
/// Returns the CU mask for the current stream
const std::vector<uint32_t> GetCUMask() const { return cuMask_; }
/// Sync all streams
static void SyncAllStreams(int deviceId, bool cpu_wait = true);
/// Check whether any blocking stream running
static bool StreamCaptureBlocking();
/// Destroy all streams on a given device
static void destroyAllStreams(int deviceId);
static void Destroy(hip::Stream* stream);
/// Check Stream Capture status to make sure it is done
@@ -416,7 +410,6 @@ public:
parallelCaptureStreams_.erase(it);
}
}
static bool existsActiveStreamForDevice(hip::Device* device);
/// The stream should be destroyed via release() rather than delete
private:
@@ -426,6 +419,8 @@ public:
/// HIP Device class
class Device {
amd::Monitor lock_{"Device lock", true};
amd::Monitor streamSetLock{"Guards device stream set"};
std::unordered_set<hip::Stream*> streamSet;
/// ROCclr context
amd::Context* context_;
/// Device's ID
@@ -499,7 +494,7 @@ public:
amd::ScopedLock lock(lock_);
/// Either stream is active or device is active
if (isActive_) return true;
if (Stream::existsActiveStreamForDevice(this)) {
if (existsActiveStreamForDevice()) {
isActive_ = true;
return true;
}
@@ -540,6 +535,22 @@ public:
/// Returns true if memory pool is valid on this device
bool IsMemoryPoolValid(MemoryPool* pool);
void AddStream(Stream* stream);
void RemoveStream(Stream* stream);
bool StreamExists(Stream* stream);
void destroyAllStreams();
void SyncAllStreams( bool cpu_wait = true);
bool StreamCaptureBlocking();
bool existsActiveStreamForDevice();
/// Wait all active streams on the blocking queue. The method enqueues a wait command and
/// doesn't stall the current thread
void WaitActiveStreams(hip::Stream* blocking_stream, bool wait_null_stream = false);
};
/// Thread Local Storage Variables Aggregator Class
@@ -589,10 +600,6 @@ public:
extern void WaitThenDecrementSignal(hipStream_t stream, hipError_t status, void* user_data);
/// Wait all active streams on the blocking queue. The method enqueues a wait command and
/// doesn't stall the current thread
extern void iHipWaitActiveStreams(hip::Stream* blocking_stream, bool wait_null_stream = false);
extern std::vector<hip::Device*> g_devices;
extern hipError_t ihipDeviceGetCount(int* count);
extern int ihipGetDevice();