CharlesCNorton commited on
Commit ·
7090afb
1
Parent(s): c94d9ea
Integrate roadmap into README, clarify LLM runtime purpose
Browse files
README.md
CHANGED
|
@@ -14,9 +14,13 @@ pipeline_tag: other
|
|
| 14 |
|
| 15 |
# Threshold Calculus
|
| 16 |
|
| 17 |
-
**
|
| 18 |
|
| 19 |
-
This
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
---
|
| 22 |
|
|
@@ -576,31 +580,176 @@ While we have tested exhaustively where feasible, the 8x8 multiplier and 8-bit d
|
|
| 576 |
|
| 577 |
---
|
| 578 |
|
| 579 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 580 |
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
1. **Floating-Point Circuits**: Implement IEEE 754 half-precision (16-bit) floating-point addition, subtraction, multiplication, and division. This addresses the most significant gap for LLM integration.
|
| 584 |
|
| 585 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 586 |
|
| 587 |
-
|
| 588 |
|
| 589 |
-
### Medium
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 590 |
|
| 591 |
-
|
| 592 |
|
| 593 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 594 |
|
| 595 |
-
|
| 596 |
|
| 597 |
-
###
|
| 598 |
|
| 599 |
-
|
|
|
|
|
|
|
|
|
|
| 600 |
|
| 601 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 602 |
|
| 603 |
-
|
|
|
|
|
|
|
|
|
|
| 604 |
|
| 605 |
---
|
| 606 |
|
|
|
|
| 14 |
|
| 15 |
# Threshold Calculus
|
| 16 |
|
| 17 |
+
**Arithmetic coprocessor for LLMs, implemented as threshold logic gates.**
|
| 18 |
|
| 19 |
+
This is a runtime component, not a proof artifact. The circuits embed directly into transformer MLP layers as a reusable arithmetic unit. The model learns when to route through circuits vs standard MLP paths. Inference runs in PyTorch.
|
| 20 |
+
|
| 21 |
+
Early training runs embedding these circuits into SmolLM2-360M show significant accuracy improvements on arithmetic tasks.
|
| 22 |
+
|
| 23 |
+
The repository contains an arithmetic core implemented as threshold logic gates stored in safetensors format. Every tensor represents a neural network weight or bias that, when combined with a Heaviside step activation function, computes exact arithmetic operations. All circuits pass exhaustive testing (7,177 tests, 100% pass rate).
|
| 24 |
|
| 25 |
---
|
| 26 |
|
|
|
|
| 580 |
|
| 581 |
---
|
| 582 |
|
| 583 |
+
## Roadmap
|
| 584 |
+
|
| 585 |
+
Goal: Complete arithmetic coprocessor for LLM mathematical reasoning.
|
| 586 |
+
|
| 587 |
+
### Completed
|
| 588 |
+
|
| 589 |
+
#### Float16 Core Arithmetic
|
| 590 |
+
- [x] `float16.add` — IEEE 754 addition (~998 gates)
|
| 591 |
+
- [x] `float16.sub` — IEEE 754 subtraction
|
| 592 |
+
- [x] `float16.mul` — IEEE 754 multiplication (~1302 gates)
|
| 593 |
+
- [x] `float16.div` — IEEE 754 division (~1854 gates)
|
| 594 |
+
- [x] `float16.neg` — sign flip
|
| 595 |
+
- [x] `float16.abs` — absolute value
|
| 596 |
+
- [x] `float16.cmp` — comparison
|
| 597 |
+
|
| 598 |
+
#### Float16 Utilities
|
| 599 |
+
- [x] `float16.unpack` — extract sign, exponent, mantissa
|
| 600 |
+
- [x] `float16.pack` — assemble components
|
| 601 |
+
- [x] `float16.normalize` — CLZ-based normalization
|
| 602 |
+
- [x] `float16.toint` — convert to int16
|
| 603 |
+
- [x] `float16.fromint` — convert from int16
|
| 604 |
+
|
| 605 |
+
#### Integer Arithmetic (8-bit)
|
| 606 |
+
- [x] Adders (half, full, ripple carry 2/4/8 bit)
|
| 607 |
+
- [x] Subtraction, negation
|
| 608 |
+
- [x] Multiplication (2x2, 4x4, 8x8)
|
| 609 |
+
- [x] Division (8-bit with remainder)
|
| 610 |
+
- [x] Comparators (all relations)
|
| 611 |
+
- [x] CLZ (8-bit and 16-bit)
|
| 612 |
+
|
| 613 |
+
#### Logic and Patterns
|
| 614 |
+
- [x] Boolean gates (AND, OR, NOT, NAND, NOR, XOR, XNOR, IMPLIES, BIIMPLIES)
|
| 615 |
+
- [x] Threshold gates (k-of-n for k=1..8)
|
| 616 |
+
- [x] Modular arithmetic (mod 2-12)
|
| 617 |
+
- [x] Pattern recognition (popcount, one-hot, symmetry)
|
| 618 |
+
- [x] Combinational (mux, demux, encoder, decoder, barrel shifter)
|
| 619 |
+
- [x] Shifts and rotates
|
| 620 |
+
|
| 621 |
+
#### Infrastructure
|
| 622 |
+
- [x] Self-documenting .inputs tensors
|
| 623 |
+
- [x] Signal registry in safetensors metadata
|
| 624 |
+
- [x] Full circuit evaluation with topological sort
|
| 625 |
+
- [x] Comprehensive test suite (7,177 tests, 100% pass)
|
| 626 |
|
| 627 |
+
---
|
|
|
|
|
|
|
| 628 |
|
| 629 |
+
### High Priority — Core Mathematical Functions
|
| 630 |
+
|
| 631 |
+
#### Powers and Roots (float16)
|
| 632 |
+
- [ ] `float16.sqrt` — square root via Newton-Raphson or digit-by-digit
|
| 633 |
+
- [ ] `float16.rsqrt` — reciprocal square root (useful for normalization)
|
| 634 |
+
- [ ] `float16.pow` — x^y for arbitrary y (via exp/ln)
|
| 635 |
+
- [ ] `float16.sq` — x² (optimized special case)
|
| 636 |
+
- [ ] `float16.cube` — x³ (optimized special case)
|
| 637 |
+
- [ ] `float16.cbrt` — cube root
|
| 638 |
+
|
| 639 |
+
#### Exponentials and Logarithms (float16)
|
| 640 |
+
- [ ] `float16.exp` — e^x via range reduction + polynomial
|
| 641 |
+
- [ ] `float16.exp2` — 2^x (simpler, useful for pow)
|
| 642 |
+
- [ ] `float16.ln` — natural logarithm
|
| 643 |
+
- [ ] `float16.log2` — base-2 logarithm (extract exponent + correction)
|
| 644 |
+
- [ ] `float16.log10` — base-10 logarithm
|
| 645 |
+
|
| 646 |
+
#### Trigonometry (float16, CORDIC)
|
| 647 |
+
- [ ] `float16.sin` — sine
|
| 648 |
+
- [ ] `float16.cos` — cosine
|
| 649 |
+
- [ ] `float16.tan` — tangent (sin/cos)
|
| 650 |
+
- [ ] `float16.sincos` — both sin and cos (CORDIC gives both)
|
| 651 |
+
- [ ] `float16.asin` — arc sine
|
| 652 |
+
- [ ] `float16.acos` — arc cosine
|
| 653 |
+
- [ ] `float16.atan` — arc tangent
|
| 654 |
+
- [ ] `float16.atan2` — two-argument arc tangent (quadrant-aware)
|
| 655 |
+
|
| 656 |
+
#### Hyperbolic Functions (float16)
|
| 657 |
+
- [ ] `float16.sinh` — hyperbolic sine
|
| 658 |
+
- [ ] `float16.cosh` — hyperbolic cosine
|
| 659 |
+
- [ ] `float16.tanh` — hyperbolic tangent (critical for ML activations)
|
| 660 |
|
| 661 |
+
---
|
| 662 |
|
| 663 |
+
### Medium Priority — Extended Operations
|
| 664 |
+
|
| 665 |
+
#### Rounding and Truncation (float16)
|
| 666 |
+
- [ ] `float16.floor` — round toward -∞
|
| 667 |
+
- [ ] `float16.ceil` — round toward +∞
|
| 668 |
+
- [ ] `float16.trunc` — round toward zero
|
| 669 |
+
- [ ] `float16.round` — round to nearest
|
| 670 |
+
- [ ] `float16.frac` — fractional part
|
| 671 |
+
- [ ] `float16.fmod` — floating-point modulo
|
| 672 |
+
|
| 673 |
+
#### Comparisons and Selection (float16)
|
| 674 |
+
- [ ] `float16.min` — minimum of two values
|
| 675 |
+
- [ ] `float16.max` — maximum of two values
|
| 676 |
+
- [ ] `float16.clamp` — clamp to range [lo, hi]
|
| 677 |
+
- [ ] `float16.sign` — sign function (-1, 0, +1)
|
| 678 |
+
- [ ] `float16.copysign` — copy sign from y to x
|
| 679 |
+
- [ ] `float16.isnan` — NaN test
|
| 680 |
+
- [ ] `float16.isinf` — infinity test
|
| 681 |
+
- [ ] `float16.isfinite` — finite test
|
| 682 |
+
|
| 683 |
+
#### Integer Arithmetic (16-bit)
|
| 684 |
+
- [ ] `arithmetic.add16` — 16-bit addition
|
| 685 |
+
- [ ] `arithmetic.sub16` — 16-bit subtraction
|
| 686 |
+
- [ ] `arithmetic.mul16` — 16-bit multiplication
|
| 687 |
+
- [ ] `arithmetic.div16` — 16-bit division with remainder
|
| 688 |
+
- [ ] `arithmetic.sqrt16` — 16-bit integer square root
|
| 689 |
+
- [ ] `arithmetic.abs16` — 16-bit absolute value
|
| 690 |
+
|
| 691 |
+
#### Number Theory
|
| 692 |
+
- [ ] `arithmetic.gcd` — greatest common divisor (Euclidean)
|
| 693 |
+
- [ ] `arithmetic.lcm` — least common multiple
|
| 694 |
+
- [ ] `arithmetic.isprime8` — primality test (8-bit)
|
| 695 |
+
- [ ] `arithmetic.factorial8` — factorial (8! = 40320 fits in 16-bit)
|
| 696 |
+
- [ ] `arithmetic.comb` — binomial coefficient nCr
|
| 697 |
+
- [ ] `arithmetic.perm` — permutation nPr
|
| 698 |
|
| 699 |
+
---
|
| 700 |
|
| 701 |
+
### Lower Priority — Specialized Functions
|
| 702 |
+
|
| 703 |
+
#### ML Activation Functions (float16)
|
| 704 |
+
- [ ] `float16.relu` — max(0, x)
|
| 705 |
+
- [ ] `float16.leaky_relu` — x if x > 0 else αx
|
| 706 |
+
- [ ] `float16.sigmoid` — 1/(1+e^(-x))
|
| 707 |
+
- [ ] `float16.softplus` — ln(1+e^x)
|
| 708 |
+
- [ ] `float16.gelu` — Gaussian error linear unit
|
| 709 |
+
- [ ] `float16.silu` — x * sigmoid(x)
|
| 710 |
+
|
| 711 |
+
#### Constants (float16 encoded)
|
| 712 |
+
- [ ] `const.pi` — π = 3.14159...
|
| 713 |
+
- [ ] `const.e` — e = 2.71828...
|
| 714 |
+
- [ ] `const.phi` — φ = 1.61803... (golden ratio)
|
| 715 |
+
- [ ] `const.sqrt2` — √2 = 1.41421...
|
| 716 |
+
- [ ] `const.ln2` — ln(2) = 0.69314...
|
| 717 |
+
- [ ] `const.log2e` — log₂(e) = 1.44269...
|
| 718 |
+
|
| 719 |
+
#### Statistics (float16, multi-input)
|
| 720 |
+
- [ ] `stats.sum` — sum of array
|
| 721 |
+
- [ ] `stats.mean` — arithmetic mean
|
| 722 |
+
- [ ] `stats.min_array` — minimum of array
|
| 723 |
+
- [ ] `stats.max_array` — maximum of array
|
| 724 |
+
- [ ] `stats.variance` — population variance
|
| 725 |
+
- [ ] `stats.stddev` — standard deviation
|
| 726 |
+
|
| 727 |
+
#### Bit Manipulation (16-bit)
|
| 728 |
+
- [ ] `bits.popcnt16` — population count
|
| 729 |
+
- [ ] `bits.clz16` — count leading zeros (done)
|
| 730 |
+
- [ ] `bits.ctz16` — count trailing zeros
|
| 731 |
+
- [ ] `bits.reverse16` — bit reversal
|
| 732 |
+
- [ ] `bits.bswap16` — byte swap
|
| 733 |
|
| 734 |
+
---
|
| 735 |
|
| 736 |
+
### Infrastructure TODO
|
| 737 |
|
| 738 |
+
#### Testing
|
| 739 |
+
- [ ] Exhaustive float16 tests for new operations
|
| 740 |
+
- [ ] Edge case coverage (±0, ±inf, NaN, subnormals)
|
| 741 |
+
- [ ] Accuracy tests against reference implementations
|
| 742 |
|
| 743 |
+
#### Documentation
|
| 744 |
+
- [ ] Circuit diagrams for CORDIC, Newton-Raphson
|
| 745 |
+
- [ ] Tutorial: implementing new circuits
|
| 746 |
+
- [ ] Tutorial: LLM integration patterns
|
| 747 |
+
- [ ] API reference for all operations
|
| 748 |
|
| 749 |
+
#### Optimization
|
| 750 |
+
- [ ] Gate count reduction analysis
|
| 751 |
+
- [ ] Critical path optimization
|
| 752 |
+
- [ ] Weight quantization study (int8/int4)
|
| 753 |
|
| 754 |
---
|
| 755 |
|
TODO.md
DELETED
|
@@ -1,172 +0,0 @@
|
|
| 1 |
-
# Threshold Calculus TODO
|
| 2 |
-
|
| 3 |
-
Goal: Complete arithmetic coprocessor for LLM mathematical reasoning.
|
| 4 |
-
|
| 5 |
-
---
|
| 6 |
-
|
| 7 |
-
## High Priority -- Core Mathematical Functions
|
| 8 |
-
|
| 9 |
-
### Powers and Roots (float16)
|
| 10 |
-
- [ ] `float16.sqrt` -- square root via Newton-Raphson or digit-by-digit
|
| 11 |
-
- [ ] `float16.rsqrt` -- reciprocal square root (useful for normalization)
|
| 12 |
-
- [ ] `float16.pow` -- x^y for arbitrary y (via exp/ln)
|
| 13 |
-
- [ ] `float16.sq` -- x² (optimized special case)
|
| 14 |
-
- [ ] `float16.cube` -- x³ (optimized special case)
|
| 15 |
-
- [ ] `float16.cbrt` -- cube root
|
| 16 |
-
|
| 17 |
-
### Exponentials and Logarithms (float16)
|
| 18 |
-
- [ ] `float16.exp` -- e^x via range reduction + polynomial
|
| 19 |
-
- [ ] `float16.exp2` -- 2^x (simpler, useful for pow)
|
| 20 |
-
- [ ] `float16.ln` -- natural logarithm
|
| 21 |
-
- [ ] `float16.log2` -- base-2 logarithm (extract exponent + correction)
|
| 22 |
-
- [ ] `float16.log10` -- base-10 logarithm
|
| 23 |
-
|
| 24 |
-
### Trigonometry (float16, CORDIC)
|
| 25 |
-
- [ ] `float16.sin` -- sine
|
| 26 |
-
- [ ] `float16.cos` -- cosine
|
| 27 |
-
- [ ] `float16.tan` -- tangent (sin/cos)
|
| 28 |
-
- [ ] `float16.sincos` -- both sin and cos (CORDIC gives both)
|
| 29 |
-
- [ ] `float16.asin` -- arc sine
|
| 30 |
-
- [ ] `float16.acos` -- arc cosine
|
| 31 |
-
- [ ] `float16.atan` -- arc tangent
|
| 32 |
-
- [ ] `float16.atan2` -- two-argument arc tangent (quadrant-aware)
|
| 33 |
-
|
| 34 |
-
### Hyperbolic Functions (float16)
|
| 35 |
-
- [ ] `float16.sinh` -- hyperbolic sine
|
| 36 |
-
- [ ] `float16.cosh` -- hyperbolic cosine
|
| 37 |
-
- [ ] `float16.tanh` -- hyperbolic tangent (critical for ML activations)
|
| 38 |
-
|
| 39 |
-
---
|
| 40 |
-
|
| 41 |
-
## Medium Priority -- Extended Operations
|
| 42 |
-
|
| 43 |
-
### Rounding and Truncation (float16)
|
| 44 |
-
- [ ] `float16.floor` -- round toward -∞
|
| 45 |
-
- [ ] `float16.ceil` -- round toward +∞
|
| 46 |
-
- [ ] `float16.trunc` -- round toward zero
|
| 47 |
-
- [ ] `float16.round` -- round to nearest
|
| 48 |
-
- [ ] `float16.frac` -- fractional part
|
| 49 |
-
- [ ] `float16.fmod` -- floating-point modulo
|
| 50 |
-
|
| 51 |
-
### Comparisons and Selection (float16)
|
| 52 |
-
- [ ] `float16.min` -- minimum of two values
|
| 53 |
-
- [ ] `float16.max` -- maximum of two values
|
| 54 |
-
- [ ] `float16.clamp` -- clamp to range [lo, hi]
|
| 55 |
-
- [ ] `float16.sign` -- sign function (-1, 0, +1)
|
| 56 |
-
- [ ] `float16.copysign` -- copy sign from y to x
|
| 57 |
-
- [ ] `float16.isnan` -- NaN test
|
| 58 |
-
- [ ] `float16.isinf` -- infinity test
|
| 59 |
-
- [ ] `float16.isfinite` -- finite test
|
| 60 |
-
|
| 61 |
-
### Integer Arithmetic (16-bit)
|
| 62 |
-
- [ ] `arithmetic.add16` -- 16-bit addition
|
| 63 |
-
- [ ] `arithmetic.sub16` -- 16-bit subtraction
|
| 64 |
-
- [ ] `arithmetic.mul16` -- 16-bit multiplication
|
| 65 |
-
- [ ] `arithmetic.div16` -- 16-bit division with remainder
|
| 66 |
-
- [ ] `arithmetic.sqrt16` -- 16-bit integer square root
|
| 67 |
-
- [ ] `arithmetic.abs16` -- 16-bit absolute value
|
| 68 |
-
|
| 69 |
-
### Number Theory
|
| 70 |
-
- [ ] `arithmetic.gcd` -- greatest common divisor (Euclidean)
|
| 71 |
-
- [ ] `arithmetic.lcm` -- least common multiple
|
| 72 |
-
- [ ] `arithmetic.isprime8` -- primality test (8-bit)
|
| 73 |
-
- [ ] `arithmetic.factorial8` -- factorial (8! = 40320 fits in 16-bit)
|
| 74 |
-
- [ ] `arithmetic.comb` -- binomial coefficient nCr
|
| 75 |
-
- [ ] `arithmetic.perm` -- permutation nPr
|
| 76 |
-
|
| 77 |
-
---
|
| 78 |
-
|
| 79 |
-
## Lower Priority -- Specialized Functions
|
| 80 |
-
|
| 81 |
-
### ML Activation Functions (float16)
|
| 82 |
-
- [ ] `float16.relu` -- max(0, x)
|
| 83 |
-
- [ ] `float16.leaky_relu` -- x if x > 0 else αx
|
| 84 |
-
- [ ] `float16.sigmoid` -- 1/(1+e^(-x))
|
| 85 |
-
- [ ] `float16.softplus` -- ln(1+e^x)
|
| 86 |
-
- [ ] `float16.gelu` -- Gaussian error linear unit
|
| 87 |
-
- [ ] `float16.silu` -- x * sigmoid(x)
|
| 88 |
-
|
| 89 |
-
### Constants (float16 encoded)
|
| 90 |
-
- [ ] `const.pi` -- π = 3.14159...
|
| 91 |
-
- [ ] `const.e` -- e = 2.71828...
|
| 92 |
-
- [ ] `const.phi` -- φ = 1.61803... (golden ratio)
|
| 93 |
-
- [ ] `const.sqrt2` -- √2 = 1.41421...
|
| 94 |
-
- [ ] `const.ln2` -- ln(2) = 0.69314...
|
| 95 |
-
- [ ] `const.log2e` -- log₂(e) = 1.44269...
|
| 96 |
-
|
| 97 |
-
### Statistics (float16, multi-input)
|
| 98 |
-
- [ ] `stats.sum` -- sum of array
|
| 99 |
-
- [ ] `stats.mean` -- arithmetic mean
|
| 100 |
-
- [ ] `stats.min_array` -- minimum of array
|
| 101 |
-
- [ ] `stats.max_array` -- maximum of array
|
| 102 |
-
- [ ] `stats.variance` -- population variance
|
| 103 |
-
- [ ] `stats.stddev` -- standard deviation
|
| 104 |
-
|
| 105 |
-
### Bit Manipulation (16-bit)
|
| 106 |
-
- [ ] `bits.popcnt16` -- population count
|
| 107 |
-
- [ ] `bits.clz16` -- count leading zeros (done)
|
| 108 |
-
- [ ] `bits.ctz16` -- count trailing zeros
|
| 109 |
-
- [ ] `bits.reverse16` -- bit reversal
|
| 110 |
-
- [ ] `bits.bswap16` -- byte swap
|
| 111 |
-
|
| 112 |
-
---
|
| 113 |
-
|
| 114 |
-
## Infrastructure
|
| 115 |
-
|
| 116 |
-
### Testing
|
| 117 |
-
- [ ] Exhaustive float16 tests for new operations
|
| 118 |
-
- [ ] Edge case coverage (±0, ±inf, NaN, subnormals)
|
| 119 |
-
- [ ] Accuracy tests against reference implementations
|
| 120 |
-
|
| 121 |
-
### Documentation
|
| 122 |
-
- [ ] Circuit diagrams for CORDIC, Newton-Raphson
|
| 123 |
-
- [ ] Tutorial: implementing new circuits
|
| 124 |
-
- [ ] Tutorial: LLM integration patterns
|
| 125 |
-
- [ ] API reference for all operations
|
| 126 |
-
|
| 127 |
-
### Optimization
|
| 128 |
-
- [ ] Gate count reduction analysis
|
| 129 |
-
- [ ] Critical path optimization
|
| 130 |
-
- [ ] Weight quantization study (int8/int4)
|
| 131 |
-
|
| 132 |
-
---
|
| 133 |
-
|
| 134 |
-
## Completed
|
| 135 |
-
|
| 136 |
-
### Float16 Core Arithmetic
|
| 137 |
-
- [x] `float16.add` -- IEEE 754 addition (~998 gates)
|
| 138 |
-
- [x] `float16.sub` -- IEEE 754 subtraction
|
| 139 |
-
- [x] `float16.mul` -- IEEE 754 multiplication (~1302 gates)
|
| 140 |
-
- [x] `float16.div` -- IEEE 754 division (~1854 gates)
|
| 141 |
-
- [x] `float16.neg` -- sign flip
|
| 142 |
-
- [x] `float16.abs` -- absolute value
|
| 143 |
-
- [x] `float16.cmp` -- comparison
|
| 144 |
-
|
| 145 |
-
### Float16 Utilities
|
| 146 |
-
- [x] `float16.unpack` -- extract sign, exponent, mantissa
|
| 147 |
-
- [x] `float16.pack` -- assemble components
|
| 148 |
-
- [x] `float16.normalize` -- CLZ-based normalization
|
| 149 |
-
- [x] `float16.toint` -- convert to int16
|
| 150 |
-
- [x] `float16.fromint` -- convert from int16
|
| 151 |
-
|
| 152 |
-
### Integer Arithmetic (8-bit)
|
| 153 |
-
- [x] Adders (half, full, ripple carry 2/4/8 bit)
|
| 154 |
-
- [x] Subtraction, negation
|
| 155 |
-
- [x] Multiplication (2x2, 4x4, 8x8)
|
| 156 |
-
- [x] Division (8-bit with remainder)
|
| 157 |
-
- [x] Comparators (all relations)
|
| 158 |
-
- [x] CLZ (8-bit and 16-bit)
|
| 159 |
-
|
| 160 |
-
### Logic and Patterns
|
| 161 |
-
- [x] Boolean gates (AND, OR, NOT, NAND, NOR, XOR, XNOR, IMPLIES, BIIMPLIES)
|
| 162 |
-
- [x] Threshold gates (k-of-n for k=1..8)
|
| 163 |
-
- [x] Modular arithmetic (mod 2-12)
|
| 164 |
-
- [x] Pattern recognition (popcount, one-hot, symmetry)
|
| 165 |
-
- [x] Combinational (mux, demux, encoder, decoder, barrel shifter)
|
| 166 |
-
- [x] Shifts and rotates
|
| 167 |
-
|
| 168 |
-
### Infrastructure
|
| 169 |
-
- [x] Self-documenting .inputs tensors
|
| 170 |
-
- [x] Signal registry in safetensors metadata
|
| 171 |
-
- [x] Full circuit evaluation with topological sort
|
| 172 |
-
- [x] Comprehensive test suite (7177 tests, 100% pass)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|