[Core] Add explicit post-load Host Weight Runtime publication (#6427)
Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
70bdd49402
commit
15e38ac173
8 files changed
+507
-29
No files matched your search
@@ -24,6 +24,7 @@ V1 includes:
|
||||
- coordinated local lookup and one-producer publication;
|
||||
- descriptor-backed safetensors mmap leases;
|
||||
- preferred and required resolution policy;
|
||||
- explicit, separately reported post-load publication;
|
||||
- validation, deny, quarantine, cleanup, and capacity controls; and
|
||||
- typed reports for every terminal resolution outcome.
|
||||
|
||||
@@ -33,7 +34,6 @@ V1 does not include:
|
||||
- a generic BF16, FP8, quantized, or model-specific producer;
|
||||
- CUDA registration, pinned staging, H2D scheduling, or GPU kernels;
|
||||
- a remote artifact provider or cross-node coordination;
|
||||
- post-load publication (V1 accepts only pre-load-safe producers);
|
||||
- automatic eviction; or
|
||||
- a change to DLO AllGather or no-AllGather behavior.
|
||||
|
||||
@@ -84,6 +84,12 @@ flowchart TD
|
||||
F -->|"preferred"| C
|
||||
F -->|"required"| E["Fail startup"]
|
||||
P -->|"nonretryable failure"| E
|
||||
C --> W{"Post-load publication enabled?"}
|
||||
W -->|"yes"| B2["Publish final model through POST_LOAD_ONLY producer"]
|
||||
B2 --> CL["Close validated publication lease"]
|
||||
CL --> R2["Return separate publication report"]
|
||||
R2 --> D
|
||||
W -->|"no"| D["Keep canonical model"]
|
||||
```
|
||||
|
||||
The modes are:
|
||||
@@ -94,10 +100,12 @@ The modes are:
|
||||
| `preferred` | Return an exact lease when available; otherwise use canonical fallback only for a miss, invalid cache entry, or typed retryable failure. |
|
||||
| `required` | Fail when an exact lease cannot be acquired. |
|
||||
|
||||
An unsupported capability, semantic identity collision, producer failure, or
|
||||
publication failure is nonretryable and remains visible even in preferred
|
||||
mode. Storage policy must never disguise a semantic or configuration error as
|
||||
a cache miss.
|
||||
During pre-load resolution, an unsupported capability, semantic identity
|
||||
collision, producer failure, or publication failure is nonretryable and remains
|
||||
visible even in preferred mode. A post-load publication failure is likewise
|
||||
visible in its own report, but cannot revise the canonical-fallback outcome.
|
||||
Storage policy must never disguise a semantic or configuration error as a cache
|
||||
miss.
|
||||
|
||||
## Loader and restoration sequence
|
||||
|
||||
@@ -118,24 +126,35 @@ sequenceDiagram
|
||||
R->>S: lookup(exact identity)
|
||||
alt validated hit
|
||||
S-->>R: HostWeightLease
|
||||
R-->>L: lease and LOCAL_HIT report
|
||||
L->>X: plan_restore(model, lease)
|
||||
X-->>L: validation-only restore plan
|
||||
L->>X: commit() once
|
||||
else miss with allowed producer
|
||||
R->>S: get_or_build(identity, producer)
|
||||
S->>P: produce(store-scoped writer)
|
||||
P-->>S: final-layout tensors and metadata
|
||||
S-->>R: validated HostWeightLease
|
||||
R-->>L: lease and LOCAL_PRODUCTION report
|
||||
L->>X: plan_restore(model, lease)
|
||||
X-->>L: validation-only restore plan
|
||||
L->>X: commit() once
|
||||
else policy permits canonical fallback
|
||||
R-->>L: CANONICAL_FALLBACK
|
||||
L->>L: Run canonical loader
|
||||
opt explicit post-load publication enabled
|
||||
L->>R: publish_after_load(identity, POST_LOAD_ONLY producer)
|
||||
R->>S: get_or_build(identity, producer)
|
||||
S-->>R: validated HostWeightLease or typed failure
|
||||
R->>R: close publication lease
|
||||
R-->>L: separate publication report
|
||||
end
|
||||
else required or nonretryable failure
|
||||
R-->>L: FAILED report
|
||||
end
|
||||
R-->>L: lease and terminal report
|
||||
L->>X: plan_restore(model, lease)
|
||||
X-->>L: validation-only restore plan
|
||||
L->>X: commit() once
|
||||
L->>T: consume restored CPU tensors
|
||||
L->>T: consume final CPU tensors and any lease
|
||||
T-->>L: transfer teardown complete
|
||||
L->>L: close lease
|
||||
L->>L: close lease when one was acquired
|
||||
```
|
||||
|
||||
`plan_restore()` must not mutate the model or lease. `commit() -> None` is the
|
||||
@@ -143,6 +162,15 @@ sole one-shot model mutation. If planning fails, canonical fallback may reuse
|
||||
the untouched model. If commit begins and fails, the partially hydrated model
|
||||
must be discarded and canonical fallback must construct a fresh model.
|
||||
|
||||
`publish_after_load()` is synchronous in V1 and accepts only a
|
||||
`POST_LOAD_ONLY` producer. Its report is separate from the terminal resolution,
|
||||
so a publication failure cannot rewrite a successful canonical fallback. A
|
||||
successful publication closes the store-returned lease inside the runtime and
|
||||
warms only future startups. It does not restore, rebind, or otherwise mutate the
|
||||
canonically loaded model serving the current startup.
|
||||
`allow_local_build` gates producers during pre-load resolution, while
|
||||
`allow_post_load_publish` independently gates this explicit post-load path.
|
||||
|
||||
## Exact representation identity
|
||||
|
||||
The store performs exact lookup. It never silently converts one representation
|
||||
@@ -252,7 +280,8 @@ removing live mappings.
|
||||
| Retryable lock, domain, or capacity failure | Canonical fallback | Fail |
|
||||
| Unsupported producer or backend | Fail | Fail |
|
||||
| Identity collision | Fail | Fail |
|
||||
| Producer or publication failure | Fail | Fail |
|
||||
| Pre-load producer or atomic publication failure | Fail | Fail |
|
||||
| Post-load publication failure after canonical fallback | Keep canonical model; report publication failure | Not reached through required resolution |
|
||||
| Restore planning failure | Canonical fallback may reuse untouched model | Fail |
|
||||
| Restore commit failure | Discard model; fallback requires a fresh instance | Fail |
|
||||
|
||||
@@ -275,7 +304,8 @@ A consumer PR must:
|
||||
a failed restore commit.
|
||||
7. Retain the lease until every transport operation that may access mapped
|
||||
memory has completed.
|
||||
8. Emit and test the terminal resolution report.
|
||||
8. Emit and test the terminal resolution report and any separate post-load
|
||||
publication report.
|
||||
|
||||
Consumer validation must prove:
|
||||
|
||||
|
||||
@@ -55,7 +55,9 @@ flowchart LR
|
||||
The contracts have deliberately narrow ownership:
|
||||
|
||||
- `HostWeightRuntime` applies resolution and fallback policy and emits one
|
||||
terminal report. It does not own a model or call the canonical loader.
|
||||
terminal resolution report. Explicit post-load publication emits a separate
|
||||
report and may return a lease, but does not revise the completed resolution.
|
||||
The runtime does not own a model or call the canonical loader.
|
||||
- `HostWeightStore` owns artifact lookup, coordinated construction,
|
||||
publication, validation, quarantine, and lifecycle.
|
||||
- `HostWeightLease` owns process-local tensor views, mapped-file resources, and
|
||||
@@ -135,9 +137,23 @@ producer cancellation requires a future process-isolated producer contract. A
|
||||
waiter timing out never cancels another process's valid build.
|
||||
|
||||
Remote providers are represented by protocols but are explicitly unsupported
|
||||
in the first implementation. V1 also invokes only `PRE_LOAD_SAFE` producers;
|
||||
enabling post-load publication is rejected during configuration until a
|
||||
separate post-load entry point and model-lifetime contract exist.
|
||||
in the first implementation. Pre-load `resolve()` invokes only
|
||||
`PRE_LOAD_SAFE` producers. A loader that completed canonical materialization
|
||||
may explicitly call `publish_after_load()` with a `POST_LOAD_ONLY` producer
|
||||
when `allow_post_load_publish` is enabled.
|
||||
|
||||
`allow_local_build` controls producer use during pre-load resolution;
|
||||
`allow_post_load_publish` independently controls the explicit post-load entry
|
||||
point. This permits lookup-only warm starts that populate a missing artifact
|
||||
only after the canonical loader has established the current model.
|
||||
|
||||
Post-load publication is synchronous in V1, but its outcome is independent of
|
||||
the already completed resolution. A store failure is returned in a separate
|
||||
publication report and cannot turn a valid canonical model into a failed
|
||||
resolution. On success, the runtime closes the validated store lease before
|
||||
returning the report. Post-load publication only warms future startups; it does
|
||||
not restore, rebind, or otherwise mutate the canonically loaded model serving
|
||||
the current startup.
|
||||
|
||||
## Restoration transaction boundary
|
||||
|
||||
|
||||
Reference in new issue
Block a user