numbl 0.4.19 → 0.4.22
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/binding.gyp +12 -6
- package/dist-browser/browser/index.d.ts +1 -1
- package/dist-browser/browser/mip.d.ts +7 -0
- package/dist-browser/browser/protocol.d.ts +1 -1
- package/dist-browser/browser.js +1 -1
- package/dist-browser/db/operations.d.ts +0 -1
- package/dist-browser/gpuHelper.d.ts +29 -0
- package/dist-browser/hooks/projectFilesState.d.ts +37 -0
- package/dist-browser/numbl-core/execSession.d.ts +39 -0
- package/dist-browser/numbl-core/executeCode.d.ts +10 -1
- package/dist-browser/numbl-core/executors/classification.d.ts +2 -10
- package/dist-browser/numbl-core/executors/jit/backend.d.ts +65 -0
- package/dist-browser/numbl-core/executors/jit/cBackend.d.ts +22 -0
- package/dist-browser/numbl-core/executors/jit/callExecutor.d.ts +13 -44
- package/dist-browser/numbl-core/executors/jit/hostHelpers.d.ts +24 -0
- package/dist-browser/numbl-core/executors/jit/jsBackend.d.ts +15 -0
- package/dist-browser/numbl-core/executors/jit/loopExecutor.d.ts +13 -40
- package/dist-browser/numbl-core/executors/jit/session.d.ts +1 -1
- package/dist-browser/numbl-core/executors/jit/topLevelExecutor.d.ts +13 -33
- package/dist-browser/numbl-core/executors/jit/valueAdapterC.d.ts +32 -48
- package/dist-browser/numbl-core/executors/lowering.d.ts +38 -96
- package/dist-browser/numbl-core/executors/plugins.d.ts +14 -28
- package/dist-browser/numbl-core/executors/registry.d.ts +32 -133
- package/dist-browser/numbl-core/executors/types.d.ts +30 -92
- package/dist-browser/numbl-core/functionResolve.d.ts +3 -13
- package/dist-browser/numbl-core/helpers/check-helpers.d.ts +0 -5
- package/dist-browser/numbl-core/helpers/glob.d.ts +14 -0
- package/dist-browser/numbl-core/helpers/linsolve.d.ts +3 -13
- package/dist-browser/numbl-core/helpers/reduction-helpers.d.ts +2 -4
- package/dist-browser/numbl-core/helpers/shape-utils.d.ts +10 -0
- package/dist-browser/numbl-core/helpers/sparse-direct.d.ts +107 -0
- package/dist-browser/numbl-core/helpers/warn.d.ts +9 -0
- package/dist-browser/numbl-core/interpreter/builtins/index.d.ts +4 -1
- package/dist-browser/numbl-core/interpreter/builtins/sparse-solvers.d.ts +16 -0
- package/dist-browser/numbl-core/interpreter/builtins/time-system.d.ts +0 -1
- package/dist-browser/numbl-core/interpreter/builtins/types.d.ts +7 -7
- package/dist-browser/numbl-core/interpreter/interpreter.d.ts +6 -6
- package/dist-browser/numbl-core/interpreter/interpreterFunctions.d.ts +9 -1
- package/dist-browser/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +6 -3
- package/dist-browser/numbl-core/jit/builtins/defs/_shared.d.ts +1 -5
- package/dist-browser/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +1 -2
- package/dist-browser/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +3 -3
- package/dist-browser/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +1 -1
- package/dist-browser/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +1 -1
- package/dist-browser/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +5 -2
- package/dist-browser/numbl-core/jit/builtins/defs/math/realsqrt.d.ts +6 -0
- package/dist-browser/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +0 -5
- package/dist-browser/numbl-core/jit/builtins/defs/shape/_construct.d.ts +0 -4
- package/dist-browser/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +2 -8
- package/dist-browser/numbl-core/jit/builtins/defs/system/deal.d.ts +4 -5
- package/dist-browser/numbl-core/jit/builtins/defs/system/feval.d.ts +7 -29
- package/dist-browser/numbl-core/jit/builtins/registry.d.ts +15 -30
- package/dist-browser/numbl-core/jit/builtins/runtime/system/cdiv.d.ts +4 -0
- package/dist-browser/numbl-core/jit/builtins/runtime/system/cscalar.d.ts +4 -0
- package/dist-browser/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +45 -15
- package/dist-browser/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +5 -5
- package/dist-browser/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +6 -0
- package/dist-browser/numbl-core/jit/codegen/emit.d.ts +9 -30
- package/dist-browser/numbl-core/jit/codegen/emitJs.d.ts +9 -27
- package/dist-browser/numbl-core/jit/codegen/emitStmt.d.ts +8 -31
- package/dist-browser/numbl-core/jit/codegen/emitTensorFused.d.ts +10 -9
- package/dist-browser/numbl-core/jit/codegen/inlinePass.d.ts +39 -48
- package/dist-browser/numbl-core/jit/codegen/prettyIR.d.ts +1 -6
- package/dist-browser/numbl-core/jit/codegen/runtime.d.ts +7 -28
- package/dist-browser/numbl-core/jit/compileSpec.d.ts +3 -6
- package/dist-browser/numbl-core/jit/compileSpecC.d.ts +5 -0
- package/dist-browser/numbl-core/jit/lowering/assignedFlags.d.ts +24 -0
- package/dist-browser/numbl-core/jit/lowering/definiteAssign.d.ts +3 -1
- package/dist-browser/numbl-core/jit/lowering/errors.d.ts +3 -15
- package/dist-browser/numbl-core/jit/lowering/ir.d.ts +0 -2
- package/dist-browser/numbl-core/jit/lowering/lower.d.ts +4 -12
- package/dist-browser/numbl-core/jit/lowering/types.d.ts +2 -7
- package/dist-browser/numbl-core/jit/numbl/index.d.ts +5 -14
- package/dist-browser/numbl-core/jit/parser/index.d.ts +4 -9
- package/dist-browser/numbl-core/jit/workspace/workspace.d.ts +32 -136
- package/dist-browser/numbl-core/jitDeclineDiagnostics.d.ts +1 -1
- package/dist-browser/numbl-core/jsUserFunctions.d.ts +10 -12
- package/dist-browser/numbl-core/lowering/classInfo.d.ts +4 -1
- package/dist-browser/numbl-core/lowering/loweringContext.d.ts +15 -23
- package/dist-browser/numbl-core/native/lapack-bridge.d.ts +137 -128
- package/dist-browser/numbl-core/native/ts-lapack-bridge.d.ts +4 -5
- package/dist-browser/numbl-core/native/ts-lapack-complex.d.ts +23 -0
- package/dist-browser/numbl-core/native/ts-lapack-eig-hermitian.d.ts +33 -0
- package/dist-browser/numbl-core/native/ts-lapack-qr-lu.d.ts +37 -0
- package/dist-browser/numbl-core/native/wasm-lapack-bridge.d.ts +4 -5
- package/dist-browser/numbl-core/ops/dispatch.d.ts +4 -5
- package/dist-browser/numbl-core/parser/types.d.ts +1 -21
- package/{dist-lib/numbl-core/runtime → dist-browser/numbl-core/plotting}/axisCommand.d.ts +2 -2
- package/dist-browser/{graphics → numbl-core/plotting}/axisLimits.d.ts +14 -2
- package/dist-browser/numbl-core/plotting/builtins.d.ts +8 -0
- package/dist-browser/numbl-core/plotting/colormaps.d.ts +10 -0
- package/dist-browser/numbl-core/{runtime/plotBuiltinDispatch.d.ts → plotting/dispatch.d.ts} +14 -25
- package/dist-browser/numbl-core/plotting/imagescExtent.d.ts +19 -0
- package/dist-browser/numbl-core/{runtime/runtimePlot.d.ts → plotting/instructions.d.ts} +5 -17
- package/dist-browser/numbl-core/plotting/parseArgsChart.d.ts +94 -0
- package/dist-browser/numbl-core/plotting/parseArgsCommon.d.ts +64 -0
- package/dist-browser/numbl-core/plotting/parseArgsLine.d.ts +103 -0
- package/dist-browser/numbl-core/plotting/parseArgsPatch.d.ts +38 -0
- package/dist-browser/numbl-core/plotting/parseArgsQuiver.d.ts +32 -0
- package/dist-browser/numbl-core/plotting/parseArgsSurface.d.ts +75 -0
- package/dist-browser/numbl-core/plotting/streamline.d.ts +16 -0
- package/{dist-graphics/graphics → dist-browser/numbl-core/plotting}/types.d.ts +9 -7
- package/dist-browser/numbl-core/runtime/cow.d.ts +0 -8
- package/dist-browser/numbl-core/runtime/refcount.d.ts +0 -3
- package/dist-browser/numbl-core/runtime/registerSpecial.d.ts +15 -0
- package/dist-browser/numbl-core/runtime/runtime.d.ts +11 -35
- package/dist-browser/numbl-core/runtime/runtimeDispatch.d.ts +6 -0
- package/dist-browser/numbl-core/runtime/specialBuiltins.d.ts +3 -9
- package/dist-browser/numbl-core/runtime/types.d.ts +12 -0
- package/dist-browser/numbl-core/runtime/uihtmlSession.d.ts +5 -13
- package/dist-browser/numbl-core/runtime/utils.d.ts +4 -1
- package/dist-browser/numbl-core/version.d.ts +1 -1
- package/dist-browser/numbl-core/workspace/workspace.d.ts +64 -0
- package/dist-browser/ts-lapack/src/BLAS/dsymv.d.ts +1 -0
- package/dist-browser/ts-lapack/src/BLAS/dsyr2.d.ts +1 -0
- package/dist-browser/ts-lapack/src/SRC/dlae2.d.ts +4 -0
- package/dist-browser/ts-lapack/src/SRC/dlaev2.d.ts +6 -0
- package/dist-browser/ts-lapack/src/SRC/dlanst.d.ts +1 -0
- package/dist-browser/ts-lapack/src/SRC/dlansy.d.ts +1 -0
- package/dist-browser/ts-lapack/src/SRC/dlasrt.d.ts +1 -0
- package/dist-browser/ts-lapack/src/SRC/dorgtr.d.ts +1 -0
- package/dist-browser/ts-lapack/src/SRC/dsteqr.d.ts +4 -0
- package/dist-browser/ts-lapack/src/SRC/dsyev.d.ts +1 -0
- package/dist-browser/ts-lapack/src/SRC/dsytd2.d.ts +1 -0
- package/dist-browser/vfs/syncVfsChanges.d.ts +2 -2
- package/dist-cli/cli.js +74241 -77271
- package/dist-graphics/graphics/FigureView.d.ts +1 -1
- package/dist-graphics/graphics/SurfView.d.ts +3 -2
- package/dist-graphics/graphics/drawPlot.d.ts +1 -1
- package/dist-graphics/graphics/exportFigureHdf5.d.ts +1 -1
- package/dist-graphics/graphics/figureHashTransport.d.ts +1 -1
- package/dist-graphics/graphics/figureUpload.d.ts +1 -1
- package/dist-graphics/graphics/importFigureHdf5.d.ts +1 -1
- package/dist-graphics/graphics/openInFigureViewer.d.ts +1 -1
- package/dist-graphics/graphics/plotHelpers.d.ts +1 -1
- package/dist-graphics/graphics/plotLegend.d.ts +1 -1
- package/dist-graphics/graphics/plotMarkers.d.ts +1 -1
- package/dist-graphics/graphics/restoreNaNs.d.ts +1 -1
- package/dist-graphics/graphics/uihtmlRelay.d.ts +16 -0
- package/dist-graphics/graphics-lib.d.ts +3 -3
- package/dist-graphics/index.js +294 -328
- package/{dist-lib/graphics → dist-graphics/numbl-core/plotting}/axisLimits.d.ts +14 -2
- package/dist-graphics/numbl-core/plotting/colormaps.d.ts +10 -0
- package/dist-graphics/numbl-core/plotting/imagescExtent.d.ts +19 -0
- package/{dist-browser/graphics → dist-graphics/numbl-core/plotting}/types.d.ts +9 -7
- package/dist-lib/browser/mip.d.ts +17 -0
- package/dist-lib/cli-scan.d.ts +8 -1
- package/dist-lib/lib.d.ts +1 -1
- package/dist-lib/lib.js +37081 -39889
- package/dist-lib/node.js +22 -14
- package/dist-lib/numbl-core/execSession.d.ts +39 -0
- package/dist-lib/numbl-core/executeCode.d.ts +10 -1
- package/dist-lib/numbl-core/executors/classification.d.ts +2 -10
- package/dist-lib/numbl-core/executors/jit/backend.d.ts +65 -0
- package/dist-lib/numbl-core/executors/jit/cBackend.d.ts +22 -0
- package/dist-lib/numbl-core/executors/jit/callExecutor.d.ts +13 -44
- package/dist-lib/numbl-core/executors/jit/hostHelpers.d.ts +24 -0
- package/dist-lib/numbl-core/executors/jit/jsBackend.d.ts +15 -0
- package/dist-lib/numbl-core/executors/jit/loopExecutor.d.ts +13 -40
- package/dist-lib/numbl-core/executors/jit/session.d.ts +1 -1
- package/dist-lib/numbl-core/executors/jit/topLevelExecutor.d.ts +13 -33
- package/dist-lib/numbl-core/executors/jit/valueAdapterC.d.ts +32 -48
- package/dist-lib/numbl-core/executors/lowering.d.ts +38 -96
- package/dist-lib/numbl-core/executors/plugins.d.ts +14 -28
- package/dist-lib/numbl-core/executors/registry.d.ts +32 -133
- package/dist-lib/numbl-core/executors/types.d.ts +30 -92
- package/dist-lib/numbl-core/functionResolve.d.ts +3 -13
- package/dist-lib/numbl-core/helpers/check-helpers.d.ts +0 -5
- package/dist-lib/numbl-core/helpers/glob.d.ts +14 -0
- package/dist-lib/numbl-core/helpers/linsolve.d.ts +3 -13
- package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +2 -4
- package/dist-lib/numbl-core/helpers/shape-utils.d.ts +10 -0
- package/dist-lib/numbl-core/helpers/sparse-direct.d.ts +107 -0
- package/dist-lib/numbl-core/helpers/warn.d.ts +9 -0
- package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +4 -1
- package/dist-lib/numbl-core/interpreter/builtins/sparse-solvers.d.ts +16 -0
- package/dist-lib/numbl-core/interpreter/builtins/time-system.d.ts +0 -1
- package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +7 -7
- package/dist-lib/numbl-core/interpreter/interpreter.d.ts +6 -6
- package/dist-lib/numbl-core/interpreter/interpreterFunctions.d.ts +9 -1
- package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +6 -3
- package/dist-lib/numbl-core/jit/builtins/defs/_shared.d.ts +1 -5
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +1 -2
- package/dist-lib/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +3 -3
- package/dist-lib/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +1 -1
- package/dist-lib/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +1 -1
- package/dist-lib/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +5 -2
- package/dist-lib/numbl-core/jit/builtins/defs/math/realsqrt.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +0 -5
- package/dist-lib/numbl-core/jit/builtins/defs/shape/_construct.d.ts +0 -4
- package/dist-lib/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +2 -8
- package/dist-lib/numbl-core/jit/builtins/defs/system/deal.d.ts +4 -5
- package/dist-lib/numbl-core/jit/builtins/defs/system/feval.d.ts +7 -29
- package/dist-lib/numbl-core/jit/builtins/registry.d.ts +15 -30
- package/dist-lib/numbl-core/jit/builtins/runtime/system/cdiv.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/cscalar.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +45 -15
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +5 -5
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +6 -0
- package/dist-lib/numbl-core/jit/codegen/emit.d.ts +9 -30
- package/dist-lib/numbl-core/jit/codegen/emitJs.d.ts +9 -27
- package/dist-lib/numbl-core/jit/codegen/emitStmt.d.ts +8 -31
- package/dist-lib/numbl-core/jit/codegen/emitTensorFused.d.ts +10 -9
- package/dist-lib/numbl-core/jit/codegen/inlinePass.d.ts +39 -48
- package/dist-lib/numbl-core/jit/codegen/prettyIR.d.ts +1 -6
- package/dist-lib/numbl-core/jit/codegen/runtime.d.ts +7 -28
- package/dist-lib/numbl-core/jit/compileSpec.d.ts +3 -6
- package/dist-lib/numbl-core/jit/compileSpecC.d.ts +5 -0
- package/dist-lib/numbl-core/jit/lowering/assignedFlags.d.ts +24 -0
- package/dist-lib/numbl-core/jit/lowering/definiteAssign.d.ts +3 -1
- package/dist-lib/numbl-core/jit/lowering/errors.d.ts +3 -15
- package/dist-lib/numbl-core/jit/lowering/ir.d.ts +0 -2
- package/dist-lib/numbl-core/jit/lowering/lower.d.ts +4 -12
- package/dist-lib/numbl-core/jit/lowering/types.d.ts +2 -7
- package/dist-lib/numbl-core/jit/numbl/index.d.ts +5 -14
- package/dist-lib/numbl-core/jit/parser/index.d.ts +4 -9
- package/dist-lib/numbl-core/jit/workspace/workspace.d.ts +32 -136
- package/dist-lib/numbl-core/jitDeclineDiagnostics.d.ts +1 -1
- package/dist-lib/numbl-core/jsUserFunctions.d.ts +10 -12
- package/dist-lib/numbl-core/lowering/classInfo.d.ts +4 -1
- package/dist-lib/numbl-core/lowering/loweringContext.d.ts +15 -23
- package/dist-lib/numbl-core/native/lapack-bridge.d.ts +137 -128
- package/dist-lib/numbl-core/native/ts-lapack-bridge.d.ts +4 -5
- package/dist-lib/numbl-core/native/ts-lapack-complex.d.ts +23 -0
- package/dist-lib/numbl-core/native/ts-lapack-eig-hermitian.d.ts +33 -0
- package/dist-lib/numbl-core/native/ts-lapack-qr-lu.d.ts +37 -0
- package/dist-lib/numbl-core/native/wasm-lapack-bridge.d.ts +4 -5
- package/dist-lib/numbl-core/ops/dispatch.d.ts +4 -5
- package/dist-lib/numbl-core/parser/types.d.ts +1 -21
- package/{dist-browser/numbl-core/runtime → dist-lib/numbl-core/plotting}/axisCommand.d.ts +2 -2
- package/{dist-graphics/graphics → dist-lib/numbl-core/plotting}/axisLimits.d.ts +14 -2
- package/dist-lib/numbl-core/plotting/builtins.d.ts +8 -0
- package/dist-lib/numbl-core/plotting/colormaps.d.ts +10 -0
- package/dist-lib/numbl-core/{runtime/plotBuiltinDispatch.d.ts → plotting/dispatch.d.ts} +14 -25
- package/dist-lib/numbl-core/plotting/imagescExtent.d.ts +19 -0
- package/dist-lib/numbl-core/{runtime/runtimePlot.d.ts → plotting/instructions.d.ts} +5 -17
- package/dist-lib/numbl-core/plotting/parseArgsChart.d.ts +94 -0
- package/dist-lib/numbl-core/plotting/parseArgsCommon.d.ts +64 -0
- package/dist-lib/numbl-core/plotting/parseArgsLine.d.ts +103 -0
- package/dist-lib/numbl-core/plotting/parseArgsPatch.d.ts +38 -0
- package/dist-lib/numbl-core/plotting/parseArgsQuiver.d.ts +32 -0
- package/dist-lib/numbl-core/plotting/parseArgsSurface.d.ts +75 -0
- package/dist-lib/numbl-core/plotting/streamline.d.ts +16 -0
- package/dist-lib/{graphics → numbl-core/plotting}/types.d.ts +9 -7
- package/dist-lib/numbl-core/runtime/cow.d.ts +0 -8
- package/dist-lib/numbl-core/runtime/refcount.d.ts +0 -3
- package/dist-lib/numbl-core/runtime/registerSpecial.d.ts +15 -0
- package/dist-lib/numbl-core/runtime/runtime.d.ts +11 -35
- package/dist-lib/numbl-core/runtime/runtimeDispatch.d.ts +6 -0
- package/dist-lib/numbl-core/runtime/specialBuiltins.d.ts +3 -9
- package/dist-lib/numbl-core/runtime/types.d.ts +12 -0
- package/dist-lib/numbl-core/runtime/uihtmlSession.d.ts +5 -13
- package/dist-lib/numbl-core/runtime/utils.d.ts +4 -1
- package/dist-lib/numbl-core/version.d.ts +1 -1
- package/dist-lib/numbl-core/workspace/workspace.d.ts +64 -0
- package/dist-lib/ts-lapack/src/BLAS/dsymv.d.ts +1 -0
- package/dist-lib/ts-lapack/src/BLAS/dsyr2.d.ts +1 -0
- package/dist-lib/ts-lapack/src/SRC/dlae2.d.ts +4 -0
- package/dist-lib/ts-lapack/src/SRC/dlaev2.d.ts +6 -0
- package/dist-lib/ts-lapack/src/SRC/dlanst.d.ts +1 -0
- package/dist-lib/ts-lapack/src/SRC/dlansy.d.ts +1 -0
- package/dist-lib/ts-lapack/src/SRC/dlasrt.d.ts +1 -0
- package/dist-lib/ts-lapack/src/SRC/dorgtr.d.ts +1 -0
- package/dist-lib/ts-lapack/src/SRC/dsteqr.d.ts +4 -0
- package/dist-lib/ts-lapack/src/SRC/dsyev.d.ts +1 -0
- package/dist-lib/ts-lapack/src/SRC/dsytd2.d.ts +1 -0
- package/dist-lib/vfs/unzipToFiles.d.ts +7 -0
- package/dist-plot-viewer/assets/index-C0fIevlp.js +4504 -0
- package/dist-plot-viewer/index.html +1 -1
- package/dist-site-viewer/assets/index-BDaviCH6.js +4832 -0
- package/dist-site-viewer/assets/numbl-worker-D6m4K2PP.js +5691 -0
- package/dist-site-viewer/index.html +2 -2
- package/native/lapack_eig.cpp +156 -0
- package/native/numbl_addon.cpp +8 -12
- package/native/numbl_addon_common.h +14 -5
- package/package.json +6 -5
- package/dist-browser/hooks/useProjectFiles.d.ts +0 -45
- package/dist-browser/numbl-core/executors/context.d.ts +0 -76
- package/dist-browser/numbl-core/executors/index.d.ts +0 -14
- package/dist-browser/numbl-core/executors/jit/cJitCallExecutor.d.ts +0 -35
- package/dist-browser/numbl-core/executors/jit/cJitLoopExecutor.d.ts +0 -31
- package/dist-browser/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +0 -29
- package/dist-browser/numbl-core/helpers/dummy.d.ts +0 -5
- package/dist-browser/numbl-core/jit/runtime/context.d.ts +0 -23
- package/dist-browser/numbl-core/jit/runtime/inferType.d.ts +0 -10
- package/dist-browser/numbl-core/jit/runtime/value.d.ts +0 -101
- package/dist-browser/numbl-core/jit/workspace/driverPrologue.d.ts +0 -59
- package/dist-browser/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +0 -62
- package/dist-browser/numbl-core/native/bridge-resolve.d.ts +0 -14
- package/dist-browser/numbl-core/runtime/plotUtils.d.ts +0 -336
- package/dist-browser/numbl-core/runtime/specialBuiltinNames.d.ts +0 -2
- package/dist-graphics/graphics/surfColormap.d.ts +0 -2
- package/dist-lib/numbl-core/executors/context.d.ts +0 -76
- package/dist-lib/numbl-core/executors/index.d.ts +0 -14
- package/dist-lib/numbl-core/executors/jit/cJitCallExecutor.d.ts +0 -35
- package/dist-lib/numbl-core/executors/jit/cJitLoopExecutor.d.ts +0 -31
- package/dist-lib/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +0 -29
- package/dist-lib/numbl-core/helpers/dummy.d.ts +0 -5
- package/dist-lib/numbl-core/jit/runtime/context.d.ts +0 -23
- package/dist-lib/numbl-core/jit/runtime/inferType.d.ts +0 -10
- package/dist-lib/numbl-core/jit/runtime/value.d.ts +0 -101
- package/dist-lib/numbl-core/jit/workspace/driverPrologue.d.ts +0 -59
- package/dist-lib/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +0 -62
- package/dist-lib/numbl-core/native/bridge-resolve.d.ts +0 -14
- package/dist-lib/numbl-core/runtime/plotUtils.d.ts +0 -336
- package/dist-lib/numbl-core/runtime/specialBuiltinNames.d.ts +0 -2
- package/dist-plot-viewer/assets/index-YeXWXIxH.js +0 -4504
- package/dist-site-viewer/assets/index-B5Y5557F.js +0 -4831
- package/dist-site-viewer/assets/numbl-worker-CtoT7C0f.js +0 -5355
- package/native/elemwise.cpp +0 -360
- package/native/unary_elemwise.cpp +0 -67
- /package/dist-browser/{graphics → numbl-core/plotting}/figuresReducer.d.ts +0 -0
- /package/dist-graphics/{graphics → numbl-core/plotting}/figuresReducer.d.ts +0 -0
- /package/dist-lib/{graphics → numbl-core/plotting}/figuresReducer.d.ts +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Builtin registry — the contract every
|
|
3
|
-
* user `.mtoc2.js` function) implements.
|
|
2
|
+
* Builtin registry — the contract every JIT builtin implements.
|
|
4
3
|
*
|
|
5
|
-
* Each builtin can supply
|
|
4
|
+
* Each builtin can supply two mirrored codegen hooks plus the
|
|
6
5
|
* always-required `transfer`:
|
|
7
6
|
*
|
|
8
7
|
* transfer(argTypes, nargout) — required. Given input types and
|
|
@@ -32,15 +31,9 @@
|
|
|
32
31
|
* outputs land in these locals via the framework's destructuring
|
|
33
32
|
* wrapper. Activates JS-side runtime snippets via `useRuntime`.
|
|
34
33
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* mirrors the emit hooks' shape so dispatch on `argTypes` /
|
|
39
|
-
* `nargout` stays parallel across all three.
|
|
40
|
-
*
|
|
41
|
-
* elementwise? — when true, every defined emit hook (and `call`)
|
|
42
|
-
* must also produce a correct scalar output when called with
|
|
43
|
-
* scalar argTypes and scalar argsC/argsJs/args. The framework
|
|
34
|
+
* elementwise? — when true, every defined emit hook must also
|
|
35
|
+
* produce a correct scalar output when called with
|
|
36
|
+
* scalar argTypes and scalar argsC/argsJs. The framework
|
|
44
37
|
* uses this for same-shape tensor fusion (and, later, broadcast
|
|
45
38
|
* / reduction-inner / mask / stencil fusion). Absence = "do not
|
|
46
39
|
* fuse me; use the regular emit on the full tensor types."
|
|
@@ -50,8 +43,6 @@
|
|
|
50
43
|
* computes the maximum compatible backend per call site.
|
|
51
44
|
*/
|
|
52
45
|
import type { Type } from "../lowering/types.js";
|
|
53
|
-
import type { RuntimeValue } from "../runtime/value.js";
|
|
54
|
-
import type { RuntimeContext } from "../runtime/context.js";
|
|
55
46
|
/** Common across every hook — the type-level call descriptor. */
|
|
56
47
|
interface CommonArgs {
|
|
57
48
|
/** Per-arg type (after lowering / inference). */
|
|
@@ -71,7 +62,7 @@ export interface EmitCArgs extends CommonArgs {
|
|
|
71
62
|
outArgsC?: string[];
|
|
72
63
|
/** Activate a runtime C snippet on the current translation unit.
|
|
73
64
|
* See `runtime.ts` for the registry and `InlineSnippet` for the
|
|
74
|
-
*
|
|
65
|
+
* inline form. */
|
|
75
66
|
useRuntime(spec: string | InlineSnippet): void;
|
|
76
67
|
}
|
|
77
68
|
export interface EmitJsArgs extends CommonArgs {
|
|
@@ -90,14 +81,6 @@ export interface EmitJsArgs extends CommonArgs {
|
|
|
90
81
|
* (with a `jsCode` body) defines a one-off helper from a builtin. */
|
|
91
82
|
useRuntime(spec: string | InlineSnippet): void;
|
|
92
83
|
}
|
|
93
|
-
export interface CallArgs extends CommonArgs {
|
|
94
|
-
/** Per-arg runtime values, evaluated by the interpreter at the
|
|
95
|
-
* call site. */
|
|
96
|
-
args: RuntimeValue[];
|
|
97
|
-
/** Host bag — `helpers.write` for stdout, future hooks for plot /
|
|
98
|
-
* error / time. */
|
|
99
|
-
ctx: RuntimeContext;
|
|
100
|
-
}
|
|
101
84
|
export interface Builtin {
|
|
102
85
|
/** Source-level name (registry key). */
|
|
103
86
|
name: string;
|
|
@@ -109,13 +92,18 @@ export interface Builtin {
|
|
|
109
92
|
emitC?(args: EmitCArgs): string;
|
|
110
93
|
/** Optional: JS codegen. */
|
|
111
94
|
emitJs?(args: EmitJsArgs): string;
|
|
112
|
-
/** Optional: direct JS function — interpreter / JIT bailout. */
|
|
113
|
-
call?(args: CallArgs): RuntimeValue[];
|
|
114
95
|
/** Elementwise = result is computed pointwise. */
|
|
115
96
|
elementwise?: boolean;
|
|
97
|
+
/** Optional: elementwise for these argument types only, for a builtin
|
|
98
|
+
* whose forms differ by arity (two-argument `max(a, b)` is pointwise,
|
|
99
|
+
* one-argument `max(a)` is a reduction). Consulted when `elementwise`
|
|
100
|
+
* is not set. */
|
|
101
|
+
isElementwiseCall?(argTypes: Type[]): boolean;
|
|
116
102
|
}
|
|
117
|
-
/**
|
|
118
|
-
|
|
103
|
+
/** Whether a call of `b` with these argument types is computed pointwise. */
|
|
104
|
+
export declare function isElementwiseCall(b: Builtin, argTypes: Type[]): boolean;
|
|
105
|
+
/** Inline-defined runtime snippet supplied by an emitter via
|
|
106
|
+
* `useRuntime({...})`. Re-exported from `runtime.ts` — kept
|
|
119
107
|
* here for doc-locality with the `Builtin` contract. */
|
|
120
108
|
export interface InlineSnippet {
|
|
121
109
|
name: string;
|
|
@@ -130,9 +118,6 @@ export declare function registerBuiltin(b: Builtin): void;
|
|
|
130
118
|
export declare function getBuiltin(name: string): Builtin | undefined;
|
|
131
119
|
/** Names of every registered builtin. Drives Monaco syntax highlighting. */
|
|
132
120
|
export declare function allBuiltinNames(): readonly string[];
|
|
133
|
-
export type Backend = "c" | "js" | "interpreter";
|
|
134
|
-
export declare function builtinSupports(b: Builtin, backend: Backend): boolean;
|
|
135
121
|
export declare function requireEmitC(b: Builtin): (args: EmitCArgs) => string;
|
|
136
122
|
export declare function requireEmitJs(b: Builtin): (args: EmitJsArgs) => string;
|
|
137
|
-
export declare function requireCall(b: Builtin): (args: CallArgs) => RuntimeValue[];
|
|
138
123
|
export {};
|
package/dist-browser/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts
CHANGED
|
@@ -13,77 +13,97 @@ export function mtoc2_tensor_atan2_st(s: any, a: any): {
|
|
|
13
13
|
shape: any;
|
|
14
14
|
data: any;
|
|
15
15
|
};
|
|
16
|
-
export function
|
|
16
|
+
export function mtoc2_tensor_hypot_tt(a: any, b: any): {
|
|
17
17
|
mtoc2Tag: string;
|
|
18
18
|
shape: any;
|
|
19
19
|
data: any;
|
|
20
20
|
};
|
|
21
|
-
export function
|
|
21
|
+
export function mtoc2_tensor_hypot_ts(a: any, s: any): {
|
|
22
22
|
mtoc2Tag: string;
|
|
23
23
|
shape: any;
|
|
24
24
|
data: any;
|
|
25
25
|
};
|
|
26
|
-
export function
|
|
26
|
+
export function mtoc2_tensor_power_tt(a: any, b: any): {
|
|
27
27
|
mtoc2Tag: string;
|
|
28
28
|
shape: any;
|
|
29
29
|
data: any;
|
|
30
30
|
};
|
|
31
|
-
export function
|
|
31
|
+
export function mtoc2_tensor_power_ts(a: any, s: any): {
|
|
32
32
|
mtoc2Tag: string;
|
|
33
33
|
shape: any;
|
|
34
34
|
data: any;
|
|
35
35
|
};
|
|
36
|
-
export function
|
|
36
|
+
export function mtoc2_tensor_power_st(s: any, a: any): {
|
|
37
37
|
mtoc2Tag: string;
|
|
38
38
|
shape: any;
|
|
39
39
|
data: any;
|
|
40
40
|
};
|
|
41
|
-
export function
|
|
41
|
+
export function mtoc2_tensor_rem_tt(a: any, b: any): {
|
|
42
42
|
mtoc2Tag: string;
|
|
43
43
|
shape: any;
|
|
44
44
|
data: any;
|
|
45
45
|
};
|
|
46
|
-
export function
|
|
46
|
+
export function mtoc2_tensor_rem_ts(a: any, s: any): {
|
|
47
47
|
mtoc2Tag: string;
|
|
48
48
|
shape: any;
|
|
49
49
|
data: any;
|
|
50
50
|
};
|
|
51
|
-
export function
|
|
51
|
+
export function mtoc2_tensor_rem_st(s: any, a: any): {
|
|
52
52
|
mtoc2Tag: string;
|
|
53
53
|
shape: any;
|
|
54
54
|
data: any;
|
|
55
55
|
};
|
|
56
|
-
export function
|
|
56
|
+
export function mtoc2_tensor_mod_tt(a: any, b: any): {
|
|
57
57
|
mtoc2Tag: string;
|
|
58
58
|
shape: any;
|
|
59
59
|
data: any;
|
|
60
60
|
};
|
|
61
|
-
export function
|
|
61
|
+
export function mtoc2_tensor_mod_ts(a: any, s: any): {
|
|
62
62
|
mtoc2Tag: string;
|
|
63
63
|
shape: any;
|
|
64
64
|
data: any;
|
|
65
65
|
};
|
|
66
|
-
export function
|
|
66
|
+
export function mtoc2_tensor_mod_st(s: any, a: any): {
|
|
67
67
|
mtoc2Tag: string;
|
|
68
68
|
shape: any;
|
|
69
69
|
data: any;
|
|
70
70
|
};
|
|
71
|
-
export function
|
|
71
|
+
export function mtoc2_tensor_max_tt(a: any, b: any): {
|
|
72
72
|
mtoc2Tag: string;
|
|
73
73
|
shape: any;
|
|
74
74
|
data: any;
|
|
75
75
|
};
|
|
76
|
-
export function
|
|
76
|
+
export function mtoc2_tensor_max_ts(a: any, s: any): {
|
|
77
77
|
mtoc2Tag: string;
|
|
78
78
|
shape: any;
|
|
79
79
|
data: any;
|
|
80
80
|
};
|
|
81
|
-
export function
|
|
81
|
+
export function mtoc2_tensor_min_tt(a: any, b: any): {
|
|
82
82
|
mtoc2Tag: string;
|
|
83
83
|
shape: any;
|
|
84
84
|
data: any;
|
|
85
85
|
};
|
|
86
|
-
export function
|
|
86
|
+
export function mtoc2_tensor_min_ts(a: any, s: any): {
|
|
87
|
+
mtoc2Tag: string;
|
|
88
|
+
shape: any;
|
|
89
|
+
data: any;
|
|
90
|
+
};
|
|
91
|
+
export function mtoc2_tensor_atan2_bcast_tt(a: any, b: any): {
|
|
92
|
+
mtoc2Tag: string;
|
|
93
|
+
shape: any;
|
|
94
|
+
data: any;
|
|
95
|
+
};
|
|
96
|
+
export function mtoc2_tensor_hypot_bcast_tt(a: any, b: any): {
|
|
97
|
+
mtoc2Tag: string;
|
|
98
|
+
shape: any;
|
|
99
|
+
data: any;
|
|
100
|
+
};
|
|
101
|
+
export function mtoc2_tensor_power_bcast_tt(a: any, b: any): {
|
|
102
|
+
mtoc2Tag: string;
|
|
103
|
+
shape: any;
|
|
104
|
+
data: any;
|
|
105
|
+
};
|
|
106
|
+
export function mtoc2_tensor_rem_bcast_tt(a: any, b: any): {
|
|
87
107
|
mtoc2Tag: string;
|
|
88
108
|
shape: any;
|
|
89
109
|
data: any;
|
|
@@ -93,3 +113,13 @@ export function mtoc2_tensor_mod_bcast_tt(a: any, b: any): {
|
|
|
93
113
|
shape: any;
|
|
94
114
|
data: any;
|
|
95
115
|
};
|
|
116
|
+
export function mtoc2_tensor_max_bcast_tt(a: any, b: any): {
|
|
117
|
+
mtoc2Tag: string;
|
|
118
|
+
shape: any;
|
|
119
|
+
data: any;
|
|
120
|
+
};
|
|
121
|
+
export function mtoc2_tensor_min_bcast_tt(a: any, b: any): {
|
|
122
|
+
mtoc2Tag: string;
|
|
123
|
+
shape: any;
|
|
124
|
+
data: any;
|
|
125
|
+
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
export function mtoc2_sum_all(t: any):
|
|
1
|
+
export function mtoc2_sum_all(t: any): number;
|
|
2
2
|
export function mtoc2_sum_dim(t: any, d: any): {
|
|
3
3
|
mtoc2Tag: string;
|
|
4
4
|
shape: any;
|
|
5
5
|
data: any;
|
|
6
6
|
};
|
|
7
|
-
export function mtoc2_prod_all(t: any):
|
|
7
|
+
export function mtoc2_prod_all(t: any): number;
|
|
8
8
|
export function mtoc2_prod_dim(t: any, d: any): {
|
|
9
9
|
mtoc2Tag: string;
|
|
10
10
|
shape: any;
|
|
11
11
|
data: any;
|
|
12
12
|
};
|
|
13
|
-
export function mtoc2_mean_all(t: any):
|
|
13
|
+
export function mtoc2_mean_all(t: any): number;
|
|
14
14
|
export function mtoc2_mean_dim(t: any, d: any): {
|
|
15
15
|
mtoc2Tag: string;
|
|
16
16
|
shape: any;
|
|
17
17
|
data: any;
|
|
18
18
|
};
|
|
19
|
-
export function mtoc2_min_all(t: any):
|
|
19
|
+
export function mtoc2_min_all(t: any): any;
|
|
20
20
|
export function mtoc2_min_dim(t: any, d: any): {
|
|
21
21
|
mtoc2Tag: string;
|
|
22
22
|
shape: any;
|
|
23
23
|
data: any;
|
|
24
24
|
};
|
|
25
|
-
export function mtoc2_max_all(t: any):
|
|
25
|
+
export function mtoc2_max_all(t: any): any;
|
|
26
26
|
export function mtoc2_max_dim(t: any, d: any): {
|
|
27
27
|
mtoc2Tag: string;
|
|
28
28
|
shape: any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export function mtoc2_realsqrt(x: any): number;
|
|
1
2
|
export function mtoc2_tensor_cos(a: any): {
|
|
2
3
|
mtoc2Tag: string;
|
|
3
4
|
shape: any;
|
|
@@ -63,6 +64,11 @@ export function mtoc2_tensor_sqrt(a: any): {
|
|
|
63
64
|
shape: any;
|
|
64
65
|
data: any;
|
|
65
66
|
};
|
|
67
|
+
export function mtoc2_tensor_realsqrt(a: any): {
|
|
68
|
+
mtoc2Tag: string;
|
|
69
|
+
shape: any;
|
|
70
|
+
data: any;
|
|
71
|
+
};
|
|
66
72
|
export function mtoc2_tensor_abs(a: any): {
|
|
67
73
|
mtoc2Tag: string;
|
|
68
74
|
shape: any;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Single-file C codegen for
|
|
2
|
+
* Single-file C codegen for JIT IR. Emits a shared-library module:
|
|
3
3
|
* 1. Standard headers + activated runtime snippets (in dep order).
|
|
4
4
|
* 2. Forward declarations for user-function specializations.
|
|
5
|
-
* 3. Function specialization bodies
|
|
6
|
-
*
|
|
5
|
+
* 3. Function specialization bodies; the entry spec gets extern
|
|
6
|
+
* linkage so the host can `dlsym` it.
|
|
7
7
|
*
|
|
8
8
|
* Scalars compile to bare `double`. Multi-element tensors compile to
|
|
9
9
|
* `mtoc2_tensor_t` — no refcount, no COW. The codegen invariant
|
|
@@ -14,39 +14,18 @@
|
|
|
14
14
|
* later distinction uniform (the assign helper releases the prior
|
|
15
15
|
* buffer, which is NULL on first call). Scope-exit emits a
|
|
16
16
|
* `mtoc2_tensor_free` for every owned local.
|
|
17
|
-
*
|
|
18
|
-
* `includeRuntime` (default true): when false, the activated runtime
|
|
19
|
-
* helpers are omitted from the output (a placeholder comment is shown
|
|
20
|
-
* instead) so the IDE's "runtime helpers" toggle can show user-level
|
|
21
|
-
* code in isolation. The emitted C is not compilable in that mode —
|
|
22
|
-
* it's a viewing aid.
|
|
23
17
|
*/
|
|
24
18
|
import type { IRProgram } from "../lowering/ir.js";
|
|
25
19
|
import { type Type } from "../lowering/types.js";
|
|
26
20
|
import { type RuntimeState } from "./runtime.js";
|
|
27
21
|
export interface EmitOptions {
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
threads?: number | "auto";
|
|
34
|
-
/** Workspace context. Threaded through `RuntimeState` so emit-time
|
|
35
|
-
* builtin lookups consult `.mtoc2.js` user builtins via
|
|
36
|
-
* `getUserBuiltin`. Optional — vitest unit tests that don't drive
|
|
37
|
-
* through a workspace can omit it. */
|
|
38
|
-
workspace?: import("./runtime.js").WorkspaceLike;
|
|
39
|
-
/** JIT-mode emit. When set, the cName of a single user-function spec
|
|
40
|
-
* to expose at module scope (no `static` qualifier so `dlsym` /
|
|
41
|
-
* koffi can resolve it after `dlopen`). Disables the `int main()`
|
|
42
|
-
* emission — the module becomes a `.so` consumers load and call
|
|
43
|
-
* into directly. Requires `prog.topLevelStmts` to be empty and
|
|
44
|
-
* `prog.functions` to contain the named spec; every spec
|
|
45
|
-
* transitively called by the entry must also be in
|
|
46
|
-
* `prog.functions` so internal calls resolve. */
|
|
47
|
-
exposeSpec?: string;
|
|
22
|
+
/** cName of the entry spec to expose at module scope (no `static`
|
|
23
|
+
* qualifier so `dlsym` / koffi can resolve it after `dlopen`).
|
|
24
|
+
* `prog.functions` must contain it and every spec it transitively
|
|
25
|
+
* calls. */
|
|
26
|
+
exposeSpec: string;
|
|
48
27
|
}
|
|
49
|
-
export declare function emitProgram(prog: IRProgram, opts
|
|
28
|
+
export declare function emitProgram(prog: IRProgram, opts: EmitOptions): string;
|
|
50
29
|
export declare function activateOwnedRuntime(t: Type, state: RuntimeState): void;
|
|
51
30
|
/** Activate the runtime snippets needed for an owned type AND return
|
|
52
31
|
* its OwnedHelpers descriptor. Shorthand for the
|
|
@@ -22,43 +22,25 @@
|
|
|
22
22
|
* <inlined runtime snippet bodies>
|
|
23
23
|
* function <user-fn-spec-1>(...) { ... }
|
|
24
24
|
* function <user-fn-spec-2>(...) { ... }
|
|
25
|
-
* function
|
|
26
|
-
* globalThis.$write = $h.write;
|
|
27
|
-
* let v1, v2, ...; // pre-declared locals
|
|
28
|
-
* ... top-level stmts ...
|
|
29
|
-
* }
|
|
30
|
-
* return run;
|
|
25
|
+
* return function ($h) { globalThis.$write = $h.write; ...; return <entry-spec>; };
|
|
31
26
|
* ```
|
|
32
27
|
*
|
|
33
|
-
* The
|
|
34
|
-
*
|
|
28
|
+
* The host evals the source via `new Function(source)()`, then calls
|
|
29
|
+
* the returned factory with its helper hooks to get the entry spec.
|
|
35
30
|
*/
|
|
36
31
|
import type { IRProgram } from "../lowering/ir.js";
|
|
37
|
-
import { type WorkspaceLike } from "./runtime.js";
|
|
38
32
|
export interface EmitJsOptions {
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* the emitted module. Default true. When false the placeholder
|
|
44
|
-
* comment lands instead — useful for the IDE preview. */
|
|
45
|
-
includeRuntime?: boolean;
|
|
46
|
-
/** JIT-mode emit. When set, the cName of a single user-function spec
|
|
47
|
-
* to expose: the outer module returns a `($h) => specFn` factory
|
|
48
|
-
* instead of the script-style `function run($h)` wrapper. Requires
|
|
49
|
-
* `prog.topLevelStmts` to be empty and `prog.functions` to contain
|
|
50
|
-
* the named spec (which must be reachable along with any specs it
|
|
51
|
-
* transitively calls). Used by the numbl JIT bridge. */
|
|
52
|
-
exposeSpec?: string;
|
|
33
|
+
/** cName of the entry spec the module's factory returns.
|
|
34
|
+
* `prog.functions` must contain it and every spec it transitively
|
|
35
|
+
* calls. */
|
|
36
|
+
exposeSpec: string;
|
|
53
37
|
}
|
|
54
38
|
export interface EmitJsResult {
|
|
55
39
|
/** Full module source — runtime snippets, user-function defs, and
|
|
56
|
-
*
|
|
57
|
-
* `return ($h) => specFn;` (when `opts.exposeSpec` is set). Ready
|
|
58
|
-
* for `new Function(...)`. */
|
|
40
|
+
* `return ($h) => specFn;`. Ready for `new Function(...)`. */
|
|
59
41
|
source: string;
|
|
60
42
|
/** Names of every runtime snippet activated during emit (debug aid;
|
|
61
43
|
* also useful to gate dependency wiring in tests). */
|
|
62
44
|
activatedSnippets: ReadonlyArray<string>;
|
|
63
45
|
}
|
|
64
|
-
export declare function emitJsProgram(prog: IRProgram, opts
|
|
46
|
+
export declare function emitJsProgram(prog: IRProgram, opts: EmitJsOptions): EmitJsResult;
|
|
@@ -11,47 +11,23 @@ import type { IRExpr, IRFunc, IRStmt } from "../lowering/ir.js";
|
|
|
11
11
|
import { type Type } from "../lowering/types.js";
|
|
12
12
|
import { type RuntimeState } from "./runtime.js";
|
|
13
13
|
import { type FutureTouchMap } from "./liveness.js";
|
|
14
|
-
/** Default initializer for a freshly-declared non-owned local. Owned
|
|
15
|
-
* types (tensors, structs, classes, handles) route through their
|
|
16
|
-
* `_empty()` helper instead and never hit this path; everything
|
|
17
|
-
* reaching here is scalar real numeric, so `0.0` always fits. */
|
|
18
|
-
export declare function defaultInitFor(): string;
|
|
19
14
|
export declare function fnRetType(fn: IRFunc): string;
|
|
20
15
|
export declare function fnParamList(fn: IRFunc): string;
|
|
21
|
-
/** Walk `stmts` once and split the result into owned vs non-owned
|
|
22
|
-
* locals. Every local is pre-declared at function top — owned with
|
|
23
|
-
* the per-type `_empty()` helper, scalars with the default init
|
|
24
|
-
* (`0.0` / `0`). The non-owned half also picks up For loop vars and
|
|
25
|
-
* multi-assign slot bindings so that a later read of a variable
|
|
26
|
-
* first written inside an If / While / For body (reachable via
|
|
27
|
-
* `mergeBranchEnvs` keeping partial-branch keys) doesn't reference
|
|
28
|
-
* an out-of-scope C local. */
|
|
29
|
-
export declare function collectLocals(stmts: IRStmt[]): {
|
|
30
|
-
owned: {
|
|
31
|
-
cName: string;
|
|
32
|
-
ty: Type;
|
|
33
|
-
}[];
|
|
34
|
-
scalars: {
|
|
35
|
-
cName: string;
|
|
36
|
-
ty: Type;
|
|
37
|
-
}[];
|
|
38
|
-
};
|
|
39
16
|
/** Emits the function/scope's exit cleanup + return statements at a
|
|
40
17
|
* given indent. Called from two places: at every `ReturnFromFunction`
|
|
41
18
|
* site (inline cleanup — no goto), and at the fall-through bottom of
|
|
42
19
|
* the function. Single source of truth so the two callers can't
|
|
43
20
|
* drift on which locals get freed in what order.
|
|
44
21
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
22
|
+
* Inlined rather than goto-to-a-shared-tail, which keeps the C emit
|
|
23
|
+
* parallel to the JS one. Inlining produces some duplication when a
|
|
24
|
+
* function has many early returns and many owned locals, but typical
|
|
25
|
+
* functions are small and the C compiler dedupes-by-tail-merge
|
|
26
|
+
* anyway. */
|
|
27
|
+
type EmitReturnTail = (indent: string) => string;
|
|
51
28
|
export declare function emitFunction(fn: IRFunc, state: RuntimeState,
|
|
52
29
|
/** Storage-class qualifier on the function definition. Default is
|
|
53
|
-
* `static` (file-scope
|
|
54
|
-
* `""` to omit the qualifier — the function then gets external
|
|
30
|
+
* `static` (file-scope). Pass `""` to omit the qualifier — the function then gets external
|
|
55
31
|
* linkage so a JIT host can resolve it via `dlsym` / koffi after
|
|
56
32
|
* `dlopen`'ing the compiled `.so`. */
|
|
57
33
|
storageClass?: "static" | ""): string;
|
|
@@ -74,3 +50,4 @@ export declare function cellLinearOffsetExpr(indices: ReadonlyArray<IRExpr>, bas
|
|
|
74
50
|
export declare function tryStaticCellOffset(indices: ReadonlyArray<IRExpr>, baseTy: Extract<Type, {
|
|
75
51
|
kind: "Cell";
|
|
76
52
|
}>): number | null;
|
|
53
|
+
export {};
|
|
@@ -23,15 +23,16 @@
|
|
|
23
23
|
* For a single-Binary RHS this is equivalent (post-`-O3`) to the
|
|
24
24
|
* existing `mtoc2_tensor_assign(&c, mtoc2_tensor_plus_tt(a, b))`
|
|
25
25
|
* path — the helper's body is literally the same loop. The point of
|
|
26
|
-
* doing the inlining at the IR level is that
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* doing the inlining at the IR level is that an IR-to-IR pass
|
|
27
|
+
* (`inlinePass.ts`, run by `compileSpecC` before emit)
|
|
28
|
+
* can fold a chain like `_t1 = a * b; c = _t1 + d` into
|
|
29
|
+
* `c = (a * b) + d`, which the fused emitter then renders as one loop
|
|
30
|
+
* with no intermediate tensor allocation.
|
|
30
31
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* (`mtoc2_tensor_<op>_bcast_tt(...)`).
|
|
32
|
+
* Only the *same-static-shape* case is handled. If any multi-element
|
|
33
|
+
* operand has a statically-different shape from the target, the
|
|
34
|
+
* Assign falls back to the runtime-helper path
|
|
35
|
+
* (`mtoc2_tensor_<op>_bcast_tt(...)`).
|
|
35
36
|
*/
|
|
36
37
|
import type { Assign, IRExpr } from "../lowering/ir.js";
|
|
37
38
|
import { type RuntimeState } from "./runtime.js";
|
|
@@ -72,6 +73,6 @@ export declare function fusedAssignNeedsShapeGuard(s: Assign): boolean;
|
|
|
72
73
|
* operand must match the shape source's runtime shape, else the assign
|
|
73
74
|
* defers to `fallbackStmt` — the bcast-aware helper path, which
|
|
74
75
|
* broadcasts compatible shapes and raises "Matrix dimensions must
|
|
75
|
-
* agree" on incompatible ones. Mirrors the JS `
|
|
76
|
+
* agree" on incompatible ones. Mirrors the JS `_tt` helpers deferring to
|
|
76
77
|
* `bcast_kernel`. */
|
|
77
78
|
export declare function emitTensorAssignFused(s: Assign, indent: string, state: RuntimeState, fallbackStmt?: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* producer Assign's RHS into its consumer's RHS and
|
|
2
|
+
* IR-to-IR rewrite for the C backend: substitutes a single-use
|
|
3
|
+
* producer Assign's RHS into its consumer's RHS and drops the
|
|
4
4
|
* producer.
|
|
5
5
|
*
|
|
6
6
|
* After ANF normalization every owned-producing tensor expression
|
|
@@ -13,54 +13,45 @@
|
|
|
13
13
|
* r2 = _t10 + 0.01
|
|
14
14
|
*
|
|
15
15
|
* emits four separate fused loops with three intermediate allocs.
|
|
16
|
-
* After inlining
|
|
16
|
+
* After inlining, the chain collapses to
|
|
17
17
|
*
|
|
18
18
|
* r2 = (rx .^ 2 + ry .^ 2 + 0.01)
|
|
19
19
|
*
|
|
20
20
|
* which the elementwise-fused emitter (`emitTensorFused.ts`) renders
|
|
21
|
-
* as a single
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* Preserves: post-inlining the IR is still well-typed (each node's
|
|
54
|
-
* `.ty` is unchanged — the substitution copies the producer's RHS
|
|
55
|
-
* subtree verbatim); the ANF invariant for owned producers still
|
|
56
|
-
* holds because we only inline producers whose RHS is NOT itself
|
|
57
|
-
* an owned producer (no TensorBuild / Call-to-direct-owned-builtin
|
|
58
|
-
* / etc.); and the `isFusableAssign` predicate that gates the
|
|
59
|
-
* emit-path routing still accepts the consumer after substitution
|
|
60
|
-
* (shape checks compose under inlining — see the design notes in
|
|
61
|
-
* `emitTensorFused.ts`).
|
|
21
|
+
* as a single loop.
|
|
22
|
+
*
|
|
23
|
+
* Gates (all must hold to inline producer P into consumer C):
|
|
24
|
+
*
|
|
25
|
+
* 1. P is a fusable Assign (`isFusableAssign`): real multi-element
|
|
26
|
+
* tensor target, pure-elementwise RHS, operand shapes matching
|
|
27
|
+
* the target.
|
|
28
|
+
* 2. P's LHS cName is read exactly once in the whole function
|
|
29
|
+
* (nested bodies included). Function outputs get a +1 bump so
|
|
30
|
+
* they are never dropped. Counting function-wide, not per body,
|
|
31
|
+
* is what makes inlining inside loop / if bodies safe: a
|
|
32
|
+
* body-local count misses reads after the loop.
|
|
33
|
+
* 3. C is the first statement after P in the same body that reads
|
|
34
|
+
* P's LHS, and it is an Assign. Statements in between must not
|
|
35
|
+
* write P's LHS or any Var P's RHS reads, and must not be
|
|
36
|
+
* control flow. C itself may write such a Var: an Assign
|
|
37
|
+
* evaluates its whole RHS before storing.
|
|
38
|
+
* 4. The read in C is in a slot position (Binary / Unary / Call
|
|
39
|
+
* operand), and C is still fusable after substitution. The
|
|
40
|
+
* latter is an ownership rule: a non-fused consumer would get a
|
|
41
|
+
* nested owned operand that nothing frees.
|
|
42
|
+
*
|
|
43
|
+
* Use counts are stable under substitution (a single-use producer's
|
|
44
|
+
* reads move into its consumer; none is duplicated or dropped), so
|
|
45
|
+
* one forward sweep per body suffices: a consumer rewritten at index
|
|
46
|
+
* j is itself considered as a producer when the sweep reaches j,
|
|
47
|
+
* which collapses chains of any depth.
|
|
48
|
+
*
|
|
49
|
+
* The pass never mutates its input. The Lowerer's specialization
|
|
50
|
+
* cache is shared by the JS and C backends, so changed functions and
|
|
51
|
+
* statements are fresh objects; untouched ones are shared.
|
|
62
52
|
*/
|
|
63
|
-
import type { IRProgram } from "../lowering/ir.js";
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
import type { IRFunc, IRProgram } from "../lowering/ir.js";
|
|
54
|
+
/** Returns a new program with every function inlined. */
|
|
55
|
+
export declare function inlinePass(prog: IRProgram): IRProgram;
|
|
56
|
+
/** Returns `fn` itself when nothing was inlined. */
|
|
57
|
+
export declare function inlineFunc(fn: IRFunc): IRFunc;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* are visible). It IS a faithful render of what the IR actually says
|
|
10
10
|
* after lowering — useful when debugging the translator.
|
|
11
11
|
*/
|
|
12
|
-
import type { IRStmt, IRFunc
|
|
12
|
+
import type { IRStmt, IRFunc } from "../lowering/ir.js";
|
|
13
13
|
/** One-line summary of a statement (no trailing newline). Returns null
|
|
14
14
|
* for stmts the emitter handles structurally (compound-block bodies
|
|
15
15
|
* get their own per-stmt comments inside). */
|
|
@@ -17,8 +17,3 @@ export declare function irStmtHeader(s: IRStmt): string | null;
|
|
|
17
17
|
/** Multi-line C block comment for a function specialization, listing
|
|
18
18
|
* name, mangled C identifier, per-parameter types, and output types. */
|
|
19
19
|
export declare function irFuncDocComment(fn: IRFunc): string;
|
|
20
|
-
/** Render the whole lowered IR as a numbl-like script with one block
|
|
21
|
-
* per function specialization plus a trailing top-level body. Used by
|
|
22
|
-
* the IDE's Internals tab in interpreter mode, where no codegen
|
|
23
|
-
* artifact exists. */
|
|
24
|
-
export declare function prettyIRProgram(prog: IRProgram): string;
|