Module Rig_nv_abi
NVIDIA GPUs' formats, as values.
What compiled code and the driver of an NVIDIA GPU share: the words a channel runs, the entries of its ring, the descriptors its launches read, the cubins they run, and the record that describes the GPU. Nothing here acts on a GPU. Each value describes bytes, and its caller writes them.
The library describes bytes with two kinds of value:
- A template (
Template.t) is bytes around the caller's values: each value is an integer known now, written in place, or a slot, a value the caller numbers and fills later through a patch.MethodandGpfifogive each operation's words as a template, andQmda launch's descriptor and parameters. - A GPU (
Gpu.t) is what the formats depend on: its classes, its geometry and the windows its driver chose, declared by the driver (declare). A cubin's kernel (Cubin) set up for launch on a GPU is aLaunch.t, from which its descriptor is built;Local_memorysizes the local memory its threads take.
cubin bytes --Cubin.of_string--> Cubin.t --kernel--> Cubin.kernel
| |
size, elf, patches Launch.make Gpu.t
| |
a loader writes the image Launch.t
|
Qmd.make, Qmd.parameters
|
Method.*, Gpfifo.entry --------> Template.t <-------------+
|
bytes as they are, or filled at each useConventions
Addresses are the GPU's virtual addresses. A slot cannot be checked here: the caller keeps the alignment and range each function states for the value that fills it.
Misuse raises Invalid_argument: an integer outside the range its function states, a class or version no launch descriptor holds. A cubin that is not one, or a kernel that takes more than a launch can, is Error msg, msg saying why.
The library has no state: any domain may use any of its values.
References
Qmd and Launch name the documents of NVIDIA's that they follow.
Channel words
GPUs
key is the key of an NVIDIA GPU's record. Compiled code finds the record of a device d with Rig.capability d key, which is None if d is not an NVIDIA GPU.
val declare : Gpu.t -> Rig_edge.capabilitydeclare c is c under key, as the facts of an NVIDIA GPU carry it (Rig_edge.facts).
module Local_memory : sig ... endKernels' local memory.