zeroshade commented on code in PR #37040:
URL: https://github.com/apache/arrow/pull/37040#discussion_r1300763131
##########
cpp/src/arrow/device.h:
##########
@@ -98,6 +100,52 @@ class ARROW_EXPORT Device : public
std::enable_shared_from_this<Device>,
/// \brief Return the DeviceAllocationType of this device
virtual DeviceAllocationType device_type() const = 0;
+ /// \brief EXPERIMENTAL: An opaque wrapper for Device-specific streams
+ ///
+ /// In essence this is just a wrapper around a void* to represent the
+ /// standard concept of a stream/queue on a device. Derived classes
+ /// should be trivially constructible from it's device-specific counterparts.
+ class ARROW_EXPORT Stream {
+ public:
+ virtual const void* get_raw() const { return NULLPTR; }
+
+ protected:
+ Stream() = default;
+ virtual ~Stream() = default;
+ };
+
+ /// \brief EXPERIMENTAL: An object that provides event/stream sync primitives
+ class ARROW_EXPORT SyncEvent {
+ public:
+ using release_fn_t = void (*)(void*);
+
+ virtual ~SyncEvent() = default;
+
+ void* get_raw() { return sync_event_.get(); }
+
+ /// @brief Block until sync event is completed.
+ virtual Status Wait() = 0;
+
+ /// @brief Make the provided stream wait on the sync event.
+ ///
+ /// Tells the provided stream that it should wait until the
+ /// synchronization event is completed without blocking the CPU.
+ virtual Status StreamWait(const Stream&) = 0;
Review Comment:
If we're gonna go that route, I think it'd be better to go that way now
rather than as a follow up. Particularly because it's a pretty small change
too.
I'm fine with going this route and it does fit better along the lines of
@pitrou's comments earlier about where it made the most sense to place some
functions. If no one objects, I'll make this change tomorrow morning. Provided
there's no other issues, I want to try to get this merged in the next day or so
and I'll start building the CUDA implementations of these interfaces for a new
PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]