Skip to main content

Module compiler

Module compiler 

Source
Expand description

Compiler trait, and the compilation caches in front of one. Compilation for a runtime: the one path every backend loads a kernel by, the two halves a backend contributes to it, the persistent stores and the in-memory cache in front of them, and what the environment records of a compilation. The Compiler contract itself lives in cubecl-runtime and is re-exported here.

Structs§

ArtifactId
Which artifact a launch needs: its kernel, and what the launch adds to it.
ArtifactStore
The compiled artifacts of one backend and device, kept by kernel and, for a backend that opts in, by the source each was finalized from — see ArtifactCompiler::source.
CompilationBatchRecord
One batch of kernels a server obtained together — compiled, or read from the compilation store, and loaded — as the environment records it. A kernel a launch compiles alone is a batch of one.
CompilationRecord
One kernel’s trip through a backend’s compilation path, as the environment records it: compiled fresh, loaded from the compilation store, or rekeyed from an artifact the store held for the same source.
CompilationRecording
A compilation being recorded: the KernelLoader opens one for each kernel it does not hold, the backend tells it what the trip goes through as it lowers the kernel, and the loader closes it with how the artifact was obtained. Every call is a no-op when the environment records nothing, and one dropped unclosed, by a trip that failed, records nothing.
KernelCacheKey
Key for an entry in the persistent compilation cache.
KernelLoader
Every kernel a device has loaded, in front of the backend that compiles and loads the ones it has not.
StoreNames
What an ArtifactStore kept by kernel and by source names its two maps, as compilation_store takes a backend’s name.

Enums§

CompilationError
JIT compilation error.
CompilationOutcome
How a backend obtained a kernel’s artifact.

Traits§

ArtifactCompiler
The half of a backend’s compilation that may run on any thread: from a kernel to the artifact the device loads, in two steps — a lowering pass through cubecl’s compiler, then whatever finishes the artifact — with one chance between them to reuse an artifact already finalized. A backend whose device lets several threads create objects at once may use it here.
CompilationTarget
The half of a backend’s compilation that runs only where the server does: the compilation store, and the loads on the server’s context.
Compiler
Compiles the representation into its own representation that can be formatted into tokens.

Functions§

build_id_hash
Pre-hashed build ID
compilation_store
A store for backend’s compiled artifacts, or None when compilation caching is disabled or the target has nowhere durable to put them.
store_compiled
Stores a freshly compiled artifact, logging rather than failing, and says whether the store took it.

Type Aliases§

ArtifactOf
The artifact an ArtifactCompiler produces.
BuildId
Platform-specific build identifier, changes on rebuild
VariantOf
The variant an ArtifactCompiler keys its artifacts by.