pitrou opened a new issue, #36103:
URL: https://github.com/apache/arrow/issues/36103

   ### Describe the enhancement requested
   
   For the C device data interface, and other applications, we'll need to add 
optional synchronization information to buffers.
   
   Here is for example a possible API. It tries to avoid or minimize additional 
footprint, especially for the CPU case:
   ```c++
   // in device.h
   class DeviceSyncEvent {
    public:
     virtual ~DeviceSyncEvent() = default;
     /// \brief Block until synchronization event is ready
     virtual Status Wait() = 0;
   };
   
   // in buffer.h
   class Buffer {
    public:
     ...
     /// \brief Device-specific synchronization event
     ///
     /// If nullptr is returned (which is always the case for CPU buffers),
     /// no synchronization is required.
     virtual DeviceSyncEvent* sync_event() { return nullptr; }
     ...
   };
   
   // in arrow/gpu
   class CudaSyncEvent : public DeviceSyncEvent {
    public:
     void* cuda_event();  // actually a CUevent
     Status Wait() override;
   };
   
   class CudaBuffer : public Buffer {
    public:
     DeviceSyncEvent* sync_event() override { return &sync_event_; }
     ...
    protected:
     CudaSyncEvent sync_event_;
     ...
   };
   ```
   
   Or, as an alternative, define a `DeviceSyncStream` instead of a 
`DeviceSyncEvent`.
   
     
   
   ### Component(s)
   
   C++


-- 
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]

Reply via email to