Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:12

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2022-2025 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 // Forward declaration(s).
0016 namespace details {
0017 struct opaque_stream;
0018 }
0019 
0020 /// Owning wrapper class around @c hipStream_t
0021 ///
0022 /// It is necessary for passing around HIP stream objects in code that should
0023 /// not be directly exposed to the HIP header(s).
0024 ///
0025 class stream {
0026  public:
0027   /// Invalid/default device identifier
0028   static constexpr int INVALID_DEVICE = -1;
0029 
0030   /// Construct a new stream (possibly for a specified device)
0031   stream(int device = INVALID_DEVICE);
0032 
0033   /// Move constructor
0034   stream(stream&& parent) noexcept;
0035 
0036   /// Destructor
0037   ~stream();
0038 
0039   /// Move assignment
0040   stream& operator=(stream&& rhs) noexcept;
0041 
0042   /// Device that the stream is associated to
0043   int device() const;
0044 
0045   /// Access a typeless pointer to the managed @c hipStream_t object
0046   void* hipStream() const;
0047 
0048   /// Wait for all queued tasks from the stream to complete
0049   void synchronize() const;
0050 
0051  private:
0052   /// Smart pointer to the managed @c hipStream_t object
0053   std::unique_ptr<details::opaque_stream> m_stream;
0054 
0055 };  // class stream
0056 
0057 }  // namespace traccc::hip