6 #include <unordered_map>
11 namespace onnxruntime {
12 class IExecutionProvider;
19 namespace synchronize {
70 auto it = other_stream_clock_.find(target_stream);
71 return it == other_stream_clock_.end() ? 0 : it->second;
77 output.reserve(other_stream_clock_.size());
78 output.insert(other_stream_clock_.begin(), other_stream_clock_.end());
91 for (
const auto& kv : clock) {
92 auto ret = other_stream_clock_.insert(kv);
94 ret.first->second =
std::max(ret.first->second, kv.second);
106 uint64_t timestamp_{0};
110 std::unordered_map<Stream*, uint64_t> other_stream_clock_{};
112 ORT_DISALLOW_COPY_ASSIGNMENT_AND_MOVE(
Stream);
115 namespace synchronize {
virtual CreateStreamFn GetCreateStreamFn(OrtDevice::DeviceType execution_device_type) const =0
virtual std::unique_ptr< synchronize::Notification > CreateNotification(size_t)
void UpdateStreamClock(const std::unordered_map< Stream *, uint64_t > &clock)
virtual void RegisterWaitFn(OrtDevice::DeviceType notification_device_type, OrtDevice::DeviceType device_type, WaitNotificationFn fn)=0
virtual WaitNotificationFn GetWaitHandle(OrtDevice::DeviceType notification_ower_device_type, OrtDevice::DeviceType executor_device_type) const =0
uint64_t GetLastSyncTimestampWithTargetStream(Stream *target_stream) const
std::function< void(Stream &, synchronize::Notification &)> WaitNotificationFn
const std::unordered_map< Stream *, uint64_t > & GetStreamSyncTable()
uint64_t BumpTimeStampAndReturn()
void CloneCurrentStreamSyncTable(std::unordered_map< Stream *, uint64_t > &output) const
const OrtDevice & GetDevice() const
StreamHandle GetHandle() const
virtual ~IStreamCommandHandleRegistry()=default
std::unordered_map< Stream *, uint64_t > stream_clock_
virtual Status CleanUpOnRunEnd()
virtual void Activate()=0
virtual ~Notification()=default
GLfloat GLfloat GLfloat GLfloat h
Stream(StreamHandle h, const OrtDevice &d)
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
std::function< std::unique_ptr< Stream >(const OrtDevice &)> CreateStreamFn
virtual void RegisterCreateStreamFn(OrtDevice::DeviceType device_type, CreateStreamFn f)=0
uint64_t GetCurrentTimestamp() const
virtual void * GetResource(int, int) const
void * NotificationHandle
virtual ~Stream()=default