static_assert(mode == cl::sycl::access::mode::read,
"Can not create non-read-only accessor from a const DeviceBuffer");
}
+ void bind(cl::sycl::handler& cgh) { cgh.require(*this); }
private:
//! Helper function to get sycl:buffer object from DeviceBuffer wrapper, with a sanity check.
namespace gmx::internal
{
-//! A "blackhole" class to be used when we want to ignore an argument to a function.
-struct EmptyClassThatIgnoresConstructorArguments
+//! A non-functional class that can be used instead of real accessors
+template<class T>
+struct NullAccessor
{
- template<class... Args>
- [[maybe_unused]] EmptyClassThatIgnoresConstructorArguments(Args&&... /*args*/)
- {
- }
+ NullAccessor(const DeviceBuffer<T>& /*buffer*/) {}
//! Allow casting to nullptr
constexpr operator std::nullptr_t() const { return nullptr; }
+ //! Placeholder implementation of \c cl::sycl::accessor::get_pointer.
+ T* get_pointer() const noexcept { return nullptr; }
+ void bind(cl::sycl::handler& /*cgh*/) { assert(false); }
};
} // namespace gmx::internal
*/
template<class T, cl::sycl::access::mode mode, bool enabled>
using OptionalAccessor =
- std::conditional_t<enabled, DeviceAccessor<T, mode>, gmx::internal::EmptyClassThatIgnoresConstructorArguments>;
+ std::conditional_t<enabled, DeviceAccessor<T, mode>, gmx::internal::NullAccessor<T>>;
#endif // #ifndef DOXYGEN
false;
#endif
-
if constexpr (usingHipSycl)
{
// hipSYCL does not support reinterpret but allows using Float3 directly.
template<typename ValueType>
void destroyParamLookupTable(DeviceBuffer<ValueType>* deviceBuffer, DeviceTexture* /* deviceTexture */)
{
- deviceBuffer->buffer_.reset(nullptr);
+ freeDeviceBuffer(deviceBuffer);
}
#endif // GMX_GPU_UTILS_DEVICEBUFFER_SYCL_H