Module Tolk.Device
Devices as a compiler sees them: the renderer that writes a device's programs, and the compiled program a runtime loads.
A device is named by its kind, the DEVICE field of a Helpers.Target.t: "CPU", "METAL", "CUDA", "NV" or "AMD". This module opens no device: opening one, allocating its memory and running programs on it are the runtime's.
Compiled programs
Renderers
val renderer : Helpers.Target.t -> (Renderer.t, string) Stdlib.resultrenderer t is the renderer of programs for t: the renderer of t's device, made for t.
Each device has one renderer, named as a target's RENDERER field names it:
"CPU":"CLANG",Cstyle.clang;"METAL":"METAL",Cstyle.metal;"CUDA"and"NV":"CUDA",Cstyle.cuda;"AMD":"HIP",Cstyle.hip.
A renderer is made once for each name and target, and later calls return that one.
The error is "D has no renderer 'R'" if the target names a renderer R other than its device D's, and the renderer's own message if it raises Invalid_argument for the target.
Raises Invalid_argument if t's device is not one of these devices, and Failure as the renderer does if its compiler's library is missing, keeping no renderer for t.