Skip to content

Tessero 0.2.0

Current stable · released 2026-09-26

Added

  • Native extension ext-tessero (Tessero\Ext\NDArray, Engine, Operand):
    • Arrays: operators + - * / ** %, slicing via $a['…'], boolean masks and integer-list indexing, foreach (native iterator), count(), clone, ==.
    • Serialisation: json_encode/toJson() (byte-identical to json_encode with JSON_PRESERVE_ZERO_FRACTION), serialize().
    • Maths: reductions along one axis, matmul, sort, where.
    • Engine: linprog, milp, MDP solvers, FFT and NumPy-identical random/normal/integers.
    • INI settings tessero.threads, tessero.memory_budget, tessero.epsilon, re-applied at every request start.
    • Kernel symbols are kept private (visibility + linker version script), so the extension coexists with the FFI library.
  • Linear and mixed-integer programming in C: Optimize\LinearProgramming::linprog/milp with SciPy conventions (bounds, status codes, marginals), LinprogResult, MilpResult::gap().
  • Markov decision processes in C: Mdp\MarkovDecisionProcess with fromDense, fromSparse, fromTransitions, valueIteration, policyIteration (exact or modified), evaluate, qValues, finiteHorizon, simulate.
  • OpenMP threads for large element-wise kernels and MDP sweeps (Tessero::setThreads, Engine::setMaxThreads). Results are identical for any thread count.
  • tsr_array metadata in the ABI with a C slice parser, broadcasting helpers and a JSON writer. NDArray::sliceNative(), toJson(), meta(), __serialize/__unserialize.
  • tsr_reduce_mid (fast reductions along non-last axes), tsr_cumulative, tsr_pcg64_shuffle, error codes -6, -7, -8.
  • Laravel package tessero/laravel: service provider, Tessero facade, AsNDArray/TensorCast Eloquent casts (JSON or exact binary), NumericArray validation rule, response()->ndarray(), tessero:doctor, settings re-applied per Octane request/task and queued job.
  • tessero info --json. tessero doctor reports the kernel, SIMD, OpenMP and the extension.
  • Documentation site (MkDocs): user guide, operations manual (deployment, configuration, memory and threads, monitoring, troubleshooting, runbooks, security, upgrading, Docker), architecture (kernel, memory model, bindings, numerical methods, solvers, testing, 8 ADRs), generated API reference, C ABI and error codes. tests/docs/examples.php checks the numbers in the guides.
  • Project files: CONTRIBUTING.md, GOVERNANCE.md, CODE_OF_CONDUCT.md, SECURITY.md, RELEASING.md, MAINTAINERS.md.
  • Reference Docker image (docker/Dockerfile).
  • Benchmarks for linprog and MDP solvers.

Changed

  • NDArray extends Tessero\Internal\OperandBase, which is Tessero\Ext\Operand when the extension is loaded, so FFI arrays gain operators.
  • NDArray constructor-promoted properties are no longer readonly (needed by __unserialize).
  • LP/MILP workspaces are allocated with tsr_alloc and count against the memory budget.
  • MILP reports status 1 (limit) instead of pruning a subtree whose relaxation hit the iteration limit or numerical trouble, and stops with an error on out-of-memory instead of pruning.

Fixed

  • Signed integer overflow in int cumulative products, sums, products and int64 matmul is now defined two's-complement wrap-around (was UB, flagged by UBSan).
  • Nelder-Mead produced wrong iterates under opcache.jit=function (PHP JIT miscompile; the loop counter now lives in a property; see docs/project/upstream-bugs.md, issue 4).
  • Stacked Linalg::det/slogdet could return a wrong value under opcache.jit=tracing after a long warm-up (PHP JIT defect, not yet isolated). LAPACK pivots are now copied out of CData in one call (issue 5).

Security

  • LP/MILP reject NaN/±INF in c, A, b (and NaN bounds) instead of returning undefined results.
  • MDP constructors and extension solvers reject non-finite rewards and probabilities and malformed CSR input (indptr not starting at 0, decreasing, or pointing past the data), which could previously read out of bounds in the extension.

Removed

  • The operator-only extension tessero_ops (replaced by ext-tessero).

Verification record

Run on the reference machine (Linux x86-64, 2 cores, AVX-512, GCC, PHP 8.4.21 NTS, NumPy 2.4.4, SciPy 1.17.1):

  • C: 173 checks, optimised and under ASan + UBSan.
  • FFI package: unit, numerics, solvers, parity (258 cases) and fuzz (300) suites, with the JIT off, function and tracing.
  • Extension: 10 phpt files and the extension parity suite (439 run, 26 FFI-only skipped), also under ASan + UBSan.
  • Laravel bridge tests on both backends. Documentation examples. FPM preload e2e.
  • Not run here (no network access to GitHub/Packagist, no container daemon): the CI matrix on other platforms and PHP versions, the service provider inside a real Laravel application, and the Docker image build.

Edit this page on GitHub