Engineering Category: Balanced Ternary & b158 Quantization
Best Use in Production: Packing and unpacking balanced ternary (-1, 0, +1) activation lanes into dense 64-bit registers for C64-constrained inference pipelines.
When to Select This Capsule: Sole canonical implementation for its 64-vector functional equivalence class. Sub-10-cycle hardware kernel (83471/20000 cyc/op); safe for ultra-hot per-sample or per-packet inner loops.
Snap-Circuit Wiring Role: Specialized Multi-Pin Stage `(i8)->i8` — wire matching input pins via `snap_dag` or `snap_pipeline`.
.text: 12 B (5 x86_64 insns)127 B)pub const fn clamp_trit(v: i8) -> i8 {
if v > 0 {
1
} else if v < 0 {
-1
} else {
0
}
}
rustc -C opt-level=3 x86_64 Disassembly (12 B .text / 5 insns)clamp_trit:
test dil, dil
sets cl
setg al
sub al, cl
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #52 | clamp_trit (THIS CAPSULE) domain: smart-tree | id: 65b9382b58fb08022c3f5eecdc180c12 | 83471/20000 cyc/op | 15903/8000 ns/op | 8000000/15903 ops/us | 12 B .text (5 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |