Spoc_core.Memorymodule type BUFFER = sig ... endA buffer packages backend-specific buffer with its operations. All transfers use raw pointers with byte sizes to avoid type parameter escaping issues in first-class modules.
Buffer with phantom type parameter for element type safety. The 'a parameter is not used at runtime but ensures type-safe transfers.
Allocate a buffer on a device for standard Bigarray types
Allocate a buffer for custom types with explicit element size in bytes
val free : 'a. 'a buffer -> unitFree a buffer
val host_to_device :
'a 'b. src:('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t ->
dst:'a buffer ->
unitCopy data from host bigarray to device. Converts bigarray to pointer internally. Type parameter ensures bigarray element type matches buffer type.
val device_to_host :
'a 'b. src:'a buffer ->
dst:('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t ->
unitCopy data from device to host bigarray. Converts bigarray to pointer internally. Type parameter ensures bigarray element type matches buffer type.
val host_ptr_to_device : 'a. src_ptr:unit Ctypes.ptr -> dst:'a buffer -> unitCopy data from raw pointer to device buffer (for custom types)
val device_to_host_ptr : 'a. src:'a buffer -> dst_ptr:unit Ctypes.ptr -> unitCopy data from device buffer to raw pointer (for custom types)
Copy data between device buffers (same device). Type parameter ensures both buffers have same element type.
val size : 'a. 'a buffer -> intGet buffer size in elements
val elem_size : 'a. 'a buffer -> intGet buffer element size in bytes
val device_ptr : 'a. 'a buffer -> nativeintGet raw device pointer
val bind_to_kargs :
'a. 'a buffer ->
Spoc_framework.Framework_sig.kargs ->
int ->
unitBind buffer to kernel args