Loading...
Searching...
No Matches
RdmaGpuBuffer.hpp
Go to the documentation of this file.
1#pragma once
2
27#include <score_plugin_gfx_export.h>
28
29#include <cstddef>
30#include <cstdint>
31#include <memory>
32
33namespace score::gfx
34{
35struct CudaFunctions;
36}
37
38namespace score::gfx::interop
39{
40
42enum class RdmaGpuApi : std::uint8_t
43{
44 None = 0,
45 Cuda,
46 Vulkan,
47 D3D12,
49};
50
53{
54 void* gpuVA{};
55 std::size_t size{};
56 void* opaque{};
57};
58
60{
61 RdmaGpuApi api{RdmaGpuApi::None};
62 std::uint32_t slotCount{};
63 std::size_t frameBytes{};
64
65 // Backend context — only the field matching `api` is read; the caller owns
66 // the lifetime of whatever it points to.
69 int cudaDevice{0};
70 const void* vulkanCtx{};
71 void* d3d12Device{};
72};
73
77class SCORE_PLUGIN_GFX_EXPORT RdmaGpuBuffer
78{
79public:
80 RdmaGpuBuffer() noexcept;
82
83 RdmaGpuBuffer(RdmaGpuBuffer&&) noexcept;
84 RdmaGpuBuffer& operator=(RdmaGpuBuffer&&) noexcept;
85 RdmaGpuBuffer(const RdmaGpuBuffer&) = delete;
86 RdmaGpuBuffer& operator=(const RdmaGpuBuffer&) = delete;
87
90 bool create(const RdmaGpuBufferConfig& cfg);
91
92 bool valid() const noexcept;
93 RdmaGpuApi backend() const noexcept;
94 std::size_t slotCount() const noexcept;
95 const RdmaGpuSlot& slot(std::size_t i) const noexcept;
96
98 void destroy() noexcept;
99
100private:
101 struct Impl;
102 std::unique_ptr<Impl> m_impl;
103};
104
105} // namespace score::gfx::interop
RdmaGpuApi
Which allocation mechanism a RdmaGpuBuffer instance uses.
Definition RdmaGpuBuffer.hpp:43
@ Cuda
CUDA VMM (CUdeviceptr); reuses CudaVmmAllocator.
@ HostFallback
64 KiB-aligned host memory (non-RDMA app-buffer path).
Owns N RDMA-capable GPU buffers. Move-only; destroy() is idempotent.
Definition RdmaGpuBuffer.hpp:78
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
Runtime-loaded CUDA driver-API table. Owns the libcuda handle.
Definition CudaFunctions.hpp:359
Definition RdmaGpuBuffer.cpp:27
Definition RdmaGpuBuffer.hpp:60
const void * vulkanCtx
Vulkan: const vkinterop::VulkanCtx*.
Definition RdmaGpuBuffer.hpp:70
score::gfx::CudaFunctions * cuda
Definition RdmaGpuBuffer.hpp:67
void * d3d12Device
D3D12: ID3D12Device*.
Definition RdmaGpuBuffer.hpp:71
int cudaDevice
Cuda: device ordinal.
Definition RdmaGpuBuffer.hpp:69
One allocated slot. gpuVA is the per-API handoff the card's SDK wants.
Definition RdmaGpuBuffer.hpp:53
void * opaque
Backend-owned per-slot context (freed in destroy()).
Definition RdmaGpuBuffer.hpp:56
void * gpuVA
CUdeviceptr / VkRemoteAddressNV / D3D12 VA / host ptr.
Definition RdmaGpuBuffer.hpp:54
std::size_t size
Actual size (granularity / 64 KiB rounded).
Definition RdmaGpuBuffer.hpp:55