doppler-gpu 0.4.15 → 0.5.1

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.
Files changed (221) hide show
  1. package/README.md +9 -0
  2. package/package.json +25 -2
  3. package/src/cli/doppler-cli.js +253 -94
  4. package/src/cli/runtime-profiles.js +3 -7
  5. package/src/client/doppler-api.d.ts +28 -0
  6. package/src/client/doppler-api.js +2 -0
  7. package/src/client/inspection.d.ts +122 -0
  8. package/src/client/inspection.js +343 -0
  9. package/src/client/runtime/index.d.ts +54 -0
  10. package/src/client/runtime/index.js +190 -18
  11. package/src/client/runtime/model-manager.d.ts +0 -4
  12. package/src/client/runtime/model-manager.js +0 -28
  13. package/src/client/runtime/model-session.d.ts +48 -1
  14. package/src/client/runtime/model-session.js +149 -30
  15. package/src/client/runtime/model-source.d.ts +10 -1
  16. package/src/client/runtime/scoped-session.d.ts +117 -0
  17. package/src/client/runtime/scoped-session.js +257 -0
  18. package/src/client/runtime/types.d.ts +0 -1
  19. package/src/client/runtime/types.js +0 -1
  20. package/src/config/evidence/boundary-evidence-policy.json +54 -0
  21. package/src/config/evidence/source-intake-policy.json +122 -0
  22. package/src/config/inspection/observation-policies.json +80 -0
  23. package/src/config/param-validator.js +21 -36
  24. package/src/config/runtime/compute/f16-activations.json +1 -0
  25. package/src/config/runtime/compute/f16-batched.json +1 -0
  26. package/src/config/runtime/default.json +1 -0
  27. package/src/config/runtime/diagnostics/debug-logits.json +1 -0
  28. package/src/config/runtime/experiments/bench/gemma3-bench-q4k-alt.json +1 -0
  29. package/src/config/runtime/experiments/bench/gemma3-bench-q4k-batched.json +1 -0
  30. package/src/config/runtime/experiments/bench/gemma3-bench-q4k.json +1 -0
  31. package/src/config/runtime/experiments/bench/gemma4-bench-q4k.json +1 -0
  32. package/src/config/runtime/experiments/bench/qwen3-bench-q4k-alt.json +1 -0
  33. package/src/config/runtime/experiments/bench/qwen3-bench-q4k-batched.json +1 -0
  34. package/src/config/runtime/experiments/debug/gemma3-browser-diagnose-q4k.json +1 -1
  35. package/src/config/runtime/experiments/debug/gemma3-debug-q4k.json +1 -3
  36. package/src/config/runtime/experiments/debug/gemma4-e2b-browser-diagnose-q4k.json +1 -1
  37. package/src/config/runtime/experiments/debug/qwen35-browser-diagnose-q4k.json +1 -1
  38. package/src/config/runtime/experiments/verify/gemma3-verify.json +1 -3
  39. package/src/config/runtime/experiments/verify/gemma4-e2b-verify.json +1 -3
  40. package/src/config/runtime/experiments/verify/lfm2-verify.json +1 -3
  41. package/src/config/runtime/experiments/verify/translategemma-verify.json +1 -3
  42. package/src/config/runtime/model/gemma2-debug.json +1 -0
  43. package/src/config/runtime/model/gemma2-pipeline-debug.json +1 -0
  44. package/src/config/runtime/model/gemma2-pipeline.json +1 -0
  45. package/src/config/runtime/model/gemma3-layer-probe.json +1 -0
  46. package/src/config/runtime/model/qwen3-5-layer-probe.json +1 -0
  47. package/src/config/runtime/model/qwen3-5-layer3-boundary-probe.json +1 -0
  48. package/src/config/runtime/model/qwen3-5-linear-attn-debug.json +1 -0
  49. package/src/config/runtime/optimization-candidates/registry.json +5 -0
  50. package/src/config/runtime/platform/metal-apple-q4k.json +1 -0
  51. package/src/config/runtime/profiles/default.json +1 -0
  52. package/src/config/runtime/profiles/diffusiongemma-26b-a4b-throughput.json +1 -0
  53. package/src/config/runtime/profiles/gemma3-270m-q4k-throughput-overlapped-probe.json +1 -0
  54. package/src/config/runtime/profiles/gemma3-270m-q4k-throughput-probe.json +1 -0
  55. package/src/config/runtime/profiles/gemma4-12b-rdrr-safe-b4.json +1 -3
  56. package/src/config/runtime/profiles/gemma4-12b-rdrr-safe-single.json +1 -3
  57. package/src/config/runtime/profiles/gemma4-31b-f16-activations-probe.json +1 -5
  58. package/src/config/runtime/profiles/gemma4-e2b-baseline-probe.json +1 -3
  59. package/src/config/runtime/profiles/gemma4-e2b-fused-rmsnorm-probe.json +1 -3
  60. package/src/config/runtime/profiles/gemma4-e2b-fused-rmsnorm-test.json +1 -0
  61. package/src/config/runtime/profiles/gemma4-e2b-int4ple-baseline-probe.json +1 -5
  62. package/src/config/runtime/profiles/gemma4-e2b-int4ple-f16a-probe.json +1 -5
  63. package/src/config/runtime/profiles/gemma4-e2b-int4ple-reference-export.json +1 -3
  64. package/src/config/runtime/profiles/gemma4-e2b-int4ple-retain-q4k-probe.json +1 -5
  65. package/src/config/runtime/profiles/gemma4-e2b-low-memory.json +1 -0
  66. package/src/config/runtime/profiles/gemma4-e2b-prefill-profile.json +1 -3
  67. package/src/config/runtime/profiles/gemma4-e2b-throughput-probe.json +1 -0
  68. package/src/config/runtime/profiles/low-memory.json +1 -0
  69. package/src/config/runtime/profiles/production.json +1 -3
  70. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-attn128-candidate.json +1 -0
  71. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-maxbatch64-candidate.json +1 -0
  72. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-normed-ffn-candidate.json +1 -0
  73. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-overlap-ringtokens1-candidate.json +1 -0
  74. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-parity.json +1 -0
  75. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-sequential-candidate.json +1 -0
  76. package/src/config/runtime/profiles/qwen-3-5-0-8b-metal-throughput.json +1 -0
  77. package/src/config/runtime/profiles/qwen-3-5-0-8b-prefill-profile.json +1 -3
  78. package/src/config/runtime/profiles/qwen-3-5-0-8b-throughput-probe.json +1 -0
  79. package/src/config/runtime/profiles/qwen-3-5-2b-f16-primary-throughput.json +1 -5
  80. package/src/config/runtime/profiles/qwen-3-5-2b-metal-parity.json +1 -0
  81. package/src/config/runtime/profiles/qwen-3-5-2b-metal-throughput.json +1 -0
  82. package/src/config/runtime/profiles/qwen-3-5-9b-metal-correctness.json +1 -0
  83. package/src/config/runtime/profiles/qwen-3-embedding-0-6b-metal-stability.json +1 -3
  84. package/src/config/runtime/profiles/qwen-3-embedding-0-6b-metal-throughput.json +1 -0
  85. package/src/config/runtime/profiles/qwen-3-reranker-0-6b-metal-stability.json +1 -0
  86. package/src/config/runtime/profiles/qwen-3-reranker-0-6b-metal-throughput.json +1 -0
  87. package/src/config/runtime/profiles/qwen3-6-27b-f16-activations-probe.json +1 -5
  88. package/src/config/runtime/profiles/rerank-stability.json +1 -3
  89. package/src/config/runtime/profiles/rerank-throughput.json +1 -3
  90. package/src/config/runtime/profiles/simulation.json +1 -3
  91. package/src/config/runtime/profiles/throughput.json +1 -3
  92. package/src/config/runtime/profiles/trace-layers.json +1 -3
  93. package/src/config/runtime/profiles/translategemma-1b-nativekd2-q4k-rdna3-throughput-probe.json +1 -0
  94. package/src/config/runtime/profiles/turboquant-contiguous-prod.json +1 -0
  95. package/src/config/runtime/profiles/turboquant-contiguous.json +1 -0
  96. package/src/config/runtime/profiles/turboquant.json +1 -0
  97. package/src/config/runtime/profiles/vector-stability.json +1 -3
  98. package/src/config/runtime/profiles/vector-throughput.json +1 -0
  99. package/src/config/runtime/profiles/verbose-trace.json +1 -3
  100. package/src/config/runtime/tiers/gemma4-128gb.json +1 -0
  101. package/src/config/runtime/tiers/gemma4-16gb.json +1 -0
  102. package/src/config/runtime/tiers/gemma4-24gb.json +1 -0
  103. package/src/config/runtime/tiers/gemma4-32gb.json +1 -0
  104. package/src/config/schema/benchmark.schema.d.ts +7 -0
  105. package/src/config/schema/benchmark.schema.js +5 -0
  106. package/src/config/schema/index.d.ts +8 -16
  107. package/src/config/schema/index.js +5 -8
  108. package/src/config/schema/kernel-thresholds.schema.d.ts +0 -12
  109. package/src/config/schema/kernel-thresholds.schema.js +0 -12
  110. package/src/config/schema/kernel-warmup.schema.d.ts +1 -3
  111. package/src/config/schema/kernel-warmup.schema.js +0 -1
  112. package/src/config/schema/runtime-profile.schema.d.ts +24 -0
  113. package/src/config/schema/runtime-profile.schema.js +92 -0
  114. package/src/config/schema/shared-runtime.schema.d.ts +1 -4
  115. package/src/config/schema/shared-runtime.schema.js +0 -2
  116. package/src/config/schema/tooling.schema.d.ts +8 -5
  117. package/src/config/schema/tooling.schema.js +3 -2
  118. package/src/debug/tensor.d.ts +2 -0
  119. package/src/debug/tensor.js +21 -2
  120. package/src/gpu/command-recorder.d.ts +5 -0
  121. package/src/gpu/command-recorder.js +17 -0
  122. package/src/gpu/kernel-runtime.js +2 -10
  123. package/src/gpu/kernels/index.d.ts +0 -2
  124. package/src/gpu/kernels/index.js +0 -2
  125. package/src/gpu/kernels/kernel-prewarm.d.ts +3 -0
  126. package/src/gpu/kernels/kernel-prewarm.js +60 -0
  127. package/src/gpu/kernels/utils.d.ts +2 -4
  128. package/src/gpu/kernels/utils.js +2 -4
  129. package/src/index.d.ts +13 -1
  130. package/src/index.js +7 -1
  131. package/src/inference/browser-harness-model-helpers.js +4 -0
  132. package/src/inference/browser-harness-runtime-helpers.js +25 -10
  133. package/src/inference/browser-harness-text-helpers.js +4 -1
  134. package/src/inference/browser-harness.d.ts +4 -0
  135. package/src/inference/browser-harness.js +91 -4
  136. package/src/inference/observation-context.d.ts +22 -0
  137. package/src/inference/observation-context.js +41 -0
  138. package/src/inference/pipelines/text/attention/attn-config.js +1 -1
  139. package/src/inference/pipelines/text/attention/executor-immediate.js +42 -0
  140. package/src/inference/pipelines/text/attention/executor-recorded.js +29 -0
  141. package/src/inference/pipelines/text/attention/index.js +7 -0
  142. package/src/inference/pipelines/text/attention/interpreter.js +1334 -0
  143. package/src/inference/pipelines/text/attention/plan.d.ts +36 -0
  144. package/src/inference/pipelines/text/attention/plan.js +328 -0
  145. package/src/inference/pipelines/text/attention/receipt.js +60 -0
  146. package/src/inference/pipelines/text/attention/record.js +8 -1278
  147. package/src/inference/pipelines/text/attention/run.js +8 -1386
  148. package/src/inference/pipelines/text/generator-decode-policy.js +4 -1
  149. package/src/inference/pipelines/text/generator-helpers.js +2 -0
  150. package/src/inference/pipelines/text/generator-steps.js +32 -15
  151. package/src/inference/pipelines/text/generator.js +10 -5
  152. package/src/inference/pipelines/text/init.d.ts +3 -0
  153. package/src/inference/pipelines/text/layer-plan-gpu.js +2 -0
  154. package/src/inference/pipelines/text/layer.js +2 -0
  155. package/src/inference/pipelines/text/model-load.d.ts +0 -1
  156. package/src/inference/pipelines/text/model-load.js +2 -11
  157. package/src/inference/pipelines/text/probes.js +10 -0
  158. package/src/inference/pipelines/text/resolved-runtime-session.d.ts +56 -0
  159. package/src/inference/pipelines/text/resolved-runtime-session.js +175 -0
  160. package/src/inference/pipelines/text/state.d.ts +6 -0
  161. package/src/inference/pipelines/text/state.js +3 -0
  162. package/src/inference/pipelines/text/types.d.ts +6 -0
  163. package/src/inference/pipelines/text.js +16 -1
  164. package/src/inference/refactor-receipt.d.ts +49 -0
  165. package/src/inference/refactor-receipt.js +188 -0
  166. package/src/inference/resource-scope.d.ts +33 -0
  167. package/src/inference/resource-scope.js +168 -0
  168. package/src/inference/test-harness.d.ts +3 -0
  169. package/src/inference/test-harness.js +1 -0
  170. package/src/storage/model-cache.d.ts +53 -0
  171. package/src/storage/model-cache.js +550 -0
  172. package/src/tooling/boundary-evidence.d.ts +51 -0
  173. package/src/tooling/boundary-evidence.js +408 -0
  174. package/src/tooling/browser-command-runner.js +4 -4
  175. package/src/tooling/command-context.d.ts +25 -0
  176. package/src/tooling/command-context.js +53 -0
  177. package/src/tooling/command-runner-shared.js +22 -5
  178. package/src/tooling/demo-receipts.d.ts +56 -0
  179. package/src/tooling/demo-receipts.js +113 -0
  180. package/src/tooling/diagnose-runner.js +2 -2
  181. package/src/tooling/execution-cost-ledger.d.ts +21 -0
  182. package/src/tooling/execution-cost-ledger.js +199 -0
  183. package/src/tooling/node-command-runner.js +2 -2
  184. package/src/tooling/opfs-cache.d.ts +11 -49
  185. package/src/tooling/opfs-cache.js +4 -510
  186. package/src/tooling/precision-replay-math.d.ts +42 -0
  187. package/src/tooling/precision-replay-math.js +174 -0
  188. package/src/tooling/program-bundle-parity.d.ts +3 -0
  189. package/src/tooling/program-bundle-parity.js +8 -0
  190. package/src/tooling/program-bundle.d.ts +1 -52
  191. package/src/tooling/program-bundle.js +0 -139
  192. package/src/tooling/registered-variant-calibration.d.ts +24 -0
  193. package/src/tooling/registered-variant-calibration.js +286 -0
  194. package/src/tooling/runtime-input-composition.js +105 -53
  195. package/src/tooling/runtime-intent.js +41 -0
  196. package/src/tooling/runtime-optimization-index.d.ts +6 -0
  197. package/src/tooling/runtime-optimization-index.js +72 -0
  198. package/src/tooling/runtime-optimization.d.ts +47 -6
  199. package/src/tooling/runtime-optimization.js +559 -40
  200. package/src/tooling/source-intake.d.ts +49 -0
  201. package/src/tooling/source-intake.js +414 -0
  202. package/src/tooling-exports/evidence.d.ts +34 -0
  203. package/src/tooling-exports/evidence.js +34 -0
  204. package/src/tooling-exports/runtime.d.ts +7 -0
  205. package/src/tooling-exports/runtime.js +7 -0
  206. package/src/tooling-exports.d.ts +11 -0
  207. package/src/tooling-exports.js +6 -3
  208. package/src/tooling-exports.shared.d.ts +32 -0
  209. package/src/tooling-exports.shared.js +31 -0
  210. package/src/version.js +1 -1
  211. package/src/config/schema/tuner.schema.d.ts +0 -39
  212. package/src/config/schema/tuner.schema.js +0 -13
  213. package/src/gpu/kernel-tuner/benchmarks.js +0 -902
  214. package/src/gpu/kernel-tuner/cache.js +0 -145
  215. package/src/gpu/kernel-tuner/index.js +0 -38
  216. package/src/gpu/kernel-tuner/tuner.js +0 -247
  217. package/src/gpu/kernel-tuner.js +0 -12
  218. package/src/gpu/kernels/kernel-tuning.d.ts +0 -42
  219. package/src/gpu/kernels/kernel-tuning.js +0 -158
  220. package/src/gpu/profiler.js +0 -382
  221. package/src/inference/pipelines/text/attention/output-gate-fusion.js +0 -37
