Skip to content

feat(runtime): add device-mesh weight manifest and store pilot - #675

Closed
fivetide wants to merge 20 commits into
warpfront:masterfrom
fivetide:feat/device-mesh-g3-manifest
Closed

feat(runtime): add device-mesh weight manifest and store pilot#675
fivetide wants to merge 20 commits into
warpfront:masterfrom
fivetide:feat/device-mesh-g3-manifest

Conversation

@fivetide

@fivetide fivetide commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Status — historical draft; do not merge as-is

Head f70f343166443e64f1ca44e996b892be95c1f569 and the checks recorded below were produced against the displaced merged-stack base 541b33c33e235efadeec67aac1da766c085cc67f, not current master. #668, #673, #674, and #676 merged on 2026-09-01 and were then backed out by a0fca0d6d; current master is 344e17a2edd893d6e323bd69189844e95bd73a9e. This branch is dirty/non-rebaseable and consumes types absent from the current tree.

This head is superseded by the G3 consistent-deliverable contract in #666. The replacement is one current-master production Single manifest/load transaction covering planning, all model-owned staged resources, typed publication, per-position parity, fault recovery, generation, existing-reset smoke, unload, and immediate retry. PR size is not the acceptance mechanism; the final composed G3 head must pass the complete matrix.

Keep this PR open and draft as historical design provenance. Do not merge, push, or rebase this head. Do not close until a replacement G3 PR is published.

Summary

Implement the G3 manifest/store layer and wire the plain LLaMA Single HFQ path to it. The branch adds pure declarations and planning for model weights, state, placements, and collectives, then fulfills that plan transactionally and publishes typed LLaMA weights under one teardown owner.

Tracks the G3 manifest/store slice in #666; it does not close G3 or claim current-tree acceptance.

What changed

  • Added hipfire-runtime::weight_manifest, a GPU- and source-format-free declaration layer. WeightEntry/StateEntry describe logical tensors and state; shard policies cover replication, tensor/vocabulary/head/expert placement, fused projections, ties, and mesh pins. plan_manifest resolves those declarations against an admitted DeviceMesh into device placements, state residency, pipeline boundary hints, and an ordered collective schedule.
  • Kept collective scheduling per declared operation rather than deduplicating by (layer, kind): distinct row-sharded operations such as wo and ffn_down remain distinct scheduled reductions. Manifest validation checks identities, shapes, shard divisibility, tied-source compatibility, and layer/state scope before fulfillment.
  • Added source-aware expert declarations (ExpertGroupSpec, ExpertSourceLayout, ExpertParallelism, and resource requirements). Validation binds router/execution identities and packed/per-expert source names, shapes, and policies; rank ownership and executor sealing remain for the direct G5 consumer.
  • Added hipfire-runtime::weight_store, keyed by (name, layer, device), with immutable projection metadata, resident or symbolic-alias handles, and a WeightOrigin containing mesh epoch, logical rank, and physical device identity. fulfill_manifest_single accepts an architecture-owned source callback returning bytes plus actual source dtype, validates the target and source contract, uploads residents, materializes ties, and explicitly rolls back every earlier resident on source, dtype, payload, upload, or injected-fault failure.
  • Added assembly guards that restore taken cells if typed construction aborts and transfer handles only on finalization. The LLaMA carrier validates the origin before attaching the transaction; the crate-private attached owner is drained through the existing ArchModel::free_gpu path.
  • Added LLaMA weight and KV-state manifests with source dtype constraints, output/embedding placement pins, and conditional lm_head tying. The HFQ carrier now admits and classifies the source before upload, sends plain non-AWQ HFQ through planning, transactional fulfillment, and typed assembly, recognizes the supported alternate explicit LM-head names, and retains AWQ-sidecar HFQ on the legacy loader. Safetensors-directory loading remains on its existing ParoQuant path while capturing the pure plan.
  • Moved the shared rank-zero layout view to derive from an admitted mesh and exposed the HFQ dtype bridge needed by the source resolver. The Architecture trait surface is unchanged.

Goals

Short term

  • Make the G3 contract deterministic: for a given LLaMA configuration, source declaration, and already-admitted mesh, planning states exactly where each weight/state cell belongs and exactly which collective operations execute, without touching a source, GPU, or allocator.
  • Exercise that contract end to end in the plain LLaMA Single HFQ production pilot: perform source admission before allocation, fulfill and assemble typed weights transactionally, and publish only after ownership and origin checks succeed.
  • Keep failure ownership explicit so a rejected source or downstream scratch/KV/attachment failure cannot leave resident buffers or partially assembled handles behind.

