numbl 0.3.0 → 0.4.0
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 +17 -33
- package/dist-cli/cli.js +61511 -46223
- package/dist-lib/graphics/types.d.ts +22 -0
- package/dist-lib/lib.js +37582 -22275
- package/dist-lib/numbl-core/executeCode.d.ts +11 -16
- package/dist-lib/numbl-core/executors/cache.d.ts +26 -0
- package/dist-lib/numbl-core/executors/classification.d.ts +134 -0
- package/dist-lib/numbl-core/executors/context.d.ts +76 -0
- package/dist-lib/numbl-core/executors/handleInline.d.ts +42 -0
- package/dist-lib/numbl-core/executors/index.d.ts +14 -0
- 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 +120 -0
- package/dist-lib/numbl-core/executors/plugins.d.ts +32 -0
- package/dist-lib/numbl-core/executors/registry.d.ts +148 -0
- package/dist-lib/numbl-core/executors/types.d.ts +103 -0
- package/dist-lib/numbl-core/functionResolve.d.ts +7 -0
- package/dist-lib/numbl-core/helpers/check-helpers.d.ts +4 -5
- package/dist-lib/numbl-core/helpers/linsolve.d.ts +2 -3
- package/dist-lib/numbl-core/helpers/prng.d.ts +1 -2
- package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +4 -1
- package/dist-lib/numbl-core/interpreter/builtins/datetime.d.ts +2 -1
- package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +1 -1
- package/dist-lib/numbl-core/interpreter/builtins/misc.d.ts +4 -1
- package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +4 -109
- package/dist-lib/numbl-core/interpreter/interpreter.d.ts +51 -49
- package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +6 -0
- package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +6 -3
- package/dist-lib/numbl-core/interpreter/types.d.ts +27 -12
- 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 +13 -5
- 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 +94 -0
- package/dist-lib/numbl-core/jsUserFunctions.d.ts +10 -2
- package/dist-lib/numbl-core/lowering/loweringContext.d.ts +24 -0
- package/dist-lib/numbl-core/native/lapack-bridge.d.ts +3 -3
- package/dist-lib/numbl-core/parser/ClassParser.d.ts +3 -0
- package/dist-lib/numbl-core/parser/types.d.ts +20 -0
- package/dist-lib/numbl-core/runtime/alloc.d.ts +12 -23
- package/dist-lib/numbl-core/runtime/constructors.d.ts +6 -6
- package/dist-lib/numbl-core/runtime/cow.d.ts +33 -0
- package/dist-lib/numbl-core/runtime/index.d.ts +4 -3
- package/dist-lib/numbl-core/runtime/indexing.d.ts +17 -2
- package/dist-lib/numbl-core/runtime/plotBuiltinDispatch.d.ts +86 -0
- package/dist-lib/numbl-core/runtime/plotUtils.d.ts +17 -2
- package/dist-lib/numbl-core/runtime/refcount.d.ts +85 -0
- package/dist-lib/numbl-core/runtime/runtime.d.ts +43 -67
- package/dist-lib/numbl-core/runtime/runtimeDispatch.d.ts +2 -2
- package/dist-lib/numbl-core/runtime/runtimeIndexing.d.ts +2 -2
- package/dist-lib/numbl-core/runtime/runtimeMemberAccess.d.ts +1 -1
- package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +1 -0
- package/dist-lib/numbl-core/runtime/struct-access.d.ts +2 -1
- package/dist-lib/numbl-core/runtime/types.d.ts +117 -62
- package/dist-lib/numbl-core/runtime/utils.d.ts +2 -8
- 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-COAM8o1E.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-CgBUy7v7.js +4748 -0
- package/dist-site-viewer/assets/index-D5YY8PKx.css +1 -0
- package/dist-site-viewer/assets/numbl-worker-VkVtodCX.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/lapack_linsolve.cpp +1 -1
- package/native/numbl_addon_common.h +2 -2
- package/native/ops/comparison.c +1 -1
- package/native/ops/real_unary_elemwise.c +3 -1
- package/package.json +16 -13
- package/dist-lib/numbl-core/jit/c/abi.d.ts +0 -90
- package/dist-lib/numbl-core/jit/c/assemble.d.ts +0 -56
- package/dist-lib/numbl-core/jit/c/classify.d.ts +0 -70
- package/dist-lib/numbl-core/jit/c/compile.d.ts +0 -37
- package/dist-lib/numbl-core/jit/c/context.d.ts +0 -152
- package/dist-lib/numbl-core/jit/c/emit/assign.d.ts +0 -20
- package/dist-lib/numbl-core/jit/c/emit/complexScalar.d.ts +0 -18
- package/dist-lib/numbl-core/jit/c/emit/fused.d.ts +0 -42
- package/dist-lib/numbl-core/jit/c/emit/helpers.d.ts +0 -40
- package/dist-lib/numbl-core/jit/c/emit/index.d.ts +0 -14
- package/dist-lib/numbl-core/jit/c/emit/scalar.d.ts +0 -23
- package/dist-lib/numbl-core/jit/c/emit/stmt.d.ts +0 -25
- package/dist-lib/numbl-core/jit/c/emit/tensor.d.ts +0 -127
- package/dist-lib/numbl-core/jit/c/emit/userCall.d.ts +0 -58
- package/dist-lib/numbl-core/jit/c/epilogue.d.ts +0 -26
- package/dist-lib/numbl-core/jit/c/feasibility.d.ts +0 -44
- package/dist-lib/numbl-core/jit/c/prelude.d.ts +0 -37
- package/dist-lib/numbl-core/jit/c/visit.d.ts +0 -63
- package/dist-lib/numbl-core/jit/e1/complexKernelEmit.d.ts +0 -46
- package/dist-lib/numbl-core/jit/e1/hash.d.ts +0 -10
- package/dist-lib/numbl-core/jit/e1/install.d.ts +0 -13
- package/dist-lib/numbl-core/jit/e1/kernelEmit.d.ts +0 -54
- package/dist-lib/numbl-core/jit/e1/multiReductionKernel.d.ts +0 -66
- package/dist-lib/numbl-core/jit/e1/openmpFlag.d.ts +0 -13
- package/dist-lib/numbl-core/jit/e1/scalarFnKernel.d.ts +0 -44
- package/dist-lib/numbl-core/jit/e2/assignKernel.d.ts +0 -34
- package/dist-lib/numbl-core/jit/e2/astToJitExpr.d.ts +0 -25
- package/dist-lib/numbl-core/jit/e2/cache.d.ts +0 -80
- package/dist-lib/numbl-core/jit/e2/chainKernelEmit.d.ts +0 -55
- package/dist-lib/numbl-core/jit/e2/classify.d.ts +0 -119
- package/dist-lib/numbl-core/jit/e2/compileFn.d.ts +0 -16
- package/dist-lib/numbl-core/jit/e2/complexChainKernelEmit.d.ts +0 -79
- package/dist-lib/numbl-core/jit/e2/emitShared.d.ts +0 -71
- package/dist-lib/numbl-core/jit/e2/install.d.ts +0 -11
- package/dist-lib/numbl-core/jit/e2/liveness.d.ts +0 -29
- package/dist-lib/numbl-core/jit/e2/loopKernel.d.ts +0 -49
- package/dist-lib/numbl-core/jit/e2/loopKernelEmit.d.ts +0 -75
- package/dist-lib/numbl-core/jit/e2/multiReductionDriver.d.ts +0 -24
- package/dist-lib/numbl-core/jit/e2/reductionKernelEmit.d.ts +0 -72
- package/dist-lib/numbl-core/jit/e2/scalarFnDriver.d.ts +0 -29
- package/dist-lib/numbl-core/jit/fusedChainHelpers.d.ts +0 -65
- package/dist-lib/numbl-core/jit/fusedScalarEmit.d.ts +0 -69
- package/dist-lib/numbl-core/jit/fusion.d.ts +0 -71
- package/dist-lib/numbl-core/jit/fusionOps.d.ts +0 -25
- package/dist-lib/numbl-core/jit/heavyOps.d.ts +0 -15
- package/dist-lib/numbl-core/jit/jitBailSafety.d.ts +0 -41
- package/dist-lib/numbl-core/jit/jitLoop.d.ts +0 -25
- package/dist-lib/numbl-core/jit/jitLoopAnalysis.d.ts +0 -37
- package/dist-lib/numbl-core/jit/jitLower.d.ts +0 -122
- package/dist-lib/numbl-core/jit/jitLowerExpr.d.ts +0 -27
- package/dist-lib/numbl-core/jit/jitLowerStmt.d.ts +0 -9
- package/dist-lib/numbl-core/jit/jitLowerTypes.d.ts +0 -29
- package/dist-lib/numbl-core/jit/jitTopLevel.d.ts +0 -22
- package/dist-lib/numbl-core/jit/jitTypes.d.ts +0 -394
- package/dist-lib/numbl-core/jit/js/jitCodegen.d.ts +0 -7
- package/dist-lib/numbl-core/jit/js/jitCodegenHoist.d.ts +0 -70
- package/dist-lib/numbl-core/jit/js/jitHelpers.d.ts +0 -34
- package/dist-lib/numbl-core/jit/js/jitHelpersComplex.d.ts +0 -21
- package/dist-lib/numbl-core/jit/js/jitHelpersIndex.d.ts +0 -33
- package/dist-lib/numbl-core/jit/js/jitHelpersTensor.d.ts +0 -34
- package/dist-lib/numbl-core/jit/js/jsFusedCodegen.d.ts +0 -17
- package/dist-lib/numbl-core/jit/js/jsMultiReduction.d.ts +0 -70
- package/dist-lib/numbl-core/jit/scalarEmit.d.ts +0 -58
- package/dist-plot-viewer/assets/index-GiUNnMQg.js +0 -4426
- package/native/jit_runtime/jit_runtime.c +0 -261
- package/native/jit_runtime/jit_runtime.h +0 -204
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared fusible-operation name sets for JIT fusion analysis.
|
|
3
|
-
*
|
|
4
|
-
* Both the C-JIT and JS-JIT fusion paths use these to determine which
|
|
5
|
-
* tensor Call nodes are fusible element-wise unary ops or absorbable
|
|
6
|
-
* trailing reductions. The numeric op codes live in their respective
|
|
7
|
-
* backend files (feasibility.ts for C, jitHelpersTensor.ts for JS).
|
|
8
|
-
*/
|
|
9
|
-
/** Tensor unary builtins fusible into per-element loops. */
|
|
10
|
-
export declare const FUSIBLE_TENSOR_UNARY_OPS: ReadonlySet<string>;
|
|
11
|
-
/**
|
|
12
|
-
* JS-JIT-safe subset: excludes transcendentals (exp, sin, cos, tan, etc.)
|
|
13
|
-
* which V8 can't SIMD-vectorize. Fusing these into a scalar per-element
|
|
14
|
-
* loop is slower than calling libnumbl_ops per-op (which uses -fopenmp-simd).
|
|
15
|
-
* The C-JIT uses the full set because GCC/Clang vectorize via #pragma omp simd.
|
|
16
|
-
*/
|
|
17
|
-
export declare const FUSIBLE_TENSOR_UNARY_OPS_JS: ReadonlySet<string>;
|
|
18
|
-
/**
|
|
19
|
-
* Two-argument tensor element-wise builtins fusible into per-element loops.
|
|
20
|
-
* These are parsed as Call nodes (not Binary nodes) and need separate
|
|
21
|
-
* recognition in isPureElementwise / emitScalarExpr.
|
|
22
|
-
*/
|
|
23
|
-
export declare const FUSIBLE_TENSOR_BINARY_OPS: ReadonlySet<string>;
|
|
24
|
-
/** Tensor reduction builtins absorbable as trailing reductions. */
|
|
25
|
-
export declare const FUSIBLE_TENSOR_REDUCTION_OPS: ReadonlySet<string>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared heavy-op heuristic for fused-loop emitters (e1 and e2).
|
|
3
|
-
*
|
|
4
|
-
* Counts the number of "expensive" math operations in a JitExpr — the
|
|
5
|
-
* kind of work that's heavy enough per element that OpenMP thread-
|
|
6
|
-
* spawn overhead pays off at N >= 100k. Arithmetic-only chains skip
|
|
7
|
-
* the parallel-for pragma because threads slow them down: the body
|
|
8
|
-
* becomes memory-bandwidth-bound and adding threads only adds overhead.
|
|
9
|
-
*/
|
|
10
|
-
import type { JitExpr } from "./jitTypes.js";
|
|
11
|
-
export declare function countHeavyOps(expr: JitExpr): number;
|
|
12
|
-
/** Minimum element count before `#pragma omp parallel for simd` kicks
|
|
13
|
-
* in. Below this the thread-spawn cost dominates the work.
|
|
14
|
-
* Overridable via `NUMBL_OMP_THRESHOLD` for benchmarks. */
|
|
15
|
-
export declare function ompParallelThreshold(): number;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bail-safety gate for JIT bodies that contain I/O side effects.
|
|
3
|
-
*
|
|
4
|
-
* Mid-execution bails (JitBailToInterpreter / JitFuncHandleBailError)
|
|
5
|
-
* cause the interpreter to re-run the body from the top. If the body
|
|
6
|
-
* already emitted I/O before the bail, that output gets duplicated —
|
|
7
|
-
* which the user would notice.
|
|
8
|
-
*
|
|
9
|
-
* Rule: a body with any I/O statement may only be JIT-compiled if we
|
|
10
|
-
* can prove no bail can happen during execution. If there's no I/O,
|
|
11
|
-
* the body can be JIT'd normally (a bail just restarts silently).
|
|
12
|
-
*
|
|
13
|
-
* Walkers are IR-level — they see the actual lowered constructs that
|
|
14
|
-
* map 1:1 to runtime bail sites. The walkers recurse into the bodies
|
|
15
|
-
* of `UserCall`-ed functions (via `generatedIRBodies`), since a bail
|
|
16
|
-
* inside a callee still forces the caller to re-run.
|
|
17
|
-
*/
|
|
18
|
-
import type { JitStmt } from "./jitTypes.js";
|
|
19
|
-
import type { GeneratedFn } from "./jitLower.js";
|
|
20
|
-
/**
|
|
21
|
-
* Names of I/O-emitting builtins that the JIT is willing to lower as
|
|
22
|
-
* ExprStmt calls. Any `Call` to one of these in the lowered IR marks
|
|
23
|
-
* the body as having observable I/O.
|
|
24
|
-
*/
|
|
25
|
-
export declare const JIT_IO_BUILTINS: Set<string>;
|
|
26
|
-
/**
|
|
27
|
-
* Walk a body + its transitively called function bodies and return
|
|
28
|
-
* whether the combined execution graph contains an I/O call.
|
|
29
|
-
*/
|
|
30
|
-
export declare function irHasIO(body: JitStmt[], generatedIRBodies: Map<string, GeneratedFn>): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Walk a body + its transitively called function bodies and return
|
|
33
|
-
* whether any construct exists that can throw `JitBailToInterpreter`
|
|
34
|
-
* or `JitFuncHandleBailError` at runtime.
|
|
35
|
-
*
|
|
36
|
-
* Bail-risky constructs:
|
|
37
|
-
* - AssignIndex / AssignIndexCol: may bail on out-of-bounds grow.
|
|
38
|
-
* - FuncHandleCall / UserDispatchCall: return-type check may bail.
|
|
39
|
-
* - UserCall: recurse into callee body.
|
|
40
|
-
*/
|
|
41
|
-
export declare function irHasBailRisk(body: JitStmt[], generatedIRBodies: Map<string, GeneratedFn>): boolean;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JIT compilation for inline for/while loops.
|
|
3
|
-
*
|
|
4
|
-
* When the interpreter encounters a for or while loop, these functions
|
|
5
|
-
* attempt to JIT-compile the loop as a synthetic function: inputs are
|
|
6
|
-
* variables from the enclosing scope, outputs are variables assigned
|
|
7
|
-
* inside the loop body. On success the compiled code runs and output
|
|
8
|
-
* values are written back to the interpreter environment.
|
|
9
|
-
*/
|
|
10
|
-
import type { Interpreter } from "../interpreter/interpreter.js";
|
|
11
|
-
import type { Stmt } from "../parser/types.js";
|
|
12
|
-
/**
|
|
13
|
-
* Attempt to JIT-compile and execute a for-loop statement.
|
|
14
|
-
* Returns true if JIT succeeded, false to fall back to interpretation.
|
|
15
|
-
*/
|
|
16
|
-
export declare function tryJitFor(interp: Interpreter, stmt: Stmt & {
|
|
17
|
-
type: "For";
|
|
18
|
-
}): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Attempt to JIT-compile and execute a while-loop statement.
|
|
21
|
-
* Returns true if JIT succeeded, false to fall back to interpretation.
|
|
22
|
-
*/
|
|
23
|
-
export declare function tryJitWhile(interp: Interpreter, stmt: Stmt & {
|
|
24
|
-
type: "While";
|
|
25
|
-
}): boolean;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Static AST analysis to determine input/output variables for loop JIT.
|
|
3
|
-
*
|
|
4
|
-
* Walks the loop body (and condition for while) to collect:
|
|
5
|
-
* - assigned: variables written inside the loop
|
|
6
|
-
* - referenced: variables read inside the loop
|
|
7
|
-
* - hasReturn: whether the loop body contains a return statement
|
|
8
|
-
*/
|
|
9
|
-
import type { Stmt } from "../parser/types.js";
|
|
10
|
-
export interface LoopVarInfo {
|
|
11
|
-
/** Variables referenced in the loop that must come from enclosing scope */
|
|
12
|
-
inputs: string[];
|
|
13
|
-
/** Variables assigned in the loop body (written back after JIT execution) */
|
|
14
|
-
outputs: string[];
|
|
15
|
-
/** Whether the loop body contains a return statement (skip JIT if true) */
|
|
16
|
-
hasReturn: boolean;
|
|
17
|
-
}
|
|
18
|
-
/** Analyze a for loop statement for JIT compilation. */
|
|
19
|
-
export declare function analyzeForLoop(stmt: Stmt & {
|
|
20
|
-
type: "For";
|
|
21
|
-
}): LoopVarInfo;
|
|
22
|
-
/**
|
|
23
|
-
* Collect the names of all variables read in a sibling-tail starting at
|
|
24
|
-
* `startIdx` of the given stmt list. Used by the loop JIT to filter the
|
|
25
|
-
* loop's output set so that loop-internal temporaries don't get written
|
|
26
|
-
* back when no later code reads them.
|
|
27
|
-
*/
|
|
28
|
-
export declare function collectReadsFromSiblings(stmts: Stmt[], startIdx: number, out: Set<string>): void;
|
|
29
|
-
/**
|
|
30
|
-
* Analyze a top-level script body (list of statements) for JIT compilation.
|
|
31
|
-
* Used by `tryJitTopLevel` to wrap the whole main script as a synthetic fn.
|
|
32
|
-
*/
|
|
33
|
-
export declare function analyzeTopLevel(stmts: Stmt[]): LoopVarInfo;
|
|
34
|
-
/** Analyze a while loop statement for JIT compilation. */
|
|
35
|
-
export declare function analyzeWhileLoop(stmt: Stmt & {
|
|
36
|
-
type: "While";
|
|
37
|
-
}): LoopVarInfo;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AST -> JIT IR lowering with type propagation. Orchestrator that owns
|
|
3
|
-
* the shared context types (LowerCtx, SliceAlias), the public result
|
|
4
|
-
* types (GeneratedFn, LoweringResult), and the `lowerFunction` entry
|
|
5
|
-
* point. Actual statement and expression lowering lives in
|
|
6
|
-
* jitLowerStmt.ts and jitLowerExpr.ts; type-level helpers are in
|
|
7
|
-
* jitLowerTypes.ts.
|
|
8
|
-
*
|
|
9
|
-
* Returns null if any unsupported construct is encountered, causing the
|
|
10
|
-
* entire function to fall back to interpretation.
|
|
11
|
-
*/
|
|
12
|
-
import type { FunctionDef } from "../interpreter/types.js";
|
|
13
|
-
import type { Interpreter } from "../interpreter/interpreter.js";
|
|
14
|
-
import type { JitType, JitExpr, JitStmt } from "./jitTypes.js";
|
|
15
|
-
import { type TypeEnv } from "./jitLowerTypes.js";
|
|
16
|
-
/**
|
|
17
|
-
* Lowered IR for a user function reached during a top-level lowering.
|
|
18
|
-
*
|
|
19
|
-
* JS-JIT caches the callee as generated JS source in `generatedFns` and
|
|
20
|
-
* is done. C-JIT needs to re-analyze the callee's IR (for recursive
|
|
21
|
-
* feasibility + emitting a static C function per callee), so we also
|
|
22
|
-
* cache the raw IR here. One entry per unique `jitName`; matches the
|
|
23
|
-
* JS-JIT specialization key.
|
|
24
|
-
*/
|
|
25
|
-
export interface GeneratedFn {
|
|
26
|
-
fn: FunctionDef;
|
|
27
|
-
argTypes: JitType[];
|
|
28
|
-
outputNames: string[];
|
|
29
|
-
outputTypes: JitType[];
|
|
30
|
-
body: JitStmt[];
|
|
31
|
-
localVars: Set<string>;
|
|
32
|
-
nargout: number;
|
|
33
|
-
}
|
|
34
|
-
export interface LoweringResult {
|
|
35
|
-
body: JitStmt[];
|
|
36
|
-
outputNames: string[];
|
|
37
|
-
localVars: Set<string>;
|
|
38
|
-
hasTensorOps: boolean;
|
|
39
|
-
/** Generated JS code for called user functions: jitName → code */
|
|
40
|
-
generatedFns: Map<string, string>;
|
|
41
|
-
/** Lowered IR for called user functions: jitName → IR + metadata.
|
|
42
|
-
* Populated alongside `generatedFns` by `lowerUserFuncCall`; the
|
|
43
|
-
* C-JIT uses it for recursive feasibility and per-callee C emission. */
|
|
44
|
-
generatedIRBodies: Map<string, GeneratedFn>;
|
|
45
|
-
/** Type of the first output variable after lowering */
|
|
46
|
-
outputType: JitType | null;
|
|
47
|
-
/** Types of all output variables in outputNames order. Mirrors the
|
|
48
|
-
* shape of JS-JIT's `return [out0, out1, ...]`. */
|
|
49
|
-
outputTypes: JitType[];
|
|
50
|
-
/** Final typed environment after lowering the body. The hybrid
|
|
51
|
-
* loop-extraction pass uses this to look up live-in/live-out var
|
|
52
|
-
* types without re-running type inference. */
|
|
53
|
-
endEnv: TypeEnv;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* A "slice alias" records that a MATLAB local was bound to a colon-slice of
|
|
57
|
-
* a real tensor (e.g. `pt = pts(:, i)`). Rather than materializing the slice
|
|
58
|
-
* as a RuntimeTensor per iteration, we remember the base tensor and a
|
|
59
|
-
* per-dim "template" of indices — scalar expressions captured at bind time
|
|
60
|
-
* for the non-colon dims, and `"colon"` placeholders for the colon dims.
|
|
61
|
-
* Subsequent reads like `pt(k)` substitute `k` into the colon positions and
|
|
62
|
-
* emit a direct scalar read on the base tensor, which compiles cleanly
|
|
63
|
-
* through the existing hoisted `idx{1,2,3}r_h` fast path.
|
|
64
|
-
*/
|
|
65
|
-
export interface SliceAlias {
|
|
66
|
-
baseName: string;
|
|
67
|
-
baseType: JitType;
|
|
68
|
-
/**
|
|
69
|
-
* One entry per index of the original bind expression, in source order.
|
|
70
|
-
* A `"colon"` slot expects to be filled by the read-site's colon indices.
|
|
71
|
-
* An `"expr"` slot carries a JitExpr that will be substituted as-is.
|
|
72
|
-
*/
|
|
73
|
-
template: ({
|
|
74
|
-
kind: "colon";
|
|
75
|
-
} | {
|
|
76
|
-
kind: "expr";
|
|
77
|
-
expr: JitExpr;
|
|
78
|
-
})[];
|
|
79
|
-
/** Sizes of the slice's colon dimensions, in source order. */
|
|
80
|
-
sliceShape: number[];
|
|
81
|
-
/** Indices into `template` where colon slots live, in source order. */
|
|
82
|
-
colonPositions: number[];
|
|
83
|
-
}
|
|
84
|
-
export interface LowerCtx {
|
|
85
|
-
env: TypeEnv;
|
|
86
|
-
localVars: Set<string>;
|
|
87
|
-
params: Set<string>;
|
|
88
|
-
/** First bail reason encountered during lowering; lets callers surface
|
|
89
|
-
* a hint for why JS-JIT declined a function (purely diagnostic, only
|
|
90
|
-
* consulted by the `NUMBL_LOG_CJIT_MISSES` tally). Writes should use
|
|
91
|
-
* `setBailReason()` which is idempotent — only the first reason sticks. */
|
|
92
|
-
bailReason?: string;
|
|
93
|
-
bailLine?: number;
|
|
94
|
-
/** Type of the deepest expr whose lowering was attempted — used as a
|
|
95
|
-
* last-resort bail reason hint when no more specific reason was set. */
|
|
96
|
-
lastExprType?: string;
|
|
97
|
-
lastExprLine?: number;
|
|
98
|
-
/** Variables that are actually assigned in the function body. */
|
|
99
|
-
assignedVars: Set<string>;
|
|
100
|
-
/**
|
|
101
|
-
* Map from a MATLAB local name to its slice alias, if any. A name is
|
|
102
|
-
* present here iff the most recent assignment to it was a whole-tensor
|
|
103
|
-
* colon slice. Reads of the name as a plain Ident bail; reads of
|
|
104
|
-
* `name(...)` substitute through the template and emit a direct scalar
|
|
105
|
-
* read of the base tensor. See `tryLowerAsSliceBind`.
|
|
106
|
-
*/
|
|
107
|
-
sliceAliases: Map<string, SliceAlias>;
|
|
108
|
-
_hasTensorOps?: boolean;
|
|
109
|
-
interp?: Interpreter;
|
|
110
|
-
/** The nargout this specialization was requested with — inlined wherever
|
|
111
|
-
* the body reads the `nargout` identifier, since the JIT specializes per
|
|
112
|
-
* nargout already. */
|
|
113
|
-
nargout?: number;
|
|
114
|
-
generatedFns: Map<string, string>;
|
|
115
|
-
generatedIRBodies: Map<string, GeneratedFn>;
|
|
116
|
-
loweringInProgress: Set<string>;
|
|
117
|
-
/** Pre-built line break table for offset→line lookup. */
|
|
118
|
-
lineTable?: number[];
|
|
119
|
-
}
|
|
120
|
-
/** Idempotent bail-reason setter. Only the first reason per function sticks. */
|
|
121
|
-
export declare function setBailReason(ctx: LowerCtx, reason: string, line?: number): void;
|
|
122
|
-
export declare function lowerFunction(fn: FunctionDef, argTypes: JitType[], nargout: number, interp?: Interpreter, generatedFns?: Map<string, string>, loweringInProgress?: Set<string>, generatedIRBodies?: Map<string, GeneratedFn>): LoweringResult | null;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expression lowering for the JIT. Paired with jitLowerStmt.ts; the two
|
|
3
|
-
* sides are mutually recursive (stmt bodies contain exprs; function-call
|
|
4
|
-
* exprs may trigger nested lowering of a callee's body). jitLower.ts is
|
|
5
|
-
* the orchestrator that ties them together via LowerCtx + lowerFunction.
|
|
6
|
-
*/
|
|
7
|
-
import type { Expr } from "../parser/types.js";
|
|
8
|
-
import { type JitExpr } from "./jitTypes.js";
|
|
9
|
-
import type { LowerCtx } from "./jitLower.js";
|
|
10
|
-
export declare function lowerExpr(ctx: LowerCtx, expr: Expr): JitExpr | null;
|
|
11
|
-
/**
|
|
12
|
-
* Stage 21: lower `src(a:b)` on a real-tensor base into a
|
|
13
|
-
* `RangeSliceRead` IR node producing a fresh column-vector tensor.
|
|
14
|
-
*
|
|
15
|
-
* Accepts `Range` with no step (default step 1). `start` and `end`
|
|
16
|
-
* must lower to numeric/boolean scalar exprs. The result is a real
|
|
17
|
-
* tensor with shape `[?, 1]` — the exact length is runtime-dependent.
|
|
18
|
-
*
|
|
19
|
-
* Caller responsibility: match the parent expression shape
|
|
20
|
-
* `Index(Ident(src), [Range])` or `FuncCall(src, [Range])` before
|
|
21
|
-
* calling. Returns null if the source isn't a real tensor or the
|
|
22
|
-
* range isn't the expected shape.
|
|
23
|
-
*/
|
|
24
|
-
export declare function tryLowerRangeSliceRead(ctx: LowerCtx, baseName: string, rangeExpr: Expr): JitExpr | null;
|
|
25
|
-
export declare function lowerIBuiltinCall(ctx: LowerCtx, expr: Expr & {
|
|
26
|
-
type: "FuncCall";
|
|
27
|
-
}): JitExpr | null;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Statement lowering for the JIT. Paired with jitLowerExpr.ts; the two
|
|
3
|
-
* sides are mutually recursive. jitLower.ts is the orchestrator that ties
|
|
4
|
-
* them together via LowerCtx + lowerFunction.
|
|
5
|
-
*/
|
|
6
|
-
import type { Stmt } from "../parser/types.js";
|
|
7
|
-
import { type JitStmt } from "./jitTypes.js";
|
|
8
|
-
import type { LowerCtx } from "./jitLower.js";
|
|
9
|
-
export declare function lowerStmts(ctx: LowerCtx, stmts: Stmt[]): JitStmt[] | null;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type-level helpers for the JIT lowering pass.
|
|
3
|
-
*
|
|
4
|
-
* Pure functions for:
|
|
5
|
-
* - Sign algebra (how signs combine through arithmetic)
|
|
6
|
-
* - Binary/unary operation result type inference
|
|
7
|
-
* - Type environment management (clone, merge, equality)
|
|
8
|
-
* - Known MATLAB constants
|
|
9
|
-
*
|
|
10
|
-
* These have no dependency on LowerCtx or the lowering state.
|
|
11
|
-
*/
|
|
12
|
-
import { BinaryOperation, UnaryOperation } from "../parser/types.js";
|
|
13
|
-
import { type JitExpr, type JitType, type SignCategory } from "./jitTypes.js";
|
|
14
|
-
export declare const KNOWN_CONSTANTS: Record<string, number>;
|
|
15
|
-
export type TypeEnv = Map<string, JitType>;
|
|
16
|
-
export declare function cloneEnv(env: TypeEnv): TypeEnv;
|
|
17
|
-
/** Merge two type environments at a join point. Returns null if any type becomes unknown. */
|
|
18
|
-
export declare function mergeEnvs(a: TypeEnv, b: TypeEnv): TypeEnv | null;
|
|
19
|
-
/** Check if two type environments are identical (by JSON comparison). */
|
|
20
|
-
export declare function envsEqual(a: TypeEnv, b: TypeEnv): boolean;
|
|
21
|
-
export declare function addSigns(a: SignCategory, b: SignCategory): SignCategory | undefined;
|
|
22
|
-
export declare function mulSigns(a: SignCategory, b: SignCategory): SignCategory | undefined;
|
|
23
|
-
export declare function combineSigns(a: SignCategory | undefined, b: SignCategory | undefined, op: BinaryOperation): SignCategory | undefined;
|
|
24
|
-
export declare function binaryResultType(op: BinaryOperation, left: JitType, right: JitType,
|
|
25
|
-
/** Lowered operand exprs. Optional because tests / older callers pass
|
|
26
|
-
* only types. When provided, enables structural nonneg detection for
|
|
27
|
-
* patterns like `x .* x` that the type-only path can't see. */
|
|
28
|
-
leftExpr?: JitExpr, rightExpr?: JitExpr): JitType | null;
|
|
29
|
-
export declare function unaryResultType(op: UnaryOperation, operand: JitType): JitType | null;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JIT compilation for the top-level script body (the main workspace).
|
|
3
|
-
*
|
|
4
|
-
* Wraps the list of non-function, non-classdef statements of a script as
|
|
5
|
-
* a synthetic `FunctionDef` whose parameters are the live-in env vars
|
|
6
|
-
* and whose outputs are every variable assigned in the script. On
|
|
7
|
-
* success the compiled code runs once and all output values are written
|
|
8
|
-
* back to the interpreter's workspace env.
|
|
9
|
-
*
|
|
10
|
-
* Mirrors `tryJitLoop` in jitLoop.ts — same lowering, same JS/C backend
|
|
11
|
-
* pipeline, same progressive type widening. The differences:
|
|
12
|
-
* - the synthetic body is the list of stmts directly, not a single For/While
|
|
13
|
-
* - every assigned variable is live-out (the whole workspace is live)
|
|
14
|
-
* - cache key is per-Interpreter (a single script AST per interp run)
|
|
15
|
-
*/
|
|
16
|
-
import type { Interpreter } from "../interpreter/interpreter.js";
|
|
17
|
-
import type { Stmt } from "../parser/types.js";
|
|
18
|
-
/**
|
|
19
|
-
* Attempt to JIT-compile and execute the top-level script body.
|
|
20
|
-
* Returns true if JIT succeeded, false to fall back to interpretation.
|
|
21
|
-
*/
|
|
22
|
-
export declare function tryJitTopLevel(interp: Interpreter, stmts: Stmt[]): boolean;
|