You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`_emit_inference_svm` — RBF kernel (`exp(-γ·‖x−sv‖²)`) or linear kernel, with `tanh` post-transform
31
+
- All outputs are bounded to `n_outputs` to prevent any buffer overflow
32
+
-**Embedded deployment profiles** — `TargetSpec.for_embedded(profile)` selects cross-compilation toolchains for four targets; the Makefile emitted by `C99Emitter` switches automatically:
- No `-fPIC` or `-shared` flags on embedded targets; produces `.a` static libraries instead of `.so`
38
+
-**LLVM IR backend** (`timber/codegen/llvm_ir.py`) — new `LLVMIREmitter` supporting `TreeEnsembleStage`, `LinearStage`, and `SVMStage`; configurable target triple (`x86_64`, `aarch64`, `cortex-m4`, …); produces `model.ll` with SSA form, named `traverse_tree_N` per-tree functions, and the `timber_infer_single` entry point
-`--iters N` flag for total timed iterations (default: 1 000)
49
+
- P50 / P95 / P99 / P999 latency percentiles
50
+
- Coefficient of variation (CV%) as a stability indicator
51
+
-`--report PATH` writes a structured JSON report *and* a self-contained HTML file (no external dependencies) with a sortable results table and system-info block
52
+
-`_bench_report_html()` helper for programmatic HTML generation
53
+
-**Nuclear-grade test suite** (`tests/test_nuclear.py`) — 139 new tests (436 total passing) covering: IR layer, sklearn/ONNX parsers, numeric accuracy (C99 vs Python IR), all optimizer passes + idempotency + pipeline fusion math verification, diff compiler, C99/WASM/MISRA-C/LLVM IR emitters, differential privacy statistical correctness, and full end-to-end pipelines
-**Binary ONNX `LinearClassifier` double weight row** — `skl2onnx` emits both class rows for binary models; parser now extracts only the positive-class row and sets `multi_weights = False`, fixing incorrect weight counts and index misalignment
59
+
-**C99 buffer overflow guard** — `multi_weights = True` softmax loop now bounded by `n_outputs` (not `n_classes`), preventing out-of-bounds writes when the output buffer is smaller than the number of internal score slots
60
+
61
+
### Changed
62
+
63
+
- ONNX supported-operator list expanded from `TreeEnsemble{Classifier,Regressor}` to include `LinearClassifier`, `LinearRegressor`, `SVMClassifier`, `SVMRegressor`, `Normalizer`, `ZipMap`, `Scaler`
Copy file name to clipboardExpand all lines: README.md
+23-17Lines changed: 23 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@
23
23
24
24
---
25
25
26
-
Timber takes a trained tree-based model — XGBoost, LightGBM, scikit-learn, CatBoost, or ONNX — runs it through a multi-pass optimizing compiler, and emits a **self-contained C99 inference binary** with zero runtime dependencies. A built-in HTTP server (Ollama-compatible API) lets you serve any model — local file or remote URL — in one command.
26
+
Timber takes a trained ML model — XGBoost, LightGBM, scikit-learn, CatBoost, or ONNX (tree ensembles, linear models, SVMs) — runs it through a multi-pass optimizing compiler, and emits a **self-contained C99 inference artifact** with zero runtime dependencies. A built-in HTTP server (Ollama-compatible API) lets you serve any model — local file or remote URL — in one command.
27
27
28
28
> **~2 µs single-sample inference · ~336× faster than Python XGBoost · ~48 KB artifact · zero runtime dependencies**
|**Formats**| 5 | Each framework only | ONNX only | GBDTs | LightGBM only |
221
+
|**Formats**| 5 (trees + linear + SVM) | Each framework only | ONNX only | GBDTs | LightGBM only |
222
222
|**C export**| Yes (C99) | No | No | Yes | No |
223
-
|**Edge / embedded**| Yes | No | Partial | Partial | No |
224
-
|**Audit / MISRA**| Roadmap | No | No | No | No |
223
+
|**LLVM IR export**| Yes | No | No | No | No |
224
+
|**Edge / embedded**| Yes (Cortex-M4/M33, RISC-V) | No | Partial | Partial | No |
225
+
|**MISRA-C output**| Yes | No | No | No | No |
226
+
|**Differential privacy**| Yes | No | No | No | No |
225
227
226
228
---
227
229
@@ -284,12 +286,13 @@ Each script trains a model, saves it, runs `timber load`, and validates predicti
284
286
285
287
## Limitations
286
288
287
-
-**ONNX** — currently supports `TreeEnsembleClassifier` / `TreeEnsembleRegressor`operators only
289
+
-**ONNX** — supports `TreeEnsemble`, `LinearClassifier/Regressor`, `SVMClassifier/Regressor`, `Normalizer`, `Scaler`; other operators (e.g., neural network layers) are not yet supported
288
290
-**CatBoost** — requires JSON export (`save_model(..., format='json')`); native binary format not supported
289
291
-**scikit-learn** — major estimators and `Pipeline` wrappers are supported; uncommon custom estimators may require a custom front-end
290
292
-**Pickle** — follow standard pickle security hygiene; only load artifacts from trusted sources
291
293
-**XGBoost** — JSON model format is the primary path; binary booster format is not supported
292
-
-**MISRA-C / safety certification** — deterministic output is guaranteed but formal MISRA-C compliance is on the roadmap, not yet certified
294
+
-**LLVM IR** — currently emitted as text (`.ll`); requires a local LLVM/Clang installation to produce native code from it
295
+
-**MISRA-C** — the built-in compliance checker covers the rules most relevant to generated code; it is not a substitute for a certified static analysis tool
293
296
294
297
---
295
298
@@ -300,15 +303,18 @@ Each script trains a model, saves it, runs `timber load`, and validates predicti
The test suite covers parsers, IR, optimizer passes, C99 emission, WebAssembly emission, numerical accuracy (± 1e-4), and end-to-end compilation for all supported frameworks.
331
+
The test suite covers: parsers (sklearn, ONNX, XGBoost, LightGBM, CatBoost), IR layer (serialization, deep_copy, all stage types), optimizer passes (correctness, idempotency, pipeline fusion math), C99/WASM/MISRA-C/LLVM IR emitters (compile + numeric accuracy), differential privacy (statistical correctness, all dtypes), and full end-to-end pipelines.
326
332
327
333
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the full development guide.
0 commit comments