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§
- Artifact
Id - Which artifact a launch needs: its kernel, and what the launch adds to it.
- Artifact
Store - 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. - Compilation
Batch Record - 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.
- Compilation
Record - 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.
- Compilation
Recording - A compilation being recorded: the
KernelLoaderopens 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. - Kernel
Cache Key - Key for an entry in the persistent compilation cache.
- Kernel
Loader - Every kernel a device has loaded, in front of the backend that compiles and loads the ones it has not.
- Store
Names - What an
ArtifactStorekept by kernel and by source names its two maps, ascompilation_storetakes a backend’s name.
Enums§
- Compilation
Error - JIT compilation error.
- Compilation
Outcome - How a backend obtained a kernel’s artifact.
Traits§
- Artifact
Compiler - 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.
- Compilation
Target - 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, orNonewhen 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§
- Artifact
Of - The artifact an
ArtifactCompilerproduces. - BuildId
- Platform-specific build identifier, changes on rebuild
- Variant
Of - The variant an
ArtifactCompilerkeys its artifacts by.