@@ -52,16 +52,6 @@ export const DEFAULT_ROPE_DEFAULTS = {
52
52
  defaultStartPos: 0,
53
53
  };
54
54
 
55
- // =============================================================================
56
- // Kernel Tuning Defaults
57
- // =============================================================================
58
-
59
- export const DEFAULT_TUNER_LIMITS = {
60
- maxComputeWorkgroupSizeX: 256,
61
- maxComputeWorkgroupSizeY: 256,
62
- maxComputeInvocationsPerWorkgroup: 256,
63
- };
64
-
65
55
  // =============================================================================
66
56
  // Attention Thresholds
67
57
  // =============================================================================
@@ -154,7 +144,6 @@ export const DEFAULT_KERNEL_THRESHOLDS = {
154
144
  attention: DEFAULT_ATTENTION_THRESHOLDS,
155
145
  fusedMatmul: DEFAULT_FUSED_MATMUL_THRESHOLDS,
156
146
  cast: DEFAULT_CAST_THRESHOLDS,
157
- tuner: DEFAULT_TUNER_LIMITS,
158
147
  };
159
148
 
160
149
 
@@ -181,7 +170,6 @@ export function setKernelThresholds(overrides) {
181
170
  attention: { ...currentThresholds.attention, ...overrides.attention },
182
171
  fusedMatmul: { ...currentThresholds.fusedMatmul, ...overrides.fusedMatmul },
183
172
  cast: { ...currentThresholds.cast, ...overrides.cast },
184
- tuner: { ...currentThresholds.tuner, ...overrides.tuner },
185
173
  };
