numbl 0.2.0 → 0.3.3

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 (127) hide show
  1. package/binding.gyp +24 -36
  2. package/dist-cli/cli.js +16096 -18209
  3. package/dist-lib/graphics/types.d.ts +22 -0
  4. package/dist-lib/lib.d.ts +1 -0
  5. package/dist-lib/lib.js +61324 -62782
  6. package/dist-lib/numbl-core/executeCode.d.ts +11 -21
  7. package/dist-lib/numbl-core/executors/cJit/builtins.d.ts +30 -0
  8. package/dist-lib/numbl-core/executors/cJit/chainCodegen.d.ts +59 -0
  9. package/dist-lib/numbl-core/executors/cJit/chainExecutor.d.ts +27 -0
  10. package/dist-lib/numbl-core/executors/cJit/chainPass.d.ts +42 -0
  11. package/dist-lib/numbl-core/executors/cJit/codegen.d.ts +44 -0
  12. package/dist-lib/numbl-core/executors/cJit/compile.d.ts +45 -0
  13. package/dist-lib/numbl-core/executors/cJit/elemwiseCodegen.d.ts +23 -0
  14. package/dist-lib/numbl-core/executors/cJit/elemwiseStructural.d.ts +33 -0
  15. package/dist-lib/numbl-core/executors/cJit/fuseAnalyze.d.ts +39 -0
  16. package/dist-lib/numbl-core/executors/cJit/fuseCodegen.d.ts +16 -0
  17. package/dist-lib/numbl-core/executors/cJit/fuseExecutor.d.ts +28 -0
  18. package/dist-lib/numbl-core/executors/cJit/loopExecutor.d.ts +32 -0
  19. package/dist-lib/numbl-core/executors/cJit/register.d.ts +10 -0
  20. package/dist-lib/numbl-core/executors/cJit/whitelist.d.ts +15 -0
  21. package/dist-lib/numbl-core/executors/cache.d.ts +26 -0
  22. package/dist-lib/numbl-core/executors/context.d.ts +76 -0
  23. package/dist-lib/numbl-core/executors/index.d.ts +17 -0
  24. package/dist-lib/numbl-core/executors/jsJit/callExecutor.d.ts +25 -0
  25. package/dist-lib/numbl-core/{jit/js → executors/jsJit/codegen}/jitCodegen.d.ts +2 -2
  26. package/dist-lib/numbl-core/{jit/js → executors/jsJit/codegen}/jitCodegenHoist.d.ts +1 -1
  27. package/dist-lib/numbl-core/executors/jsJit/codegen/jsMultiReduction.d.ts +67 -0
  28. package/dist-lib/numbl-core/executors/jsJit/helpers/alloc.d.ts +12 -0
  29. package/dist-lib/numbl-core/{jit/js → executors/jsJit/helpers}/jitHelpers.d.ts +2 -2
  30. package/dist-lib/numbl-core/{jit/js → executors/jsJit/helpers}/jitHelpersComplex.d.ts +1 -1
  31. package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersIndex.d.ts +33 -0
  32. package/dist-lib/numbl-core/{jit/js → executors/jsJit/helpers}/jitHelpersTensor.d.ts +7 -7
  33. package/dist-lib/numbl-core/executors/jsJit/jitCall.d.ts +59 -0
  34. package/dist-lib/numbl-core/executors/jsJit/jitLoop.d.ts +53 -0
  35. package/dist-lib/numbl-core/executors/jsJit/jitTopLevel.d.ts +44 -0
  36. package/dist-lib/numbl-core/executors/jsJit/loopExecutor.d.ts +15 -0
  37. package/dist-lib/numbl-core/{jit/jitLoopAnalysis.d.ts → executors/jsJit/lower/blockAnalysis.d.ts} +5 -5
  38. package/dist-lib/numbl-core/{jit → executors/jsJit/lower}/jitBailSafety.d.ts +1 -1
  39. package/dist-lib/numbl-core/{jit → executors/jsJit/lower}/jitLower.d.ts +18 -4
  40. package/dist-lib/numbl-core/{jit → executors/jsJit/lower}/jitLowerExpr.d.ts +11 -2
  41. package/dist-lib/numbl-core/{jit → executors/jsJit/lower}/jitLowerStmt.d.ts +2 -2
  42. package/dist-lib/numbl-core/{jit → executors/jsJit/lower}/jitLowerTypes.d.ts +2 -2
  43. package/dist-lib/numbl-core/{jit → executors/jsJit/lower}/scalarEmit.d.ts +2 -2
  44. package/dist-lib/numbl-core/executors/jsJit/shared.d.ts +120 -0
  45. package/dist-lib/numbl-core/executors/jsJit/topLevelExecutor.d.ts +17 -0
  46. package/dist-lib/numbl-core/executors/lowering.d.ts +166 -0
  47. package/dist-lib/numbl-core/executors/plugins.d.ts +39 -0
  48. package/dist-lib/numbl-core/executors/registry.d.ts +148 -0
  49. package/dist-lib/numbl-core/executors/types.d.ts +103 -0
  50. package/dist-lib/numbl-core/fileIOAdapter.d.ts +2 -0
  51. package/dist-lib/numbl-core/functionResolve.d.ts +7 -0
  52. package/dist-lib/numbl-core/helpers/check-helpers.d.ts +4 -5
  53. package/dist-lib/numbl-core/helpers/linsolve.d.ts +2 -3
  54. package/dist-lib/numbl-core/helpers/prng.d.ts +1 -2
  55. package/dist-lib/numbl-core/interpreter/builtins/datetime.d.ts +2 -1
  56. package/dist-lib/numbl-core/interpreter/builtins/misc.d.ts +4 -1
  57. package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +4 -91
  58. package/dist-lib/numbl-core/interpreter/interpreter.d.ts +34 -44
  59. package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +6 -3
  60. package/dist-lib/numbl-core/interpreter/types.d.ts +27 -12
  61. package/dist-lib/numbl-core/{jit/jitTypes.d.ts → jitTypes.d.ts} +15 -1
  62. package/dist-lib/numbl-core/jsUserFunctions.d.ts +8 -0
  63. package/dist-lib/numbl-core/lowering/loweringContext.d.ts +24 -0
  64. package/dist-lib/numbl-core/native/lapack-bridge.d.ts +3 -3
  65. package/dist-lib/numbl-core/parser/types.d.ts +20 -0
  66. package/dist-lib/numbl-core/runtime/constructors.d.ts +6 -6
  67. package/dist-lib/numbl-core/runtime/cow.d.ts +33 -0
  68. package/dist-lib/numbl-core/runtime/index.d.ts +3 -2
  69. package/dist-lib/numbl-core/runtime/indexing.d.ts +6 -1
  70. package/dist-lib/numbl-core/runtime/plotBuiltinDispatch.d.ts +86 -0
  71. package/dist-lib/numbl-core/runtime/plotUtils.d.ts +17 -2
  72. package/dist-lib/numbl-core/runtime/refcount.d.ts +85 -0
  73. package/dist-lib/numbl-core/runtime/runtime.d.ts +27 -66
  74. package/dist-lib/numbl-core/runtime/runtimeDispatch.d.ts +2 -2
  75. package/dist-lib/numbl-core/runtime/runtimeIndexing.d.ts +2 -2
  76. package/dist-lib/numbl-core/runtime/runtimeMemberAccess.d.ts +1 -1
  77. package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +1 -0
  78. package/dist-lib/numbl-core/runtime/struct-access.d.ts +2 -1
  79. package/dist-lib/numbl-core/runtime/types.d.ts +104 -62
  80. package/dist-lib/numbl-core/runtime/utils.d.ts +2 -8
  81. package/dist-lib/numbl-core/version.d.ts +1 -1
  82. package/dist-plot-viewer/assets/index-COAM8o1E.js +4426 -0
  83. package/dist-plot-viewer/index.html +1 -1
  84. package/native/lapack_linsolve.cpp +1 -1
  85. package/native/numbl_addon.cpp +9 -0
  86. package/native/numbl_addon_common.h +2 -2
  87. package/native/ops/comparison.c +1 -1
  88. package/package.json +3 -8
  89. package/dist-lib/numbl-core/jit/c/abi.d.ts +0 -90
  90. package/dist-lib/numbl-core/jit/c/assemble.d.ts +0 -56
  91. package/dist-lib/numbl-core/jit/c/classify.d.ts +0 -70
  92. package/dist-lib/numbl-core/jit/c/compile.d.ts +0 -37
  93. package/dist-lib/numbl-core/jit/c/context.d.ts +0 -152
  94. package/dist-lib/numbl-core/jit/c/emit/assign.d.ts +0 -20
  95. package/dist-lib/numbl-core/jit/c/emit/complexScalar.d.ts +0 -18
  96. package/dist-lib/numbl-core/jit/c/emit/fused.d.ts +0 -42
  97. package/dist-lib/numbl-core/jit/c/emit/helpers.d.ts +0 -40
  98. package/dist-lib/numbl-core/jit/c/emit/index.d.ts +0 -14
  99. package/dist-lib/numbl-core/jit/c/emit/scalar.d.ts +0 -23
  100. package/dist-lib/numbl-core/jit/c/emit/stmt.d.ts +0 -25
  101. package/dist-lib/numbl-core/jit/c/emit/tensor.d.ts +0 -127
  102. package/dist-lib/numbl-core/jit/c/emit/userCall.d.ts +0 -58
  103. package/dist-lib/numbl-core/jit/c/epilogue.d.ts +0 -26
  104. package/dist-lib/numbl-core/jit/c/feasibility.d.ts +0 -44
  105. package/dist-lib/numbl-core/jit/c/hybrid.d.ts +0 -42
  106. package/dist-lib/numbl-core/jit/c/install.d.ts +0 -15
  107. package/dist-lib/numbl-core/jit/c/parityError.d.ts +0 -26
  108. package/dist-lib/numbl-core/jit/c/prelude.d.ts +0 -37
  109. package/dist-lib/numbl-core/jit/c/registry.d.ts +0 -51
  110. package/dist-lib/numbl-core/jit/c/visit.d.ts +0 -63
  111. package/dist-lib/numbl-core/jit/e1/install.d.ts +0 -13
  112. package/dist-lib/numbl-core/jit/e1/kernelEmit.d.ts +0 -54
  113. package/dist-lib/numbl-core/jit/e1/openmpFlag.d.ts +0 -13
  114. package/dist-lib/numbl-core/jit/e1/scalarFnKernel.d.ts +0 -44
  115. package/dist-lib/numbl-core/jit/fusedChainHelpers.d.ts +0 -65
  116. package/dist-lib/numbl-core/jit/fusedScalarEmit.d.ts +0 -61
  117. package/dist-lib/numbl-core/jit/fusion.d.ts +0 -71
  118. package/dist-lib/numbl-core/jit/fusionOps.d.ts +0 -25
  119. package/dist-lib/numbl-core/jit/index.d.ts +0 -7
  120. package/dist-lib/numbl-core/jit/jitLoop.d.ts +0 -25
  121. package/dist-lib/numbl-core/jit/jitTopLevel.d.ts +0 -22
  122. package/dist-lib/numbl-core/jit/js/jitHelpersIndex.d.ts +0 -33
  123. package/dist-lib/numbl-core/jit/js/jsFusedCodegen.d.ts +0 -17
  124. package/dist-lib/numbl-core/runtime/alloc.d.ts +0 -23
  125. package/dist-plot-viewer/assets/index-GiUNnMQg.js +0 -4426
  126. package/native/jit_runtime/jit_runtime.c +0 -261
  127. package/native/jit_runtime/jit_runtime.h +0 -204
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>numbl - Figures</title>
7
- <script type="module" crossorigin src="/assets/index-GiUNnMQg.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-COAM8o1E.js"></script>
8
8
  </head>
