Module Tolk.Compiler
Kernel source compiler.
A compiler turns rendered source code into a compiled binary. Each backend provides its own compiler (e.g. clang for CPU, nvcc for CUDA). Renderers carry an optional compiler via Renderer.compiler; the device selects the active renderer and uses its compiler at Device.compile_program time.
compile_cached is the primary entry point: it checks the on-disk cache before invoking the underlying compiler. Disk caching is controlled by the CCACHE environment variable (default 1, set to 0 to disable).
Types
Raised by compile when compilation fails. The payload is a human-readable error message.
Constructors
val make :
name:string ->
?cachekey:string ->
compile:(string -> bytes) ->
unit ->
tmake ~name ?cachekey ~compile () is a compiler with the given name and compilation function.
cachekey is the disk cache table name (e.g., "compile_clang_jit"). When None (default) or when the CCACHE environment variable is 0, compile_cached bypasses the disk cache.
Accessors
val name : t -> stringname c is c's name.
val cachekey : t -> string optioncachekey c is c's disk cache table name, or None when c was created without one. The key identifies the exact compilation target (e.g. "compile_cuda_sm_90"), so it doubles as a compiler and architecture fingerprint for callers keying their own caches.
Compiling
val compile : t -> string -> bytescompile c src compiles src using c, bypassing the disk cache.