186
174
  currentThresholds = cloneThresholdTree(nextThresholds);
187
175
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Kernel Warmup Config Schema
3
3
  *
4
- * Controls optional kernel prewarming and auto-tuning.
4
+ * Controls optional kernel prewarming.
5
5
  *
6
6
  * @module config/schema/kernel-warmup
7
7
  */
@@ -11,8 +11,6 @@ export interface KernelWarmupConfigSchema {
11
11
  prewarm: boolean;
12
12
  /** Prewarm scheduling mode (parallel or sequential). */
13
13
  prewarmMode: 'parallel' | 'sequential';
14
- /** Auto-tune kernel workgroup sizes for the active model config. */
15
- autoTune: boolean;
16
14
  }
17
15
 
18
16
  /** Default kernel warmup configuration */
@@ -1,5 +1,4 @@
1
1
  export const DEFAULT_KERNEL_WARMUP_CONFIG = {
2
2
  prewarm: false,
3
3
  prewarmMode: 'parallel',
4
- autoTune: false,
5
4
  };
@@ -0,0 +1,24 @@
1
+ import type { ToolingIntent } from './tooling.schema.js';
2
+
3
+ export type RuntimeProfileStability = 'canonical' | 'experimental' | 'deprecated';
4
+
5
+ export interface RuntimeProfileMetadata {
6
+ id: string;
7
+ name: string;
8
+ intent: Exclude<ToolingIntent, null>;
9
+ compatibleIntents: Array<Exclude<ToolingIntent, null>>;
10
+ stability: RuntimeProfileStability;
11
+ owner: string;
12
+ createdAtUtc: string;
13
+ }
14
+
15
+ export function validateRuntimeProfileMetadata(
16
+ profile: Record<string, unknown>,
17
+ label?: string
18
+ ): Readonly<RuntimeProfileMetadata>;
19
+
20
+ export function assertRuntimeProfileIntentCompatibility(
21
+ profile: Record<string, unknown>,
22
+ requestIntent: ToolingIntent,
23
+ label?: string
24
+ ): Readonly<RuntimeProfileMetadata>;
@@ -0,0 +1,92 @@
1
+ import { TOOLING_INTENTS } from './tooling.schema.js';
2
+
3
+ const RUNTIME_PROFILE_STABILITIES = Object.freeze([
4
+ 'canonical',
5
+ 'experimental',
6
+ 'deprecated',
7
+ ]);
8
+
9
+ function assertNonEmptyString(value, label) {
10
+ if (typeof value !== 'string' || value.trim().length === 0) {
11
+ throw new Error(`DopplerConfigError: ${label} must be a non-empty string.`);
12
+ }
13
+ return value.trim();
14
+ }
15
+
16
+ function normalizeCompatibleIntents(value, label) {
17
+ if (!Array.isArray(value) || value.length === 0) {
18
+ throw new Error(`DopplerConfigError: ${label} must be a non-empty array.`);
19
+ }
20
+ const compatibleIntents = value.map((intent, index) => {
21
+ const normalized = assertNonEmptyString(intent, `${label}[${index}]`);
22
+ if (!TOOLING_INTENTS.includes(normalized)) {
23
+ throw new Error(
24
+ `DopplerConfigError: ${label}[${index}] must be one of ${TOOLING_INTENTS.join(', ')}.`
25
+ );
26
+ }
27
+ return normalized;
28
+ });
29
+ if (new Set(compatibleIntents).size !== compatibleIntents.length) {
30
+ throw new Error(`DopplerConfigError: ${label} must not contain duplicates.`);
31
+ }
32
+ return compatibleIntents;
33
+ }
34
+
35
+ export function validateRuntimeProfileMetadata(profile, label = 'runtime profile') {
36
+ if (!profile || typeof profile !== 'object' || Array.isArray(profile)) {
37
+ throw new Error(`DopplerConfigError: ${label} must be an object.`);
38
+ }
39
+ const id = assertNonEmptyString(profile.id, `${label}.id`);
40
+ const name = assertNonEmptyString(profile.name, `${label}.name`);
41
+ const intent = assertNonEmptyString(profile.intent, `${label}.intent`);
42
+ if (!TOOLING_INTENTS.includes(intent)) {
43
+ throw new Error(
44
+ `DopplerConfigError: ${label}.intent must be one of ${TOOLING_INTENTS.join(', ')}.`
45
+ );
46
+ }
47
+ const compatibleIntents = normalizeCompatibleIntents(
48
+ profile.compatibleIntents,
49
+ `${label}.compatibleIntents`
50
+ );
51
+ if (!compatibleIntents.includes(intent)) {
52
+ throw new Error(
53
+ `DopplerConfigError: ${label}.compatibleIntents must include the profile intent "${intent}".`
54
+ );
55
+ }
56
+ const stability = assertNonEmptyString(profile.stability, `${label}.stability`);
57
+ if (!RUNTIME_PROFILE_STABILITIES.includes(stability)) {
58
+ throw new Error(
59
+ `DopplerConfigError: ${label}.stability must be one of ${RUNTIME_PROFILE_STABILITIES.join(', ')}.`
60
+ );
61
+ }
62
+ const owner = assertNonEmptyString(profile.owner, `${label}.owner`);
63
+ const createdAtUtc = assertNonEmptyString(profile.createdAtUtc, `${label}.createdAtUtc`);
64
+ if (Number.isNaN(Date.parse(createdAtUtc))) {
65
+ throw new Error(`DopplerConfigError: ${label}.createdAtUtc must be an ISO-8601 timestamp.`);
66
+ }
67
+ return Object.freeze({
68
+ id,
69
+ name,
70
+ intent,
71
+ compatibleIntents: Object.freeze([...compatibleIntents]),
72
+ stability,
73
+ owner,
74
+ createdAtUtc,
75
+ });
76
+ }
77
+
78
+ export function assertRuntimeProfileIntentCompatibility(profile, requestIntent, label = 'runtime profile') {
79
+ const metadata = validateRuntimeProfileMetadata(profile, label);
80
+ if (requestIntent === null || requestIntent === undefined) {
81
+ throw new Error(
82
+ `DopplerConfigError: ${label} "${metadata.id}" requires a harness command intent.`
83
+ );
84
+ }
85
+ if (!metadata.compatibleIntents.includes(requestIntent)) {
86
+ throw new Error(
87
+ `DopplerConfigError: ${label} "${metadata.id}" is not compatible with intent "${requestIntent}". ` +
88
+ `Compatible intents: ${metadata.compatibleIntents.join(', ')}.`
89
+ );
90
+ }
91
+ return metadata;
92
+ }
@@ -12,7 +12,6 @@ import type { KernelThresholdsConfigSchema } from './kernel-thresholds.schema.js
12
12
  import type { BufferPoolConfigSchema } from './buffer-pool.schema.js';
