#include "config.h"
+#include <memory>
+
+#include "gromacs/math/vectypes.h"
+
#if GMX_GPU_CUDA
//! \brief A device-side buffer of ValueTypes
#elif GMX_GPU_SYCL
-// SYCL-TODO:
-
-//! \brief A device-side buffer of ValueTypes
+/*! \libinternal \brief
+ * A minimal wrapper around \c cl::sycl::buffer to hide it away and simplify compilation.
+ */
template<typename ValueType>
-using DeviceBuffer = ValueType*;
+struct DeviceBuffer
+{
+ class ClSyclBufferWrapper;
+ std::unique_ptr<ClSyclBufferWrapper> buffer_;
+
+ DeviceBuffer();
+ ~DeviceBuffer();
+ DeviceBuffer(DeviceBuffer<ValueType> const& src);
+ DeviceBuffer(DeviceBuffer<ValueType>&& src) noexcept;
+ DeviceBuffer& operator=(DeviceBuffer<ValueType> const& src);
+ DeviceBuffer& operator=(DeviceBuffer<ValueType>&& src) noexcept;
+
+ //! Helper function to get the size in bytes of a single element
+ static constexpr size_t elementSize() { return sizeof(ValueType); }
+
+ // static_case<void*> is used in MPI+CUDA code, this stub is necessary for compilation.
+ explicit operator void*() const { throw; }
+};
+
+// Must explicitly instantiate for some types.
+extern template struct DeviceBuffer<gmx::RVec>;
#else
#endif
-
#endif // GMX_GPU_UTILS_DEVICEBUFFER_DATATYPE_H