9
9
  <body style="margin: 0; overflow: hidden">
10
10
  <div id="root"></div>
@@ -9,7 +9,7 @@
9
9
  * BRe: Float64Array, BIm: Float64Array, nrhs: number): {re, im}
10
10
  *
11
11
  * A is m×n in column-major order; B is m×nrhs.
12
- * Returns X (n×nrhs) in a new Float64Array in column-major order.
12
+ * Returns X (n×nrhs) in a allocFloat64Array in column-major order.
13
13
  *
14
14
  * Square (m == n):
15
15
  * Uses dgesv / zgesv (LU with partial pivoting). Throws if A is singular.
@@ -22,9 +22,11 @@
22
22
  #include "numbl_addon_common.h"
23
23
  #include <cstdlib>
24
24
 
25
+ #ifndef __APPLE__
25
26
  extern "C" {
26
27
  void openblas_set_num_threads(int num_threads);
27
28
  }
29
+ #endif
28
30
 
29
31
  // ── Addon version ────────────────────────────────────────────────────────────
30
32
  // Bump this integer whenever the addon's API changes (new functions, signature
@@ -58,9 +60,16 @@ static Napi::Value AddonVersion(const Napi::CallbackInfo& info) {
58
60
  Napi::Object Init(Napi::Env env, Napi::Object exports) {
59
61
  // Use single-threaded BLAS unless the user explicitly set the env var.
60
62
  // Multi-threaded BLAS adds overhead for the many small matmuls in numbl.
63
+ #ifdef __APPLE__
64
+ // Accelerate reads VECLIB_MAXIMUM_THREADS from the environment on first use.
65
+ if (!std::getenv("VECLIB_MAXIMUM_THREADS")) {
66
+ setenv("VECLIB_MAXIMUM_THREADS", "1", 0);
67
+ }
68
+ #else
61
69
  if (!std::getenv("OPENBLAS_NUM_THREADS")) {
62
70
  openblas_set_num_threads(1);
63
71
  }
72
+ #endif
64
73
  exports.Set(Napi::String::New(env, "addonVersion"),
65
74
  Napi::Function::New(env, AddonVersion));
66
75
  exports.Set(Napi::String::New(env, "inv"),
@@ -227,14 +227,14 @@ inline std::vector<lapack_complex_double> splitToInterleaved(
227
227
  return out;
228
228
  }
229
229
 
230
- // Create a new Float64Array from a std::vector<double>.
230
+ // Create a allocFloat64Array from a std::vector<double>.
231
231
  inline Napi::Float64Array vecToF64(Napi::Env env, const std::vector<double>& v) {
232
232
  auto arr = Napi::Float64Array::New(env, v.size());
233
233
  std::memcpy(arr.Data(), v.data(), v.size() * sizeof(double));
234
234
  return arr;
235
235
  }
236
236
 
237
- // Create a new Float64Array from raw pointer + count.
237
+ // Create a allocFloat64Array from raw pointer + count.
238
238
  inline Napi::Float64Array ptrToF64(Napi::Env env, const double* data, size_t n) {
239
239
  auto arr = Napi::Float64Array::New(env, n);
240
240
  std::memcpy(arr.Data(), data, n * sizeof(double));
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Real + complex comparison ops. Output is a logical tensor stored as
3
- * 0.0 / 1.0 in a double buffer (numbl stores logicals as FloatXArray with
3
+ * 0.0 / 1.0 in a double buffer (numbl stores logicals as Float64Array with
4
4
  * an _isLogical flag on the runtime tensor).
5
5
  *
6
6
  * Caller-allocated input/output buffers; never copies.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numbl",
3
- "version": "0.2.0",
3
+ "version": "0.3.3",
4
4
  "description": "Run .m source files in the browser and on the command line by compiling to JavaScript",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -45,7 +45,7 @@
45
45
  "copy:test-scripts": "tsx scripts/copy-test-scripts.ts",
46
46
  "bundle:stdlib": "tsx scripts/bundle-stdlib.ts",
47
47
  "build:web": "npm run bundle:stdlib && tsc -b && vite build",
48
- "build:lib": "npm run bundle:stdlib && esbuild src/lib.ts --bundle --platform=neutral --format=esm --outfile=dist-lib/lib.js --loader:.wasm=file && tsc -p tsconfig.lib.json",
48
+ "build:lib": "npm run bundle:stdlib && esbuild src/lib.ts --bundle --platform=node --format=esm --outfile=dist-lib/lib.js --packages=external --loader:.wasm=file && tsc -p tsconfig.lib.json",
49
49
  "build:cli": "npm run bundle:stdlib && esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist-cli/cli.js --packages=external --loader:.wasm=file",
50
50
  "install": "true",
51
51
  "build:addon": "node-gyp rebuild",
@@ -54,16 +54,11 @@
54
54
  "lint": "eslint .",
55
55
  "typecheck": "tsc -b",
56
56
  "preview": "vite preview",
57
- "test": "npm run test:float64",
58
- "test:float32": "NUMBL_USE_FLOAT32=true vitest run",
59
- "test:float64": "NUMBL_USE_FLOAT32=false vitest run",
57
+ "test": "vitest run",
60
58
  "test:coverage": "vitest run --coverage",
61
59
  "test:coverage:all": "bash scripts/coverage-all.sh",
62
60
  "test:scripts": "bash numbl_test_scripts/run_all.sh",
63
61
  "test:browser": "playwright test",
64
- "test:scripts:c-jit": "bash numbl_test_scripts/run_c_jit.sh",
65
- "test:scripts:c-jit-fuse": "bash numbl_test_scripts/run_c_jit_fuse.sh",
66
- "test:scripts:c-jit-parity": "bash numbl_test_scripts/run_c_jit_parity.sh",
67
62
  "build:wasm": "bash numbl_test_scripts/build_wasm.sh",
68
63
  "update-readme": "tsx scripts/update-readme-usage.ts",
69
64
  "check-readme": "tsx scripts/update-readme-usage.ts --check",
@@ -1,90 +0,0 @@
1
- /**
2
- * The native ABI as an explicit slot schema — one source of truth shared
3
- * between the C-signature builder (assemble.ts) and the JS wrapper
4
- * marshaller (install.ts).
5
- *
6
- * Each `AbiSlot` carries everything either side needs: the C type for
7
- * the signature, the koffi type string (with `_Out_` prefix for
8
- * out-pointers), the identifier name in the emitted C, and a backref
9
- * (paramIdx / outputIdx) so the JS wrapper can locate the source value
10
- * or output buffer without reconstructing the param-to-slot mapping
11
- * itself.
12
- *
13
- * Adding a new ABI shape = add a slot kind here, emit it in
14
- * `buildAbiSlots`, and handle it in the JS marshaller.
15
- */
16
- import type { ClassificationResult } from "./classify.js";
17
- export type AbiSlotKind = "scalar" | "complexScalarRe" | "complexScalarIm" | "tensorData"
18
- /** Imaginary data pointer for a complex tensor param. Paired with
19
- * `tensorData`. Marshaller passes the RuntimeTensor's `.imag` (a
20
- * Float64Array) or NULL when `.imag === undefined`; the numbl_ops
21
- * complex kernels treat NULL imag as all-zero. */
22
- | "tensorDataIm" | "tensorLen" | "tensorD0" | "tensorD1" | "scalarOut" | "complexScalarReOut" | "complexScalarImOut" | "fixedOutBuf"
23
- /** Imaginary fixed-output buffer (complex tensor output, non-dynamic). */
24
- | "fixedOutBufIm" | "fixedOutLen" | "dynOutBuf"
25
- /** Imaginary buffer pointer for a dynamic complex tensor output. C
26
- * mallocs, transfers ownership via `double **`; wrapper decodes+copies
27
- * into a fresh Float64Array then frees. */
28
- | "dynOutBufIm" | "dynOutLen" | "dynOutD0" | "dynOutD1" | "ticState" | "errFlag"
29
- /** Callback for `disp(...)` — JS-registered function pointer. The C
30
- * body invokes it directly; the JS wrapper supplies a koffi-registered
31
- * pointer that routes into `rt.output`. Signature:
32
- * void __disp_cb(const char *s, double num, int kind)
33
- * kind=0 => use `s`, kind=1 => use `num`. */
34
- | "dispCb";
35
- export interface AbiSlot {
36
- kind: AbiSlotKind;
37
- /** C type string for the signature, e.g. "double", "const double *",
38
- * "double **". */
39
- cType: string;
40
- /** Identifier as it appears in the C signature. */
41
- cName: string;
42
- /** koffi type string, with `_Out_` prefix where koffi must treat the
43
- * pointer as an out-param. */
44
- koffiType: string;
45
- /** Index into paramDescs, for "scalar" / "tensor*" kinds. */
46
- paramIdx?: number;
47
- /** Index into outputDescs, for output-allocated kinds. */
48
- outputIdx?: number;
49
- }
50
- export interface CParamDesc {
51
- name: string;
52
- kind: "scalar" | "complexScalar" | "tensor";
53
- /** For tensor params: max indexing arity the body uses (1, 2, or 3).
54
- * Drives the extra `_d0` / `_d1` shape args the JS wrapper must
55
- * marshal. `undefined` means the tensor is only used in whole-tensor
56
- * ops (legacy data/len ABI). */
57
- ndim?: number;
58
- /** True for complex tensor params. Adds an imag-data slot right after
59
- * the real-data slot; the marshaller supplies the tensor's `.imag`
60
- * Float64Array or NULL. Ignored for scalar kinds. */
61
- isComplex?: boolean;
62
- /** Ordered slots this param contributes to the ABI. One slot for a
63
- * scalar; two for a complex scalar (re + im); two or more
64
- * (data + [imag for complex] + len + optional d0/d1) for a tensor. */
65
- slots: AbiSlot[];
66
- }
67
- /** Per-output descriptor. Tells the JS wrapper how to marshal outputs. */
68
- export interface COutputDesc {
69
- name: string;
70
- kind: "scalar" | "boolean" | "complexScalar" | "tensor";
71
- /** True for tensor outputs using the dynamic-output ABI: the C code
72
- * malloc's the buffer and transfers ownership via `double **` and
73
- * extra d0/d1 out-slots. The JS wrapper decodes the pointer, copies
74
- * into a fresh Float64Array, and frees the C allocation. */
75
- dynamic?: boolean;
76
- /** True for complex tensor outputs. Fixed outputs add a paired imag
77
- * Float64Array buffer; dynamic outputs add a paired imag `double **`
78
- * out-pointer the caller decodes + frees after the call. */
79
- isComplex?: boolean;
80
- /** Ordered slots this output contributes to the ABI. One for scalars,
81
- * two for complex scalars (reOut + imOut), two for fixed real tensor
82
- * outputs (buf + lenOut), three for fixed complex (buf + bufIm +
83
- * lenOut), four for dynamic real tensor outputs, five for dynamic
84
- * complex (dynBuf + dynBufIm + dynLen + dynD0 + dynD1). */
85
- slots: AbiSlot[];
86
- }
87
- /** Build the ABI schema for one generated function. Mutates paramDescs /
88
- * outputDescs in place by filling in `slots`; returns the complete
89
- * `abiSlots` array in calling order (params, then outputs, then trailers). */
90
- export declare function buildAbiSlots(paramDescs: CParamDesc[], outputDescs: COutputDesc[], cls: ClassificationResult, paramOutputTensors: Set<string>, unshareTensorParams: Set<string>, needsTicState: boolean, needsErrorFlag: boolean, needsDispCb: boolean): AbiSlot[];
@@ -1,56 +0,0 @@
1
- /**
2
- * JIT IR → pure C code generation (koffi path).
3
- *
4
- * Orchestration only: this file wires the classify / ABI / emit pieces
5
- * together and assembles the final C source (headers + per-callee
6
- * static functions + outer function).
7
- *
8
- * classify.ts — TensorMeta / analyzeTensorUsage, the single pass
9
- * feeding every downstream decision.
10
- * abi.ts — AbiSlot / CParamDesc / COutputDesc, buildAbiSlots.
11
- * The one schema walked by both signature and JS.
12
- * emit/ — per-statement / per-expression C emission, split
13
- * by concern (scalar, complexScalar, tensor, assign,
14
- * userCall, stmt, fused). Reads ctx.cls for every
15
- * classification decision.
16
- * context.ts — EmitCtx + shared name/opcode helpers.
17
- *
18
- * UserCall support: when a feasible user-defined function is called
19
- * from the outer body, its lowered IR is already in `generatedIRBodies`
20
- * (populated by `lowerUserFuncCall` in jitLower.ts). We emit each
21
- * reachable callee as a `static void jit_<jitName>(...)` in the same
22
- * .c file, in post-order so callees are defined before callers. The
23
- * shared `__err_flag` pointer flows from outer to every callee.
24
- */
25
- import { type JitStmt, type JitType } from "../jitTypes.js";
26
- import type { GeneratedFn } from "../jitLower.js";
27
- import { type AbiSlot, type CParamDesc, type COutputDesc } from "./abi.js";
28
- export type { AbiSlot, AbiSlotKind } from "./abi.js";
29
- export type { CParamDesc, COutputDesc } from "./abi.js";
30
- export { mangle, mangleIm, tensorData, tensorDataIm, tensorLen, tensorD0, tensorD1, formatNumberLiteral, C_SCALAR_TARGET, } from "./context.js";
31
- export interface GenerateCResult {
32
- cSource: string;
33
- cFnName: string;
34
- paramDescs: CParamDesc[];
35
- outputDescs: COutputDesc[];
36
- /** The full ABI slot list in calling order:
37
- * paramDescs[0].slots ++ paramDescs[1].slots ++ ...
38
- * ++ outputDescs[0].slots ++ ... ++ trailer slots (ticState/errFlag).
39
- * The JS wrapper walks this list to marshal values. */
40
- abiSlots: AbiSlot[];
41
- /** True when any tensor is involved (params, locals, or outputs). */
42
- usesTensors: boolean;
43
- /** koffi function signature string for declaring the C function. */
44
- koffiSignature: string;
45
- /** True when tic/toc are used — the function has an extra `double*` param. */
46
- needsTicState: boolean;
47
- /** True when any Index read was emitted — the function has an extra
48
- * `double *__err_flag` trailing param. */
49
- needsErrorFlag: boolean;
50
- /** True when a `disp(...)` call was emitted — the function has an
51
- * extra `void (*__disp_cb)(const char *, double, int)` trailing
52
- * param. The JS wrapper registers a callback that routes back to
53
- * `rt.output`. */
54
- needsDispCb: boolean;
55
- }
56
- export declare function generateC(body: JitStmt[], params: string[], outputs: string[], nargout: number, localVars: Set<string>, argTypes: JitType[], _outputType: JitType | null, outputTypes: JitType[], fnName: string, fuse?: boolean, openmp?: boolean, generatedIRBodies?: Map<string, GeneratedFn>): GenerateCResult;
@@ -1,70 +0,0 @@
1
- /**
2
- * C-JIT: unified classification pass for tensor names.
3
- *
4
- * Replaces the ten ad-hoc sets/maps (`tensorVars`, `paramTensorNames`,
5
- * `outputTensorNames`, `localTensorNames`, `assignIndexTargets`,
6
- * `unshareTensorParams`, `tensorMaxDim`, `freshAllocTensors`,
7
- * `dynamicOutputs`, `paramOutputTensors`) that the codegen used to
8
- * build from 7+ body walks. Everything downstream — signature builder,
9
- * prelude, epilogue, emit helpers, fusion call — now reads from the
10
- * `TensorMeta` table this pass produces.
11
- */
12
- import type { JitExpr, JitStmt, JitType } from "../jitTypes.js";
13
- export type TensorKind =
14
- /** Tensor param, never appears in the output list. */
15
- "param"
16
- /** Tensor param whose name is also in the output list. */
17
- | "paramOutput"
18
- /** Pure tensor output (not a param). */
19
- | "output"
20
- /** Tensor local (neither param nor output). */
21
- | "local";
22
- export interface TensorMeta {
23
- kind: TensorKind;
24
- /** Max index arity on this name (1/2/3). 0 means the name is never
25
- * used as an Index or AssignIndex base. */
26
- maxIndexDim: number;
27
- /** True when any `Assign(name, RHS)` has RHS ∈ {TensorLiteral,
28
- * VConcatGrow, Call(zeros|ones), Var(src) where src.hasFreshAlloc,
29
- * RangeSliceRead}. Propagated to fixed point. */
30
- hasFreshAlloc: boolean;
31
- /** True when any AssignIndex / AssignIndexRange / AssignIndexCol
32
- * uses this name as the base. */
33
- isAssignIndexTarget: boolean;
34
- /** Derived: `kind === "param"` and (`isAssignIndexTarget` or
35
- * `hasFreshAlloc`). Triggers the unshare-at-entry malloc+memcpy
36
- * prelude so writes don't leak to the caller's buffer. */
37
- needsUnshare: boolean;
38
- /** Derived: `hasFreshAlloc` and (`kind === "output"` or
39
- * `kind === "paramOutput"`). Triggers the `double **` dynamic-output
40
- * ABI. */
41
- isDynamicOutput: boolean;
42
- /** True when this tensor's `JitType.isComplex === true` — either at
43
- * the boundary (param / output type) or propagated from a complex
44
- * RHS for locals. Drives paired imag-buffer plumbing: every complex
45
- * tensor gets a `v_name_data_im` companion pointer, an extra ABI
46
- * slot for boundaries, and imag malloc / free / copy parallel to
47
- * the existing real path. */
48
- isComplex: boolean;
49
- }
50
- export interface ClassificationResult {
51
- /** All names with a tensor role, in insertion order (params first,
52
- * then outputs, then locals in body order). */
53
- tensorNames: string[];
54
- /** Per-name metadata. */
55
- meta: Map<string, TensorMeta>;
56
- /** True iff any name has `hasFreshAlloc`. Lets callers skip the
57
- * dynamic-output marshalling when no name uses it. */
58
- hasAnyDynamic: boolean;
59
- /** Name → is any tensor role. `meta.has(name)`. */
60
- tensorVars: Set<string>;
61
- /** Names with `kind === "param"` or `"paramOutput"`. */
62
- paramTensorNames: Set<string>;
63
- /** Names with `kind === "output"` or `"paramOutput"`. */
64
- outputTensorNames: Set<string>;
65
- /** Names with `kind === "local"`. */
66
- localTensorNames: Set<string>;
67
- }
68
- /** Does this Assign RHS allocate a fresh C-owned buffer? */
69
- export declare function isFreshTensorRhs(expr: JitExpr): boolean;
70
- export declare function analyzeTensorUsage(body: JitStmt[], params: string[], argTypes: JitType[], outputNames: string[], outputTypes: JitType[]): ClassificationResult;
@@ -1,37 +0,0 @@
1
- /**
2
- * C-JIT compilation driver (koffi path).
3
- *
4
- * Takes generated C source, compiles it into a `.so` shared library,
5
- * loads it via koffi, and returns the declared function.
6
- *
7
- * Strategy:
8
- * 1. Content-addressed cache under ~/.cache/numbl/c-jit/ — the hash
9
- * includes the source bytes plus compiler/platform/numbl versions,
10
- * so any input change forces a recompile.
11
- * 2. On cache miss, write `src.c` into a fresh tmpdir and shell out to
12
- * the C compiler (`$NUMBL_CC` or `cc`) with `-shared -fPIC`.
13
- * 3. Load with koffi.load() and declare the function.
14
- *
15
- * No Node API headers are needed — functions are plain C with raw types.
16
- * No NAPI_MODULE_INIT, no module registration, no exit hooks.
17
- */
18
- export interface CompiledCFn {
19
- fn: (...args: unknown[]) => unknown;
20
- cachedPath: string;
21
- /** The loaded koffi library handle, for declaring additional exports. */
22
- lib: any;
23
- }
24
- /**
25
- * Compile + load a C function via koffi. Returns null on any failure.
26
- *
27
- * `koffiSignature` is the koffi type-string for the C function, e.g.:
28
- * "void jit_fn(double, double *, int64_t, double *)"
29
- */
30
- export declare function compileAndLoad(cSource: string, koffiSignature: string, _cFnName: string, log?: (m: string) => void, extraFlags?: string[]): CompiledCFn | null;
31
- export declare function resetCEnvForTesting(): void;
32
- export declare function cJitUnavailableReason(): string | undefined;
33
- export declare function cJitCacheSize(): number;
34
- export declare function readCachedBuild(cachedPath: string): Buffer;
35
- /** True when the C compiler supports `-fopenmp` (thread-level parallelism).
36
- * Triggers env discovery on first call so it can be used before compileAndLoad. */
37
- export declare function cJitOpenmpAvailable(log?: (m: string) => void): boolean;
@@ -1,152 +0,0 @@
1
- /**
2
- * Shared types, constants, and helpers used by both emit.ts (the per-
3
- * function emitter) and assemble.ts (the orchestration that builds
4
- * the final signature / prelude / epilogue).
5
- *
6
- * Contains no emit logic itself — pulling this out of the main file
7
- * breaks the otherwise-circular dependency between assemble.ts and
8
- * the emit helpers.
9
- */
10
- import { BinaryOperation } from "../../parser/types.js";
11
- import type { ScalarOpTarget } from "../scalarEmit.js";
12
- import type { ClassificationResult } from "./classify.js";
13
- import type { CParamDesc, COutputDesc } from "./abi.js";
14
- /** Per-callee ABI info the outer emitter uses to marshal its call sites.
15
- * `emitUserCall` reads `paramDescs` to know what slots each param
16
- * contributes (data + len + optional d0/d1 for tensors) and
17
- * `outputDescs` to know whether the return uses the dynamic-output ABI. */
18
- export interface CalleeAbi {
19
- paramDescs: CParamDesc[];
20
- outputDescs: COutputDesc[];
21
- }
22
- /**
23
- * Minimum NUMBL_JIT_RT_VERSION the emitter needs at link time.
24
- *
25
- * Bump this in lockstep with NUMBL_JIT_RT_VERSION in
26
- * native/jit_runtime/jit_runtime.h whenever we add a helper the emitter
27
- * calls. The emitted C asserts `NUMBL_JIT_RT_VERSION >= N` so a stale
28
- * archive fails the per-JIT compile step with a clear message instead
29
- * of a cryptic linker "undefined reference" error.
30
- *
31
- * Version log:
32
- * 1 — initial: idx1r, mod, sign, reduce_flat, tic/toc/monotonic_time.
33
- * 2 — set1r_h (scalar linear Index write with soft-bail on OOB).
34
- * 3 — idx2r / idx3r / set2r_h / set3r_h (multi-index Index read/write).
35
- * 4 — setRange1r_h / setCol2r_h / copyRange1r (range/col slice r/w).
36
- * 5 — is_nan / is_inf / is_finite (predicates that survive -ffast-math
37
- * by inspecting IEEE-754 bit patterns).
38
- */
39
- export declare const NUMBL_JIT_RT_REQUIRED_VERSION = 5;
40
- export declare function mangle(name: string): string;
41
- /** Imaginary part of a complex scalar local / param. Paired with
42
- * `mangle(name)` (the real part). */
43
- export declare function mangleIm(name: string): string;
44
- /** Join a C type and an identifier with a space unless the type already
45
- * ends in `*` (pointer types get no space between `*` and the name). */
46
- export declare function spaceBeforeName(cType: string): string;
47
- export declare const C_SCALAR_TARGET: ScalarOpTarget;
48
- export declare const TENSOR_BIN_OP: Partial<Record<BinaryOperation, string>>;
49
- export declare const TENSOR_COMPLEX_BIN_OP: Partial<Record<BinaryOperation, string>>;
50
- export declare const TENSOR_CMP_OP: Partial<Record<BinaryOperation, string>>;
51
- /**
52
- * Tensor-op dispatch helpers. Each reads `IBuiltin.jitCapabilities` for
53
- * the named builtin and returns the corresponding libnumbl_ops opcode
54
- * enum name / C function name — or `undefined` when the builtin has no
55
- * C-JIT tensor-op routing. These helpers are the single source of truth
56
- * for both the C feasibility check (feasibility.ts) and the C emitter
57
- * (emit.ts); registering a new tensor op is a single edit on the
58
- * IBuiltin, not three parallel table updates.
59
- */
60
- /** libnumbl_ops unary opcode enum name for a tensor-unary builtin. */
61
- export declare function getTensorUnaryOp(name: string): string | undefined;
62
- /** C function name for a 2-arg element-wise tensor binary builtin. */
63
- export declare function getTensorBinaryFn(name: string): string | undefined;
64
- /** libnumbl_ops reduce opcode enum name for a tensor-reduction builtin. */
65
- export declare function getTensorReductionOp(name: string): string | undefined;
66
- export declare function formatNumberLiteral(v: number): string;
67
- export declare function tensorData(name: string): string;
68
- /** Imaginary data pointer for a complex tensor. Pairs with
69
- * `tensorData(name)` — both locals carry the same length and shape
70
- * info. The kernels in numbl_ops accept NULL for the imag pointer as
71
- * "all zero", so a nominally-complex tensor whose `.imag` is undefined
72
- * can still be passed efficiently without allocating a zero buffer.
73
- *
74
- * Uses the `__im_` prefix so a user variable `x_data_im` can't collide
75
- * with the imag companion of `x`'s tensor data. */
76
- export declare function tensorDataIm(name: string): string;
77
- export declare function tensorLen(name: string): string;
78
- /** Row count (shape[0]) for a 2D/3D-indexed tensor param. Also reused
79
- * as the mutable row-count local for fresh-alloc tensors (TensorLiteral/
80
- * zeros/ones/VConcatGrow targets). */
81
- export declare function tensorD0(name: string): string;
82
- /** Column count. For 3D tensor params this is shape[1]; for fresh-alloc
83
- * tensors it's shape[1] (i.e., the column count of a matrix or 1 for
84
- * a column vector). */
85
- export declare function tensorD1(name: string): string;
86
- export interface EmitCtx {
87
- /** Shared classification table: every tensor-name decision reads from
88
- * here (kind, maxIndexDim, hasFreshAlloc, needsUnshare,
89
- * isDynamicOutput, ...). See `classify.ts`. */
90
- cls: ClassificationResult;
91
- /** Counter for scratch buffer slots. Each tensor sub-expression that
92
- * doesn't have a top-level dest gets a scratch double* + int64_t pair. */
93
- scratchCount: number;
94
- /** Scratch indices whose tensor expression was complex — the prelude
95
- * declares a paired `__sN_data_im` for these, and epilogue frees both
96
- * buffers. Real scratches stay single-buffer. */
97
- complexScratch: Set<number>;
98
- /** Counter for for-loop step temps. */
99
- tmp: {
100
- n: number;
101
- };
102
- /** Set of scratch indices that were actually used. */
103
- usedScratch: Set<number>;
104
- /** When set, expression emission can prepend statements (e.g. for
105
- * reductions of complex tensor expressions that need scratch buffers). */
106
- pendingStmts?: {
107
- lines: string[];
108
- indent: string;
109
- };
110
- /** Emit fused per-element loops for tensor chains (--fuse). */
111
- fuse: boolean;
112
- /** Set when tic or toc is used — triggers __tic_state parameter. */
113
- needsTicState: boolean;
114
- /** Set when any Index read is emitted — triggers __err_flag parameter
115
- * and the __numbl_idx1r helper. JS wrapper checks the flag after the
116
- * call and throws "Index exceeds array bounds" if set. */
117
- needsErrorFlag: boolean;
118
- /** Set when a `disp(...)` call is emitted — triggers the __disp_cb
119
- * trailer parameter. The JS wrapper registers a koffi callback that
120
- * routes back into `rt.output` with MATLAB-style formatting. */
121
- needsDispCb: boolean;
122
- /** Emit `#pragma omp parallel for` on fused non-reduction loops. */
123
- openmp: boolean;
124
- /** ABI of every reachable UserCall callee (keyed by `jitName`). Populated
125
- * by `generateC` as each callee is emitted, then handed to the outer
126
- * emitter so `emitUserCall` can walk the callee's paramDescs to marshal
127
- * tensor args (and decide scalar-vs-tensor return shape) at the call
128
- * site. Absent during tests that only emit a single function. */
129
- calleeAbi?: Map<string, CalleeAbi>;
130
- /** Names (params + locals + outputs) that hold `complex_or_number`
131
- * scalar values and thus have paired `v_name` / `v_name_im` locals. */
132
- complexScalarVars: Set<string>;
133
- }
134
- export declare function isTensorVar(ctx: EmitCtx, name: string): boolean;
135
- export declare function isComplexTensorVar(ctx: EmitCtx, name: string): boolean;
136
- export declare function isComplexScalarVar(ctx: EmitCtx, name: string): boolean;
137
- export declare function hasFreshAlloc(ctx: EmitCtx, name: string): boolean;
138
- export declare function isDynamicOutput(ctx: EmitCtx, name: string): boolean;
139
- export declare function isLocalTensor(ctx: EmitCtx, name: string): boolean;
140
- export declare function isOutputTensor(ctx: EmitCtx, name: string): boolean;
141
- export declare function tensorMaxDim(ctx: EmitCtx, name: string): number;
142
- /** Allocate a scratch buffer pair (__s{n}_data, __s{n}_len). */
143
- export declare function allocScratch(ctx: EmitCtx): number;
144
- /** Allocate a complex scratch triple (__s{n}_data, __s{n}_data_im,
145
- * __s{n}_len) — the emitter tags the index so the prelude declares
146
- * and the epilogue frees the imag companion. */
147
- export declare function allocComplexScratch(ctx: EmitCtx): number;
148
- export declare function scratchData(n: number): string;
149
- /** Imaginary companion for a complex scratch buffer. Only declared in
150
- * the prelude when the scratch index appears in ctx.complexScratch. */
151
- export declare function scratchDataIm(n: number): string;
152
- export declare function scratchLen(n: number): string;
@@ -1,20 +0,0 @@
1
- import { type JitExpr } from "../../jitTypes.js";
2
- import { type EmitCtx } from "../context.js";
3
- /** Complex-tensor Assign: parallels emitTensorAssign but writes paired
4
- * re+im buffers. RHS sub-exprs route through emitComplexTensorExprToStmts
5
- * / emitComplexTensorBinaryStmts. For a real RHS (e.g. a Var pointing
6
- * to a real tensor), imag is widened via NULL pointer or a zero buffer.
7
- *
8
- * Runs inside a pendingStmts frame so nested complex scalar sub-expressions
9
- * (`1i`, `3+4i`, `re(z) + 1i*im(z)`, ...) can materialize their pair
10
- * locals into the same `lines` stream ahead of the kernel call. */
11
- export declare function emitComplexTensorAssign(lines: string[], indent: string, destName: string, expr: JitExpr, ctx: EmitCtx): void;
12
- /** Emit a tensor-result Assign: handles Binary, Unary, Call on tensors. */
13
- export declare function emitTensorAssign(lines: string[], indent: string, destName: string, expr: JitExpr, ctx: EmitCtx): void;
14
- /** Emit an Assign where the RHS is a reduction on a tensor sub-
15
- * expression (not just a Var) — e.g. `y = sum(x .* z)`. The tensor
16
- * expression is materialised into a scratch buffer first, then the
17
- * scalar reduction reads that buffer. */
18
- export declare function emitReductionOfTensorExpr(lines: string[], indent: string, destName: string, callExpr: JitExpr & {
19
- tag: "Call";
20
- }, ctx: EmitCtx): void;
@@ -1,18 +0,0 @@
1
- import type { JitExpr } from "../../jitTypes.js";
2
- import { type EmitCtx } from "../context.js";
3
- import { type ComplexPair } from "./helpers.js";
4
- /** Materialize a ComplexPair into two fresh `__cN_re` / `__cN_im` locals
5
- * prepended to `ctx.pendingStmts.lines`. Used when the emitted formula
6
- * would otherwise evaluate either sub-expression more than once (e.g.
7
- * both Mul and Div reference each operand twice in the per-component
8
- * formula). Returns references to the new locals. */
9
- export declare function materializeComplexPair(pair: ComplexPair, ctx: EmitCtx): ComplexPair;
10
- /** Emit a complex-valued scalar expression, returning (re, im) C
11
- * expression strings. Call sites that need a pair (complex RHS, complex
12
- * operand of a complex op, arg of real/imag/conj on complex) route
13
- * through here. Real sub-expressions widen implicitly (im = 0). */
14
- export declare function emitComplex(expr: JitExpr, ctx: EmitCtx): ComplexPair;
15
- /** Emit a scalar sub-expression at a complex tensor op boundary. Returns
16
- * a (re, im) pair of C expressions. Real scalars become (expr, "0.0");
17
- * complex scalars go through emitComplex for their pair form. */
18
- export declare function emitComplexScalarPair(expr: JitExpr, ctx: EmitCtx): ComplexPair;
@@ -1,42 +0,0 @@
1
- /**
2
- * Fused per-element loop emission for the C-JIT.
3
- *
4
- * Given a FusibleChain (from fusion.ts), emits a single
5
- * `for (int64_t __i = 0; __i < N; __i++) { ... }`
6
- * loop that evaluates all the chain's tensor assigns as inline scalar
7
- * expressions per element — no libnumbl_ops calls, no intermediate
8
- * buffers.
9
- *
10
- * Scalar expressions (number literals, scalar vars, scalar math calls)
11
- * pass through unchanged. Tensor var references become either:
12
- * - `v_name_data[__i]` for input params / pre-existing tensors
13
- * - `__f_name` for chain-produced intermediates (scalar local)
14
- *
15
- * The optional trailing reduction is absorbed as an inline accumulator
16
- * (`__f_acc += expr`) inside the same loop, eliminating the need to
17
- * materialise the tensor result at all when it is only consumed by the
18
- * reduction.
19
- */
20
- import type { FusibleChain } from "../../fusion.js";
21
- /**
22
- * Emit a fused per-element loop for the given chain.
23
- *
24
- * Appends C source lines to `lines`. All scalar math helpers the inner
25
- * body may reference (mod, sign, ...) live in jit_runtime.a, so this
26
- * function no longer reports back "helpers needed" — the emitter simply
27
- * calls them as library symbols.
28
- *
29
- * Dispatches to the real or complex per-element emitter based on whether
30
- * any assign in the chain produces a complex tensor. Both paths share
31
- * the outer shell (lenVar, writeBack, parallel-for decision, loop open);
32
- * only the buffer sizing, per-element emission, and write-back differ.
33
- *
34
- * `allTensorVars` is the full set of tensor-typed variable names.
35
- * `paramTensors` is the subset that are input parameters.
36
- * `outputTensorNames` is the subset that are function outputs.
37
- * `localTensorNames` is the subset that are non-param, non-output locals.
38
- * `complexTensorNames` is the subset whose tensor has a paired imag buffer.
39
- * `complexScalarVars` is the set of scalar vars that hold complex values
40
- * (pair-of-doubles `v_name` / `__im_v_name`).
41
- */
42
- export declare function emitFusedChain(lines: string[], indent: string, chain: FusibleChain, allTensorVars: ReadonlySet<string>, paramTensors: ReadonlySet<string>, outputTensorNames: ReadonlySet<string>, localTensorNames: ReadonlySet<string>, dynamicOutputNames: ReadonlySet<string>, complexTensorNames: ReadonlySet<string>, complexScalarVars: ReadonlySet<string>, openmp?: boolean): void;
@@ -1,40 +0,0 @@
1
- /**
2
- * Small shared helpers used across the emit/ modules.
3
- *
4
- * These are one-liners and trivial utilities that don't belong in any
5
- * one topic file — keeping them here avoids either duplicating them
6
- * across topic files or inflating a topic file with unrelated detail.
7
- */
8
- import type { JitExpr } from "../../jitTypes.js";
9
- import type { TensorMeta } from "../classify.js";
10
- import type { EmitCtx } from "../context.js";
11
- export declare function isTensorExpr(expr: JitExpr): boolean;
12
- export declare function isComplexExpr(expr: JitExpr): boolean;
13
- /** Pair of C expressions holding the real and imaginary parts of a
14
- * complex scalar value. Produced by `emitComplex`. */
15
- export interface ComplexPair {
16
- re: string;
17
- im: string;
18
- }
19
- /** Complex tensor expression result: data + dataIm + len in C. For a
20
- * Var whose JitType is a real tensor, `dataIm` is the literal string
21
- * `"NULL"` — the numbl_ops complex kernels treat that as "all zero",
22
- * so a real tensor flowing into a complex op doesn't need a zero
23
- * buffer. */
24
- export interface ComplexTensorResult {
25
- data: string;
26
- dataIm: string;
27
- len: string;
28
- }
29
- /** Widen a real scalar C expression to a complex pair (im = 0). */
30
- export declare function widenRealToComplex(realCode: string): ComplexPair;
31
- /** Escape a JS string into a C string literal (double-quoted, with C
32
- * escapes for backslash, double-quote, and common control chars;
33
- * non-ASCII bytes encoded as `\xNN` octets of their UTF-8 encoding). */
34
- export declare function cStringLiteral(s: string): string;
35
- /** Resolve a tensor name's meta or throw — the tensor-creation emit
36
- * helpers depend on the name being classified (with `hasFreshAlloc`)
37
- * for the d0/d1 locals they write to actually exist at runtime.
38
- * Failing loudly here beats emitting C that references undeclared
39
- * identifiers. */
40
- export declare function requireFreshAllocMeta(ctx: EmitCtx, destName: string, site: string): TensorMeta;