13
13
  import type { GpuCacheConfigSchema } from './gpu-cache.schema.js';
14
14
  import type { MemoryLimitsConfigSchema } from './memory-limits.schema.js';
15
- import type { TunerConfigSchema } from './tuner.schema.js';
16
15
  import type { KernelWarmupConfigSchema } from './kernel-warmup.schema.js';
17
16
  import type { HotSwapConfigSchema } from './hotswap.schema.js';
18
17
  import type { IntentBundleConfigSchema } from './intent-bundle.schema.js';
@@ -53,7 +52,7 @@ export interface SharedRuntimeConfigSchema {
53
52
  kernelRegistry: KernelRegistryConfigSchema;
54
53
  /** Kernel selection thresholds */
55
54
  kernelThresholds: KernelThresholdsConfigSchema;
56
- /** Kernel prewarm and auto-tuning settings */
55
+ /** Kernel prewarming settings */
57
56
  kernelWarmup: KernelWarmupConfigSchema;
58
57
  /** GPU buffer pool sizing */
59
58
  bufferPool: BufferPoolConfigSchema;
@@ -61,8 +60,6 @@ export interface SharedRuntimeConfigSchema {
61
60
  gpuCache: GpuCacheConfigSchema;
62
61
  /** WASM heap and segment limits */
63
62
  memory: MemoryLimitsConfigSchema;
64
- /** Kernel autotuning settings */
65
- tuner: TunerConfigSchema;
66
63
  /** Hot-swap security policy */
67
64
  hotSwap: HotSwapConfigSchema;
68
65
  /** Intent bundle gating policy */
@@ -3,7 +3,6 @@ import { DEFAULT_KERNEL_THRESHOLDS } from './kernel-thresholds.schema.js';
3
3
  import { DEFAULT_BUFFER_POOL_CONFIG } from './buffer-pool.schema.js';
4
4
  import { DEFAULT_GPU_CACHE_CONFIG } from './gpu-cache.schema.js';
5
5
  import { DEFAULT_MEMORY_LIMITS_CONFIG } from './memory-limits.schema.js';
6
- import { DEFAULT_TUNER_CONFIG } from './tuner.schema.js';
7
6
  import { DEFAULT_KERNEL_WARMUP_CONFIG } from './kernel-warmup.schema.js';
8
7
  import { DEFAULT_HOTSWAP_CONFIG } from './hotswap.schema.js';
9
8
  import { DEFAULT_BRIDGE_CONFIG } from './bridge.schema.js';
@@ -38,7 +37,6 @@ export const DEFAULT_SHARED_RUNTIME_CONFIG = {
38
37
  bufferPool: DEFAULT_BUFFER_POOL_CONFIG,
39
38
  gpuCache: DEFAULT_GPU_CACHE_CONFIG,
40
39
  memory: DEFAULT_MEMORY_LIMITS_CONFIG,
41
- tuner: DEFAULT_TUNER_CONFIG,
42
40
  hotSwap: DEFAULT_HOTSWAP_CONFIG,
43
41
  intentBundle: DEFAULT_INTENT_BUNDLE_CONFIG,
44
42
  bridge: DEFAULT_BRIDGE_CONFIG,
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Tooling Intent Config Schema Definitions
3
3
  *
4
- * Defines the top-level tooling intent for verification, investigation,
5
- * or calibration runs.
4
+ * Defines runtime-owned tooling observation and converter configuration.
5
+ * Active command intent lives in ToolingCommandRequest.
6
6
  *
7
7
  * @module config/schema/tooling
8
8
  */
@@ -11,19 +11,22 @@ import type { ConverterConfigSchema } from './converter.schema.js';
11
11
 
12
12
  export type ToolingIntent = 'verify' | 'investigate' | 'calibrate' | null;
13
13
  export type ToolingDiagnosticsMode = 'off' | 'on_failure' | 'always';
14
+ export type RefactorReceiptPolicy = 'off' | 'on_failure' | 'always';
14
15
 
15
16
  export interface ToolingConfigSchema {
16
- /** High-level tooling intent for the run */
17
- intent: ToolingIntent;
18
17
  /** Diagnostics policy for verification runs */
19
18
  diagnostics: ToolingDiagnosticsMode;
19
+ /** Permanent behavior-receipt capture policy */
20
+ refactorReceipts: RefactorReceiptPolicy;
20
21
  /** Optional converter config overrides for browser tooling */
21
22
  converter?: Partial<ConverterConfigSchema> | null;
22
23
  }
23
24
 
24
- /** Allowed tooling intents */
25
+ /** Allowed command and runtime-profile metadata intents */
25
26
  export declare const TOOLING_INTENTS: ToolingIntent[];
26
27
  /** Allowed diagnostics modes */
27
28
  export declare const TOOLING_DIAGNOSTICS: ToolingDiagnosticsMode[];
29
+ /** Allowed behavior-receipt capture policies */
30
+ export declare const REFACTOR_RECEIPT_POLICIES: RefactorReceiptPolicy[];
28
31
  /** Default tooling configuration */
29
32
  export declare const DEFAULT_TOOLING_CONFIG: ToolingConfigSchema;
@@ -1,12 +1,13 @@
1
1
  // =============================================================================
2
- // Tooling Intent Config
2
+ // Tooling Observation Config
3
3
  // =============================================================================
4
4
 
5
5
  export const TOOLING_INTENTS = ['verify', 'investigate', 'calibrate'];
6
6
  export const TOOLING_DIAGNOSTICS = ['off', 'on_failure', 'always'];
7
+ export const REFACTOR_RECEIPT_POLICIES = ['off', 'on_failure', 'always'];
7
8
 
8
9
  export const DEFAULT_TOOLING_CONFIG = {
9
- intent: null,
10
10
  diagnostics: 'on_failure',
11
+ refactorReceipts: 'off',
11
12
  converter: null,
12
13
  };
@@ -75,6 +75,8 @@ export interface TensorSnapshot {
75
75
  std: number;
76
76
  };
77
77
  sample: number[];
78
+ sampleCoordinates: number[][];
79
+ fullTensorDigest: string | null;
78
80
  data?: number[];
79
81
  hasNaN: boolean;
80
82
  hasInf: boolean;
@@ -3,6 +3,7 @@
3
3
  import { gpuDevice } from './config.js';
4
4
  import { log } from './log.js';
5
5
  import { computeArrayStats } from './stats.js';
6
+ import { sha256BytesHex } from '../utils/sha256.js';
6
7
 
7
8
  // ============================================================================
8
9
  // Internal Helpers
@@ -251,6 +252,8 @@ export async function snapshotTensor(buffer, shape, dtype = 'f32', options = {})
251
252
  dtype,
252
253
  stats: { min: 0, max: 0, maxAbs: 0, mean: 0, std: 0 },
253
254
  sample: [],
255
+ sampleCoordinates: [],
256
+ fullTensorDigest: null,
254
257
  hasNaN: false,
255
258
  hasInf: false,
256
259
  };
@@ -259,10 +262,24 @@ export async function snapshotTensor(buffer, shape, dtype = 'f32', options = {})
259
262
 
260
263
  export function snapshotFromArray(arr, shape, dtype = 'f32', options = {}) {
261
264
  const numElements = shape.reduce((a, b) => a * b, 1);
262
- const stats = computeArrayStats(arr, Math.min(arr.length, numElements));
265
+ const capturedElements = Math.min(arr.length, numElements);
266
+ const stats = computeArrayStats(arr, capturedElements);
263
267
  const data = options.includeData === true
264
268
  ? Array.from(arr.slice(0, numElements))
265
269
  : undefined;
270
+ const sampleLength = Math.min(8, capturedElements);
271
+ const sampleCoordinates = [];
272
+ for (let flatIndex = 0; flatIndex < sampleLength; flatIndex += 1) {
273
+ let remainder = flatIndex;
274
+ const coordinate = new Array(shape.length);
275
+ for (let axis = shape.length - 1; axis >= 0; axis -= 1) {
276
+ coordinate[axis] = remainder % shape[axis];
277
+ remainder = Math.floor(remainder / shape[axis]);
278
+ }
279
+ sampleCoordinates.push(coordinate);
280
+ }
281
+ const byteLength = capturedElements * arr.BYTES_PER_ELEMENT;
282
+ const digestBytes = new Uint8Array(arr.buffer, arr.byteOffset, byteLength);
266
283
 
267
284
  const snapshot = {
268
285
  ok: true,
@@ -276,7 +293,9 @@ export function snapshotFromArray(arr, shape, dtype = 'f32', options = {}) {
276
293
  mean: stats.mean,
277
294
  std: stats.std,
278
295
  },
279
- sample: Array.from(arr.slice(0, 8)),
296
+ sample: Array.from(arr.slice(0, sampleLength)),
297
+ sampleCoordinates,
298
+ fullTensorDigest: `sha256:${sha256BytesHex(digestBytes)}`,
280
299
  hasNaN: stats.nanCount > 0,
281
300
  hasInf: stats.infCount > 0,
282
301
  };
@@ -157,6 +157,11 @@ export declare class CommandRecorder {
157
157
  getStats(): {
158
158
  opCount: number;
159
159
  opLabelCounts: Record<string, number>;
160
+ dispatches: Array<{
161
+ label: string;
162
+ kind: 'direct' | 'indirect';
163
+ workgroups: number[] | null;
164
+ }>;
160
165
  computePassCount: number;
161
166
  tempBufferCount: number;
162
167
  pooledBufferCount: number;
@@ -43,6 +43,8 @@ export class CommandRecorder {
43
43
 
44
44
  #opLabelCounts;
45
45
 
46
+ #dispatchRecords;
47
+
46
48
  #recordLabels;
47
49
 
48
50
  #computePassCount;
@@ -96,6 +98,7 @@ export class CommandRecorder {
96
98
  this.#opCount = 0;
97
99
  this.#recordLabels = options.recordLabels !== false;
98
100
  this.#opLabelCounts = this.#recordLabels ? Object.create(null) : null;
101
+ this.#dispatchRecords = [];
99
102
  this.#computePassCount = 0;
100
103
  this.#activeComputePass = null;
101
104
  // Initialize profiling if requested and available
@@ -316,6 +319,11 @@ export class CommandRecorder {
316
319
  throw new Error('[CommandRecorder] Cannot record dispatch after submit');
317
320
  }
318
321
  const opLabel = this.#recordDispatchOperation(label);
322
+ this.#dispatchRecords.push({
323
+ label: opLabel ?? this.#normalizeOperationLabel(label),
324
+ kind: 'direct',
325
+ workgroups: Array.from(workgroups),
326
+ });
319
327
  if (this.#profilingEnabled) {
320
328
  const pass = this.#beginRawComputePass(opLabel);
321
329
  pass.setPipeline(pipeline);
@@ -335,6 +343,11 @@ export class CommandRecorder {
335
343
  throw new Error('[CommandRecorder] Cannot record dispatch after submit');
336
344
  }
337
345
  const opLabel = this.#recordDispatchOperation(label);
346
+ this.#dispatchRecords.push({
347
+ label: opLabel ?? this.#normalizeOperationLabel(label),
348
+ kind: 'indirect',
349
+ workgroups: null,
350
+ });
338
351
  if (this.#profilingEnabled) {
339
352
  const pass = this.#beginRawComputePass(opLabel);
340
353
  pass.setPipeline(pipeline);
@@ -524,6 +537,10 @@ export class CommandRecorder {
524
537
  return {
525
538
  opCount: this.#opCount,
526
539
  opLabelCounts,
540
+ dispatches: this.#dispatchRecords.map((record) => ({
541
+ ...record,
542
+ workgroups: record.workgroups ? [...record.workgroups] : null,
543
+ })),
527
544
  computePassCount: this.#computePassCount,
528
545
  tempBufferCount: this.#tempBuffers.length,
529
546
  pooledBufferCount: this.#pooledBuffers.length,
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- import { autoTuneKernels, prewarmKernels, clearKernelCaches } from './kernels/utils.js';
3
+ import { prewarmKernels, clearKernelCaches } from './kernels/utils.js';
4
4
  import { getRuntimeConfig } from '../config/runtime.js';
5
5
 
6
6
 
@@ -14,26 +14,18 @@ export async function prepareKernelRuntime(
14
14
  const {
15
15
  prewarm = kernelWarmup.prewarm,
16
16
  prewarmMode = kernelWarmup.prewarmMode,
17
- autoTune = kernelWarmup.autoTune,
18
17
  clearCaches = false,
19
- modelConfig = {},
20
18
  } = options;
21
19
 
22
20
  if (clearCaches) {
23
21
  clearKernelCaches();
24
22
  }
25
23
 
26
- let tuned = false;
27
- if (autoTune) {
28
- await autoTuneKernels(modelConfig);
29
- tuned = true;
30
- }
31
-
32
24
  let warmed = false;
33
25
  if (prewarm) {
34
26
  await prewarmKernels({ mode: prewarmMode });
35
27
  warmed = true;
36
28
  }
37
29
 
38
- return { warmed, tuned };
30
+ return { warmed };
39
31
  }
@@ -19,8 +19,6 @@ export {
19
19
  clearKernelCaches,
20
20
  clearPipelineCache,
21
21
  getCacheStats,
22
- getTunedWorkgroupSize,
23
- autoTuneKernels,
24
22
  prewarmKernels,
25
23
  type KernelConfig,
26
24
  } from './utils.js';
@@ -14,8 +14,6 @@ export {
14
14
  clearKernelCaches,
15
15
  clearPipelineCache,
16
16
  getCacheStats,
17
- getTunedWorkgroupSize,
18
- autoTuneKernels,
19
17
  prewarmKernels,
20
18
  } from './utils.js';
21
19
 
@@ -0,0 +1,3 @@
1
+ export declare function prewarmKernels(options?: {
2
+ mode?: 'parallel' | 'sequential';
3
+ }): Promise<void>;
@@ -0,0 +1,60 @@
1
+ import { getKernelCapabilities } from '../device.js';
2
+ import { KERNEL_CONFIGS } from './kernel-configs.js';
3
+ import { createPipeline, clearPipelineCaches } from './pipeline-cache.js';
4
+ import { clearShaderCaches } from './shader-cache.js';
5
+ import { hasRequiredFeatures } from './feature-check.js';
6
+ import { log } from '../../debug/index.js';
7
+
8
+ export async function prewarmKernels(options = {}) {
9
+ const capabilities = getKernelCapabilities();
10
+ const mode = options.mode ?? 'parallel';
11
+ const entries = Object.entries(KERNEL_CONFIGS)
12
+ .sort(([left], [right]) => left.localeCompare(right))
13
+ .map(([operation, variants]) => [
14
+ operation,
15
+ Object.entries(variants).sort(([left], [right]) => left.localeCompare(right)),
16
+ ]);
17
+
18
+ try {
19
+ if (mode === 'sequential') {
20
+ let count = 0;
21
+ for (const [operation, variants] of entries) {
22
+ for (const [variant, config] of variants) {
23
+ if (config.requires && !hasRequiredFeatures(config.requires, capabilities)) {
24
+ continue;
25
+ }
26
+ try {
27
+ await createPipeline(operation, variant);
28
+ count += 1;
29
+ } catch (error) {
30
+ log.warn('KernelPrewarm', `Prewarm failed for ${operation}/${variant}: ${error.message}`);
31
+ }
32
+ }
33
+ }
34
+ log.debug('KernelPrewarm', `Prewarmed ${count} kernel pipelines`);
35
+ return;
36
+ }
37
+
38
+ const jobs = [];
39
+ for (const [operation, variants] of entries) {
40
+ for (const [variant, config] of variants) {
41
+ if (config.requires && !hasRequiredFeatures(config.requires, capabilities)) {
42
+ continue;
43
+ }
44
+ jobs.push(
45
+ createPipeline(operation, variant)
46
+ .then(() => {})
47
+ .catch((error) => {
48
+ log.warn('KernelPrewarm', `Prewarm failed for ${operation}/${variant}: ${error.message}`);
49
+ })
50
+ );
51
+ }
52
+ }
53
+ await Promise.all(jobs);
54
+ log.debug('KernelPrewarm', `Prewarmed ${jobs.length} kernel pipelines`);
55
+ } catch (error) {
56
+ clearPipelineCaches();
57
+ clearShaderCaches();
58
+ throw error;
59
+ }
60
+ }
@@ -62,14 +62,12 @@ export {
62
62
  } from './feature-check.js';
63
63
 
64
64
  // ============================================================================
65
- // Re-exports from kernel-tuning
65
+ // Re-exports from kernel prewarming
66
66
  // ============================================================================
67
67
 
68
68
  export {
69
- getTunedWorkgroupSize,
70
- autoTuneKernels,
71
69
  prewarmKernels,
72
- } from './kernel-tuning.js';
70
+ } from './kernel-prewarm.js';
73
71
 
74
72
  // ============================================================================
75
73
  // Re-exports from uniform-utils
@@ -81,14 +81,12 @@ export {
81
81
  } from './feature-check.js';
82
82
 
83
83
  // ============================================================================
84
- // Re-exports from kernel-tuning
84
+ // Re-exports from kernel prewarming
85
85
  // ============================================================================
86
86
 
87
87
  export {
88
- getTunedWorkgroupSize,
89
- autoTuneKernels,
90
88
  prewarmKernels,
91
- } from './kernel-tuning.js';
89
+ } from './kernel-prewarm.js';
92
90
 
93
91
  // ============================================================================
94
92
  // Re-exports from uniform-utils
package/src/index.d.ts CHANGED
@@ -1,3 +1,15 @@
1
1
  export { DOPPLER_VERSION } from './version.js';
2
- export { doppler, doppler as dr } from './client/doppler-api.js';
2
+ export {
3
+ doppler,
4
+ doppler as dr,
5
+ generate,
6
+ load,
7
+ open,
8
+ } from './client/doppler-api.js';
9
+ export type {
10
+ DopplerGenerationResult,
11
+ DopplerPromptInput,
12
+ DopplerScopedGenerateOptions,
13
+ DopplerScopedModelSession,
14
+ } from './client/doppler-api.js';
3
15
  export { createDopplerProvider } from './client/provider.js';
package/src/index.js CHANGED
@@ -1,3 +1,9 @@
1
1
  export { DOPPLER_VERSION } from './version.js';
2
- export { doppler, doppler as dr } from './client/doppler-api.js';
2
+ export {
3
+ doppler,
4
+ doppler as dr,
5
+ generate,
6
+ load,
7
+ open,
8
+ } from './client/doppler-api.js';
3
9
  export { createDopplerProvider } from './client/provider.js';
@@ -156,6 +156,7 @@ async function initializeInferenceFromStorage(modelId, options = {}) {
156
156
  : `Using default shard-store context for "${modelId}"`
157
157
  );
158
158
  const pipeline = await createPipeline(manifest, {
159
+ commandContext: options.commandContext ?? null,
159
160
  gpu: { device },
160
161
  runtime: options.runtime,
161
162
  ...(storage ? { storage } : {}),
@@ -209,6 +210,7 @@ async function initializeInferenceFromSourcePath(sourcePath, options = {}) {
209
210
 
210
211
  onProgress?.('pipeline', 0.3, 'Creating pipeline...');
211
212
  const pipeline = await createPipeline(sourceBundle.manifest, {
213
+ commandContext: options.commandContext ?? null,
212
214
  gpu: { device },
213
215
  runtime: effectiveRuntime,
214
216
  storage: sourceBundle.storageContext,
@@ -345,6 +347,8 @@ export async function initializeSuiteModel(options = {}) {
345
347
  onProgress: options.onProgress,
346
348
  log: options.log,
347
349
  loadMode,
350
+ modelId: options.modelId ?? null,
351
+ commandContext: options.commandContext ?? null,
348
352
  });
349
353
  }
350
354
  const modelLoadMs = Math.max(0, performance.now() - loadStart);