Repository navigation
PAC-3: libraries stop choosing their users' allocator and GPU stack - #93
Merged
Merged
Conversation
…PU stack PAC-3. turso's `mimalloc` feature installs a `#[global_allocator]` in turso's own crate root, so the workspace's turso line made `weftdb` — a published library — decide the process allocator of every program that links it, including one with an allocator of its own or none at all. splimes' default `gpu` feature did the same one layer over: `gpu` -> `wgpu` -> the Vulkan, Metal and DX12 backends, in the dependency graph of five library crates. Our own binaries lose nothing. `weft-server` and `weft-tui` now name mimalloc 0.1.52 in their own roots, which is the edit the 1.0 plan's L-MAIN lane already schedules (docs/release/1.0-plan.md:126, "Later main.rs edits, one per wave: PAC-3 (W2, `#[global_allocator]`). `weft-server` and `weft-bench` ask splimes for `gpu` directly, and `weftdb`'s interpolation benches get it as a dev-dependency, so every GPU path this repository compiles and exercises is still compiled and exercised. splimes' `serde` stays on, because `weftdb::BatchedMeasurement` serialises a `splimes::Resolution`; turso's other default, `fts`, stays off as it already was, since it is full-text search and pulling it in grows the graph with tantivy, tantivy-columnar and zstd-sys. `weftdb`'s tracing-subscriber moves to dev-dependencies — only test code installs a subscriber. The non-dev dependency graphs, counted as distinct packages before and after: weft-line-protocol and weft-reduce 77 -> 25, weftdb 266 -> 227, weft-orchestration 267 -> 231. Two crate-doc lines in weftdb/src/lib.rs named splimes' GPU-only `calibrate` and are reworded, since the doc job denies broken intra-doc links.
…cator and GPU stack PR #93. Two decisions were being made for every program that links these crates: turso's mimalloc feature installs a #[global_allocator] in turso's own crate root, so asking for it on the published library weftdb chose the allocator of every embedder's process; and splimes' default features pull wgpu, which sat in the normal graph of four libraries that never call a GPU API. The allocator now belongs to the executables, which is where the plan puts this slice (docs/release/1.0-plan.md:126). GPU stays opt-in at the dependency level. Distinct packages in the normal graph: weft-line-protocol and weft-reduce 77 -> 25, weft-orchestration 267 -> 231, weftdb 266 -> 227. Recorded in the note: the two keeps (splimes serde for BatchedMeasurement, turso fts left off as it already was), and that cargo bench -p weftdb is no longer allocator-comparable across this commit.
Base automatically changed from
rob2/engine-panic-failstop
to
xname/declare-validation
October 21, 2026 15:30
This was referenced Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the wave 2 box in
ROADMAP.md:Stacked on #92 (ROB-2), which is stacked on #91 (X-NAME) and #90 (X-ERR).
The allocator
turso 0.8.1 carries this in its own crate root:
This workspace asked turso for
mimalloc, andweftdb— a published library — inherited thatdependency. So every program that linked
weftdbhad its process allocator replaced with mimalloc:an embedder that sets its own, one that wants the system allocator, one that ships to a platform
where mimalloc is the wrong call. A library cannot make that decision for the process it runs in.
turso = { version = "0.8", default-features = false }.weft-serverandweft-tuinow depend onmimallocdirectly and declare it in their ownmain.rs.That is the edit the plan's L-MAIN lane already schedules —
docs/release/1.0-plan.md:126, "Latermain.rs edits, one per wave: PAC-3 (W2,
#[global_allocator])" — so the choice now sits in thefile that owns the process.
libmimalloc-sys 0.1.49, both already in
Cargo.lockandTHIRD-PARTY-LICENSES.md), same allocator,chosen by the binary that runs it.
weft-benchnever linkedweftdband never had mimalloc, so itdoes not change.
wgpu
splimes = "1"at the workspace level took splimes' default features, andgpuis one of them:gpu→wgpu→ the Vulkan, Metal and DX12 backends. Five library crates depend on splimes, so aprogram that linked
weft-line-protocolto parse a text line was pulling a GPU driver stack into itsbuild and its binary.
The workspace line is now
splimes = { version = "1", default-features = false, features = ["serde"] }.The two executables that call the GPU API —
weft-serverandweft-bench, throughprewarm_gpu,calibrateandgpu_pool_stats— enablegputhemselves, andweftdb's interpolation benches get itas a dev-dependency, so every GPU path this repository runs is still compiled and still exercised.
tracing-subscriber
Moved from
weftdb's[dependencies]to[dev-dependencies]. Nothing in the library installs asubscriber outside
#[cfg(test)], so every program linkingweftdbwas building registry, fmt andenv-filter code it never called.
Proof
Distinct packages in each crate's non-dev dependency graph (
cargo tree -p X -e normal | sort -u | wc -l),measured before at
df21a2ein a throwaway worktree and after in this branch:weft-line-protocolweft-reduceweftdbweft-orchestrationcargo tree -p weftdb -i wgpu -e normalandcargo tree -p weftdb -i mimalloc -e normalboth returnnothing on this branch;
weft-server's graph still resolves both, because it asks for them.Deliberately unchanged
serdestays on.weftdb::BatchedMeasurement(weftdb/src/types/batches/batch.rs:52)derives
Serialize/Deserializeover asplimes::Resolutionfield. Turning it off would be acompile break for the crate that ships it, not hygiene.
fts, stays off, as it already was. It is turso's full-text search, andswitching it on grows every build with
tantivy,tantivy-columnar,zstd-sysand the rest ofthat tree — an early version of this line enabled it and the lock diff grew by 435 lines, which is
how that was caught. Nothing in this workspace uses FTS.
src/calls a splimes GPU API. The GPU callers areweft-server/src/gpu.rs,weft-bench/src/engine.rsandweft-bench/src/gpu_memory.rs, plusweftdb/benches/interpolate_range.rs.What an embedder has to do
Two things a user of the published libraries may notice, both written up in⚠️ :
CHANGELOG.mdwith aweftdb— asplimes::Backend::Gpuwhile depending onweftdbalone — has to name
splimesitself now.weftdbdeclares it in its own binary.One comparison to be aware of
cargo bench -p weftdbis criterion, which is not test code, so it used to inherit mimalloc throughturso and now runs on the system allocator: a
weftdbbench figure taken before this release is notdirectly comparable with one taken after. The Weft-Bench series, including the nightly regression track
EVI-5 will add, is unaffected.
Verification
cargo +stable check --workspace --all-targets --lockedcargo +stable clippy --workspace --all-targets --all-features --locked -- -D clippy::correctness -D clippy::suspicious -D clippy::perfRUSTDOCFLAGS="-D warnings" cargo +stable doc --workspace --no-deps --locked— two crate-level doclines in
weftdb/src/lib.rsnamed splimes' GPU-onlycalibrateand had to be reworded, sincerustdoc resolves a
::code span and would now fail to link it.weftdb(389),weft-server(291),weft-orchestration,weft-reduce,weft-line-protocol,weft-arrowcargo +nightly fmt --all -- --checkchanges,
mimallocwas already inCargo.lockandTHIRD-PARTY-LICENSES.md.Follow-up, deliberately not in this PR
tokiowithfeatures = ["full"]sits in[workspace.dependencies]and reaches the publishedlibraries the same way mimalloc did — every library user gets the whole runtime, drivers, macros and
sync, whether or not they use it. Same class of leak, but the fix changes which tokio features are on
for four crates and their tests, so it deserves its own slice and its own CI run.