numbl 0.3.3 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +6 -5
- package/dist-cli/cli.js +63077 -42047
- package/dist-lib/graphics/types.d.ts +40 -1
- package/dist-lib/lib.d.ts +0 -1
- package/dist-lib/lib.js +78446 -57671
- package/dist-lib/numbl-core/executeCode.d.ts +10 -12
- package/dist-lib/numbl-core/executors/classification.d.ts +134 -0
- package/dist-lib/numbl-core/executors/handleInline.d.ts +42 -0
- package/dist-lib/numbl-core/executors/index.d.ts +0 -3
- package/dist-lib/numbl-core/executors/jit/cJitCallExecutor.d.ts +35 -0
- package/dist-lib/numbl-core/executors/jit/cJitLoopExecutor.d.ts +31 -0
- package/dist-lib/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +29 -0
- package/dist-lib/numbl-core/executors/jit/callExecutor.d.ts +45 -0
- package/dist-lib/numbl-core/executors/jit/compileC.d.ts +51 -0
- package/dist-lib/numbl-core/executors/jit/compileC.node.d.ts +25 -0
- package/dist-lib/numbl-core/executors/jit/hostHelpers.d.ts +27 -0
- package/dist-lib/numbl-core/executors/jit/loopExecutor.d.ts +41 -0
- package/dist-lib/numbl-core/executors/jit/session.d.ts +17 -0
- package/dist-lib/numbl-core/executors/jit/topLevelExecutor.d.ts +36 -0
- package/dist-lib/numbl-core/executors/jit/typeAdapter.d.ts +28 -0
- package/dist-lib/numbl-core/executors/jit/typeAdapterC.d.ts +73 -0
- package/dist-lib/numbl-core/executors/jit/valueAdapter.d.ts +48 -0
- package/dist-lib/numbl-core/executors/jit/valueAdapterC.d.ts +108 -0
- package/dist-lib/numbl-core/executors/lowering.d.ts +31 -77
- package/dist-lib/numbl-core/executors/plugins.d.ts +14 -21
- package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +4 -1
- package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +1 -1
- package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +0 -18
- package/dist-lib/numbl-core/interpreter/interpreter.d.ts +37 -21
- package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +6 -0
- package/dist-lib/numbl-core/interpreter/interpreterFunctions.d.ts +13 -1
- package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +1 -1
- package/dist-lib/numbl-core/jit/builtins/defs/_shared.d.ts +43 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +123 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/minus.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mpower.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mrdivide.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mtimes.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/plus.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/power.d.ts +30 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/rdivide.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/times.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/uminus.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/_compare.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/eq.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/ge.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/gt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/le.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/lt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/ne.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/diag/assert.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/_format_args.d.ts +17 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/disp.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/error.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/fprintf.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/sprintf.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/warning.d.ts +15 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/_shortcircuit.d.ts +30 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +30 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/and.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/andand.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/boolconst.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/classBuiltin.d.ts +21 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +15 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isa.d.ts +13 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/iscell.d.ts +8 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isempty.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isequal.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isfield.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isinf.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isnan.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isnumeric.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isreal.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isscalar.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isstruct.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/logical.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/not.d.ts +15 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/or.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/oror.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +21 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/typequery.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/xor.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/_complex_fold.d.ts +34 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +51 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/abs.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/angle.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/asinh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/atan.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/atan2.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/besselh.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/ceil.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/conj.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/constants.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/cos.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/cosh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/dot.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/double.d.ts +28 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/exp.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/fix.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/floor.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/hypot.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/imag.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/linspace.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/log.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/log10.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/log2.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/logspace.d.ts +8 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/mod.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/norm.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/real.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/rem.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/round.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sign.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sin.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sinh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sqrt.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/tan.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/tanh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/uniquetol.d.ts +22 -0
- package/dist-lib/numbl-core/jit/builtins/defs/plot/dispatch.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/_cumulative.d.ts +49 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +126 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/_variance.d.ts +17 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/all.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/any.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummax.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummin.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumprod.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumsum.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/diff.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/length.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/max.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/mean.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/min.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/numel.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/prod.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/std.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/sum.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/var.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/_construct.d.ts +67 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +34 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/cat.d.ts +33 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/diag.d.ts +29 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/eye.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/flip.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/meshgrid.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/ones.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/repmat.d.ts +37 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/reshape.d.ts +39 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/size.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/sort.d.ts +19 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/transpose.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/tril.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/triu.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/zeros.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/deal.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/feval.d.ts +36 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/pathBuiltins.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/tic.d.ts +8 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/toc.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/index.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/registry.d.ts +138 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/cell/cell.d.ts +24 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/loop_count.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/range_value.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/scalar_index.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/tensor_make_range.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/assert_fmt.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_complex.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_double.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_struct.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor_complex.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/error_fmt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/format_complex.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/format_double.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/format_engine.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/fprintf.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/sprintf.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/warning_fmt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/plot/plot_dispatch.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/snippets.gen.d.ts +86 -0
- 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 +103 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/deep_clone.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/isequal.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/tictoc.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_copy_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cat.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cumulative.d.ts +32 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diag.d.ts +33 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diff.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_dot.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_complex.d.ts +90 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real.d.ts +75 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +95 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_eye.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_nd.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_square.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_flip.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_linspace.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logical_real.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logspace.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_meshgrid.d.ts +29 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_complex.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_real.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_norm.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_square.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_predicate.d.ts +42 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_complex.d.ts +53 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +42 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_repmat.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_size.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_sort_real.d.ts +36 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_triangular.d.ts +22 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_complex_math.d.ts +128 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +95 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_uniquetol.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_var.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_square.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/text/strcmp.d.ts +2 -0
- package/dist-lib/numbl-core/jit/codegen/cFormat.d.ts +36 -0
- package/dist-lib/numbl-core/jit/codegen/cHelpers.d.ts +48 -0
- package/dist-lib/numbl-core/jit/codegen/emit.d.ts +55 -0
- package/dist-lib/numbl-core/jit/codegen/emitCellTypedef.d.ts +23 -0
- package/dist-lib/numbl-core/jit/codegen/emitExpr.d.ts +33 -0
- package/dist-lib/numbl-core/jit/codegen/emitIndex.d.ts +56 -0
- package/dist-lib/numbl-core/jit/codegen/emitJs.d.ts +64 -0
- package/dist-lib/numbl-core/jit/codegen/emitNamedTypedef.d.ts +58 -0
- package/dist-lib/numbl-core/jit/codegen/emitStmt.d.ts +76 -0
- package/dist-lib/numbl-core/jit/codegen/emitTensorConcat.d.ts +23 -0
- package/dist-lib/numbl-core/jit/codegen/emitTensorConcatJs.d.ts +16 -0
- package/dist-lib/numbl-core/jit/codegen/emitTensorFused.d.ts +77 -0
- package/dist-lib/numbl-core/jit/codegen/inlinePass.d.ts +66 -0
- package/dist-lib/numbl-core/jit/codegen/liveness.d.ts +58 -0
- package/dist-lib/numbl-core/jit/codegen/prettyIR.d.ts +24 -0
- package/dist-lib/numbl-core/jit/codegen/runtime.d.ts +150 -0
- package/dist-lib/numbl-core/jit/compileSpec.d.ts +84 -0
- package/dist-lib/numbl-core/jit/compileSpecC.d.ts +93 -0
- package/dist-lib/numbl-core/jit/index.d.ts +15 -0
- package/dist-lib/numbl-core/jit/lowering/classDefs.d.ts +109 -0
- package/dist-lib/numbl-core/jit/lowering/errors.d.ts +35 -0
- package/dist-lib/numbl-core/jit/lowering/indexFold.d.ts +31 -0
- package/dist-lib/numbl-core/jit/lowering/indexResolve.d.ts +100 -0
- package/dist-lib/numbl-core/jit/lowering/ir.d.ts +584 -0
- package/dist-lib/numbl-core/jit/lowering/lower.d.ts +271 -0
- package/dist-lib/numbl-core/jit/lowering/lowerCellIndex.d.ts +41 -0
- package/dist-lib/numbl-core/jit/lowering/lowerCellLit.d.ts +19 -0
- package/dist-lib/numbl-core/jit/lowering/lowerClassConstructor.d.ts +55 -0
- package/dist-lib/numbl-core/jit/lowering/lowerFuncCall.d.ts +34 -0
- package/dist-lib/numbl-core/jit/lowering/lowerHandle.d.ts +57 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexLoad.d.ts +16 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexSlice.d.ts +29 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexSliceStore.d.ts +19 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexStore.d.ts +14 -0
- package/dist-lib/numbl-core/jit/lowering/lowerMethodCall.d.ts +45 -0
- package/dist-lib/numbl-core/jit/lowering/lowerMultiAssign.d.ts +36 -0
- package/dist-lib/numbl-core/jit/lowering/lowerTensorLit.d.ts +25 -0
- package/dist-lib/numbl-core/jit/lowering/rangeCount.d.ts +19 -0
- package/dist-lib/numbl-core/jit/lowering/specialize.d.ts +93 -0
- package/dist-lib/numbl-core/jit/lowering/types.d.ts +503 -0
- package/dist-lib/numbl-core/jit/lowering/walk.d.ts +17 -0
- package/dist-lib/numbl-core/jit/numbl/index.d.ts +30 -0
- package/dist-lib/numbl-core/jit/parser/astUtils.d.ts +43 -0
- package/dist-lib/numbl-core/jit/parser/index.d.ts +12 -0
- package/dist-lib/numbl-core/jit/parser/sourceLoc.d.ts +12 -0
- package/dist-lib/numbl-core/jit/runtime/context.d.ts +23 -0
- package/dist-lib/numbl-core/jit/runtime/inferType.d.ts +10 -0
- package/dist-lib/numbl-core/jit/runtime/value.d.ts +101 -0
- package/dist-lib/numbl-core/jit/workspace/driverPrologue.d.ts +59 -0
- package/dist-lib/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +62 -0
- package/dist-lib/numbl-core/jit/workspace/workspace.d.ts +243 -0
- package/dist-lib/numbl-core/jitTypes.d.ts +7 -321
- package/dist-lib/numbl-core/jsUserFunctions.d.ts +2 -2
- package/dist-lib/numbl-core/parser/ClassParser.d.ts +3 -0
- package/dist-lib/numbl-core/runtime/index.d.ts +1 -1
- package/dist-lib/numbl-core/runtime/indexing.d.ts +11 -1
- package/dist-lib/numbl-core/runtime/plotUtils.d.ts +28 -2
- package/dist-lib/numbl-core/runtime/runtime.d.ts +16 -1
- package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +5 -0
- package/dist-lib/numbl-core/runtime/types.d.ts +19 -3
- package/dist-lib/numbl-core/version.d.ts +1 -1
- package/dist-lib/numbl-core/workspace/types.d.ts +8 -0
- package/dist-plot-viewer/assets/index-DfxsWeyf.js +4426 -0
- package/dist-plot-viewer/index.html +1 -1
- package/dist-site-viewer/404.html +33 -0
- package/dist-site-viewer/assets/index-C5c2lKAx.js +4748 -0
- package/dist-site-viewer/assets/index-D5YY8PKx.css +1 -0
- package/dist-site-viewer/assets/numbl-worker-CkoM4MUa.js +11836 -0
- package/dist-site-viewer/coi-serviceworker.js +70 -0
- package/dist-site-viewer/favicon.svg +23 -0
- package/dist-site-viewer/index.html +16 -0
- package/dist-site-viewer/logo.svg +26 -0
- package/dist-site-viewer/numbl-embed.js +111 -0
- package/dist-site-viewer/vite.svg +1 -0
- package/native/ops/real_unary_elemwise.c +3 -1
- package/package.json +15 -9
- package/dist-lib/numbl-core/executors/cJit/builtins.d.ts +0 -30
- package/dist-lib/numbl-core/executors/cJit/chainCodegen.d.ts +0 -59
- package/dist-lib/numbl-core/executors/cJit/chainExecutor.d.ts +0 -27
- package/dist-lib/numbl-core/executors/cJit/chainPass.d.ts +0 -42
- package/dist-lib/numbl-core/executors/cJit/codegen.d.ts +0 -44
- package/dist-lib/numbl-core/executors/cJit/compile.d.ts +0 -45
- package/dist-lib/numbl-core/executors/cJit/elemwiseCodegen.d.ts +0 -23
- package/dist-lib/numbl-core/executors/cJit/elemwiseStructural.d.ts +0 -33
- package/dist-lib/numbl-core/executors/cJit/fuseAnalyze.d.ts +0 -39
- package/dist-lib/numbl-core/executors/cJit/fuseCodegen.d.ts +0 -16
- package/dist-lib/numbl-core/executors/cJit/fuseExecutor.d.ts +0 -28
- package/dist-lib/numbl-core/executors/cJit/loopExecutor.d.ts +0 -32
- package/dist-lib/numbl-core/executors/cJit/register.d.ts +0 -10
- package/dist-lib/numbl-core/executors/cJit/whitelist.d.ts +0 -15
- package/dist-lib/numbl-core/executors/jsJit/callExecutor.d.ts +0 -25
- package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegen.d.ts +0 -7
- package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegenHoist.d.ts +0 -70
- package/dist-lib/numbl-core/executors/jsJit/codegen/jsMultiReduction.d.ts +0 -67
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpers.d.ts +0 -34
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersComplex.d.ts +0 -21
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersIndex.d.ts +0 -33
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersTensor.d.ts +0 -34
- package/dist-lib/numbl-core/executors/jsJit/jitCall.d.ts +0 -59
- package/dist-lib/numbl-core/executors/jsJit/jitLoop.d.ts +0 -53
- package/dist-lib/numbl-core/executors/jsJit/jitTopLevel.d.ts +0 -44
- package/dist-lib/numbl-core/executors/jsJit/loopExecutor.d.ts +0 -15
- package/dist-lib/numbl-core/executors/jsJit/lower/blockAnalysis.d.ts +0 -37
- package/dist-lib/numbl-core/executors/jsJit/lower/jitBailSafety.d.ts +0 -41
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLower.d.ts +0 -136
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerExpr.d.ts +0 -36
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerStmt.d.ts +0 -9
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerTypes.d.ts +0 -29
- package/dist-lib/numbl-core/executors/jsJit/lower/scalarEmit.d.ts +0 -58
- package/dist-lib/numbl-core/executors/jsJit/shared.d.ts +0 -120
- package/dist-lib/numbl-core/executors/jsJit/topLevelExecutor.d.ts +0 -17
- package/dist-plot-viewer/assets/index-COAM8o1E.js +0 -4426
- /package/dist-lib/numbl-core/{executors/jsJit/helpers → runtime}/alloc.d.ts +0 -0
|
@@ -20,10 +20,13 @@ export interface ExecOptions {
|
|
|
20
20
|
log?: (message: string) => void;
|
|
21
21
|
/** Enable profiling of builtin function calls. */
|
|
22
22
|
profile?: boolean;
|
|
23
|
-
/** Called each time a JIT function is compiled, with a description
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/** Called each time a JIT function is compiled, with a description, the
|
|
24
|
+
* generated source, and the backend language (`"js"` or `"c"`). */
|
|
25
|
+
onJitCompile?: (description: string, code: string, lang: "js" | "c") => void;
|
|
26
|
+
/** Called when a JIT-compiled unit bails to the interpreter at runtime
|
|
27
|
+
* (e.g. an indexed-store array growth the JIT can't model). Surfaced
|
|
28
|
+
* as a warning; the CLI routes it to stderr. */
|
|
29
|
+
onJitBail?: (message: string) => void;
|
|
27
30
|
/** Initial hold state for plotting (persisted across REPL executions). */
|
|
28
31
|
initialHoldState?: boolean;
|
|
29
32
|
/** Override or add builtins for this execution only. */
|
|
@@ -34,13 +37,8 @@ export interface ExecOptions {
|
|
|
34
37
|
system?: SystemAdapter;
|
|
35
38
|
/** Synchronous callback for the `input()` builtin. Displays prompt, returns user's line. */
|
|
36
39
|
onInput?: (prompt: string) => string;
|
|
37
|
-
/** Optimization mode: `"0"` interpreter, `"1"` JS-JIT, `"
|
|
38
|
-
* scalar-loop only. */
|
|
40
|
+
/** Optimization mode: `"0"` interpreter, `"1"` JS-JIT, `"2"` C-JIT. */
|
|
39
41
|
optimization?: import("./executors/plugins.js").OptLevel;
|
|
40
|
-
/** Compile C-JIT kernels with `-ffast-math` (libmvec-vectorized
|
|
41
|
-
* transcendentals; reductions are reorder-allowed). Default true;
|
|
42
|
-
* opt out via the CLI's `--no-fast-math` flag. */
|
|
43
|
-
fastMath?: boolean;
|
|
44
42
|
/**
|
|
45
43
|
* Initial implicit cwd path for the MATLAB-style "cwd is the first search path" feature.
|
|
46
44
|
* - undefined → auto-detect from `system.cwd()` and scan its files.
|
|
@@ -81,8 +79,8 @@ export interface ProfileData {
|
|
|
81
79
|
export interface ExecResult {
|
|
82
80
|
output: string[];
|
|
83
81
|
generatedJS: string;
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
82
|
+
/** C source emitted by the C-JIT backend (`--opt 2`). Empty placeholder
|
|
83
|
+
* when no C was generated (e.g. `--opt 0`/`1`). */
|
|
86
84
|
generatedC: string;
|
|
87
85
|
plotInstructions: PlotInstruction[];
|
|
88
86
|
returnValue: RuntimeValue;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classification (JS-JIT-independent).
|
|
3
|
+
*
|
|
4
|
+
* Two classification phases — top-level (whole-script) and call
|
|
5
|
+
* (user-function-call) — produce the analysis records that codegen
|
|
6
|
+
* executors consume to decide whether they can lower a stmt list /
|
|
7
|
+
* call and to key their caches.
|
|
8
|
+
*
|
|
9
|
+
* The analysis is purely AST + type inference and is consumed by the
|
|
10
|
+
* JIT executors (`executors/jit/`) — no backend-specific IR involved.
|
|
11
|
+
*/
|
|
12
|
+
import type { Interpreter } from "../interpreter/interpreter.js";
|
|
13
|
+
import type { FunctionDef } from "../interpreter/types.js";
|
|
14
|
+
import type { Stmt, Expr } from "../parser/types.js";
|
|
15
|
+
import { type JitType } from "../jitTypes.js";
|
|
16
|
+
/** A capture-free function handle the JIT inlines into the spec body as
|
|
17
|
+
* an in-scope `@...` constant instead of taking it as a runtime input.
|
|
18
|
+
* `identity` keys the spec cache (distinct handles → distinct specs). */
|
|
19
|
+
export interface ConstHandle {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly expr: Expr;
|
|
22
|
+
readonly identity: string;
|
|
23
|
+
}
|
|
24
|
+
/** Names that look like variables but never resolve to env values
|
|
25
|
+
* (constants, the special `end` slot, the imaginary unit). Skipped
|
|
26
|
+
* when collecting env inputs. */
|
|
27
|
+
export declare const KNOWN_CONSTANTS: ReadonlySet<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Drop `exact` from a numeric scalar `JitType`. Numeric `exact` only
|
|
30
|
+
* survives unification when two consecutive specializations see the
|
|
31
|
+
* *same* literal — almost never the case for variables — so stripping
|
|
32
|
+
* up front means the first specialization's cacheKey already matches
|
|
33
|
+
* later calls.
|
|
34
|
+
*/
|
|
35
|
+
export declare function pruneArgType(t: JitType): JitType;
|
|
36
|
+
/**
|
|
37
|
+
* Progressive type widening: in-place unify each entry of `types`
|
|
38
|
+
* with the corresponding entry of `prev`. No-op when shapes don't
|
|
39
|
+
* match (different arity → different specialization, no widening).
|
|
40
|
+
*
|
|
41
|
+
* Widening that would collapse a known type to `unknown` is rejected
|
|
42
|
+
* — keep this call's concrete type so a fresh, specific spec gets
|
|
43
|
+
* built. Without this, a 1st call with (number, …) followed by a 2nd
|
|
44
|
+
* call with (tensor, …) would unify the first arg to `unknown` and
|
|
45
|
+
* poison every subsequent specialization with the same arg shape.
|
|
46
|
+
*/
|
|
47
|
+
export declare function widenAgainst(types: JitType[], prev: readonly JitType[] | undefined): void;
|
|
48
|
+
/**
|
|
49
|
+
* Gather env inputs for the synthetic FunctionDef of a top-level
|
|
50
|
+
* block. For each candidate name: skip known constants, skip names
|
|
51
|
+
* not in env (likely fn names), infer the JIT type, prune `exact`.
|
|
52
|
+
* Returns null if any candidate has an unknown type — that's a
|
|
53
|
+
* structural blocker for lowering.
|
|
54
|
+
*/
|
|
55
|
+
export declare function gatherTypedEnvInputs(interp: Interpreter, candidates: readonly string[]): {
|
|
56
|
+
inputs: string[];
|
|
57
|
+
inputTypes: JitType[];
|
|
58
|
+
} | null;
|
|
59
|
+
export interface TopLevelClassification {
|
|
60
|
+
readonly stmts: readonly Stmt[];
|
|
61
|
+
readonly inputs: readonly string[];
|
|
62
|
+
readonly inputTypes: readonly JitType[];
|
|
63
|
+
readonly outputs: readonly string[];
|
|
64
|
+
readonly currentFile: string;
|
|
65
|
+
readonly hasReturn: boolean;
|
|
66
|
+
/** Body contains a `%!numbl:assert_jit c` directive (the C-JIT
|
|
67
|
+
* variant) — see `containsAssertJitC`. Makes the JS-JIT executors
|
|
68
|
+
* decline at `--opt 2` so the unit must C-JIT (or fall to the
|
|
69
|
+
* interpreter, which raises). */
|
|
70
|
+
readonly assertsCJit: boolean;
|
|
71
|
+
readonly cacheKey: string;
|
|
72
|
+
}
|
|
73
|
+
export declare function classifyTopLevel(interp: Interpreter, stmts: readonly Stmt[], prevInputTypes: readonly JitType[] | undefined): TopLevelClassification | null;
|
|
74
|
+
export interface LoopClassification {
|
|
75
|
+
/** The single For/While stmt this classification describes. */
|
|
76
|
+
readonly stmt: Stmt & {
|
|
77
|
+
type: "For" | "While";
|
|
78
|
+
};
|
|
79
|
+
readonly inputs: readonly string[];
|
|
80
|
+
readonly inputTypes: readonly JitType[];
|
|
81
|
+
/** Loop-local writes that are read by code AFTER the loop in the
|
|
82
|
+
* same sibling list. Loop-internal-only temporaries are filtered
|
|
83
|
+
* out so a JIT artifact doesn't need to write them back to env. */
|
|
84
|
+
readonly outputs: readonly string[];
|
|
85
|
+
readonly currentFile: string;
|
|
86
|
+
readonly hasReturn: boolean;
|
|
87
|
+
/** Loop body contains a `%!numbl:assert_jit c` directive (C-JIT variant). */
|
|
88
|
+
readonly assertsCJit: boolean;
|
|
89
|
+
/** Capture-free handle inputs to inline as in-scope `@...` constants
|
|
90
|
+
* in the synthesized spec body (instead of runtime inputs). */
|
|
91
|
+
readonly constHandles: readonly ConstHandle[];
|
|
92
|
+
readonly cacheKey: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Classify a single For/While loop at `siblings[siblingIndex]`. The
|
|
96
|
+
* post-loop tail of the sibling list is scanned to filter the
|
|
97
|
+
* loop's assigned-set down to names that are actually live-out
|
|
98
|
+
* (read after the loop) — purely loop-internal scratch never makes
|
|
99
|
+
* it into the synthetic function's outputs.
|
|
100
|
+
*/
|
|
101
|
+
export declare function classifyLoop(interp: Interpreter, stmt: Stmt & {
|
|
102
|
+
type: "For" | "While";
|
|
103
|
+
}, siblings: readonly Stmt[], siblingIndex: number, prevInputTypes: readonly JitType[] | undefined): LoopClassification | null;
|
|
104
|
+
export interface CallClassification {
|
|
105
|
+
readonly fn: FunctionDef;
|
|
106
|
+
readonly nargout: number;
|
|
107
|
+
readonly argTypes: readonly JitType[];
|
|
108
|
+
readonly cacheKey: string;
|
|
109
|
+
/**
|
|
110
|
+
* Effective parameter names for this specialization. Mirrors
|
|
111
|
+
* `fn.params` for non-varargin functions. For varargin functions,
|
|
112
|
+
* the trailing `varargin` is replaced with one synthetic name per
|
|
113
|
+
* variadic arg (`$va_0`, `$va_1`, …). argTypes is one-to-one with
|
|
114
|
+
* effectiveParams.
|
|
115
|
+
*/
|
|
116
|
+
readonly effectiveParams: readonly string[];
|
|
117
|
+
/** Number of variadic args (0 when fn has no varargin). */
|
|
118
|
+
readonly nVarargin: number;
|
|
119
|
+
/** Function body contains a `%!numbl:assert_jit c` directive (C-JIT variant). */
|
|
120
|
+
readonly assertsCJit: boolean;
|
|
121
|
+
}
|
|
122
|
+
export declare function classifyCall(fn: FunctionDef, args: unknown[], nargout: number, prevArgTypes: readonly JitType[] | undefined): CallClassification | null;
|
|
123
|
+
/** True if any statement in `stmts` is a `%!numbl:assert_jit c` directive
|
|
124
|
+
* (the C-JIT variant), recursing into control-flow bodies (if / for /
|
|
125
|
+
* while / switch / try) but NOT into nested function definitions — a
|
|
126
|
+
* directive inside a nested function belongs to that function's own unit.
|
|
127
|
+
*
|
|
128
|
+
* Only the `c` variant matters here: it requires C-JIT at `--opt 2`, so
|
|
129
|
+
* the JS-JIT executors decline such a unit at `--opt 2` to force either
|
|
130
|
+
* C-JIT or an interpreter fallthrough (which then raises). The plain
|
|
131
|
+
* `%!numbl:assert_jit` (require JS-JIT at `--opt 1` only) needs no
|
|
132
|
+
* executor change — the interpreter's `Directive` handler raises if it
|
|
133
|
+
* reaches the directive at `--opt 1`. */
|
|
134
|
+
export declare function containsAssertJitC(stmts: readonly Stmt[]): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function-handle inlining for the JIT.
|
|
3
|
+
*
|
|
4
|
+
* A function handle that crosses a compile boundary — a loop input
|
|
5
|
+
* (`f = @...; for ...; f(x); end`) or a call argument
|
|
6
|
+
* (`applyfn(@sq, x)`) — arrives at the executor as an opaque
|
|
7
|
+
* `function_handle` value the JIT can't type. But a *capture-free*
|
|
8
|
+
* handle is fully described by its source AST, so instead of marshaling
|
|
9
|
+
* it across the boundary we inline its `@...` definition as an in-scope
|
|
10
|
+
* handle constant inside the synthesized spec. That reduces the boundary
|
|
11
|
+
* case to the already-supported in-scope case (`lowerAnonFunc` /
|
|
12
|
+
* `lowerFuncHandle` + `dispatchHandleCall`), which lowers identically on
|
|
13
|
+
* the JS and C backends — no value-adapter or ABI work.
|
|
14
|
+
*
|
|
15
|
+
* "Capture-free" is the key constraint: a handle that closes over an
|
|
16
|
+
* outer variable can't be inlined, because the inlined copy would
|
|
17
|
+
* re-resolve that name in the spec's scope (a different value, or
|
|
18
|
+
* unresolved) rather than the by-value snapshot the handle took. We
|
|
19
|
+
* detect captures against the handle's own recorded definition
|
|
20
|
+
* environment, so the test reflects what the handle actually closed
|
|
21
|
+
* over, not a syntactic guess.
|
|
22
|
+
*/
|
|
23
|
+
import type { Expr } from "../parser/index.js";
|
|
24
|
+
/**
|
|
25
|
+
* If `val` is a function handle the JIT can inline as a compile-time
|
|
26
|
+
* constant in a spec compiled for `compileFile`, return its `@...`
|
|
27
|
+
* defining Expr; otherwise return null.
|
|
28
|
+
*
|
|
29
|
+
* Inlinable iff:
|
|
30
|
+
* - it's a `RuntimeFunction` carrying a recorded `handleAst`, AND
|
|
31
|
+
* - it was defined in `compileFile` (so a `@name` target resolves to
|
|
32
|
+
* the same function it did at definition — file-local functions can
|
|
33
|
+
* shadow across files), AND
|
|
34
|
+
* - for an anonymous handle, it is capture-free: no name its body
|
|
35
|
+
* references (other than its own params) exists as a variable in the
|
|
36
|
+
* handle's recorded definition environment.
|
|
37
|
+
*
|
|
38
|
+
* Named (`@name`) handles are always capture-free. Anything the lowerer
|
|
39
|
+
* ultimately can't compile (e.g. a builtin target) simply makes the
|
|
40
|
+
* enclosing unit decline to the interpreter — still correct.
|
|
41
|
+
*/
|
|
42
|
+
export declare function inlinableHandleExpr(val: unknown, compileFile: string): Expr | null;
|
|
@@ -11,7 +11,4 @@ export { ExecutorCache } from "./cache.js";
|
|
|
11
11
|
export type { JitType, SignCategory } from "../jitTypes.js";
|
|
12
12
|
export { jitTypeKey, unifyJitTypes, isScalarType, isTensorType, isComplexType, isKnownInteger, } from "../jitTypes.js";
|
|
13
13
|
export { inferJitType } from "../interpreter/builtins/types.js";
|
|
14
|
-
export { jsJitTopLevelExecutor } from "./jsJit/topLevelExecutor.js";
|
|
15
|
-
export { jsJitLoopExecutor } from "./jsJit/loopExecutor.js";
|
|
16
|
-
export { jsJitCallExecutor } from "./jsJit/callExecutor.js";
|
|
17
14
|
export { registerExecutorsForOpt } from "./plugins.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cjit-call — C-backed JIT executor for user-function calls.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `callExecutor.ts` (the JS-emit sibling) but routes the
|
|
5
|
+
* specialization's emitted code through `compileSpecC` →
|
|
6
|
+
* `cc -shared -fPIC -O3` → `dlopen` via koffi instead of
|
|
7
|
+
* `new Function(source)`. The dispatch, gating, and caching
|
|
8
|
+
* conventions are otherwise identical, so a sibling executor can
|
|
9
|
+
* register alongside the JS path at the same opt level without any
|
|
10
|
+
* arbitration in the dispatcher beyond cost-based selection.
|
|
11
|
+
*
|
|
12
|
+
* Declines when:
|
|
13
|
+
* - `nativeBridge` / `koffi` are not available (browser).
|
|
14
|
+
* - Any param or output type fails the C-FFI feasibility check
|
|
15
|
+
* (`compilerTypeToCDecl` returns null).
|
|
16
|
+
* - mtoc2 throws `UnsupportedConstruct` / `JitTypeError` at lowering.
|
|
17
|
+
*/
|
|
18
|
+
import type { Executor } from "../types.js";
|
|
19
|
+
import { type JitType } from "../../jitTypes.js";
|
|
20
|
+
import type { FunctionDef } from "../../interpreter/types.js";
|
|
21
|
+
import { type Type as CompilerType, type SpecCSignature } from "../../jit/index.js";
|
|
22
|
+
import { type CompiledC } from "./compileC.js";
|
|
23
|
+
interface CJitCallData {
|
|
24
|
+
readonly fn: FunctionDef;
|
|
25
|
+
readonly nargout: number;
|
|
26
|
+
readonly argTypes: readonly JitType[];
|
|
27
|
+
readonly compilerArgTypes: readonly CompilerType[];
|
|
28
|
+
readonly args: readonly unknown[];
|
|
29
|
+
}
|
|
30
|
+
interface CompiledArtifact {
|
|
31
|
+
readonly compiled: CompiledC;
|
|
32
|
+
readonly signature: SpecCSignature;
|
|
33
|
+
}
|
|
34
|
+
export declare const cJitCallExecutor: Executor<CJitCallData, CompiledArtifact | null>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cjit-loop — C-backed JIT executor for outermost For/While
|
|
3
|
+
* loops. Mirrors `loopExecutor.ts` (JS-emit sibling) but routes
|
|
4
|
+
* through `compileSpecC` → `cc -shared` → `koffi`. See
|
|
5
|
+
* `cJitCallExecutor.ts` for the marshaling protocol; this file just
|
|
6
|
+
* adapts the loop-shape `data` to the same C-side pipeline.
|
|
7
|
+
*/
|
|
8
|
+
import type { Executor } from "../types.js";
|
|
9
|
+
import { type JitType } from "../../jitTypes.js";
|
|
10
|
+
import type { Stmt } from "../../parser/index.js";
|
|
11
|
+
import type { ConstHandle } from "../classification.js";
|
|
12
|
+
import { type Type as CompilerType, type SpecCSignature } from "../../jit/index.js";
|
|
13
|
+
import { type CompiledC } from "./compileC.js";
|
|
14
|
+
interface CJitLoopData {
|
|
15
|
+
readonly loopStmt: Stmt & {
|
|
16
|
+
type: "For" | "While";
|
|
17
|
+
};
|
|
18
|
+
readonly inputs: readonly string[];
|
|
19
|
+
readonly outputs: readonly string[];
|
|
20
|
+
readonly inputTypes: readonly JitType[];
|
|
21
|
+
readonly compilerInputTypes: readonly CompilerType[];
|
|
22
|
+
readonly constHandles: readonly ConstHandle[];
|
|
23
|
+
readonly currentFile: string;
|
|
24
|
+
readonly cacheKey: string;
|
|
25
|
+
}
|
|
26
|
+
interface CompiledArtifact {
|
|
27
|
+
readonly compiled: CompiledC;
|
|
28
|
+
readonly signature: SpecCSignature;
|
|
29
|
+
}
|
|
30
|
+
export declare const cJitLoopExecutor: Executor<CJitLoopData, CompiledArtifact | null>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cjit-top-level — C-backed JIT executor for whole-script bodies.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `topLevelExecutor.ts` (JS-emit sibling) but routes through
|
|
5
|
+
* `compileSpecC` → `cc -shared` → `koffi`. See `cJitCallExecutor.ts`
|
|
6
|
+
* for the marshaling protocol. Same `isAllSuppressed` gate as the JS
|
|
7
|
+
* sibling so `displayAssign`/`displayResult` semantics stay on the
|
|
8
|
+
* interpreter path.
|
|
9
|
+
*/
|
|
10
|
+
import type { Executor } from "../types.js";
|
|
11
|
+
import { type JitType } from "../../jitTypes.js";
|
|
12
|
+
import type { Stmt } from "../../parser/index.js";
|
|
13
|
+
import { type Type as CompilerType, type SpecCSignature } from "../../jit/index.js";
|
|
14
|
+
import { type CompiledC } from "./compileC.js";
|
|
15
|
+
interface CJitTopLevelData {
|
|
16
|
+
readonly stmts: readonly Stmt[];
|
|
17
|
+
readonly inputs: readonly string[];
|
|
18
|
+
readonly outputs: readonly string[];
|
|
19
|
+
readonly inputTypes: readonly JitType[];
|
|
20
|
+
readonly compilerInputTypes: readonly CompilerType[];
|
|
21
|
+
readonly currentFile: string;
|
|
22
|
+
readonly cacheKey: string;
|
|
23
|
+
}
|
|
24
|
+
interface CompiledArtifact {
|
|
25
|
+
readonly compiled: CompiledC;
|
|
26
|
+
readonly signature: SpecCSignature;
|
|
27
|
+
}
|
|
28
|
+
export declare const cJitTopLevelExecutor: Executor<CJitTopLevelData, CompiledArtifact | null>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jit-call — executor that compiles user-function calls via mtoc2's
|
|
3
|
+
* `compileSpec` JIT entry point and runs the emitted JS in-process.
|
|
4
|
+
*
|
|
5
|
+
* Replaces the JS-JIT call executor at `--opt 1`. The shape of the
|
|
6
|
+
* fallback path is the same: on rejection (mtoc2's
|
|
7
|
+
* `UnsupportedConstruct` / `TypeError` during lowering, or a JitType
|
|
8
|
+
* the type adapter can't translate), `propose()` declines and the
|
|
9
|
+
* dispatcher falls through to the next executor / interpreter.
|
|
10
|
+
*
|
|
11
|
+
* Key differences from JS-JIT:
|
|
12
|
+
*
|
|
13
|
+
* - **No mid-run bailouts.** mtoc2 either lowers cleanly or rejects
|
|
14
|
+
* statically. When `compile()` returns, the artifact will run to
|
|
15
|
+
* completion. `bailRisk` is `false`.
|
|
16
|
+
* - **Shared `Lowerer.specializations` is the cache.** One Workspace
|
|
17
|
+
* + Lowerer pair per LoweringContext (i.e. per execution session);
|
|
18
|
+
* accumulating specs persist across calls so a function called
|
|
19
|
+
* repeatedly with the same arg signature reuses the prior compile.
|
|
20
|
+
* - **Output-count support.** `nargout >= 1` (single-output and
|
|
21
|
+
* multi-output `[a, b, ...] = f(x)`). `nargout === 0` (bare-stmt
|
|
22
|
+
* `f();`) is declined because mtoc2's nargout=0 spec emits a no-
|
|
23
|
+
* return body, but numbl's interpreter still uses the first
|
|
24
|
+
* declared output for `ans` binding — let the interpreter handle.
|
|
25
|
+
* - **Loop-depth gate.** Declines when `interp.loopDepth > 0` so a
|
|
26
|
+
* hot loop iterating function calls doesn't pay per-call JIT
|
|
27
|
+
* propose / spec-cache overhead. Once an outer call is JIT'd, its
|
|
28
|
+
* loops run inside mtoc2's compiled code anyway.
|
|
29
|
+
*/
|
|
30
|
+
import type { Executor } from "../types.js";
|
|
31
|
+
import { type JitType } from "../../jitTypes.js";
|
|
32
|
+
import type { FunctionDef } from "../../interpreter/types.js";
|
|
33
|
+
import { type Type as CompilerType } from "../../jit/index.js";
|
|
34
|
+
interface JitCallData {
|
|
35
|
+
readonly fn: FunctionDef;
|
|
36
|
+
readonly nargout: number;
|
|
37
|
+
readonly argTypes: readonly JitType[];
|
|
38
|
+
readonly compilerArgTypes: readonly CompilerType[];
|
|
39
|
+
readonly args: readonly unknown[];
|
|
40
|
+
}
|
|
41
|
+
interface CompiledArtifact {
|
|
42
|
+
readonly specFn: (...args: unknown[]) => unknown;
|
|
43
|
+
}
|
|
44
|
+
export declare const jitCallExecutor: Executor<JitCallData, CompiledArtifact | null>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe surface for the koffi C-JIT pipeline.
|
|
3
|
+
*
|
|
4
|
+
* The real implementation (`compileAndLoadCImpl`) lives in
|
|
5
|
+
* `compileC.node.ts` because it imports Node-only modules (`node:fs`,
|
|
6
|
+
* `node:child_process`, `node:os`, `node:crypto`) that vite/rollup
|
|
7
|
+
* cannot bundle for the browser. The CLI's bootstrap registers the
|
|
8
|
+
* Node implementation here at startup via `setCompileAndLoadCImpl()`;
|
|
9
|
+
* any browser bundle leaves it unregistered, so the koffi-backed
|
|
10
|
+
* executors decline (their proposals already gate on
|
|
11
|
+
* `bridge.koffi !== undefined`).
|
|
12
|
+
*
|
|
13
|
+
* Types stay in this file so the koffi executors can import them
|
|
14
|
+
* without dragging Node-only deps into the static dep graph.
|
|
15
|
+
*/
|
|
16
|
+
import type { NativeBridge } from "../../workspace/types.js";
|
|
17
|
+
/** The koffi function reference returned by `lib.func(decl)`. The
|
|
18
|
+
* actual call signature is controlled by the caller's declaration —
|
|
19
|
+
* type as variadic and let the caller cast. */
|
|
20
|
+
export type CFn = (...args: unknown[]) => unknown;
|
|
21
|
+
export interface CompiledC {
|
|
22
|
+
readonly fn: CFn;
|
|
23
|
+
/** koffi `Lib` instance — useful for binding auxiliary symbols
|
|
24
|
+
* (`free` from libc, allocator helpers, etc.) without re-opening
|
|
25
|
+
* the .so. */
|
|
26
|
+
readonly lib: KoffiLib;
|
|
27
|
+
/** Path to the .so on disk — diagnostics only. */
|
|
28
|
+
readonly libPath: string;
|
|
29
|
+
/** Cache hit (true) vs. fresh cc invocation (false). */
|
|
30
|
+
readonly cacheHit: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** koffi's runtime-shaped lib object. Loosely typed because koffi
|
|
33
|
+
* doesn't ship TS types for its declaration-string API. */
|
|
34
|
+
export interface KoffiLib {
|
|
35
|
+
func(declaration: string): CFn;
|
|
36
|
+
}
|
|
37
|
+
/** Signature of the real compile-and-load. The CLI registers an
|
|
38
|
+
* implementation that shells out to `cc` and `dlopen`s the result
|
|
39
|
+
* via koffi. */
|
|
40
|
+
export type CompileAndLoadCImpl = (source: string, declaration: string, bridge: NativeBridge) => CompiledC;
|
|
41
|
+
/** Install the Node-side C-JIT implementation. Called by `cli.ts`
|
|
42
|
+
* during CLI bootstrap; browser bundles never call this, so `impl`
|
|
43
|
+
* stays null and the koffi executors decline. */
|
|
44
|
+
export declare function setCompileAndLoadCImpl(fn: CompileAndLoadCImpl): void;
|
|
45
|
+
/** Compile (or look up cached) and load. Delegates to whatever was
|
|
46
|
+
* registered via `setCompileAndLoadCImpl()`; throws if no
|
|
47
|
+
* implementation is available (= running in a browser host that
|
|
48
|
+
* somehow got past the koffi executor's `bridge.koffi` gate). */
|
|
49
|
+
export declare function compileAndLoadC(source: string, declaration: string, bridge: NativeBridge): CompiledC;
|
|
50
|
+
export declare function setReadCachedCSourceImpl(fn: (hash: string) => string | null): void;
|
|
51
|
+
export declare function readCachedCSource(hash: string): string | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-only implementation of the koffi C-JIT pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Cache layout: `~/.cache/numbl/mtoc2-c-jit/<sha>.so` (one per unique
|
|
5
|
+
* `(declaration, source, flags)` triple). On hit, `dlopen` and reuse —
|
|
6
|
+
* no `cc` invocation. On miss, write `<sha>.c`, exec `cc`, then
|
|
7
|
+
* `dlopen`.
|
|
8
|
+
*
|
|
9
|
+
* This file is split out of `compileC.ts` so the browser bundle stays
|
|
10
|
+
* free of `node:fs` / `node:child_process` imports — vite/rollup
|
|
11
|
+
* cannot resolve them for the browser target. Browser bundles import
|
|
12
|
+
* only `compileC.ts` (types + a runtime-injected stub); the CLI
|
|
13
|
+
* imports this file at bootstrap and calls `setCompileAndLoadCImpl()`.
|
|
14
|
+
*/
|
|
15
|
+
import type { NativeBridge } from "../../workspace/types.js";
|
|
16
|
+
import { type CompiledC } from "./compileC.js";
|
|
17
|
+
/** Compile (or look up cached) and load. The cache key is the SHA of
|
|
18
|
+
* `(flags, declaration, source)` so two different signatures or
|
|
19
|
+
* compile-flag sets against the same source get distinct artifacts. */
|
|
20
|
+
export declare function compileAndLoadC(source: string, declaration: string, bridge: NativeBridge): CompiledC;
|
|
21
|
+
/** Read a previously-compiled C source from disk. Diagnostic helper. */
|
|
22
|
+
export declare function readCachedCSource(hash: string): string | null;
|
|
23
|
+
/** Register both implementations with the browser-safe surface. The
|
|
24
|
+
* CLI imports this module at bootstrap to wire them in. */
|
|
25
|
+
export declare function registerNodeCompileC(): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the `$h` helpers object that mtoc2's emitted spec receives
|
|
3
|
+
* when invoked via the numbl JIT bridge.
|
|
4
|
+
*
|
|
5
|
+
* - `write(s)` — output sink. Routed to `rt.output(...)` so `disp` /
|
|
6
|
+
* `fprintf` / `warning` etc. land in numbl's output stream.
|
|
7
|
+
* - `plotDispatch(name, args)` — host hook for plot builtins.
|
|
8
|
+
* mtoc2's emitted `mtoc2_plot_dispatch(...)` calls this in
|
|
9
|
+
* preference to the standalone-mode JSON-on-stdout wire format.
|
|
10
|
+
* We translate args from mtoc2's emit shape into `RuntimeValue`
|
|
11
|
+
* via `jitToNumbl` and call numbl's `dispatchPlotBuiltin`,
|
|
12
|
+
* pushing the resulting instruction onto `rt.plotInstructions` —
|
|
13
|
+
* so `colorbar('off')` / `pcolor(...)` / etc. produce the same
|
|
14
|
+
* plot-instruction stream as the interpreter would.
|
|
15
|
+
*
|
|
16
|
+
* The unknown-name fallthrough (when `dispatchPlotBuiltin` returns
|
|
17
|
+
* false) is a programmer error: every name mtoc2's plot builtin
|
|
18
|
+
* registration covers is in `PLOT_ALL_NAMES`, which is sourced from
|
|
19
|
+
* the same list `dispatchPlotBuiltin` switches on. Throw so the
|
|
20
|
+
* mismatch is loud rather than silently dropping a side effect.
|
|
21
|
+
*/
|
|
22
|
+
import type { Runtime } from "../../runtime/runtime.js";
|
|
23
|
+
export interface JitHostHelpers {
|
|
24
|
+
write: (s: string) => void;
|
|
25
|
+
plotDispatch: (name: string, args: unknown[]) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function buildHostHelpers(rt: Runtime): JitHostHelpers;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jit-loop — compiles a single For/While stmt via mtoc2's
|
|
3
|
+
* `compileSpec` with the loop wrapped as a synthetic user function
|
|
4
|
+
* whose params are the variables the loop reads (env inputs) and
|
|
5
|
+
* whose outputs are the variables it assigns that are live after the
|
|
6
|
+
* loop (filtered in classification).
|
|
7
|
+
*
|
|
8
|
+
* Mirrors `topLevelExecutor.ts` — the only structural difference is
|
|
9
|
+
* that the synthetic body is a single-element `[loopStmt]` instead of
|
|
10
|
+
* a whole script body.
|
|
11
|
+
*
|
|
12
|
+
* Loop-depth gate: only fires when `interp.loopDepth === 0`. A loop
|
|
13
|
+
* dispatched while the interpreter is iterating an enclosing
|
|
14
|
+
* loop-body would pay per-iter propose/cache overhead with no
|
|
15
|
+
* speedup, because the *outer* loop is the natural JIT entry point
|
|
16
|
+
* (it captures the inner loop's body and runs it natively in mtoc2-
|
|
17
|
+
* emitted code). When the outer loop fires its own JIT, the inner
|
|
18
|
+
* loop never reaches the interpreter dispatcher at all.
|
|
19
|
+
*/
|
|
20
|
+
import type { Executor } from "../types.js";
|
|
21
|
+
import { type JitType } from "../../jitTypes.js";
|
|
22
|
+
import type { Stmt } from "../../parser/index.js";
|
|
23
|
+
import { type Type as CompilerType } from "../../jit/index.js";
|
|
24
|
+
import type { ConstHandle } from "../classification.js";
|
|
25
|
+
interface JitLoopData {
|
|
26
|
+
readonly loopStmt: Stmt & {
|
|
27
|
+
type: "For" | "While";
|
|
28
|
+
};
|
|
29
|
+
readonly inputs: readonly string[];
|
|
30
|
+
readonly outputs: readonly string[];
|
|
31
|
+
readonly inputTypes: readonly JitType[];
|
|
32
|
+
readonly compilerInputTypes: readonly CompilerType[];
|
|
33
|
+
readonly constHandles: readonly ConstHandle[];
|
|
34
|
+
readonly currentFile: string;
|
|
35
|
+
readonly cacheKey: string;
|
|
36
|
+
}
|
|
37
|
+
interface CompiledArtifact {
|
|
38
|
+
readonly specFn: (...args: unknown[]) => unknown;
|
|
39
|
+
}
|
|
40
|
+
export declare const jitLoopExecutor: Executor<JitLoopData, CompiledArtifact | null>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-LoweringContext mtoc2 session state shared between
|
|
3
|
+
* `jitCallExecutor` and `jitTopLevelExecutor`. One `Workspace`
|
|
4
|
+
* (built from numbl's existing `LoweringContext`) and one `Lowerer`
|
|
5
|
+
* per execution session, so the `Lowerer.specializations` cache
|
|
6
|
+
* persists across whole-scope + per-call dispatches.
|
|
7
|
+
*
|
|
8
|
+
* The session is keyed on the LoweringContext object — WeakMap-cleared
|
|
9
|
+
* automatically when the context goes out of scope.
|
|
10
|
+
*/
|
|
11
|
+
import type { Interpreter } from "../../interpreter/interpreter.js";
|
|
12
|
+
import { Workspace, Lowerer } from "../../jit/index.js";
|
|
13
|
+
export interface SessionState {
|
|
14
|
+
workspace: Workspace;
|
|
15
|
+
lowerer: Lowerer;
|
|
16
|
+
}
|
|
17
|
+
export declare function getOrCreateSession(interp: Interpreter): SessionState;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jit-top-level — compiles a script body via mtoc2's `compileSpec`
|
|
3
|
+
* with the body wrapped as a synthetic user function whose params are
|
|
4
|
+
* the variables the body reads (env inputs) and whose outputs are the
|
|
5
|
+
* variables it assigns (env outputs).
|
|
6
|
+
*
|
|
7
|
+
* The interpreter calls `Registry.tryRunWholeScope` once at script
|
|
8
|
+
* start; we register this via `registerWholeScope`. On compile
|
|
9
|
+
* success the entire script runs in mtoc2-emitted JS; on
|
|
10
|
+
* `UnsupportedConstruct` / `TypeError` we decline and the dispatcher
|
|
11
|
+
* falls through to per-stmt dispatch (where jit-call still handles
|
|
12
|
+
* individual user-function calls).
|
|
13
|
+
*
|
|
14
|
+
* Top-level loops *inside* the script execute as part of the
|
|
15
|
+
* compiled artifact, so `loopDepth` only gates dispatch-level calls,
|
|
16
|
+
* not this whole-scope attempt.
|
|
17
|
+
*/
|
|
18
|
+
import type { Executor } from "../types.js";
|
|
19
|
+
import { type JitType } from "../../jitTypes.js";
|
|
20
|
+
import type { Stmt } from "../../parser/index.js";
|
|
21
|
+
import { type Type as CompilerType } from "../../jit/index.js";
|
|
22
|
+
interface JitTopLevelData {
|
|
23
|
+
readonly stmts: readonly Stmt[];
|
|
24
|
+
readonly inputs: readonly string[];
|
|
25
|
+
readonly outputs: readonly string[];
|
|
26
|
+
readonly inputTypes: readonly JitType[];
|
|
27
|
+
readonly compilerInputTypes: readonly CompilerType[];
|
|
28
|
+
readonly currentFile: string;
|
|
29
|
+
readonly cacheKey: string;
|
|
30
|
+
}
|
|
31
|
+
interface CompiledArtifact {
|
|
32
|
+
readonly specFn: (...args: unknown[]) => unknown;
|
|
33
|
+
readonly nargout: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const jitTopLevelExecutor: Executor<JitTopLevelData, CompiledArtifact | null>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter: numbl `JitType` → mtoc2 `Type`.
|
|
3
|
+
*
|
|
4
|
+
* Called by the mtoc2 JIT executor at `propose()` time. Numbl observes
|
|
5
|
+
* each argument's `JitType` from the live runtime value (via
|
|
6
|
+
* `inferJitType`); the adapter translates it into the matching mtoc2
|
|
7
|
+
* Type so `compileSpec` can specialize on the same shape information.
|
|
8
|
+
*
|
|
9
|
+
* Two design rules:
|
|
10
|
+
*
|
|
11
|
+
* 1. **Always strip exact.** Runtime-observed scalars must NOT shard
|
|
12
|
+
* mtoc2's spec cache by value. We never propagate `exact` through
|
|
13
|
+
* the adapter — `compileSpec` calls `withoutExact` again
|
|
14
|
+
* defensively, but doing it here makes the spec key wider one step
|
|
15
|
+
* earlier.
|
|
16
|
+
* 2. **Reject unsupported kinds via `null`.** The executor's
|
|
17
|
+
* `propose()` treats `null` from this adapter as "decline this
|
|
18
|
+
* JIT proposal" — the dispatcher falls through to the next
|
|
19
|
+
* executor (eventually the interpreter). First-cut coverage is
|
|
20
|
+
* scalars + dense real/complex tensors + strings + chars. Structs,
|
|
21
|
+
* cells, class instances, struct arrays, sparse, dictionaries, and
|
|
22
|
+
* function handles return `null`; they can be added later.
|
|
23
|
+
*/
|
|
24
|
+
import type { JitType } from "../../jitTypes.js";
|
|
25
|
+
import { type Type } from "../../jit/index.js";
|
|
26
|
+
/** Translate a numbl `JitType` to the matching mtoc2 `Type`.
|
|
27
|
+
* Returns `null` for kinds the mtoc2 JIT path doesn't accept (yet). */
|
|
28
|
+
export declare function jitTypeToCompilerType(jt: JitType): Type | null;
|