Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-16 08:20:30

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2022-2026 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 // System include(s).
0011 #include <memory>
0012 
0013 namespace traccc::hip {
0014 
0015 /// Wrapper class around @c hipStream_t
0016 ///
0017 /// It is necessary for passing around HIP stream objects in code that should
0018 /// not be directly exposed to the HIP header(s).
0019 ///
0020 /// Note that unlike @c vecmem::hip::stream_wrapper, this type can not own a
0021 /// stream of its own. It can only view a stream that is owned by
0022 /// "somebody else".
0023 ///
0024 class stream_wrapper {
0025  public:
0026   /// Wrap an existing @c hipStream_t object, without taking ownership
0027   explicit stream_wrapper(void* stream);
0028 
0029   /// Copy constructor
0030   stream_wrapper(const stream_wrapper& parent) = default;
0031   /// Move constructor
0032   stream_wrapper(stream_wrapper&& parent) = default;
0033 
0034   /// Copy assignment
0035   stream_wrapper& operator=(const stream_wrapper& rhs) = default;
0036   /// Move assignment
0037   stream_wrapper& operator=(stream_wrapper&& rhs) = default;
0038 
0039   /// Device that the stream is associated to
0040   int device() const;
0041 
0042   /// Access a typeless pointer to the managed @c hipStream_t object
0043   void* hipStream() const;
0044 
0045   /// Wait for all queued tasks from the stream to complete
0046   void synchronize() const;
0047 
0048  private:
0049   /// Bare pointer to the wrapped @c hipStream_t object
0050   void* m_stream;
0051 
0052 };  // class stream_wrapper
0053 
0054 }  // namespace traccc::hip