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
Copy file name to clipboardExpand all lines: AGENTS.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,3 +62,4 @@ This file helps AI agents discover and understand how to work with this reposito
62
62
- Enhanced `tests/python/test_gguf.py` with quant-parameterized round-trip checks, metadata assertions, and a regression case for invalid quant identifiers to spotlight the GGUF helpers before future agents touch them.
63
63
- Hardened the SIMD detection helpers in `include/t81/core/detail/simd.hpp` with CPUID/xgetbv fallbacks, documented the `add_trytes_*` overflow semantics, and made NEON runtime checks opt-out via `T81_DISABLE_NEON`.
64
64
- Added the `compression-first` GGUF export profile (metadata + CLI flags), plus `scripts/gguf_benchmark.py` and CLI docs that walk FP16 to ternary GGUF before/after measurements.
65
+
- Added `examples/ternary_phi3_ptq_qat_demo.ipynb` to showcase Phi-3-mini PTQ/QAT size, latency, and perplexity comparisons in one compact notebook.
Copy file name to clipboardExpand all lines: DEVELOPMENT.md
+56-8Lines changed: 56 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
#Developer Onboarding Guide
1
+
#Developer Onboarding Guide
2
2
3
3
This project already boasts extensive documentation (`README.md`, `docs/index.md`, `AGENTS.md`, `docs/ROADMAP.md`), but this guide focuses on the concrete steps a new contributor needs to take so they can build, test, and iterate quickly.
4
4
@@ -11,15 +11,43 @@ cd t81lib
11
11
12
12
The repository uses CMake for every build target, so keep a spare build directory for each configuration (e.g., `build`, `build-python`).
`run-tests.sh` (located in the repo root) configures CMake with `-DT81LIB_BUILD_TESTS=ON`, builds the default targets, and runs `ctest`. The script respects the `BUILD_DIR` environment variable, so you can run `BUILD_DIR=build-debug ./run-tests.sh` if you want a custom path.
21
49
22
-
## 3. Python bindings
50
+
## 4. Python bindings
23
51
24
52
```bash
25
53
./build-python.sh
@@ -37,19 +65,39 @@ pipx ensurepath
37
65
38
66
The console scripts `t81-convert`, `t81-gguf`, and `t81-qat` become available after the pipx installation.
39
67
40
-
## 4. CLI helpers
68
+
## 5. Common workflows
69
+
70
+
Use the scripts in the repo root for the most common tasks:
71
+
72
+
```bash
73
+
# clean configure + build + ctest
74
+
./run-tests.sh
75
+
76
+
# configure + build the pybind11 module
77
+
./build-python.sh
78
+
79
+
# custom build dir
80
+
BUILD_DIR=build-debug ./run-tests.sh
81
+
```
82
+
83
+
Expected outputs:
84
+
85
+
-`run-tests.sh` prints the CMake configure summary, build steps, and `ctest` results.
86
+
-`build-python.sh` emits the binding target and leaves the extension module in the build dir.
87
+
88
+
## 6. CLI helpers
41
89
42
90
All CLI workflow documentation lives in `docs/references/cli-usage.md`, and the Mermaid diagrams are in `docs/diagrams/cli-workflows-mermaid.md`. Consult those docs for flag explanations, input requirements, and usage examples before writing CLI-focused contributions.
43
91
44
-
## 5. Documentation & roadmap
92
+
## 7. Documentation & roadmap
45
93
46
94
If you're updating architecture or proposing a major change, refer to `docs/ROADMAP.md` for the current vision and the recommended initiatives that maintainers are tracking. Document your work in the nearest relevant doc (README, docs/index, AGENTS, etc.).
47
95
48
-
## 6. Developer container
96
+
## 8. Developer container
49
97
50
-
VS Code users can open this repo in the configured `.devcontainer`to get a reproducible environment with CMake, Ninja, Clang, Python, and pipx pre-installed. After opening the folder, select **Reopen in Container** and let VS Code build the container once.
98
+
Preferred setup is a native local toolchain. Use the `.devcontainer`only if you need a fully reproducible VS Code + Docker environment with CMake, Ninja, Clang, Python, and pipx pre-installed. After opening the folder in VS Code, select **Reopen in Container** and let the container build once.
51
99
52
-
## 7. Additional tips
100
+
## 9. Additional tips
53
101
54
102
* Keep your changes small and test locally before opening a PR.
55
103
* Run `clang-format` on files you touch (see `.clang-format` for the style configuration).
# -> Runs 2-4x faster on CPU than FP16 with packed ternary kernels
37
+
38
+
Next steps: `t8.nn.Linear` for drop-in layers, `t8.convert`/`t8.gguf` for programmatic conversion, and `t81 convert`/`t81 gguf` for CLI flows.
39
+
17
40
## Minimum viable success
18
41
19
42
```cpp
@@ -121,7 +144,7 @@ Optional CUDA/ROCm backends can be enabled with `-DUSE_CUDA=ON` / `-DUSE_ROCM=ON
121
144
122
145
## CLI helpers
123
146
124
-
`t81 convert`, `t81 gguf`, `t81 info`, and `t81-qat` automate quantize→export→train flows with progress reporting and validation hooks (the legacy `t81-convert`/`t81-gguf` names still work). Browse [docs/references/cli-usage.md](docs/references/cli-usage.md), [docs/diagrams/cli-workflows-mermaid.md](docs/diagrams/cli-workflows-mermaid.md), and [examples/cli-examples.md](examples/cli-examples.md) for recipes.
147
+
`t81 convert`, `t81 gguf`, `t81 info`, and `t81-qat` automate quantize→export→train flows with progress reporting and validation hooks (the legacy `t81-convert`/`t81-gguf` names still work). Note: both `t81 convert` (new) and `t81-convert` (legacy) are available for backward compatibility. Browse [docs/references/cli-usage.md](docs/references/cli-usage.md), [docs/diagrams/cli-workflows-mermaid.md](docs/diagrams/cli-workflows-mermaid.md), and [examples/cli-examples.md](examples/cli-examples.md) for recipes.
125
148
126
149
### Large models & GGUF streaming
127
150
@@ -153,7 +176,7 @@ For a zero-disk workaround you can also dequantize on the fly (via `t81.dequanti
153
176
- Deterministic numerics and research-grade arithmetic built atop the same core.
154
177
- Ternary hardware simulation and energy modeling (see [docs/hardware.md](docs/hardware.md)).
155
178
156
-
See [docs/use-cases.md](docs/use-cases.md) for demos, notebooks, and experiments that spotlight these flows.
179
+
See [Use Cases & Demos](docs/use-cases.md) for real-world workflows, including the Phi-3-mini ternary notebook.
Copy file name to clipboardExpand all lines: docs/ROADMAP.md
+21-11Lines changed: 21 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,35 +56,45 @@ The codebase is thoughtfully commented, consistently formatted by `clang-format`
56
56
57
57
## 3. Next Steps Recommendations
58
58
59
+
### Progress update (2024)
60
+
61
+
Recent work has delivered parts of this roadmap:
62
+
63
+
***Recommendation 1** — quickstart matrix + common workflows added to `DEVELOPMENT.md`.
64
+
***Recommendation 2** — CI matrix expanded for OS/build types and SIMD guards; Python tests standardized on Linux.
65
+
***Recommendation 3** — Python entry-points table added to `docs/python-api.md` and `docs/python-cookbook.md`, with links from `docs/index.md`.
66
+
67
+
Remaining items are listed below with the next steps still required.
68
+
59
69
### Recommendation 1: Streamline the Developer Onboarding Experience
60
70
61
71
***Why**: New contributors struggle with CMake options, Python extras, and building bindings.
62
72
***Benefits**: Faster first-time builds, fewer setup questions, more contributions.
63
73
***Effort**: Medium.
64
74
***Implementation**:
65
-
1.Add`DEVELOPMENT.md` with step-by-step instructions (clone, configure with `T81LIB_BUILD_PYTHON_BINDINGS`, `pipx` options, CLI usage).
66
-
2.Provide helper scripts or Makefile targets (`run-tests.sh`, `build-python.sh`) that wrap the most common commands.
67
-
3.Deliver a `.devcontainer`(VS Code + Docker) to let contributors spin up a configured environment without manual dependency juggling.
75
+
1.Expand`DEVELOPMENT.md` with a quickstart matrix (CMake-only vs. bindings vs. torch extras) and explicit `T81LIB_BUILD_PYTHON_BINDINGS` examples. **Done.**
76
+
2.Add a short "common workflows" section that references `run-tests.sh` and `build-python.sh`, plus expected outputs/flags. **Done.**
77
+
3.Decide whether a `.devcontainer`is still needed or document the current preferred local setup to avoid duplicate paths. **Done.**
68
78
69
79
### Recommendation 2: Expand CI and Code Quality Automation
70
80
71
81
***Why**: The existing CI could do more to prevent regressions and enforce style across languages.
72
82
***Benefits**: Higher confidence in main, earlier detection of regressions, better cross-platform coverage.
73
83
***Effort**: Medium.
74
84
***Implementation**:
75
-
1. Extend `.github/workflows/ci.yml` with a build matrix (GCC/Clang, binding vs. minimal configuration, AVX vs. scalar) and run both C++ and Python test suites.
76
-
2. Add format/lint steps (`clang-format` check, `ruff`/`black` for Python) to gate style.
77
-
3. Publish coverage/artifacts (e.g., via Codecov or GHA artifacts) so maintainers can monitor test completeness.
85
+
1. Extend `.github/workflows/ci.yml` with a richer build matrix (GCC/Clang, bindings vs. minimal configuration, AVX vs. scalar) and run both C++ and Python test suites.**Done (matrix + SIMD guard updates).**
86
+
2. Add format/lint steps (`clang-format` check, `ruff`/`black` for Python) to gate style.**Done.**
87
+
3. Publish coverage/artifacts (e.g., via Codecov or GHA artifacts) so maintainers can monitor test completeness.**Done (coverage artifact upload).**
78
88
79
89
### Recommendation 3: Unify and Document the Python API Surface
80
90
81
91
***Why**: Python users currently discover helpers across `t81lib`, `t81`, and CLI docs.
82
92
***Benefits**: Easier discoverability, faster adoption, clearer path from C++ bindings to Torch wrappers.
83
93
***Effort**: Low-Medium.
84
94
***Implementation**:
85
-
1.Integrate Sphinx or MkDocs into `docs/` to auto-generate Python API reference from docstrings and tie it to the existing docs site.
86
-
2.Add a “Python Cookbook” doc with recipes showing how to combine `t81lib.pack_dense_matrix`, `t81.torch.TernaryTensor`, and CLI helpers.
87
-
3.Consider re-exporting the binding objects via the higher-level `t81` module so users can `import t81` and access the full quantization stack.
95
+
1.Expand MkDocs coverage by generating the Python API reference via mkdocstrings and ensuring key modules are linked from `docs/index.md`. **Done (entry-point links + extra directives).**
96
+
2.Keep the “Python Cookbook” up to date with end-to-end recipes (bindings + `t81.torch` + CLI), and add a short "choose your entry point" table. **Done (entry points table).**
97
+
3.Validate that the `t81` re-exports stay in sync with `t81lib` bindings and add a quick API surface checklist. **Done (checklist added).**
88
98
89
99
### Recommendation 4: Introduce a Standardized Quantization-Aware Training Benchmark
90
100
@@ -93,8 +103,8 @@ The codebase is thoughtfully commented, consistently formatted by `clang-format`
93
103
***Effort**: High.
94
104
***Implementation**:
95
105
1. Define a benchmark (e.g., small BERT or ViT on GLUE/CIFAR subsets) with FP32, PTQ, and QAT runs.
96
-
2.Create a `scripts/` benchmark script that trains the model, applies `t81` quantization, and logs accuracy, model size, and latency.
97
-
3.Document the benchmark/results in a new `BENCHMARKS.md`(link from `README.md`) so the community can reproduce and compare.
106
+
2.Extend the existing `scripts/` benchmark tooling to log accuracy, model size, and latency in a standardized JSON schema.
107
+
3.Update `BENCHMARKS.md`with reproducible baseline results and link the dataset/model artifacts used for comparisons.
98
108
99
109
### Recommendation 5: Harden the GPU Tensor Metadata Path
From here: `t8.nn.Linear` for drop-in layers, `t8.convert`/`t8.gguf` for scripted conversion, and `t81 convert`/`t81 gguf` for CLI workflows.
35
+
10
36
## Core resources
11
37
12
38
-**Landing & Quick Start** — [`README.md`](../README.md) contains the hero content, badges, and a comprehensive quick
@@ -22,6 +48,7 @@ to understand the balanced ternary engine without digging through specs immediat
22
48
[`examples/ternary_sparse_preview.py`](../examples/ternary_sparse_preview.py) for runnable workflows.
23
49
-**Python API reference** — [`docs/python-api.md`](python-api.md) lays out how MkDocs plus `mkdocstrings` auto-generate the binding reference.
24
50
-**Python cookbook** — [`docs/python-cookbook.md`](python-cookbook.md) gathers recipes that mix `t81lib.pack_dense_matrix`, `t81.torch.TernaryTensor`, and the CLI helpers.
51
+
-**Python entry points** — [`docs/python-api.md`](python-api.md) and [`docs/python-cookbook.md`](python-cookbook.md) now include a quick table showing which module to import for each workflow.
-**PyTorch how-to** — [`docs/torch.md`](torch.md) walks through `t81.torch`, `t81.nn`, conversion helpers, and how the CLI scripts mirror the Python flows.
27
54
-**CLI reference** — [`docs/references/cli-usage.md`](references/cli-usage.md) lists the unified `t81 convert`/`t81 gguf` helpers (with legacy `t81-convert`/`t81-gguf` aliases) plus `t81-qat`
0 commit comments