Typed wrapper around EXCubeCL GPU buffers.
Provides a struct-based API so buffers can be passed around safely and matched on in function heads.
Lifecycle
- Create via
new/3,zeros/2, orfrom_binary/3 - Use in
Dala.Gpu.Compute.run_kernel/4orDala.Gpu.Compute.submit/1 - Read results via
Dala.Gpu.Compute.read/1 - Free via
Dala.Gpu.Compute.free/1
Buffers are automatically freed when the owning process exits
(via Rust ResourceArc cleanup). Explicit free/1 is a no-op but
provided for API compatibility.
Summary
Functions
Create a GPU buffer from a raw binary.
Create a new GPU buffer from a list of values.
Return the total number of elements in the buffer.
Return true if the buffer is valid (has a non-nil ref).
Create a zero-initialized GPU buffer.
Types
@type t() :: %Dala.Gpu.Compute.Buffer{ dtype: atom(), ref: reference(), shape: tuple(), size_bytes: non_neg_integer() }
Functions
Create a GPU buffer from a raw binary.
Create a new GPU buffer from a list of values.
@spec num_elements(t()) :: non_neg_integer()
Return the total number of elements in the buffer.
Return true if the buffer is valid (has a non-nil ref).
Create a zero-initialized GPU buffer.