@plasius/gpu-model-runtime 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -3
- package/dist/index.cjs +636 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +118 -1
- package/dist/index.d.ts +118 -1
- package/dist/index.js +633 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
# @plasius/gpu-model-runtime
|
|
2
2
|
|
|
3
|
-
Adapter discovery, source resolution, loading orchestration,
|
|
3
|
+
Adapter discovery, source resolution, loading orchestration, bounded residency,
|
|
4
|
+
and worker offload.
|
|
4
5
|
|
|
5
6
|
This repository is the dedicated package boundary defined by ADR 0094.
|
|
6
7
|
|
|
7
|
-
## Bootstrap status
|
|
8
|
-
|
|
9
8
|
The runtime owns orchestration only. Canonical model documents, diagnostics, and
|
|
10
9
|
renderer-specific data remain owned by the corresponding `@plasius/gpu-model-*`
|
|
11
10
|
packages and are carried through generic type parameters until the core package
|
|
@@ -51,9 +50,83 @@ result.canonicalModel;
|
|
|
51
50
|
result.rendererReady;
|
|
52
51
|
```
|
|
53
52
|
|
|
53
|
+
## Model residency
|
|
54
|
+
|
|
55
|
+
`ModelResidencyManager` owns the lifetime of promoted runtime models shared by
|
|
56
|
+
world tiles, zones, editor previews, and other GPU consumers. Cache identity is
|
|
57
|
+
the canonical `ModelAssetRef.contentHash` plus LOD and optional partition ID, so
|
|
58
|
+
many spatial instances can share one adapter load and one GPU resource.
|
|
59
|
+
|
|
60
|
+
The manager provides:
|
|
61
|
+
|
|
62
|
+
- reference-counted, idempotent leases;
|
|
63
|
+
- per-acquisition cancellation without aborting other interested consumers;
|
|
64
|
+
- cancellation of a shared load once every interested consumer has gone away;
|
|
65
|
+
- separate hard CPU/GPU byte budgets and bounded in-flight adapter work;
|
|
66
|
+
- release of timed-out concurrency slots even when an adapter ignores abort;
|
|
67
|
+
- completion of asynchronous eviction disposal before replacement loading;
|
|
68
|
+
- deterministic eviction by lowest retained priority, least-recent use, and
|
|
69
|
+
cache key;
|
|
70
|
+
- exact-once disposal for evicted, failed-integrity, cancelled, timed-out,
|
|
71
|
+
late-completing, and shutdown resources; and
|
|
72
|
+
- immutable accounting metrics for runtime diagnostics.
|
|
73
|
+
|
|
74
|
+
Loaders remain adapter-driven. The package does not eagerly import any model
|
|
75
|
+
format implementation.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { ModelResidencyManager } from "@plasius/gpu-model-runtime";
|
|
79
|
+
|
|
80
|
+
const models = new ModelResidencyManager({
|
|
81
|
+
budget: {
|
|
82
|
+
maxCpuBytes: 256 * 1024 * 1024,
|
|
83
|
+
maxGpuBytes: 384 * 1024 * 1024,
|
|
84
|
+
maxInFlightLoads: 4,
|
|
85
|
+
},
|
|
86
|
+
load: async ({ assetRef, lod, partitionId, signal }) => {
|
|
87
|
+
const loaded = await modelAdapter.load({
|
|
88
|
+
assetRef,
|
|
89
|
+
lod,
|
|
90
|
+
partitionId,
|
|
91
|
+
signal,
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
resource: loaded.resource,
|
|
95
|
+
contentHash: loaded.contentHash,
|
|
96
|
+
cpuBytes: loaded.cpuBytes,
|
|
97
|
+
gpuBytes: loaded.gpuBytes,
|
|
98
|
+
dispose: loaded.dispose,
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const lease = await models.acquire({
|
|
104
|
+
assetRef,
|
|
105
|
+
lod: 0,
|
|
106
|
+
priority: 100,
|
|
107
|
+
estimatedCpuBytes: 4 * 1024 * 1024,
|
|
108
|
+
estimatedGpuBytes: 12 * 1024 * 1024,
|
|
109
|
+
signal,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
render(lease.resource);
|
|
113
|
+
lease.release();
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Call `setPriority` and `setPinned` on a live lease as visibility changes. Call
|
|
117
|
+
`shutdown()` when the owning renderer is destroyed; it aborts pending work and
|
|
118
|
+
disposes resident resources without waiting indefinitely for an adapter that
|
|
119
|
+
ignores abort. If detached adapter work eventually completes, its late resource
|
|
120
|
+
is still disposed exactly once.
|
|
121
|
+
|
|
122
|
+
Canonical model identity comes from `@plasius/asset-contracts`; this package
|
|
123
|
+
does not define a parallel asset catalog. See
|
|
124
|
+
[`docs/adrs/adr-0006-content-addressed-model-residency.md`](docs/adrs/adr-0006-content-addressed-model-residency.md).
|
|
125
|
+
|
|
54
126
|
## Rollout
|
|
55
127
|
|
|
56
128
|
- Feature flag: gpu.model.conversion.enabled
|
|
129
|
+
- Origin-shard integration flag: world.persistent-atlas.enabled
|
|
57
130
|
- Capability: none for this package-only layer
|
|
58
131
|
- Rollback: disable the feature flag and keep the published package version pinned to the last validated release
|
|
59
132
|
|