← Back

Module buffer

enum BufferUsage

Source: gpu/buffer.joule:9

enum MemoryLocation

Source: gpu/buffer.joule:24

struct GpuBuffer

GPU buffer handle

Source: gpu/buffer.joule:36

enum BufferHandle

Internal buffer handle (backend-specific)

Source: gpu/buffer.joule:46

fn new(

Source: gpu/buffer.joule:75

fn len(&self) -> usize

Get the number of elements

Source: gpu/buffer.joule:116

fn size_bytes(&self) -> usize

Get size in bytes

Source: gpu/buffer.joule:121

fn is_empty(&self) -> bool

Check if buffer is empty

Source: gpu/buffer.joule:126

fn location(&self) -> MemoryLocation

Get the memory location

Source: gpu/buffer.joule:131

fn usage(&self) -> BufferUsage

Get the usage hint

Source: gpu/buffer.joule:136

fn write(&mut self, data: &[T]) -> Result<(), GpuError>

Source: gpu/buffer.joule:142

fn cudaMemcpy(

Source: gpu/buffer.joule:155

const CUDA_MEMCPY_HOST_TO_DEVICE: i32

Source: gpu/buffer.joule:162

fn mtl_buffer_contents(buffer: *mut std::ffi::c_void) -> *mut std::ffi::c_void;

Source: gpu/buffer.joule:181

fn hipMemcpy(

Source: gpu/buffer.joule:196

const HIP_MEMCPY_HOST_TO_DEVICE: i32

Source: gpu/buffer.joule:203

fn read(&self, data: &mut [T]) -> Result<(), GpuError>

Source: gpu/buffer.joule:227

fn cudaMemcpy(

Source: gpu/buffer.joule:240

const CUDA_MEMCPY_DEVICE_TO_HOST: i32

Source: gpu/buffer.joule:247

fn mtl_buffer_contents(buffer: *mut std::ffi::c_void) -> *mut std::ffi::c_void;

Source: gpu/buffer.joule:266

fn hipMemcpy(

Source: gpu/buffer.joule:281

const HIP_MEMCPY_DEVICE_TO_HOST: i32

Source: gpu/buffer.joule:288

fn read_all(&self) -> Result<Vec<T>, GpuError>

Source: gpu/buffer.joule:312

fn write_async(&mut self, data: &[T]) -> Result<(), GpuError>

Source: gpu/buffer.joule:320

fn cudaMemcpyAsync(

Source: gpu/buffer.joule:333

const CUDA_MEMCPY_HOST_TO_DEVICE: i32

Source: gpu/buffer.joule:341

fn copy_to(&self, other: &mut GpuBuffer<T>) -> Result<(), GpuError>

Source: gpu/buffer.joule:369

fn cudaMemcpy(

Source: gpu/buffer.joule:382

const CUDA_MEMCPY_DEVICE_TO_DEVICE: i32

Source: gpu/buffer.joule:389

fn hipMemcpy(

Source: gpu/buffer.joule:403

const HIP_MEMCPY_DEVICE_TO_DEVICE: i32

Source: gpu/buffer.joule:410

fn fill(&mut self, value: T) -> Result<(), GpuError>

Source: gpu/buffer.joule:433

fn cudaMemset(

Source: gpu/buffer.joule:440

fn zero(&mut self) -> Result<(), GpuError>

Source: gpu/buffer.joule:469

fn cudaMemset(

Source: gpu/buffer.joule:474

fn hipMemset(

Source: gpu/buffer.joule:489

fn drop(&mut self)

Source: gpu/buffer.joule:528

fn cudaFree(ptr: *mut std::ffi::c_void) -> i32;

Source: gpu/buffer.joule:533

fn hipFree(ptr: *mut std::ffi::c_void) -> i32;

Source: gpu/buffer.joule:546

fn cuda_alloc(size_bytes: usize, location: MemoryLocation) -> Result<*mut std::ffi::c_void, GpuError>

Source: gpu/buffer.joule:559

fn cudaMalloc(ptr: *mut *mut std::ffi::c_void, size: usize) -> i32;

Source: gpu/buffer.joule:561

fn cudaMallocHost(ptr: *mut *mut std::ffi::c_void, size: usize) -> i32;

Source: gpu/buffer.joule:562

fn cudaMallocManaged(ptr: *mut *mut std::ffi::c_void, size: usize, flags: u32) -> i32;

Source: gpu/buffer.joule:563

fn metal_alloc(

Source: gpu/buffer.joule:586

fn mtl_device_new_buffer(

Source: gpu/buffer.joule:593

fn rocm_alloc(size_bytes: usize, location: MemoryLocation) -> Result<*mut std::ffi::c_void, GpuError>

Source: gpu/buffer.joule:617

fn hipMalloc(ptr: *mut *mut std::ffi::c_void, size: usize) -> i32;

Source: gpu/buffer.joule:619

fn hipHostMalloc(ptr: *mut *mut std::ffi::c_void, size: usize, flags: u32) -> i32;

Source: gpu/buffer.joule:620

fn hipMallocManaged(ptr: *mut *mut std::ffi::c_void, size: usize, flags: u32) -> i32;

Source: gpu/buffer.joule:621

fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result

Source: gpu/buffer.joule:645