Long term

  • Keep planning separate from execution across device meshes. G2 admission supplies the effective mesh, while future multi-device fulfillment and G5 derive rank ownership and sealed executor plans from these declarations rather than introducing format- or family-specific planners.
  • Extend the same manifest/source contracts to production non-Single routes without creating a second weight owner or allowing raw topology requests to bypass source-aware admission.

Benefits

  • Placement, state, boundary, and collective behavior can be tested deterministically without a GPU; the named schedule also makes omitted or duplicated per-operation reductions observable.
  • Manifest planning contains no file or GPU representation. Carriers own namespace translation and actual source dtype, so the logical contract can be reused across formats without silent representation conversion.
  • Transaction and assembly boundaries make publication leak-safe: early resident allocations are released on fulfillment failure, taken cells are restored when typed assembly is abandoned, and origin mismatch is rejected before release work.
  • The Single pilot provides a concrete ownership path for LLaMA while leaving mesh-aware execution to the later admission and executor layers.

Dependency and landing order

  • feat(hardware): establish named device mesh ownership #673 and feat(loader): centralize source-aware parallel admission #674 are historical merged partials, not dependencies available on current master; both were reverted.
  • Replacement G3 work consumes accepted G1 DeviceMesh topology inside hipfire_runtime::multi_gpu. Do not add the reverted hipfire-hardware crate or combine this with Gpus constructor/all-reduce signature changes.
  • The G3 production route is deliberately Single-only. Corrected G2 admission is required before any production non-Single or multi-device route, but not for this genuinely Single-only deliverable.
  • Replacement G5 work consumes the accepted G3 deliverable and must follow accepted G1, G2, and G3; the current feat(dispatch): seal collective-aware MoE step execution #677 head remains historical provenance, not implementation ancestry.
  • The historical head raises scripts/leanup-thresholds.txt to daemon_lines <= 4589; replacement G3 work must satisfy the current <= 4155 ratchet rather than raising it.

Verification

Historical archived-head evidence only; none of these results establishes current-master acceptance:

  • Changed Rust files passed scoped rustfmt on head f70f343166443e64f1ca44e996b892be95c1f569.
  • Isolated cargo build passed on the displaced normalized stack.
  • Scoped clippy for hipfire-runtime and hipfire-arch-llama completed with existing warnings.
  • Isolated cargo test passed: 3,490 passed, 12 ignored.
  • Seven GitHub Actions check-runs completed successfully on the historical head.
  • Fresh current-master branch build, tests, formatting, lint, and repository gates.
  • Real hardware registry runs: at minimum hipfire run qwen3.6:27b and one A3B, with decoded text inspected and recorded.
  • Physical GPU manifest fulfillment beyond ignored fixtures.
  • python3 -m tools.change_gate run --base beta was not run; fork tracker output is not upstream acceptance evidence.

Nonclaims / follow-up

  • The manifest fulfillment API in this PR is deliberately Single-only. This PR does not claim physical multi-device manifest fulfillment or executor execution; production non-Single routing waits for the G2-admitted mesh and subsequent G5 integration.
  • HFQ files with AWQ scale sidecars remain on the established loader until sidecar ownership is represented by the manifest transaction. Safetensors-directory sources likewise remain on the existing ParoQuant loader until an equivalent representation resolver is available.
  • Architecture-trait change: No Architecture trait surface change.

Wall time: 0.69 seconds
No current-master compatibility, physical-device acceptance, production non-Single route, or completion claim is made by this historical head.

Propagate G1 mesh errors through layout and placement planning, preserve retryable teardown ownership in the daemon slot, and refresh generated crate maps. The daemon grows by 39 lines for typed retry restoration and rollback ownership; the ratchet records that explicit lifecycle trade.
RATCHET-RAISE: daemon_lines 4155 -> 4194, traded for typed retry restoration and rollback ownership in transactional manifest loading.
# Conflicts:
#	crates/hipfire-arch-llama/map.md
#	crates/hipfire-arch-llama/src/carrier.rs
#	crates/hipfire-daemon/map.md
#	crates/hipfire-loader/map.md
#	crates/hipfire-loader/src/lib.rs
#	crates/hipfire-runtime/map.md
#	crates/hipfire-runtime/src/model_load.rs
RATCHET-RAISE: daemon_lines 4564 -> 4589, traded for retryable unload restoration across the admitted-load transaction.
@fivetide

fivetide commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

Closing as historical provenance per this PR's own status note ("Do not close until a replacement G3 PR is published").

The replacement is published: #704 (draft, fivetide:replan/g3-manifest, stacked on the #682 head). It is a fresh implementation on the G2 redo base — this displaced-stack head (f70f34316, base 541b33c33) is not its ancestry and must never be merged, rebased, or promoted. Evidence on #704 supersedes the archived checks recorded here.

@fivetide fivetide closed this Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants