Skip to main content

cubecl_environment/bundle/
mod.rs

1//! Named environment bundles.
2//!
3//! A bundle packages pre-warmed caches (autotune results, compiled kernels)
4//! under a human-chosen name such as "H100 Linux" so applications can ship
5//! them and skip cold-start tuning and compilation.
6//!
7//! # Import, not a runtime layer
8//!
9//! A bundle is only ever used to *fill* the local storage, through
10//! [`import`]. Once imported, its entries are ordinary rows and the file can
11//! be deleted: runtime lookups go to
12//! [`Storage`](crate::persistence::Storage) and nothing else. There is no
13//! read path in which a bundle participates, so no cache hit ever depends on
14//! a file staying installed.
15//!
16//! Entries land with [`Origin::Imported`](crate::persistence::Origin), which
17//! lets a locally computed value replace one that turns out to be stale.
18//!
19//! # Formats
20//!
21//! [`Bundle`] is deliberately format-agnostic: a bundle answers by namespace
22//! and key bytes, exactly like the local storage, so nothing about a layout on
23//! disk is load-bearing. [`SqliteBundle`] is the native format, a single
24//! `SQLite` file. [`EmbeddedBundle`] is one flat blob for wasm and no-std
25//! targets, which have no file system to open.
26//!
27//! Writing is native-only on purpose. A bundle for any target is produced on a
28//! development machine by [`export`], and only consumed elsewhere.
29//!
30//! # Correctness
31//!
32//! Bundles are never trusted for correctness: imported autotune entries go
33//! through the same checksum validation as local ones, and every namespace
34//! carries the cubecl version and the device fingerprint, so a mismatched
35//! machine never looks them up. A wrong bundle costs load time, nothing
36//! else.
37
38mod base;
39mod embedded;
40mod import;
41// The manifest is the description of a bundle, not a way of storing one, so it
42// is available wherever a bundle can be read: the flat format exists for the
43// targets `cache` can't reach, and they need the same schema guards.
44mod manifest;
45
46pub use base::*;
47pub use embedded::*;
48pub use import::*;
49pub use manifest::*;
50
51#[cfg(native_cache)]
52mod export;
53#[cfg(native_cache)]
54mod flat;
55#[cfg(native_cache)]
56mod open;
57#[cfg(native_cache)]
58mod sqlite;
59
60#[cfg(native_cache)]
61pub use export::*;
62#[cfg(native_cache)]
63pub use open::*;
64#[cfg(native_cache)]
65pub use sqlite::*;