Module Sarek_hip.Hip_api

Constants

val max_device_name_length : int

Error checking

val check : string -> Hip_types.hip_result -> unit
type kernargs = {
  1. params : unit Ctypes.ptr Ctypes.ptr;
  2. slots : int64 Ctypes.ptr;
}

hipModuleLaunchKernel is asynchronous and the HIP stack snapshots the kernel parameters at dispatch time, not at the call site (see the CUDA sibling's note - it explicitly calls out the HIP behaviour). Freeing the arg cells when Kernel.launch returns would be a use-after-free once the GC reclaims them. We retain them until the stream that ran the launch is drained, keyed by (device_id, stream_key). The cells are held for liveness only and never inspected. A mutex guards the list against concurrent domains.

val pending_kernargs : (int * nativeint * kernargs) list Stdlib.ref
val pending_lock : Stdlib.Mutex.t
val retain_kernargs : int -> nativeint -> kernargs -> unit
val retire_stream : int -> nativeint -> unit
val retire_device : int -> unit
val stream_key_of_ptr : 'a Ctypes.ptr -> nativeint
val default_stream_key : nativeint

Device Management

module Device : sig ... end

Memory Management

module Memory : sig ... end

Stream Management

module Stream : sig ... end

Event Management

module Event : sig ... end

Ranged / asynchronous copies, pinned memory, stream ordering

module Async : sig ... end

Kernel Management

module Kernel : sig ... end

Utility Functions

val runtime_version : unit -> int
val is_available : unit -> bool

Available if libamdhip64 loads, libhiprtc loads, and at least one device is present. hiprtc is required because this backend is JIT-only (HIP C++ -> code object at runtime).

val memory_info : Device.t -> int64 * int64