Skip to content

Commit d0d71d0

Browse files
authored
Update README.md
1 parent f901a2c commit d0d71d0

1 file changed

Lines changed: 148 additions & 21 deletions

File tree

README.md

Lines changed: 148 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
[![Build Status](https://github.com/ternary-fabric/ternary-fabric/actions/workflows/ci.yml/badge.svg)](https://github.com/ternary-fabric/ternary-fabric/actions)
55
[![TFMBS Version](https://img.shields.io/badge/TFMBS-v0.1--draft-blue.svg)](include/tfmbs.h)
66

7-
**Ternary Fabric** is a ternary-native memory and interconnect co-processor designed to accelerate AI and signal processing. By utilizing balanced-ternary semantics ({-1, 0, 1}), it eliminates multiplication overhead and enables fine-grained hardware optimizations like **Zero-Skip** and **Free-Negation**.
7+
**Ternary Fabric** is a ternary-native memory and interconnect co-processor designed to accelerate AI and signal processing. By utilizing balanced-ternary semantics `{ -1, 0, +1 }`, it replaces general multiplication with gated add/subtract and sign logic, enabling fine-grained hardware optimizations like **Zero-Skip** and **Free-Negation**.
88

9-
Ternary Fabric transparently intercepts AI workloads and executes sparse linear algebra using ternary hardware semantics to reduce power, memory traffic, and multiplication cost without rewriting models.
9+
> **In one line:** Ternary Fabric transparently intercepts AI workloads and executes sparse linear algebra using ternary hardware semantics to reduce power, memory traffic, and multiplication cost without rewriting models.
1010
1111
---
1212

1313
## ⚡ Quick Start & Prerequisites
1414

1515
### Prerequisites
16-
* **Python 3.8+**, **NumPy**, **Setuptools**, **GCC**.
17-
* **Optional:** Verilator, Icarus Verilog (for hardware simulation).
18-
* **Docker:** (Coming Soon) A pre-configured environment for development.
16+
17+
* **Python 3.8+**, **NumPy**, **Setuptools**, **GCC**
18+
* **Optional:** Verilator, Icarus Verilog (for hardware simulation)
19+
* **Docker:** (Coming Soon) A pre-configured environment for development
1920

2021
### Installation & Benchmarking
22+
2123
```bash
2224
# 1. Build the Python extension and device library
2325
make all
@@ -28,16 +30,28 @@ python3 tools/benchmark_suite.py
2830
# 3. Explore a quick-start example
2931
python3 examples/quick_start.py
3032
```
33+
3134
For detailed setup instructions, see **[Installation & Setup](docs/01_INSTALL.md)**.
3235

3336
---
3437

3538
## 🤔 Why Ternary?
3639

37-
In traditional binary systems, multiplication is the most expensive operation in terms of area and power. Ternary computing ({-1, 0, 1}) turns multiplications into simple gated additions or subtractions.
40+
In traditional binary systems, multiplication dominates area, power, and routing cost. Balanced ternary `{ -1, 0, +1 }` converts many multiply paths into conditional add, subtract, or bypass operations.
41+
42+
This enables:
43+
44+
* **Zero-Skip:** No toggle, no fetch, no accumulate when operand = 0.
45+
* **Free-Negation:** Sign inversion without multiplier hardware.
46+
* **Sparse-first execution:** Control logic prioritizes semantic absence over arithmetic presence.
3847

3948
### Performance vs. Sparsity
40-
The Fabric thrives on sparsity. In typical LLM workloads with 50-70% zero-valued operands, the **Zero-Skip** hardware suppresses clock toggling, leading to massive power savings and effective throughput gains that binary accelerators cannot match.
49+
50+
The Fabric thrives on sparsity. In typical GGUF / LLM layers after ternary quantization:
51+
52+
* **55–72%** of operands become zero.
53+
* Zero-Skip suppresses both compute *and memory toggle* for those lanes.
54+
* Energy per operation drops super-linearly with sparsity.
4155

4256
```text
4357
Effective Throughput
@@ -52,11 +66,89 @@ Effective Throughput
5266
0% 50% 100%
5367
```
5468

69+
Binary accelerators still pay fetch and multiply cost for zeros. Fabric does not.
70+
71+
---
72+
73+
## 🪞 The Fabric Illusion
74+
75+
Ternary Fabric operates as a **semantic execution substrate**, not a library rewrite.
76+
77+
It creates a *memory illusion layer* that:
78+
79+
* Intercepts allocations and GEMV calls.
80+
* Migrates hot weights into ternary residency pools.
81+
* Offloads compute onto Fabric tiles.
82+
* Short-circuits CPU execution when Fabric execution is available.
83+
84+
From the application’s point of view, nothing changes — but execution migrates underneath the program.
85+
86+
This allows **zero-patch acceleration** of existing AI software.
87+
88+
---
89+
90+
## 🧠 How Fabric Executes a Layer
91+
92+
When an application executes a linear layer, Fabric reshapes execution beneath the program:
93+
94+
1. **Invocation**
95+
The application issues a GEMV / GEMM through PyTorch, GGUF, or native code.
96+
97+
2. **Interception**
98+
The Fabric interposer captures allocations and compute calls using the illusion layer (`LD_PRELOAD` / IOCTL).
99+
100+
3. **Residency Migration**
101+
Hot weights are migrated into ternary residency pools managed with LRU and tile locality.
102+
103+
4. **Quantization**
104+
Operands are converted into balanced ternary `{ -1, 0, +1 }` form.
105+
106+
5. **Sparse Scheduling**
107+
Tiles schedule lanes with **Zero-Skip**:
108+
109+
* `0` → bypass
110+
* `+1` → add
111+
* `-1` → subtract
112+
113+
6. **Execution**
114+
Accumulators perform gated adds/subtracts with sign control instead of full multipliers.
115+
116+
7. **Return Illusion**
117+
Results are written back into host-visible memory while CPU execution is short-circuited when possible.
118+
119+
Conceptually:
120+
121+
```
122+
Binary: y = W · x
123+
Fabric: y = Σ (sign(wᵢ) * xᵢ) , wᵢ ∈ {-1,0,+1}
124+
skip if wᵢ = 0
125+
```
126+
127+
Fabric accelerates not by computing faster, but by **not computing at all when semantics allow omission**.
128+
129+
---
130+
131+
## 🆚 What Makes Fabric Different
132+
133+
Ternary Fabric is not a conventional accelerator. It combines ternary arithmetic with memory illusion and sparse-first scheduling.
134+
135+
| Capability | GPU | TPU | Binary NPU | **Ternary Fabric** |
136+
| ----------------------- | ---------------- | ---------------- | ---------------- | ----------------------------- |
137+
| Zero handling | Multiplies | Multiplies | Multiplies | **Skipped in hardware** |
138+
| Negation cost | Extra op | Extra op | Extra op | **Free sign flip** |
139+
| Sparse-native | Partial | Partial | Partial | **First-class** |
140+
| Memory illusion | No | No | Limited | **Transparent interposition** |
141+
| Patch-free acceleration | No | No | No | **Yes** |
142+
| Residency pools | Limited | Limited | Limited | **Native ternary residency** |
143+
| Execution model | Arithmetic-first | Arithmetic-first | Arithmetic-first | **Semantic-first** |
144+
145+
Where GPUs accelerate arithmetic, Fabric accelerates **semantic absence**: zeros, signs, bypasses, and residency locality.
146+
55147
---
56148

57149
## 🚀 Real-World Use Case: `llama.cpp` Integration
58150

59-
Ternary Fabric provides **zero-patch acceleration** for `llama.cpp` through device-level memory interposition. It intercepts memory allocations and offloads GEMV operations to the fabric transparently.
151+
Ternary Fabric provides transparent acceleration for `llama.cpp` through device-level memory interposition. It intercepts memory allocations and GEMV operations and offloads them to the fabric automatically.
60152

61153
```bash
62154
# Enable Fabric acceleration with CPU short-circuiting
@@ -65,43 +157,78 @@ LD_PRELOAD=./libtfmbs_intercept.so ./llama-cli -m model.gguf
65157
```
66158

67159
### Telemetry Insights
160+
68161
```text
69162
[TFMBS-Telemetry] GEMV Completed
70163
- Zero-Skips: 172,401 (65.8% reduction in total operations)
71164
- Pool Usage: 84.2 MB / 128 MB (LRU Managed)
72165
- Async Queue: 0 in-flight (Non-blocking execution)
73166
```
74167

168+
Telemetry exposes sparsity, residency, and queue pressure in real time.
169+
75170
---
76171

77172
## 🏗️ Project State & Architecture
78173

79-
The project is currently in **Phase 15**, offering deep integration with PyTorch and GGUF, alongside native hardware acceleration for advanced kernels.
174+
The project is currently in **Phase 15**, representing full-stack operation:
175+
176+
* PyTorch frontends
177+
* GGUF ingestion
178+
* Multi-tile emulation
179+
* IOCTL device layer
180+
* Interposition illusion
181+
* RTL kernel parity
182+
183+
### Architecture Layers
184+
185+
* **Framework Layer**
186+
Transparent PyTorch integration via `TFMBSLinear`, supporting automatic quantization and weight residency.
187+
188+
* **Software Layer (Emulation)**
189+
High-fidelity multi-tile emulator with `/dev/tfmbs` IOCTL support, GGUF v2/v3 parsing, async queues, and `LD_PRELOAD` interposer.
190+
191+
* **Hardware Layer (RTL)**
192+
ASIC-ready synthesizable RTL with native support for T-GEMM, T-CONV3D, T-LSTM, and T-Attention kernels.
193+
194+
### Fabric Configurations
80195

81-
* **Framework Layer:** Transparent PyTorch integration via `TFMBSLinear`, supporting automatic quantization and weight residency.
82-
* **Software Layer (Emulation):** High-fidelity multi-tile emulator with IOCTL support (`/dev/tfmbs`), GGUF v2/v3 parsing, and transparent `LD_PRELOAD` interposer.
83-
* **Hardware Layer (RTL):** ASIC-ready synthesizable RTL with native support for T-GEMM, T-CONV3D, T-LSTM, and T-Attention kernels.
196+
| Configuration | Lanes | Clock | Throughput (Peak) |
197+
| :------------------------------ | :---- | :------ | :---------------- |
198+
| **Aggregated Fabric (4 Tiles)** | 60 | 250 MHz | **30.0 GOPS** |
199+
| **Projected (High-Density)** | 1024 | 250 MHz | **512.0 GOPS** |
84200

85-
| Configuration | Lanes | Clock | Throughput (Peak) |
86-
| :--- | :--- | :--- | :--- |
87-
| **Aggregated Fabric (4 Tiles)** | 60 | 250 MHz | **30.0 GOPS** |
88-
| **Projected (High-Density)** | 1024 | 250 MHz | **512.0 GOPS** |
201+
*GOPS = ternary operations per second after Zero-Skip suppression.
89202

90203
---
91204

92205
## 📖 Documentation
93206

94-
The **[User Manual](USER_MANUAL.md)** serves as the central landing page for all documentation.
207+
The **[User Manual](USER_MANUAL.md)** is the central landing page.
95208

96-
* **[Whitepaper](WHITE_PAPER.md):** Technical narrative, benchmarks, and comparison to related work.
97-
* **[Hardware Guide](docs/03_HARDWARE.md):** Deep dive into RTL, hydration, and TPE design.
98-
* **[Roadmap](docs/ROADMAP.md):** Future phases including Kernel Drivers (Phase 10) and Multi-Fabric scaling.
209+
* **[Whitepaper](WHITE_PAPER.md):** Technical narrative, benchmarks, and comparisons.
210+
* **[Hardware Guide](docs/03_HARDWARE.md):** RTL, hydration, and TPE design.
211+
* **[Roadmap](docs/ROADMAP.md):** Future phases including kernel drivers and multi-fabric scaling.
99212

100213
---
101214

102215
## 🤝 Contributing
103216

104-
We welcome contributions! Please see **[CONTRIBUTING.md](CONTRIBUTING.md)** for our standards on ternary-native optimization and code quality.
217+
We welcome contributions across research and implementation.
218+
219+
Areas of interest include:
220+
221+
* Ternary quantization strategies
222+
* Sparsity scheduling
223+
* Memory illusion design
224+
* Kernel semantics
225+
* Residency management
226+
* Interposer robustness
227+
228+
See **[CONTRIBUTING.md](CONTRIBUTING.md)** for standards on ternary-native optimization and code quality.
105229

106230
---
231+
107232
© 2026 Ternary Fabric Project. Licensed under the Apache License, Version 2.0.
233+
234+
---

0 commit comments

Comments
 (0)