@simulatte/doppler 0.1.6 → 0.1.7
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/CHANGELOG.md +126 -0
- package/README.md +16 -23
- package/package.json +14 -1
- package/src/adapters/adapter-registry.js +12 -1
- package/src/adapters/lora-loader.js +23 -6
- package/src/bridge/extension-client.d.ts +5 -0
- package/src/bridge/extension-client.js +40 -0
- package/src/bridge/index.d.ts +2 -1
- package/src/bridge/index.js +6 -4
- package/src/browser/browser-converter.js +26 -1
- package/src/browser/file-picker.js +6 -0
- package/src/browser/safetensors-parser-browser.js +84 -1
- package/src/browser/shard-io-browser.js +2 -2
- package/src/browser/tensor-source-download.js +8 -2
- package/src/browser/tensor-source-http.d.ts +1 -0
- package/src/browser/tensor-source-http.js +5 -1
- package/src/client/doppler-api.browser.js +20 -4
- package/src/client/doppler-api.js +19 -3
- package/src/client/doppler-provider/generation.js +12 -0
- package/src/client/doppler-provider/model-manager.d.ts +10 -0
- package/src/client/doppler-provider/model-manager.js +91 -19
- package/src/client/doppler-provider/source-runtime.d.ts +2 -1
- package/src/client/doppler-provider/source-runtime.js +132 -13
- package/src/client/doppler-registry.json +8 -7
- package/src/config/backward-registry-loader.js +17 -2
- package/src/config/execution-v0-contract-check.js +113 -15
- package/src/config/kernel-path-contract-check.js +57 -29
- package/src/config/kernel-path-loader.js +5 -36
- package/src/config/kernels/kernel-ref-digests.js +1 -1
- package/src/config/kernels/registry.js +14 -1
- package/src/config/kernels/registry.json +7 -5
- package/src/config/loader.d.ts +1 -1
- package/src/config/loader.js +12 -2
- package/src/config/merge-contract-check.js +59 -4
- package/src/config/merge-helpers.js +128 -7
- package/src/config/merge.d.ts +1 -0
- package/src/config/merge.js +10 -0
- package/src/config/param-validator.js +47 -2
- package/src/config/presets/kernel-paths/{gemma2-q4k-dequant-f32a.json → gemma2-q4k-dequant-f32a-nosubgroups.json} +3 -3
- package/src/config/presets/kernel-paths/gemma3-f16-fused-f32a-online-streamingprefill.json +223 -0
- package/src/config/presets/kernel-paths/{gemma3-q4k-dequant-f32a.json → gemma3-q4k-dequant-f32a-nosubgroups.json} +3 -3
- package/src/config/presets/kernel-paths/registry.json +29 -8
- package/src/config/presets/models/gemma2.json +2 -2
- package/src/config/presets/runtime/experiments/bench/gemma3-bench-q4k.json +1 -1
- package/src/config/presets/runtime/experiments/debug/gemma3-debug-q4k.json +1 -1
- package/src/config/presets/runtime/experiments/verify/gemma3-verify.json +1 -1
- package/src/config/presets/runtime/kernels/dequant-f16-q4k.json +6 -13
- package/src/config/presets/runtime/kernels/dequant-f32-q4k.json +6 -13
- package/src/config/presets/runtime/kernels/embeddinggemma-q4k-dequant-f32a.json +37 -0
- package/src/config/presets/runtime/kernels/fused-q4k.json +6 -13
- package/src/config/presets/runtime/kernels/gemma2-q4k-dequant-f16a.json +33 -0
- package/src/config/presets/runtime/kernels/gemma2-q4k-dequant-f32a-nosubgroups.json +33 -0
- package/src/config/presets/runtime/kernels/gemma2-q4k-fused-f32a.json +33 -0
- package/src/config/presets/runtime/kernels/safe-q4k.json +6 -13
- package/src/config/presets/runtime/platform/metal-apple-q4k.json +1 -1
- package/src/config/runtime.js +6 -1
- package/src/config/schema/debug.schema.d.ts +5 -0
- package/src/config/schema/doppler.schema.js +16 -21
- package/src/config/schema/inference-defaults.schema.js +3 -3
- package/src/config/schema/kernel-path.schema.d.ts +5 -1
- package/src/config/schema/kernel-thresholds.schema.js +12 -4
- package/src/config/schema/manifest.schema.d.ts +2 -1
- package/src/config/schema/manifest.schema.js +16 -3
- package/src/config/training-defaults.js +30 -22
- package/src/converter/conversion-plan.js +94 -9
- package/src/converter/core.d.ts +7 -0
- package/src/converter/core.js +14 -9
- package/src/converter/execution-v0-manifest.js +4 -1
- package/src/converter/index.d.ts +1 -0
- package/src/converter/index.js +1 -0
- package/src/converter/manifest-inference.js +43 -12
- package/src/converter/parsers/diffusion.js +0 -3
- package/src/converter/quantization-info.js +35 -15
- package/src/converter/shard-packer.d.ts +1 -1
- package/src/converter/shard-packer.js +4 -1
- package/src/debug/config.js +123 -11
- package/src/debug/signals.js +7 -1
- package/src/debug/tensor.d.ts +2 -0
- package/src/debug/tensor.js +13 -2
- package/src/distribution/p2p-control-plane.js +52 -12
- package/src/distribution/p2p-observability.js +43 -7
- package/src/distribution/p2p-webrtc-browser.js +20 -0
- package/src/distribution/shard-delivery.js +77 -26
- package/src/formats/gguf/types.js +33 -16
- package/src/formats/rdrr/groups.d.ts +12 -4
- package/src/formats/rdrr/groups.js +3 -6
- package/src/formats/rdrr/parsing.js +39 -2
- package/src/formats/rdrr/types.d.ts +2 -1
- package/src/gpu/command-recorder.js +86 -61
- package/src/gpu/device.d.ts +1 -0
- package/src/gpu/device.js +73 -19
- package/src/gpu/kernel-tuner/benchmarks.js +326 -316
- package/src/gpu/kernel-tuner/cache.js +71 -4
- package/src/gpu/kernel-tuner/tuner.js +22 -4
- package/src/gpu/kernels/attention.js +15 -34
- package/src/gpu/kernels/backward/adam.js +62 -58
- package/src/gpu/kernels/backward/attention_backward.js +257 -169
- package/src/gpu/kernels/backward/conv2d_backward.js +14 -1
- package/src/gpu/kernels/cast.js +191 -149
- package/src/gpu/kernels/check-stop.js +33 -44
- package/src/gpu/kernels/conv2d.js +27 -17
- package/src/gpu/kernels/cross_entropy_loss.js +21 -15
- package/src/gpu/kernels/depthwise_conv2d.js +36 -26
- package/src/gpu/kernels/dequant.js +178 -126
- package/src/gpu/kernels/energy.d.ts +3 -21
- package/src/gpu/kernels/energy.js +111 -88
- package/src/gpu/kernels/feature-check.js +1 -1
- package/src/gpu/kernels/fused_ffn.js +84 -65
- package/src/gpu/kernels/fused_matmul_residual.js +56 -33
- package/src/gpu/kernels/fused_matmul_rmsnorm.js +62 -45
- package/src/gpu/kernels/gather.js +33 -15
- package/src/gpu/kernels/gelu.js +19 -11
- package/src/gpu/kernels/grouped_pointwise_conv2d.js +33 -23
- package/src/gpu/kernels/groupnorm.js +34 -23
- package/src/gpu/kernels/kv-quantize.js +5 -2
- package/src/gpu/kernels/layernorm.js +35 -19
- package/src/gpu/kernels/logit-merge.js +5 -3
- package/src/gpu/kernels/matmul.js +58 -39
- package/src/gpu/kernels/modulate.js +23 -15
- package/src/gpu/kernels/moe.js +221 -175
- package/src/gpu/kernels/pixel_shuffle.js +22 -14
- package/src/gpu/kernels/relu.js +18 -10
- package/src/gpu/kernels/repeat_channels.js +25 -17
- package/src/gpu/kernels/residual.js +37 -27
- package/src/gpu/kernels/rmsnorm.js +57 -41
- package/src/gpu/kernels/rope.js +3 -0
- package/src/gpu/kernels/sample.js +27 -38
- package/src/gpu/kernels/sana_linear_attention.js +18 -10
- package/src/gpu/kernels/scale.js +18 -11
- package/src/gpu/kernels/shader-cache.js +4 -2
- package/src/gpu/kernels/silu.js +120 -72
- package/src/gpu/kernels/softmax.js +44 -25
- package/src/gpu/kernels/split_qkv.js +23 -13
- package/src/gpu/kernels/transpose.js +18 -10
- package/src/gpu/kernels/transpose.wgsl +5 -3
- package/src/gpu/kernels/upsample2d.js +21 -13
- package/src/gpu/kernels/utils.js +20 -13
- package/src/gpu/partitioned-buffer-pool.js +10 -2
- package/src/gpu/perf-guards.js +2 -9
- package/src/gpu/profiler.js +27 -22
- package/src/gpu/readback-utils.d.ts +16 -0
- package/src/gpu/readback-utils.js +41 -0
- package/src/gpu/submit-tracker.js +13 -0
- package/src/gpu/uniform-cache.d.ts +1 -0
- package/src/gpu/uniform-cache.js +30 -9
- package/src/hotswap/intent-bundle.js +6 -0
- package/src/hotswap/manifest.d.ts +10 -1
- package/src/hotswap/manifest.js +12 -2
- package/src/hotswap/runtime.js +30 -8
- package/src/index-browser.d.ts +44 -0
- package/src/index-browser.js +14 -0
- package/src/inference/browser-harness-contract-helpers.d.ts +5 -0
- package/src/inference/browser-harness-contract-helpers.js +28 -0
- package/src/inference/browser-harness-diffusion-energy-suites.d.ts +2 -0
- package/src/inference/browser-harness-diffusion-energy-suites.js +269 -0
- package/src/inference/browser-harness-model-helpers.d.ts +16 -0
- package/src/inference/browser-harness-model-helpers.js +217 -0
- package/src/inference/browser-harness-report-helpers.d.ts +7 -0
- package/src/inference/browser-harness-report-helpers.js +42 -0
- package/src/inference/browser-harness-runtime-helpers.d.ts +61 -0
- package/src/inference/browser-harness-runtime-helpers.js +415 -0
- package/src/inference/browser-harness-suite-helpers.d.ts +28 -0
- package/src/inference/browser-harness-suite-helpers.js +268 -0
- package/src/inference/browser-harness-text-helpers.d.ts +27 -0
- package/src/inference/browser-harness-text-helpers.js +788 -0
- package/src/inference/browser-harness.d.ts +6 -0
- package/src/inference/browser-harness.js +130 -1996
- package/src/inference/kv-cache/base.js +140 -94
- package/src/inference/kv-cache/tiered.js +5 -3
- package/src/inference/moe-router.js +88 -56
- package/src/inference/multi-model-network.js +5 -3
- package/src/inference/network-evolution.d.ts +11 -2
- package/src/inference/network-evolution.js +20 -21
- package/src/inference/pipelines/context.d.ts +3 -0
- package/src/inference/pipelines/context.js +142 -2
- package/src/inference/pipelines/diffusion/helpers.js +7 -2
- package/src/inference/pipelines/diffusion/pipeline.js +2 -1
- package/src/inference/pipelines/diffusion/sd3-transformer.js +10 -10
- package/src/inference/pipelines/diffusion/vae.js +3 -7
- package/src/inference/pipelines/energy/pipeline.js +27 -21
- package/src/inference/pipelines/energy/quintel.d.ts +5 -0
- package/src/inference/pipelines/energy/quintel.js +11 -0
- package/src/inference/pipelines/energy-head/row-head-pipeline.js +17 -13
- package/src/inference/pipelines/structured/json-head-pipeline.js +26 -11
- package/src/inference/pipelines/text/attention/projections.js +151 -101
- package/src/inference/pipelines/text/attention/record.js +62 -8
- package/src/inference/pipelines/text/attention/run.js +62 -8
- package/src/inference/pipelines/text/config.js +3 -4
- package/src/inference/pipelines/text/embed.js +2 -8
- package/src/inference/pipelines/text/execution-plan.js +41 -19
- package/src/inference/pipelines/text/execution-v0-contract-helpers.d.ts +59 -0
- package/src/inference/pipelines/text/execution-v0-contract-helpers.js +937 -0
- package/src/inference/pipelines/text/execution-v0-runtime-builders.d.ts +15 -0
- package/src/inference/pipelines/text/execution-v0-runtime-builders.js +279 -0
- package/src/inference/pipelines/text/execution-v0.js +62 -1013
- package/src/inference/pipelines/text/generator-steps.d.ts +46 -0
- package/src/inference/pipelines/text/generator-steps.js +298 -207
- package/src/inference/pipelines/text/generator.js +6 -23
- package/src/inference/pipelines/text/init.js +78 -20
- package/src/inference/pipelines/text/kernel-path-auto-select.js +2 -0
- package/src/inference/pipelines/text/kernel-trace.d.ts +2 -0
- package/src/inference/pipelines/text/kernel-trace.js +6 -0
- package/src/inference/pipelines/text/layer.js +3 -9
- package/src/inference/pipelines/text/linear-attention.d.ts +10 -0
- package/src/inference/pipelines/text/linear-attention.js +80 -6
- package/src/inference/pipelines/text/logits/gpu.js +10 -5
- package/src/inference/pipelines/text/logits/index.js +10 -11
- package/src/inference/pipelines/text/logits/utils.d.ts +7 -0
- package/src/inference/pipelines/text/logits/utils.js +9 -0
- package/src/inference/pipelines/text/lora-apply.js +50 -32
- package/src/inference/pipelines/text/model-load.js +279 -104
- package/src/inference/pipelines/text/moe-cache.js +5 -4
- package/src/inference/pipelines/text/moe-cpu-gptoss.js +74 -69
- package/src/inference/pipelines/text/moe-cpu.js +42 -38
- package/src/inference/pipelines/text/moe-gpu.js +110 -86
- package/src/inference/pipelines/text/ops.js +90 -90
- package/src/inference/pipelines/text/probes.js +9 -9
- package/src/inference/pipelines/text/weights.js +17 -7
- package/src/inference/pipelines/text.js +13 -1
- package/src/inference/speculative.d.ts +2 -2
- package/src/inference/speculative.js +4 -18
- package/src/inference/test-harness.d.ts +1 -1
- package/src/inference/test-harness.js +15 -5
- package/src/inference/tokenizer.d.ts +0 -5
- package/src/inference/tokenizer.js +4 -23
- package/src/inference/tokenizers/bpe.js +9 -0
- package/src/inference/tokenizers/bundled.js +20 -0
- package/src/inference/tokenizers/sentencepiece.js +12 -0
- package/src/loader/doppler-loader.js +38 -22
- package/src/loader/dtype-utils.js +3 -44
- package/src/loader/embedding-loader.js +7 -3
- package/src/loader/experts/expert-cache.js +13 -6
- package/src/loader/experts/expert-loader.js +10 -6
- package/src/loader/final-weights-loader.js +8 -4
- package/src/loader/layer-loader.js +2 -1
- package/src/loader/loader-state.js +2 -2
- package/src/loader/memory-monitor.js +8 -0
- package/src/loader/multi-model-loader.d.ts +14 -0
- package/src/loader/multi-model-loader.js +70 -24
- package/src/loader/shard-cache.js +81 -12
- package/src/loader/shard-resolver.js +25 -3
- package/src/loader/tensors/tensor-loader.js +209 -144
- package/src/loader/tensors/tensor-reader.js +76 -19
- package/src/loader/weight-downcast.js +1 -1
- package/src/memory/buffer-pool.d.ts +9 -1
- package/src/memory/buffer-pool.js +109 -44
- package/src/memory/unified-detect.js +1 -1
- package/src/rules/inference/kernel-path.rules.json +24 -8
- package/src/rules/rule-registry.js +25 -1
- package/src/storage/backends/opfs-store.js +68 -24
- package/src/storage/downloader.js +364 -83
- package/src/storage/index.d.ts +3 -0
- package/src/storage/index.js +3 -0
- package/src/storage/preflight.d.ts +2 -2
- package/src/storage/preflight.js +24 -2
- package/src/storage/quickstart-downloader.js +11 -5
- package/src/storage/registry.js +10 -4
- package/src/storage/reports.js +1 -1
- package/src/storage/shard-manager.d.ts +15 -1
- package/src/storage/shard-manager.js +51 -3
- package/src/storage/source-artifact-store.d.ts +52 -0
- package/src/storage/source-artifact-store.js +234 -0
- package/src/tooling/command-api-constants.d.ts +9 -0
- package/src/tooling/command-api-constants.js +9 -0
- package/src/tooling/command-api-family-normalizers.d.ts +9 -0
- package/src/tooling/command-api-family-normalizers.js +343 -0
- package/src/tooling/command-api-helpers.d.ts +25 -0
- package/src/tooling/command-api-helpers.js +262 -0
- package/src/tooling/command-api.js +16 -602
- package/src/tooling/command-envelope.js +4 -1
- package/src/tooling/command-runner-shared.js +52 -18
- package/src/tooling/lean-execution-contract.js +150 -3
- package/src/tooling/node-browser-command-runner.js +161 -271
- package/src/tooling/node-command-runner.js +29 -3
- package/src/tooling/node-converter.js +27 -1
- package/src/tooling/node-source-runtime.d.ts +1 -1
- package/src/tooling/node-source-runtime.js +84 -3
- package/src/tooling/node-webgpu.js +24 -21
- package/src/tooling/opfs-cache.js +21 -4
- package/src/tooling/runtime-input-composition.d.ts +38 -0
- package/src/tooling/runtime-input-composition.js +86 -0
- package/src/tooling/source-runtime-bundle.d.ts +40 -5
- package/src/tooling/source-runtime-bundle.js +261 -34
- package/src/tooling/source-runtime-materializer.d.ts +6 -0
- package/src/tooling/source-runtime-materializer.js +93 -0
- package/src/training/attention-backward.js +32 -17
- package/src/training/autograd.js +80 -52
- package/src/training/checkpoint-watch.d.ts +2 -1
- package/src/training/checkpoint-watch.js +39 -6
- package/src/training/checkpoint.js +40 -11
- package/src/training/clip.js +2 -1
- package/src/training/datasets/token-batch.js +20 -8
- package/src/training/distillation/checkpoint-watch.js +1 -0
- package/src/training/distillation/student-fixture.d.ts +22 -0
- package/src/training/distillation/student-fixture.js +846 -0
- package/src/training/distillation/suite-data.d.ts +45 -0
- package/src/training/distillation/suite-data.js +189 -0
- package/src/training/lora-pipeline.js +4 -7
- package/src/training/lora.js +26 -12
- package/src/training/loss.js +5 -6
- package/src/training/objectives/cross_entropy.js +2 -5
- package/src/training/objectives/distill_kd.js +4 -8
- package/src/training/objectives/distill_triplet.js +4 -8
- package/src/training/objectives/ul_stage2_base.js +4 -8
- package/src/training/operator-command.js +2 -0
- package/src/training/optimizer.js +19 -7
- package/src/training/runner.js +2 -1
- package/src/training/suite.js +18 -978
- package/src/training/tensor-factory.d.ts +9 -0
- package/src/training/tensor-factory.js +13 -0
- package/src/training/trainer.js +3 -5
- package/src/training/ul_dataset.js +3 -5
- package/src/training/workloads.js +70 -79
- package/src/version.js +1 -1
- package/tools/convert-safetensors-node.js +22 -16
- package/tools/doppler-cli.js +44 -25
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"source": "
|
|
3
|
+
"source": "models/catalog.json",
|
|
4
4
|
"models": [
|
|
5
5
|
{
|
|
6
|
-
"modelId": "gemma-3-270m-it-
|
|
6
|
+
"modelId": "gemma-3-270m-it-q4k-ehf16-af32",
|
|
7
7
|
"aliases": [
|
|
8
8
|
"gemma3-270m",
|
|
9
9
|
"google/gemma-3-270m-it",
|
|
10
10
|
"gemma-3-270m-it-wq4k-ef16",
|
|
11
|
+
"gemma-3-270m-it-wq4k-ef16-hf16",
|
|
11
12
|
"gemma-3-270m-it-wq4k-ef16-hf16-f32"
|
|
12
13
|
],
|
|
13
14
|
"modes": [
|
|
@@ -15,12 +16,12 @@
|
|
|
15
16
|
],
|
|
16
17
|
"hf": {
|
|
17
18
|
"repoId": "Clocksmith/rdrr",
|
|
18
|
-
"revision": "
|
|
19
|
-
"path": "models/gemma-3-270m-it-
|
|
19
|
+
"revision": "cd6c12be0e83e92d6dbd92598a0aa94391ec7e94",
|
|
20
|
+
"path": "models/gemma-3-270m-it-q4k-ehf16-af32"
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
|
-
"modelId": "google-embeddinggemma-300m-
|
|
24
|
+
"modelId": "google-embeddinggemma-300m-q4k-ehf16-af32",
|
|
24
25
|
"aliases": [
|
|
25
26
|
"embeddinggemma-300m",
|
|
26
27
|
"google/embeddinggemma-300m",
|
|
@@ -31,8 +32,8 @@
|
|
|
31
32
|
],
|
|
32
33
|
"hf": {
|
|
33
34
|
"repoId": "Clocksmith/rdrr",
|
|
34
|
-
"revision": "
|
|
35
|
-
"path": "models/google-embeddinggemma-300m-
|
|
35
|
+
"revision": "b23aca921ea11729d6f34b9484555968a5ab0e42",
|
|
36
|
+
"path": "models/google-embeddinggemma-300m-q4k-ehf16-af32"
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
]
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import { loadJson } from '../utils/load-json.js';
|
|
2
2
|
import { validateBackwardRegistry } from './schema/backward-registry.schema.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function deepFreeze(value, seen = new WeakSet()) {
|
|
5
|
+
if (!value || typeof value !== 'object' || seen.has(value)) {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
seen.add(value);
|
|
9
|
+
for (const entry of Object.values(value)) {
|
|
10
|
+
deepFreeze(entry, seen);
|
|
11
|
+
}
|
|
12
|
+
return Object.freeze(value);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const backwardRegistryData = deepFreeze(
|
|
16
|
+
validateBackwardRegistry(
|
|
17
|
+
await loadJson('./kernels/backward-registry.json', import.meta.url, 'Failed to load json')
|
|
18
|
+
)
|
|
19
|
+
);
|
|
5
20
|
|
|
6
21
|
export function loadBackwardRegistry() {
|
|
7
|
-
return
|
|
22
|
+
return backwardRegistryData;
|
|
8
23
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_EXECUTION_V0_COMPUTE_DEFAULTS,
|
|
3
|
-
isExecutionV0Digest,
|
|
4
|
-
isExecutionV0Semver,
|
|
5
|
-
} from './schema/execution-v0.schema.js';
|
|
1
|
+
import { isExecutionV0Digest, isExecutionV0Semver } from './schema/execution-v0.schema.js';
|
|
6
2
|
|
|
7
3
|
function normalizeDtype(value, label) {
|
|
8
4
|
const normalized = String(value ?? '').trim().toLowerCase();
|
|
@@ -32,6 +28,107 @@ function assertExecutionV0KernelRef(kernelRef, label) {
|
|
|
32
28
|
}
|
|
33
29
|
}
|
|
34
30
|
|
|
31
|
+
function requirePlainObject(value, label) {
|
|
32
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
33
|
+
throw new Error(`[ExecutionV0Contract] ${label} must be an object.`);
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function requireOwnProperty(root, key, label) {
|
|
39
|
+
if (!Object.prototype.hasOwnProperty.call(root, key)) {
|
|
40
|
+
throw new Error(`[ExecutionV0Contract] ${label} is required.`);
|
|
41
|
+
}
|
|
42
|
+
return root[key];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function requireNullableObject(root, key, label) {
|
|
46
|
+
const value = requireOwnProperty(root, key, label);
|
|
47
|
+
if (value === null) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return requirePlainObject(value, label);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function requireArrayProperty(root, key, label) {
|
|
54
|
+
const value = requireOwnProperty(root, key, label);
|
|
55
|
+
if (!Array.isArray(value)) {
|
|
56
|
+
throw new Error(`[ExecutionV0Contract] ${label} must be an array.`);
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function requireDtypeProperty(root, key, label) {
|
|
62
|
+
const value = requireOwnProperty(root, key, label);
|
|
63
|
+
if (value == null) {
|
|
64
|
+
throw new Error(`[ExecutionV0Contract] ${label} is required.`);
|
|
65
|
+
}
|
|
66
|
+
return normalizeDtype(value, label);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function validateExecutionV0SessionDefaults(sessionDefaults = {}) {
|
|
70
|
+
const normalizedSessionDefaults = requirePlainObject(
|
|
71
|
+
sessionDefaults,
|
|
72
|
+
'manifest.inference.sessionDefaults'
|
|
73
|
+
);
|
|
74
|
+
const compute = requirePlainObject(
|
|
75
|
+
requireOwnProperty(normalizedSessionDefaults, 'compute', 'sessionDefaults.compute'),
|
|
76
|
+
'sessionDefaults.compute'
|
|
77
|
+
);
|
|
78
|
+
const computeDefaults = requirePlainObject(
|
|
79
|
+
requireOwnProperty(compute, 'defaults', 'sessionDefaults.compute.defaults'),
|
|
80
|
+
'sessionDefaults.compute.defaults'
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
requireDtypeProperty(
|
|
84
|
+
computeDefaults,
|
|
85
|
+
'activationDtype',
|
|
86
|
+
'sessionDefaults.compute.defaults.activationDtype'
|
|
87
|
+
);
|
|
88
|
+
requireDtypeProperty(
|
|
89
|
+
computeDefaults,
|
|
90
|
+
'mathDtype',
|
|
91
|
+
'sessionDefaults.compute.defaults.mathDtype'
|
|
92
|
+
);
|
|
93
|
+
requireDtypeProperty(
|
|
94
|
+
computeDefaults,
|
|
95
|
+
'accumDtype',
|
|
96
|
+
'sessionDefaults.compute.defaults.accumDtype'
|
|
97
|
+
);
|
|
98
|
+
requireDtypeProperty(
|
|
99
|
+
computeDefaults,
|
|
100
|
+
'outputDtype',
|
|
101
|
+
'sessionDefaults.compute.defaults.outputDtype'
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
requireArrayProperty(
|
|
105
|
+
compute,
|
|
106
|
+
'kernelProfiles',
|
|
107
|
+
'sessionDefaults.compute.kernelProfiles'
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const kvcache = requireNullableObject(
|
|
111
|
+
normalizedSessionDefaults,
|
|
112
|
+
'kvcache',
|
|
113
|
+
'sessionDefaults.kvcache'
|
|
114
|
+
);
|
|
115
|
+
if (kvcache !== null) {
|
|
116
|
+
requireDtypeProperty(
|
|
117
|
+
kvcache,
|
|
118
|
+
'kvDtype',
|
|
119
|
+
'sessionDefaults.kvcache.kvDtype'
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
requireNullableObject(
|
|
124
|
+
normalizedSessionDefaults,
|
|
125
|
+
'decodeLoop',
|
|
126
|
+
'sessionDefaults.decodeLoop'
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
return normalizedSessionDefaults;
|
|
130
|
+
}
|
|
131
|
+
|
|
35
132
|
function createPrecisionSources(step, profile) {
|
|
36
133
|
return {
|
|
37
134
|
inputDtype: step.precision?.inputDtype != null
|
|
@@ -89,10 +186,10 @@ export function resolveExecutionV0KernelProfile(profileIndex, step) {
|
|
|
89
186
|
}
|
|
90
187
|
|
|
91
188
|
export function resolveExecutionV0Precision(step, profile, sessionDefaults = {}) {
|
|
92
|
-
const defaults =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
189
|
+
const defaults = requirePlainObject(
|
|
190
|
+
sessionDefaults?.compute?.defaults,
|
|
191
|
+
'sessionDefaults.compute.defaults'
|
|
192
|
+
);
|
|
96
193
|
const precision = {
|
|
97
194
|
inputDtype: step.precision?.inputDtype
|
|
98
195
|
?? profile?.precision?.inputDtype
|
|
@@ -132,12 +229,12 @@ export function resolveExecutionV0KVIO(step, profile, sessionDefaults = {}) {
|
|
|
132
229
|
source: 'kernelProfile',
|
|
133
230
|
};
|
|
134
231
|
}
|
|
135
|
-
const defaults = {
|
|
136
|
-
...DEFAULT_EXECUTION_V0_COMPUTE_DEFAULTS,
|
|
137
|
-
...(sessionDefaults?.compute?.defaults ?? {}),
|
|
138
|
-
};
|
|
139
232
|
const kvDtype = normalizeDtype(
|
|
140
|
-
|
|
233
|
+
requireOwnProperty(
|
|
234
|
+
requireNullableObject(sessionDefaults, 'kvcache', 'sessionDefaults.kvcache') ?? {},
|
|
235
|
+
'kvDtype',
|
|
236
|
+
'sessionDefaults.kvcache.kvDtype'
|
|
237
|
+
),
|
|
141
238
|
`${step.id}.sessionDefaults.kvcache.kvDtype`
|
|
142
239
|
);
|
|
143
240
|
return {
|
|
@@ -155,10 +252,11 @@ export function buildExecutionV0ContractArtifact(manifestInference, options = {}
|
|
|
155
252
|
const checks = [];
|
|
156
253
|
const errors = [];
|
|
157
254
|
const perStep = {};
|
|
158
|
-
|
|
255
|
+
let sessionDefaults = manifestInference.sessionDefaults ?? {};
|
|
159
256
|
let profileIndex;
|
|
160
257
|
|
|
161
258
|
try {
|
|
259
|
+
sessionDefaults = validateExecutionV0SessionDefaults(sessionDefaults);
|
|
162
260
|
profileIndex = indexExecutionV0KernelProfiles(sessionDefaults);
|
|
163
261
|
} catch (error) {
|
|
164
262
|
errors.push(error instanceof Error ? error.message : String(error));
|
|
@@ -36,6 +36,11 @@ function normalizeRegistryEntry(entry, index) {
|
|
|
36
36
|
? entry.aliasOf.trim()
|
|
37
37
|
: null;
|
|
38
38
|
const hasFile = typeof entry.file === 'string' && entry.file.trim() !== '';
|
|
39
|
+
if (aliasOf && hasFile) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`kernel-path contract: entries[${index}] must not include both file and aliasOf.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
39
44
|
if (!aliasOf && !hasFile) {
|
|
40
45
|
throw new Error(
|
|
41
46
|
`kernel-path contract: entries[${index}] must include file or aliasOf.`
|
|
@@ -111,12 +116,16 @@ function normalizeAutoSelectRule(rule, index) {
|
|
|
111
116
|
const hasSubgroups = typeof match.hasSubgroups === 'boolean'
|
|
112
117
|
? match.hasSubgroups
|
|
113
118
|
: null;
|
|
119
|
+
const hasF16 = typeof match.hasF16 === 'boolean'
|
|
120
|
+
? match.hasF16
|
|
121
|
+
: null;
|
|
114
122
|
const value = rule.value;
|
|
115
123
|
if (typeof value === 'string' && value.trim() !== '') {
|
|
116
124
|
return {
|
|
117
125
|
matchKernelPathRef,
|
|
118
126
|
allowCapabilityAutoSelection,
|
|
119
127
|
hasSubgroups,
|
|
128
|
+
hasF16,
|
|
120
129
|
valueKind: 'string',
|
|
121
130
|
value: value.trim(),
|
|
122
131
|
isDefault: Object.keys(match).length === 0,
|
|
@@ -127,6 +136,7 @@ function normalizeAutoSelectRule(rule, index) {
|
|
|
127
136
|
matchKernelPathRef,
|
|
128
137
|
allowCapabilityAutoSelection,
|
|
129
138
|
hasSubgroups,
|
|
139
|
+
hasF16,
|
|
130
140
|
valueKind: 'context',
|
|
131
141
|
value: value.context.trim(),
|
|
132
142
|
isDefault: Object.keys(match).length === 0,
|
|
@@ -380,9 +390,9 @@ export function validateKernelPathContractFacts(facts) {
|
|
|
380
390
|
autoSelectShapeErrors += 1;
|
|
381
391
|
errors.push('[KernelPathContract] non-default autoSelect rules must match on kernelPathRef.');
|
|
382
392
|
}
|
|
383
|
-
if (rule.hasSubgroups == null) {
|
|
393
|
+
if (rule.hasSubgroups == null && rule.hasF16 == null) {
|
|
384
394
|
autoSelectShapeErrors += 1;
|
|
385
|
-
errors.push('[KernelPathContract] non-default autoSelect rules must match on hasSubgroups.');
|
|
395
|
+
errors.push('[KernelPathContract] non-default autoSelect rules must match on hasSubgroups and/or hasF16.');
|
|
386
396
|
}
|
|
387
397
|
if (rule.valueKind === 'context') {
|
|
388
398
|
autoSelectShapeErrors += 1;
|
|
@@ -401,36 +411,54 @@ export function validateKernelPathContractFacts(facts) {
|
|
|
401
411
|
);
|
|
402
412
|
}
|
|
403
413
|
}
|
|
404
|
-
const resolvedAutoSelectRules = autoSelectRules.map((rule) =>
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
: rule.
|
|
415
|
-
|
|
414
|
+
const resolvedAutoSelectRules = autoSelectRules.map((rule) => {
|
|
415
|
+
if (rule.isDefault) {
|
|
416
|
+
return {
|
|
417
|
+
match: {},
|
|
418
|
+
value: rule.valueKind === 'context'
|
|
419
|
+
? { context: rule.value }
|
|
420
|
+
: rule.value,
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
const match = {
|
|
424
|
+
allowCapabilityAutoSelection: rule.allowCapabilityAutoSelection,
|
|
425
|
+
kernelPathRef: rule.matchKernelPathRef,
|
|
426
|
+
};
|
|
427
|
+
if (rule.hasSubgroups != null) {
|
|
428
|
+
match.hasSubgroups = rule.hasSubgroups;
|
|
429
|
+
}
|
|
430
|
+
if (rule.hasF16 != null) {
|
|
431
|
+
match.hasF16 = rule.hasF16;
|
|
432
|
+
}
|
|
433
|
+
return {
|
|
434
|
+
match,
|
|
435
|
+
value: rule.valueKind === 'context'
|
|
436
|
+
? { context: rule.value }
|
|
437
|
+
: rule.value,
|
|
438
|
+
};
|
|
439
|
+
});
|
|
416
440
|
for (const entry of entries) {
|
|
417
441
|
for (const allowCapabilityAutoSelection of [true, false]) {
|
|
418
442
|
for (const hasSubgroups of [true, false]) {
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
443
|
+
for (const hasF16 of [true, false]) {
|
|
444
|
+
const selected = selectByRules(resolvedAutoSelectRules, {
|
|
445
|
+
kernelPathRef: entry.id,
|
|
446
|
+
allowCapabilityAutoSelection,
|
|
447
|
+
hasSubgroups,
|
|
448
|
+
hasF16,
|
|
449
|
+
});
|
|
450
|
+
const resolved = isPlainObject(selected) && selected.context === 'kernelPathRef'
|
|
451
|
+
? entry.id
|
|
452
|
+
: selected;
|
|
453
|
+
if (typeof resolved !== 'string' || !resolved.length || !entriesById.has(resolved)) {
|
|
454
|
+
autoSelectCoverageErrors += 1;
|
|
455
|
+
errors.push(
|
|
456
|
+
`[KernelPathContract] autoSelect rules did not yield a valid kernel path for ` +
|
|
457
|
+
`"${entry.id}" (allowCapabilityAutoSelection=${allowCapabilityAutoSelection}, ` +
|
|
458
|
+
`hasSubgroups=${hasSubgroups}, hasF16=${hasF16}).`
|
|
459
|
+
);
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
434
462
|
}
|
|
435
463
|
}
|
|
436
464
|
}
|
|
@@ -3,6 +3,7 @@ import { KERNEL_CONFIGS } from '../gpu/kernels/utils.js';
|
|
|
3
3
|
import { selectByRules } from '../gpu/kernels/rule-matcher.js';
|
|
4
4
|
import { loadJson } from '../utils/load-json.js';
|
|
5
5
|
import { buildKernelPathContractArtifact } from './kernel-path-contract-check.js';
|
|
6
|
+
import { mergeKernelPathPolicy } from './merge-helpers.js';
|
|
6
7
|
|
|
7
8
|
// =============================================================================
|
|
8
9
|
// Built-in Kernel Paths (imported at build time)
|
|
@@ -454,49 +455,17 @@ export function getKernelPathAttentionVariant(
|
|
|
454
455
|
|
|
455
456
|
let activeKernelPath = null;
|
|
456
457
|
let activeKernelPathSource = 'none';
|
|
457
|
-
|
|
458
|
+
const DEFAULT_ACTIVE_KERNEL_PATH_POLICY = {
|
|
458
459
|
mode: 'locked',
|
|
459
460
|
sourceScope: ['model', 'manifest'],
|
|
460
461
|
onIncompatible: 'error',
|
|
461
462
|
};
|
|
463
|
+
let activeKernelPathPolicy = DEFAULT_ACTIVE_KERNEL_PATH_POLICY;
|
|
462
464
|
|
|
463
|
-
function
|
|
464
|
-
const normalized = String(source ?? '').trim().toLowerCase();
|
|
465
|
-
if (normalized === 'runtime') return 'config';
|
|
466
|
-
if (normalized === 'execution_v0') return 'execution-v0';
|
|
467
|
-
return normalized;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
function normalizeKernelPathPolicy(policy) {
|
|
471
|
-
if (!policy || typeof policy !== 'object' || Array.isArray(policy)) {
|
|
472
|
-
return {
|
|
473
|
-
mode: 'locked',
|
|
474
|
-
sourceScope: ['model', 'manifest'],
|
|
475
|
-
onIncompatible: 'error',
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
const mode = String(policy.mode ?? '').trim().toLowerCase() === 'capability-aware'
|
|
479
|
-
? 'capability-aware'
|
|
480
|
-
: 'locked';
|
|
481
|
-
const sourceScope = Array.isArray(policy.sourceScope ?? policy.allowSources)
|
|
482
|
-
? (policy.sourceScope ?? policy.allowSources)
|
|
483
|
-
.map((source) => normalizeKernelPathSource(source))
|
|
484
|
-
.filter((source) => source.length > 0)
|
|
485
|
-
: ['model', 'manifest'];
|
|
486
|
-
const onIncompatible = String(policy.onIncompatible ?? '').trim().toLowerCase() === 'remap'
|
|
487
|
-
? 'remap'
|
|
488
|
-
: 'error';
|
|
489
|
-
return {
|
|
490
|
-
mode,
|
|
491
|
-
sourceScope: sourceScope.length > 0 ? [...new Set(sourceScope)] : ['model', 'manifest'],
|
|
492
|
-
onIncompatible,
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
export function setActiveKernelPath(path, source = 'none', policy = null) {
|
|
465
|
+
export function setActiveKernelPath(path, source = 'none', policy = undefined) {
|
|
497
466
|
activeKernelPath = path;
|
|
498
467
|
activeKernelPathSource = path ? source : 'none';
|
|
499
|
-
activeKernelPathPolicy =
|
|
468
|
+
activeKernelPathPolicy = mergeKernelPathPolicy(DEFAULT_ACTIVE_KERNEL_PATH_POLICY, policy);
|
|
500
469
|
}
|
|
501
470
|
|
|
502
471
|
export function getActiveKernelPath() {
|
|
@@ -220,7 +220,7 @@ export const KERNEL_REF_CONTENT_DIGESTS = Object.freeze({
|
|
|
220
220
|
"topk.wgsl#main": "a18763303cd18e8a020e647f8a52f65403526849faf835d9f9394f634c3c97eb",
|
|
221
221
|
"topk.wgsl#softmax_topk": "95ff3517da909e4bd4d0ff8d85b619bd250522943aeb9276375edc59f67e9604",
|
|
222
222
|
"topk.wgsl#topk_2_small": "289eaa5c4f005e0aaf37dfe5343aeda30d9ab3929979dbf0cc3553f23e136807",
|
|
223
|
-
"transpose.wgsl#main": "
|
|
223
|
+
"transpose.wgsl#main": "8caf8664dfc579b4e92edce50783263c535764006290cc7902108f26586113a2",
|
|
224
224
|
"upsample2d_f16.wgsl#main": "43cee5f2503cb4b6caea45e9842f8961ce313b02eb8ed23a97d6967113ce521c",
|
|
225
225
|
"upsample2d.wgsl#main": "6de9172ad3d6940dd3c94470a105755a33760e66a84d6e9e96ec4d6a07dc4a25"
|
|
226
226
|
});
|
|
@@ -4,6 +4,17 @@ let cachedRegistry = null;
|
|
|
4
4
|
|
|
5
5
|
let registryUrl = null;
|
|
6
6
|
|
|
7
|
+
function deepFreeze(value, seen = new WeakSet()) {
|
|
8
|
+
if (!value || typeof value !== 'object' || seen.has(value)) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
seen.add(value);
|
|
12
|
+
for (const entry of Object.values(value)) {
|
|
13
|
+
deepFreeze(entry, seen);
|
|
14
|
+
}
|
|
15
|
+
return Object.freeze(value);
|
|
16
|
+
}
|
|
17
|
+
|
|
7
18
|
export function setRegistryUrl(url) {
|
|
8
19
|
registryUrl = url;
|
|
9
20
|
cachedRegistry = null;
|
|
@@ -15,7 +26,9 @@ export async function getRegistry() {
|
|
|
15
26
|
}
|
|
16
27
|
|
|
17
28
|
const source = registryUrl || './registry.json';
|
|
18
|
-
cachedRegistry =
|
|
29
|
+
cachedRegistry = deepFreeze(
|
|
30
|
+
await loadJson(source, import.meta.url, 'Failed to load kernel registry')
|
|
31
|
+
);
|
|
19
32
|
return cachedRegistry;
|
|
20
33
|
}
|
|
21
34
|
|
|
@@ -2174,7 +2174,7 @@
|
|
|
2174
2174
|
}
|
|
2175
2175
|
],
|
|
2176
2176
|
"baseUniforms": {
|
|
2177
|
-
"size":
|
|
2177
|
+
"size": 32,
|
|
2178
2178
|
"fields": [
|
|
2179
2179
|
{
|
|
2180
2180
|
"name": "M",
|
|
@@ -2202,7 +2202,9 @@
|
|
|
2202
2202
|
1,
|
|
2203
2203
|
1
|
|
2204
2204
|
],
|
|
2205
|
-
"requires": [
|
|
2205
|
+
"requires": [
|
|
2206
|
+
"shader-f16"
|
|
2207
|
+
]
|
|
2206
2208
|
},
|
|
2207
2209
|
"f16": {
|
|
2208
2210
|
"wgsl": "matmul_gemv_residual_f16.wgsl",
|
|
@@ -2377,12 +2379,12 @@
|
|
|
2377
2379
|
"offset": 20
|
|
2378
2380
|
},
|
|
2379
2381
|
{
|
|
2380
|
-
"name": "
|
|
2382
|
+
"name": "rotary_dim",
|
|
2381
2383
|
"type": "u32",
|
|
2382
2384
|
"offset": 24
|
|
2383
2385
|
},
|
|
2384
2386
|
{
|
|
2385
|
-
"name": "
|
|
2387
|
+
"name": "interleaved",
|
|
2386
2388
|
"type": "u32",
|
|
2387
2389
|
"offset": 28
|
|
2388
2390
|
}
|
|
@@ -4116,7 +4118,7 @@
|
|
|
4116
4118
|
}
|
|
4117
4119
|
],
|
|
4118
4120
|
"baseUniforms": {
|
|
4119
|
-
"size":
|
|
4121
|
+
"size": 32,
|
|
4120
4122
|
"fields": [
|
|
4121
4123
|
{
|
|
4122
4124
|
"name": "num_tokens",
|
package/src/config/loader.d.ts
CHANGED
package/src/config/loader.js
CHANGED
|
@@ -161,8 +161,7 @@ export function detectPreset(
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
return 'transformer';
|
|
164
|
+
return null;
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
// =============================================================================
|
|
@@ -178,6 +177,17 @@ export function resolveConfig(
|
|
|
178
177
|
(manifest.config || {}),
|
|
179
178
|
manifest.modelType
|
|
180
179
|
);
|
|
180
|
+
if (!id) {
|
|
181
|
+
const modelId = String(manifest?.modelId ?? 'unknown').trim() || 'unknown';
|
|
182
|
+
const modelType = String(manifest?.config?.model_type ?? 'unknown').trim() || 'unknown';
|
|
183
|
+
const architecture = String(manifest?.modelType ?? 'unknown').trim() || 'unknown';
|
|
184
|
+
throw createDopplerError(
|
|
185
|
+
ERROR_CODES.CONFIG_PRESET_UNKNOWN,
|
|
186
|
+
`Could not detect a preset for manifest "${modelId}" ` +
|
|
187
|
+
`(architecture="${architecture}", model_type="${modelType}"). ` +
|
|
188
|
+
'Provide an explicit presetId instead of relying on the generic transformer fallback.'
|
|
189
|
+
);
|
|
190
|
+
}
|
|
181
191
|
|
|
182
192
|
// Get resolved preset
|
|
183
193
|
const preset = resolvePreset(id);
|
|
@@ -77,6 +77,7 @@ function buildWitnessMergeManifest() {
|
|
|
77
77
|
embeddingTranspose: false,
|
|
78
78
|
embeddingVocabSize: 1024,
|
|
79
79
|
},
|
|
80
|
+
pipeline: 'decode-only',
|
|
80
81
|
layerPattern: null,
|
|
81
82
|
chatTemplate: {
|
|
82
83
|
type: 'gemma',
|
|
@@ -114,6 +115,13 @@ export function buildMergeContractArtifact() {
|
|
|
114
115
|
&& mergedUndefined._sources.get('inference.defaultKernelPath') === 'manifest',
|
|
115
116
|
`value=${mergedUndefined.inference.defaultKernelPath}, source=${mergedUndefined._sources.get('inference.defaultKernelPath')}`
|
|
116
117
|
);
|
|
118
|
+
recordCheck(
|
|
119
|
+
checks,
|
|
120
|
+
'runtime.mergeConfig.pipeline_preserves_manifest_value',
|
|
121
|
+
mergedUndefined.inference.pipeline === 'decode-only'
|
|
122
|
+
&& mergedUndefined._sources.get('inference.pipeline') === 'manifest',
|
|
123
|
+
`value=${String(mergedUndefined.inference.pipeline)}, source=${mergedUndefined._sources.get('inference.pipeline')}`
|
|
124
|
+
);
|
|
117
125
|
|
|
118
126
|
const mergedNull = mergeConfig(buildWitnessMergeManifest(), {
|
|
119
127
|
defaultKernelPath: null,
|
|
@@ -152,6 +160,35 @@ export function buildMergeContractArtifact() {
|
|
|
152
160
|
`value=${String(runtimeConfig.runtime.inference.chatTemplate.enabled)}`
|
|
153
161
|
);
|
|
154
162
|
|
|
163
|
+
const isolatedConfigA = createDopplerConfig();
|
|
164
|
+
isolatedConfigA.runtime.inference.compute.activationDtype = 'f32';
|
|
165
|
+
const isolatedConfigB = createDopplerConfig();
|
|
166
|
+
recordCheck(
|
|
167
|
+
checks,
|
|
168
|
+
'runtime.schema.defaults_are_isolated_per_instance',
|
|
169
|
+
isolatedConfigB.runtime.inference.compute.activationDtype !== 'f32'
|
|
170
|
+
&& isolatedConfigA.runtime.inference.compute !== isolatedConfigB.runtime.inference.compute,
|
|
171
|
+
`configA=${isolatedConfigA.runtime.inference.compute.activationDtype}, configB=${isolatedConfigB.runtime.inference.compute.activationDtype}`,
|
|
172
|
+
'actual'
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
const calibrateConfig = createDopplerConfig({
|
|
176
|
+
runtime: {
|
|
177
|
+
shared: {
|
|
178
|
+
tooling: {
|
|
179
|
+
intent: 'calibrate',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
recordCheck(
|
|
185
|
+
checks,
|
|
186
|
+
'runtime.schema.calibrate_does_not_mutate_kernel_warmup_defaults',
|
|
187
|
+
calibrateConfig.runtime.shared.kernelWarmup.prewarm === false,
|
|
188
|
+
`prewarm=${String(calibrateConfig.runtime.shared.kernelWarmup.prewarm)}`,
|
|
189
|
+
'actual'
|
|
190
|
+
);
|
|
191
|
+
|
|
155
192
|
const overlaySources = new Map();
|
|
156
193
|
const chosenRuntimeValue = chooseDefinedWithSource(
|
|
157
194
|
'inference.defaultKernelPath',
|
|
@@ -252,6 +289,24 @@ export function buildMergeContractArtifact() {
|
|
|
252
289
|
'actual'
|
|
253
290
|
);
|
|
254
291
|
|
|
292
|
+
let invalidShallowOverrideError = null;
|
|
293
|
+
try {
|
|
294
|
+
mergeShallowObject(
|
|
295
|
+
{ type: 'base', enabled: true },
|
|
296
|
+
null
|
|
297
|
+
);
|
|
298
|
+
} catch (error) {
|
|
299
|
+
invalidShallowOverrideError = error;
|
|
300
|
+
}
|
|
301
|
+
recordCheck(
|
|
302
|
+
checks,
|
|
303
|
+
'runtime.mergeShallowObject.invalid_explicit_override_fails_closed',
|
|
304
|
+
invalidShallowOverrideError instanceof Error
|
|
305
|
+
&& /shallow object overrides must be plain objects/.test(invalidShallowOverrideError.message),
|
|
306
|
+
`error=${invalidShallowOverrideError?.message ?? 'none'}`,
|
|
307
|
+
'actual'
|
|
308
|
+
);
|
|
309
|
+
|
|
255
310
|
const layeredAttention = mergeLayeredShallowObjects(
|
|
256
311
|
{ slidingWindow: 4096, attentionBias: false },
|
|
257
312
|
{ slidingWindow: 2048 },
|
|
@@ -273,7 +328,7 @@ export function buildMergeContractArtifact() {
|
|
|
273
328
|
onIncompatible: 'error',
|
|
274
329
|
},
|
|
275
330
|
{
|
|
276
|
-
allowSources: ['
|
|
331
|
+
allowSources: ['config', 'execution-v0'],
|
|
277
332
|
onIncompatible: 'remap',
|
|
278
333
|
}
|
|
279
334
|
);
|
|
@@ -283,7 +338,7 @@ export function buildMergeContractArtifact() {
|
|
|
283
338
|
Array.isArray(mergedKernelPathPolicy.sourceScope)
|
|
284
339
|
&& Array.isArray(mergedKernelPathPolicy.allowSources)
|
|
285
340
|
&& mergedKernelPathPolicy.sourceScope.length === 2
|
|
286
|
-
&& mergedKernelPathPolicy.sourceScope[0] === '
|
|
341
|
+
&& mergedKernelPathPolicy.sourceScope[0] === 'config'
|
|
287
342
|
&& mergedKernelPathPolicy.allowSources[1] === 'execution-v0'
|
|
288
343
|
&& mergedKernelPathPolicy.onIncompatible === 'remap',
|
|
289
344
|
`sourceScope=${JSON.stringify(mergedKernelPathPolicy.sourceScope)}, allowSources=${JSON.stringify(mergedKernelPathPolicy.allowSources)}`,
|
|
@@ -294,7 +349,7 @@ export function buildMergeContractArtifact() {
|
|
|
294
349
|
runtime: {
|
|
295
350
|
inference: {
|
|
296
351
|
kernelPathPolicy: {
|
|
297
|
-
allowSources: ['
|
|
352
|
+
allowSources: ['config', 'execution-v0'],
|
|
298
353
|
},
|
|
299
354
|
},
|
|
300
355
|
},
|
|
@@ -303,7 +358,7 @@ export function buildMergeContractArtifact() {
|
|
|
303
358
|
checks,
|
|
304
359
|
'runtime.schema.kernelPathPolicy.helper_is_used',
|
|
305
360
|
Array.isArray(runtimeConfigWithKernelPathPolicy.runtime.inference.kernelPathPolicy.sourceScope)
|
|
306
|
-
&& runtimeConfigWithKernelPathPolicy.runtime.inference.kernelPathPolicy.sourceScope[0] === '
|
|
361
|
+
&& runtimeConfigWithKernelPathPolicy.runtime.inference.kernelPathPolicy.sourceScope[0] === 'config'
|
|
307
362
|
&& runtimeConfigWithKernelPathPolicy.runtime.inference.kernelPathPolicy.allowSources[1] === 'execution-v0',
|
|
308
363
|
`policy=${JSON.stringify(runtimeConfigWithKernelPathPolicy.runtime.inference.kernelPathPolicy)}`,
|
|
309
364
|
'actual'
|