fix #675: complete production Single manifest/load transaction (G3 redo, stacked on #682) - #704
Open
fivetide wants to merge 11 commits into
Open
fix #675: complete production Single manifest/load transaction (G3 redo, stacked on #682)#704fivetide wants to merge 11 commits into
fivetide wants to merge 11 commits into
Conversation
9 tasks
fivetide
force-pushed
the
replan/g3-manifest
branch
from
September 7, 2026 06:45
f7a9ee7 to
e760350
Compare
21 tasks
fivetide
marked this pull request as ready for review
September 7, 2026 07:41
added 11 commits
September 8, 2026 09:26
… (G3) Port the declaration/planning layer (WeightEntry/ShardPolicy/StateEntry, validate_manifest, plan_manifest, expert source declarations) from the historical G3 head 04de36c onto the current master base (G1 redo warpfront#681): types now resolve against hipfire_runtime::device_mesh::DeviceMesh, whose coordinate/group methods are fallible (Result<_, MeshError>) — callsites expect after admission-validated coordinates. Pure module: no GPU, file, carrier, quantizer, or allocation dependency. 7 module tests pass (placement/boundaries, per-op schedule order, divisibility/ties/expert-shape validation, expert source identity, layer range, representation contracts).
…r base (G3) Port WeightStore/WeightLoadTransaction/WeightStoreAssembly from historical G3 head 04de36c: source-callback fulfillment (fulfill_manifest_single), tied aliases with actual-dtype constraints, per-(name,layer,device) placements and immutable projections, origin capture/validation against mesh epoch + logical rank + physical device, staged assembly with rollback ownership, and explicit release with resident accounting. Adapts the G1 redo device_mesh import path (hipfire_hardware -> crate::device_mesh). 14 tests pass, incl. live-GPU rollback/fault-injection scenarios (origin mismatch never frees, post-upload fault rolls back every resident, malformed payload and dtype/source failures free prior residents).
Port the llama-family typed cutover from historical G3 head 04de36c: - arch.rs: Llama::weight_manifest/weight_manifest_for_hfq/state_manifest with source dtype constraints (linear/embedding/norm) and fused-QKV + shard declarations; tied lm_head when the HFQ omits a separate head. - carrier.rs: classify_hfq_route, hfq_source namespace seam, AttachedWeightStore (transaction -> typed assembly -> single teardown owner, drain on unload), assemble_llama_weights, plan_single + Layout::from_mesh consumption. - arch_model.rs: LlamaBundle unload drains the attached store (scratch -> store -> weights -> kv ordering preserved). - hfq.rs: split validate_llama_hfq_admission (reject mis-tagged Qwen2 before every loader route incl. manifest pilot); HfqFile::has_awq_sidecars. - model_load.rs: Layout::from_mesh/validate, load_weights empty-devices guard + pre-source layout validation. Adapted to the G1-redo device_mesh (no hipfire-hardware crate; fallible coord API with admitted-mesh expects). 13 llama carrier tests pass incl. production manifest-vs-legacy logit parity, post-resident-failure full reclaim, tied lm_head aliasing without second allocation, AWQ-legacy-route selection, biased-HFQ pre-upload rejection; model_load 3/3; hfq 11/11; weight_backend 37/37.
Adds the warpfront#666 G3 fixture-lock parity oracle: loads the tracker fixture qwen3:0.6b (qwen3-0.6b-llama.mq4, size + md5 pinned) through both the production manifest route (ManifestPlainLlama) and the legacy load_weights_hfq reference from equivalent cloned state, then decodes the same committed prompt greedily in lockstep. At every committed position it asserts token IDs, logits, KV geometry/byte extents, the position counter, alias identity, and route identity; end state compares layer-0 K/V payloads byte-for-byte. Evidence on halo gfx1151: 19 committed positions, worst logit diff 0.000e0 (bitwise), 0 K/V byte diffs, 0 aliasing divergence. Skips cleanly when the fixture or a GPU is absent.
…e (G3) Extends the warpfront#666 G3 evidence to the full load lifecycle on the tracker fixture qwen3:0.6b: production load through the ManifestPlainLlama route, decode, existing-reset smoke (reset_session_state then decode is byte-identical), warm-baseline store accounting, unload through the sole consuming owner (ArchModel::free_gpu drains the attached store), immediate reload with identical decode, a deterministic post-upload fault whose rollback returns every resident allocation, and an immediate retry that decodes identically. Halo gfx1151 evidence: warm baseline 311 resident store allocations; all decode legs byte-identical; fault leg zero-free (allocations == releases). Skips cleanly when the fixture or a GPU is absent.
Two additional pinned-fixture evidence tests: - production_awq_sidecar_loads_and_decodes_on_gpu_through_legacy_route: an AWQ-sidecar HFQ is classified LegacyAwq, loads through the retained loader on GPU with no manifest store attached, and decodes. - pinned_fixture_repeated_load_unload_cycles_leak_nothing: four production load/unload cycles on qwen3:0.6b publish exactly the warm baseline (311 residents) every cycle, decode identically, and stay within a bounded free-VRAM floor after unload. - pinned_fixture_legacy_route_cycles_vram_bounded: the same VRAM floor measured on the legacy loader for comparison. Finding recorded in-test: on gfx1151 UMA, hipMemGetInfo does not credit driver-pooled frees in-cycle; the legacy route shows the same ~540MB net per-cycle drift as the manifest route (with async partial recovery), so the floor is set at 1 GiB/cycle — the manifest route introduces no retention beyond the loader it replaces.
…planner beta 90b2cc7 deleted CollectiveHint::AllReduce as unreferenced dead code (bundled with the genuine init_vram_weighted removal). The G3 manifest planner is the producer that makes it live: weight_manifest schedules one ordered per-operation reduction hint per row- or expert-sharded declaration, which is part of the warpfront#666 G3 contract (validation of ordered per-operation collectives). Restores only the enum variant; init_vram_weighted stays deleted.
…evidence tests beta's vision-loader work added vision_path to LoadCtx; the test helper now sets it to None. The pinned-fixture GPU evidence tests serialize on a module Mutex because hipMemGetInfo is device-global and parallel GPU tests in one process corrupted the VRAM floor measurements.
fivetide
force-pushed
the
replan/g3-manifest
branch
from
September 8, 2026 07:35
1e68f81 to
368deaa
Compare
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.
Status — base
beta(G2 landed on beta)Base note: #682 (G2) content was merged into the
betabranch (upstreambetanow containsreplan/g2-admission@95e0e654e);masterdoes not carry it yet. This branch is rebased ontoupstream/beta(10 commits,6b5003daa→e7603508), so the diff againstbetais the pure G3 change: +4564/−120 across 12 files. #682's GitHub PR onmasterremains open; its beta merge is what this PR stacks on.Rebase onto
betarequired two shared-seam adaptations, both committed with rationale: (1)CollectiveHint::AllReducerestored indevice_mesh.rs— beta commit90b2cc7aadeleted it as unreferenced dead code, but the G3 manifest planner is the producer that makes it live (per-operation ordered collective schedule is part of the #666 contract);init_vram_weightedstays deleted. (2) Test-sideLoadCtx::vision_path(beta vision-loader) plus a module Mutex serializing the pinned-fixture GPU evidence tests (hipMemGetInfo is device-global).This is the replacement for the historical #675 draft (G3, displaced-stack provenance only). It does not close #666's G3 milestone by itself — milestone acceptance is recorded by the tracker JSON at the accepted composed head, per the wave doctrine.
2026-09-07 review preparation
Head
1e68f81818a40f0bd79983c854fab602ad040557adds only a regeneratedhipfire-arch-llama/map.md(carrier line count and total).python3 scripts/check-crate-maps.py --checkpasses for all 43 maps, and the new CI gates job passes. No Rust or runtime behavior changed. Hardware results below remain explicitly scoped toe7603508; this documentation-only commit is not a new hardware run or milestone acceptance. The separate advisory Clippy failure is in the Qwen35 exampletest_dflash_hidden_scatter_gfx1100.rs:29(clippy::approx_constant), outside this G3 patch.Summary
Implement the G3 manifest/store layer and wire the plain LLaMA Single HFQ production path to it, under one
ArchModelowner. A plain LLaMA HFQ source is classified, admitted, and routed through pure manifest planning → transactional fulfillment → typed assembly → publication, with parity against the legacy loader proven bitwise on a pinned real fixture, and the full load lifecycle (reset smoke, unload, immediate reload, deterministic fault, immediate retry) evidenced on hardware.What changed
hipfire-runtime::weight_manifest— GPU- and source-format-free declaration layer.WeightEntry/StateEntrydescribe logical tensors and state; shard policies cover replication, tensor/vocabulary/head/expert placement, fused projections, ties, and mesh pins.plan_manifestresolves declarations against an admittedDeviceMeshinto device placements, state residency, pipeline boundary hints, and an ordered per-operation collective schedule. Manifest validation checks identities, names, dtypes, shapes, divisibility, scope, ties, aliases, cycles, mesh epoch, logical rank, and physical device before fulfillment. Expert declarations are carried for the G5 consumer.hipfire-runtime::weight_store— keyed by(name, layer, device)with immutable projection metadata, resident or symbolic-alias handles, and aWeightOrigincarrying mesh epoch, logical rank, and physical device identity.fulfill_manifestvalidates the target/source contract, uploads residents, materializes ties, and on the first source/dtype/payload/upload/assembly failure rolls back every earlier resident in reverse order, no legacy fallback. Assembly guards restore taken cells when typed construction aborts; publication transfers handles only on finalization. Deterministic fault seam + resident accounting under#[doc(hidden)] pub mod test_support.hipfire-arch-llama—LlamaBundle::load_bundleclassifies HFQ sources (HfqLoadRoute::{ManifestPlainLlama, LegacyAwq}), routes plain non-AWQ files through the manifest transaction and typed assembly, and retains AWQ-sidecar HFQ plus safetensors-directory sources on their existing loaders.Llama::weight_manifest{,_for_hfq}/state_manifestdeclare weights and KV state with source-dtype constraints, output/embedding pins, and conditionallm_headtying. The attached store is crate-private; the sole consuming owner isArchModel::free_gpu(scratch → store drain → weights → KV), so teardown cannot encounter an origin mismatch or a second unload owner.hfq.rssplitsvalidate_llama_hfq_admissionout ahead of every llama loader route;model_load.rsgainsLayout::from_mesh+Layout::validateand an empty-devices guard;weight_backend.rsexposes the HFQ dtype bridge. NoArchitecturetrait surface change.Ownership
LlamaBundleArchModelowner, plus the committed pinned-fixture parity oracle and lifecycle evidence tests.UnloadError/retryable-preflight loader/daemon teardown machinery (G4 provenance from the old feat(runtime): add device-mesh weight manifest and store pilot #675 head is deliberately not ported), multi-device/non-Single fulfillment and MoE execution (G5), planner-side GPU/file I/O (the planner performs none).Verification
All hardware evidence on halo (gfx1151, 128 GB UMA, ROCm/HIP 7.2), on the final composed beta head (
e7603508), release binaries rebuilt from that head (hipfire md59d290b26c517b84b94053a37f287736d, daemon md53b68f139c2eab5a9366692f52d84f647).Committed pinned-fixture parity oracle (
pinned_fixture_manifest_legacy_parity_oracle)Tracker fixture
qwen3:0.6b=~/.hipfire/models/qwen3-0.6b-llama.mq4, size 495,181,824, md52579e10ba3a988818386f2b07632ee01(size + route class asserted in-test; fixture lock). ProductionManifestPlainLlamaroute vs legacyload_weights_hfqreference decode the same committed prompt (md54f880dbf80dbff04c0690dd8dce80d39) greedily in lockstep:0.000e0(bitwise); token IDs, alias identity, KV geometry/byte extents, and position counters identical at every position; route identity recorded.Committed lifecycle evidence (
pinned_fixture_lifecycle_fault_retry_reload)Same fixture: production load → decode → existing-reset smoke (
reset_session_state, decode byte-identical) → unload via the soleArchModel::free_gpuowner → immediate reload (decode byte-identical) → deterministic post-upload fault (rollback zero-free: resident allocations == releases) → immediate retry (decode byte-identical). Warm baseline: 311 resident store allocations. All legs decode[785, 6722, 315, 9625, …]identically.Additional validation added after the first evidence pass
production_awq_sidecar_loads_and_decodes_on_gpu_through_legacy_route): an AWQ-sidecar HFQ is classifiedLegacyAwq, loads on GPU throughload_weights_hfqwith no manifest store attached, and decodes.pinned_fixture_repeated_load_unload_cycles_leak_nothing): four production cycles on the pinned fixture publish exactly the warm baseline (311 residents) every cycle, decode byte-identically, and stay within a bounded free-VRAM floor. A comparison test on the legacy loader (pinned_fixture_legacy_route_cycles_vram_bounded) shows the same ~540 MB net per-cyclehipMemGetInfodrift on gfx1151 UMA (driver-pooled frees are not credited in-cycle, with async partial recovery) — the manifest route introduces no VRAM retention beyond the loader it replaces; the committed floor is 1 GiB/cycle so only a manifest-specific doubling trips it.hipfire servepre-warms the pinned fixture (serve log:llama: HFQ source route = ManifestPlainLlama); two independent/v1/chat/completionsturns (each a fresh engine session — the reset boundary at the serving seam) both returned correct decoded text ("The capital of France is Paris, and the capital of Japan is Tokyo." / "The largest planet is Jupiter, and its main moon is Europa.").hipfire runon the 15 GBqwen3.5-27b.mq4(qwen3_5 arch — exercises the sharedhfq/model_loadseams at scale through its own carrier; coherent decoded text). Manifest-route scale is bounded by the pinned llama-family fixture per the G3 contract.Loader-path production runs (decoded text read; Kaden's bar)
hipfire run …/qwen3-0.6b-llama.mq42579e10b…llama: HFQ source route = ManifestPlainLlama; coherent decoded texthipfire run qwen3.6:27b9a6acdc49bcaa6a7b52ac161444cb769hipfire run …/qwen3.6-35b-a3b.mq4edde51ec1dac0f2bd42cff5ef1cb8944Both big fixtures match the pinned identities in
AGENTS.md. No perf numbers are claimed from these runs (fixture-digest discipline applies to perf reporting; none is made here).Batteries (all green)
hipfire-runtimelib: 628/628 on the beta head (incl.weight_manifest7/7,weight_store14/14 with live-GPU rollback/fault,hfq,model_load,weight_backend).hipfire-arch-llamalib: 18/18, stable across two consecutive full runs on the beta head (carrier manifest/legacy/alias/AWQ/fault tests + pinned-fixture oracle, lifecycle, AWQ-sidecar GPU legacy load, and load/unload cycle evidence; GPU evidence tests serialized).-p hipfire-runtime --lib,-p hipfire-arch-llama --lib): 0 errors.scripts/leanup-ratchets.sh: 21/21 metrics, 0 violations;daemon_linesunchanged at the 4176 cap — not raised (historical feat(runtime): add device-mesh weight manifest and store pilot #675 raised it to 4589; this PR does not).check-crate-maps.py).Nonclaims / retained routes
Architecturetrait surface change.hipfire-hardwarecrate (Gpus stays inhipfire_runtime::multi_gpu); no Cargo.toml dependency added for the manifest/store/route work.UnloadError/retryable-teardown loader/daemon machinery is not ported (G4 lifecycle ownership); it is retained as provenance for the G4 redo.leanup-thresholds.txtedits in this PR.Dependency and landing order
hipfire_runtime::device_mesh, merged feat(runtime): add DeviceMesh topology (fixed #673 G1) #681) — consumed via the fallible coord API (Result<_, MeshError>with.expecton validated coordinates).beta, which already contains G2 head95e0e654e59a3892777a6fc73894006a576c6e43. This PR is G3-only against beta; the still-open feat(loader): source-aware admission — classify and admit before teardown (fixed #674 G2) #682 targets master and does not need to merge there before this beta PR can be reviewed. G1/G2/G3 milestone acceptance still requires the agreed final-composition receipts; merge status is not acceptance.