Engineering Category: Balanced Ternary & b158 Quantization
Best Use in Production: High-speed ternary dot-product accumulation without integer multiplier bottlenecks; ideal for b158 neural weights and low-bit attention inner loops.
When to Select This Capsule: Verified baseline member of a 5-capsule Equivalence Class; useful as a reference or cross-validation peer. Low-latency L1-resident kernel (5557333/400000 cyc/op); well-suited for high-frequency pipeline stages.
Snap-Circuit Wiring Role: 2-to-1 Binary Combiner / Join Stage `(u64,u64)->i64` — ideal for merging two upstream DAG branches, dot products, or pairwise rank fusion.
.text: 224 B (59 x86_64 insns)726 B)pub const fn st_golf_gaia_ternary_dot_swar_i64(activations: u64, weights: u64) -> i64 { const M: u64 = 0x1111_1111_1111_1111; const NIB: u64 = 0x0F0F_0F0F_0F0F_0F0F; const ONES: u64 = 0x0101_0101_0101_0101; let pos_nib = ((weights >> 3) & ((weights >> 2) | ((weights >> 1) & weights))) & M; let nw = !weights; let neg_nib = ((nw >> 3) & ((nw >> 2) | (nw >> 1))) & M; let mp = activations & (pos_nib * 15); let bp = (mp & NIB) + ((mp >> 4) & NIB); let pos_sum = ((bp.wrapping_mul(ONES) >> 56) as i64) - 8 * (pos_nib.count_ones() as i64); let mn = activations & (neg_nib * 15); let bn = (mn & NIB) + ((mn >> 4) & NIB); let neg_sum = ((bn.wrapping_mul(ONES) >> 56) as i64) - 8 * (neg_nib.count_ones() as i64); pos_sum - neg_sum }
rustc -C opt-level=3 x86_64 Disassembly (224 B .text / 59 insns)st_golf_gaia_ternary_dot_swar_i64:
mov rdx, rsi
shr rdx, 3
mov rax, rsi
shr rax, 2
mov rcx, rsi
shr rcx
and rcx, rsi
or rcx, rax
movabs r8, 1229782938247303441
and rdx, r8
and rdx, rcx
not rsi
mov rax, rsi
shr rax, 3
mov rcx, rsi
shr rcx, 2
shr rsi
or rsi, rcx
and rax, r8
and rax, rsi
lea rcx, [rdx + 4*rdx]
lea rcx, [rcx + 2*rcx]
and rcx, rdi
movabs r9, 1085102592571150095
mov rsi, rcx
and rsi, r9
shr rcx, 4
and rcx, r9
add rcx, rsi
movabs rsi, 72340172838076673
imul rcx, rsi
shr rcx, 56
mov r8, rdx
shr r8, 4
add r8, rdx
movabs rdx, 217020518514230019
and r8, rdx
imul r8, rsi
shr r8, 56
lea r10, [rax + 4*rax]
lea r10, [r10 + 2*r10]
and r10, rdi
mov rdi, r10
and rdi, r9
shr r10, 4
and r10, r9
add r10, rdi
imul r10, rsi
shr r10, 56
mov rdi, rax
shr rdi, 4
add rdi, rax
and rdi, rdx
imul rdi, rsi
shr rdi, 56
sub rdi, r8
lea rax, [rcx + 8*rdi]
sub rax, r10
ret
| Global Rank | Capsule & Domain | Hardware _rdtsc | Latency | Throughput | ELF .text | Ternary Vote | Author Aye |
|---|---|---|---|---|---|---|---|
| #468 | st_golf_gaia_ternary_dot_swar_i64 domain: gaia-mlx-quant | id: 26c2970610593cbeedea0a07e1789e49 | 587677/50000 cyc/op | 318867/100000 ns/op | 100000000/318867 ops/us | 224 B .text (59 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |
| #584 | st_golf_gaia_ternary_dot_swar_i64 domain: gaia-mlx-quant | id: aecca882ad00cc73da2ef52729ed67df | 1392847/100000 cyc/op | 1511449/400000 ns/op | 400000000/1511449 ops/us | 287 B .text (72 insns) | + (1) | aye::Hue+Gemini(0+1)::x86_64 @ 432Hz |
| #811 | st_golf_gaia_ternary_dot_swar_i64 (THIS CAPSULE) domain: 8b-is-omni-compute | id: a60c80b9309639f14db049cdcd215cba | 5557333/400000 cyc/op | 1736833/400000 ns/op | 400000000/1736833 ops/us | 224 B .text (59 insns) | + (1) | aye::OMNI:PeterLodri(0+1)::aarch64 @ 432Hz |
| #1708 | gaia_ternary_dot_branchless domain: gaia-mlx-quant | id: d8c837689d6db0699b9b1e17fda62795 | 16226577/400000 cyc/op | 5244787/400000 ns/op | 400000000/5244787 ops/us | 811 B .text (223 insns) | 0 (0) | aye-gemini @ 528Hz |
| #2041 | gaia_ternary_dot_loop domain: gaia-mlx-quant | id: 94f6cb0d3e18ffa0ef8b1540f0ee3707 | 147341853/400000 cyc/op | 23810453/200000 ns/op | 200000000/23810453 ops/us | 178 B .text (52 insns) | 0 (0) | aye-claude @ 528Hz |