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
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,4 +57,4 @@ This file helps AI agents discover and understand how to work with this reposito
57
57
- Added `scripts/ternary_quantization_benchmark.py` plus `BENCHMARKS.md` so contributors can reproduce a Fashion-MNIST FP32/PTQ/QAT benchmark and log accuracy/latency/storage for each mode; README now links the benchmark doc.
58
58
- Rewrote `pyproject.toml` with valid TOML sections so editable installs (and `pip install -e '.[torch]'`) can parse the metadata cleanly before building the extension.
59
59
- Restructured `README.md` into a onboarding-focused front door and added companion docs (`docs/use-cases.md`, `docs/hardware.md`, `docs/api-overview.md`, `docs/python-install.md`, `docs/torch.md`, `examples/README.md`) so heavy reference material lives outside the visitor-facing overview.
60
-
- Added optional CUDA/ROCm toggles plus a GPU dispatcher sketch (`include/t81/linalg/gemm_gpu.hpp`, `src/linalg/{gemm_cuda.cu,gemm_dispatch.cpp,gemm_rocm.cpp}`) so future teams can wire the new `where`/`clamp`/`lerp`/`addcmul` helpers into GPU kernels, and expanded `python/bindings.cpp` + `tests/python/test_gpu_ops.py` to expose and exercise the new APIs.
60
+
- Added optional CUDA/ROCm toggles plus a GPU dispatcher sketch (`include/t81/linalg/gemm_gpu.hpp`, `src/linalg/{gemm_cuda.cu,gemm_dispatch.cpp,gemm_rocm.cpp}`) so future teams can wire the new `where`/`clamp`/`lerp`/`addcmul` helpers into GPU kernels, introduced `t81::TensorMetadata` + Python helpers (`python/bindings.cpp`) that extract metadata from NumPy/Torch tensors, and expanded `tests/python/test_gpu_ops.py` to cover the metadata-backed bindings on both CPU and GPU paths.
`pip install .[torch]` unlocks the `t81lib`/`t81` namespace, NumPy quantization helpers, and the `t81.torch`/`t81.nn` layers that mix ternary weights with FP32/BF16 biases. Jump deeper via [docs/python-api.md](docs/python-api.md), [docs/python-cookbook.md](docs/python-cookbook.md), and [docs/torch.md](docs/torch.md).
99
99
100
+
## GPU backends & tensor metadata
101
+
102
+
Enable CUDA/ROCm through the optional `-DUSE_CUDA=ON` and `-DUSE_ROCM=ON` flags during CMake configuration so the Python bindings link against the new GPU kernels (`python/CMakeLists.txt`). Once enabled, `t81lib.where`, `t81lib.clamp`, `t81lib.lerp`, and `t81lib.addcmul` accept either NumPy buffers or PyTorch tensors and route the work directly to CUDA/HIP kernels via the lightweight [`t81::TensorMetadata`](include/t81/tensor_metadata.hpp) ABI. The metadata struct carries device/dtype/shape/stride info plus raw `data_ptr`, letting the dispatcher avoid host copies and keep outputs on-device. When torch is installed, `t81lib` automatically wraps GPU tensors; when only NumPy is available it falls back to CPU buffers. Consult [docs/torch.md](docs/torch.md) and `python/bindings.cpp` for the extraction helpers and lifetime semantics.
103
+
100
104
## CLI helpers
101
105
102
106
`t81-convert`, `t81-gguf`, and `t81-qat` automate quantize→export→train flows with progress reporting and validation hooks. 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.
Copy file name to clipboardExpand all lines: docs/ROADMAP.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,16 @@ The codebase is thoughtfully commented, consistently formatted by `clang-format`
96
96
2. Create a `scripts/` benchmark script that trains the model, applies `t81` quantization, and logs accuracy, model size, and latency.
97
97
3. Document the benchmark/results in a new `BENCHMARKS.md` (link from `README.md`) so the community can reproduce and compare.
98
98
99
+
### Recommendation 5: Harden the GPU Tensor Metadata Path
100
+
101
+
***Why**: GPU acceleration for ternary ops unlocks real inference speedups only if the dispatcher can safely read raw device pointers and keep outputs on-device, and the Python bindings need a stable contract (TensorMetadata) to wrap Torch/NumPy tensors the same way.
102
+
***Benefits**: Enables CUDA/ROCm kernels (where/clamp/lerp/addcmul) to run without host copies, makes GPU/CPU fallbacks explicit, and gives PyTorch users a predictable ABI.
103
+
***Effort**: Medium.
104
+
***Implementation**:
105
+
1. Continue documenting the `t81::TensorMetadata` ABI (`device_type`, `dtype`, `sizes`, `strides`, `data_ptr`, `storage_offset`, `requires_sync`) so future kernels and Python helpers rely on the same struct.
106
+
2. Expand the dispatcher to record broadcasting/non-contiguous layouts (or copy them to contiguous buffers when needed) so `backend_available == CUDA/ROCm` paths no longer require perfect contiguity.
107
+
3. Run the CUDA 12.4 / ROCm 6+ CI jobs, validate the latency/accuracy guardrails in `tests/python/test_gpu_ops.py`, and flag any ABI mismatches between `torch.Tensor` and `TensorMetadata` so the GPU helpers can be certified before release.
108
+
99
109
---
100
110
101
111
The above roadmap tightly ties into the existing structure (`docs/`, `scripts/`, CLI helpers) while making the project more approachable, ensuring quality, highlighting the Python story, and showcasing real-world value through benchmarks.
0 commit comments