rns-engine 0.11.2__tar.gz → 0.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. {rns_engine-0.11.2 → rns_engine-0.12.0}/PKG-INFO +156 -75
  2. rns_engine-0.12.0/README.md +536 -0
  3. {rns_engine-0.11.2 → rns_engine-0.12.0}/pyproject.toml +2 -2
  4. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/__init__.py +4 -3
  5. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_runtime.json +97 -0
  6. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c01.b64 +1 -0
  7. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c02.b64 +1 -0
  8. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c03.b64 +1 -0
  9. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c04.b64 +1 -0
  10. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c05.b64 +1 -0
  11. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c06.b64 +1 -0
  12. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c07.b64 +1 -0
  13. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c08.b64 +1 -0
  14. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c09.b64 +1 -0
  15. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c10.b64 +1 -0
  16. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c11.b64 +1 -0
  17. rns_engine-0.12.0/src/rns_engine/data/g4s1_public_t4_source_c12.b64 +1 -0
  18. rns_engine-0.12.0/src/rns_engine/g4_integer_benchmark.py +454 -0
  19. rns_engine-0.12.0/src/rns_engine/g4_matmul.py +145 -0
  20. rns_engine-0.12.0/src/rns_engine/g4_public.py +178 -0
  21. rns_engine-0.12.0/src/rns_engine/g4_runtime.py +293 -0
  22. rns_engine-0.12.0/src/rns_engine/g4_xops.py +207 -0
  23. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine.egg-info/PKG-INFO +156 -75
  24. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine.egg-info/SOURCES.txt +31 -0
  25. rns_engine-0.12.0/tests/test_g4_api_exports.py +8 -0
  26. rns_engine-0.12.0/tests/test_g4_matmul_api.py +41 -0
  27. rns_engine-0.12.0/tests/test_g4_no_combined_percentage.py +9 -0
  28. rns_engine-0.12.0/tests/test_g4_public.py +57 -0
  29. rns_engine-0.12.0/tests/test_g4_readme_contract.py +14 -0
  30. rns_engine-0.12.0/tests/test_g4_runtime.py +24 -0
  31. rns_engine-0.12.0/tests/test_g4_runtime_metadata.py +21 -0
  32. rns_engine-0.12.0/tests/test_g4_runtime_payload_parts.py +10 -0
  33. rns_engine-0.12.0/tests/test_g4_source_privacy.py +22 -0
  34. rns_engine-0.12.0/tests/test_g4_version.py +9 -0
  35. rns_engine-0.12.0/tests/test_g4_xops.py +56 -0
  36. rns_engine-0.12.0/tests/test_g4_xops_key_text.py +12 -0
  37. rns_engine-0.12.0/tests/test_g4_xops_rational_boundary.py +22 -0
  38. rns_engine-0.11.2/README.md +0 -455
  39. {rns_engine-0.11.2 → rns_engine-0.12.0}/CAPACITY_PLANNING.md +0 -0
  40. {rns_engine-0.11.2 → rns_engine-0.12.0}/CUDA_PARALLEL_LANES.md +0 -0
  41. {rns_engine-0.11.2 → rns_engine-0.12.0}/G4_SERIES1_EVIDENCE.md +0 -0
  42. {rns_engine-0.11.2 → rns_engine-0.12.0}/LICENSE +0 -0
  43. {rns_engine-0.11.2 → rns_engine-0.12.0}/MANIFEST.in +0 -0
  44. {rns_engine-0.11.2 → rns_engine-0.12.0}/PRE_CUDA_READINESS.md +0 -0
  45. {rns_engine-0.11.2 → rns_engine-0.12.0}/benchmarks/weighted_int32_baseline.py +0 -0
  46. {rns_engine-0.11.2 → rns_engine-0.12.0}/colab/T4_EXACT_GEMM_BRINGUP.ipynb +0 -0
  47. {rns_engine-0.11.2 → rns_engine-0.12.0}/setup.cfg +0 -0
  48. {rns_engine-0.11.2 → rns_engine-0.12.0}/setup.py +0 -0
  49. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/_core.cpp +0 -0
  50. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/_weighted.cpp +0 -0
  51. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/capacity.py +0 -0
  52. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/coefficients.py +0 -0
  53. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/cuda_contract.py +0 -0
  54. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_public_summary.json +0 -0
  55. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part01.b64 +0 -0
  56. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part02.b64 +0 -0
  57. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part03.b64 +0 -0
  58. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part04.b64 +0 -0
  59. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part05.b64 +0 -0
  60. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part06a.b64 +0 -0
  61. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part06b.b64 +0 -0
  62. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part07.b64 +0 -0
  63. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part08a.b64 +0 -0
  64. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part08b.b64 +0 -0
  65. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part09.b64 +0 -0
  66. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part10a.b64 +0 -0
  67. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part10b1.b64 +0 -0
  68. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part10b2.b64 +0 -0
  69. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part10b4.b64 +0 -0
  70. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part11.b64 +0 -0
  71. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part12a.b64 +0 -0
  72. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part12b.b64 +0 -0
  73. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part13.b64 +0 -0
  74. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part14a.b64 +0 -0
  75. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part14b.b64 +0 -0
  76. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part15a.b64 +0 -0
  77. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part15b.b64 +0 -0
  78. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part16a.b64 +0 -0
  79. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part16b.b64 +0 -0
  80. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part17a.b64 +0 -0
  81. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part17b1.b64 +0 -0
  82. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part17b2a.b64 +0 -0
  83. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part17b2b1.b64 +0 -0
  84. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part17b2b2.b64 +0 -0
  85. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_replay.part17b2b3.b64 +0 -0
  86. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/data/g4s1_t4_runtime.json +0 -0
  87. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/engine.py +0 -0
  88. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/exact_gemm.py +0 -0
  89. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/g4_benchmark.py +0 -0
  90. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/g4_results.py +0 -0
  91. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/g4_trust.py +0 -0
  92. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/lane_plan.py +0 -0
  93. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/pre_cuda.py +0 -0
  94. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/rail_planning.py +0 -0
  95. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/signed.py +0 -0
  96. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/weighted.py +0 -0
  97. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine/wide.py +0 -0
  98. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine.egg-info/dependency_links.txt +0 -0
  99. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine.egg-info/entry_points.txt +0 -0
  100. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine.egg-info/not-zip-safe +0 -0
  101. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine.egg-info/requires.txt +0 -0
  102. {rns_engine-0.11.2 → rns_engine-0.12.0}/src/rns_engine.egg-info/top_level.txt +0 -0
  103. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_capacity.py +0 -0
  104. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_coefficients.py +0 -0
  105. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_cuda_contract.py +0 -0
  106. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_exact_gemm.py +0 -0
  107. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_g4_benchmark.py +0 -0
  108. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_g4_results.py +0 -0
  109. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_g4_species_labels.py +0 -0
  110. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_g4_trust.py +0 -0
  111. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_packaging.py +0 -0
  112. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_pre_cuda.py +0 -0
  113. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_pre_cuda_assets.py +0 -0
  114. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_rail_planning.py +0 -0
  115. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_rns.py +0 -0
  116. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_session.py +0 -0
  117. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_signed.py +0 -0
  118. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_weighted.py +0 -0
  119. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_weighted_benchmark.py +0 -0
  120. {rns_engine-0.11.2 → rns_engine-0.12.0}/tests/test_wide.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rns_engine
3
- Version: 0.11.2
3
+ Version: 0.12.0
4
4
  Summary: Exact RNS engine with session/cache API.
5
5
  Author: Evan Wesley
6
6
  License-Expression: AGPL-3.0-only
@@ -28,27 +28,95 @@ Dynamic: license-file
28
28
 
29
29
  **Exact arithmetic without the usual speed-or-accuracy tradeoff.**
30
30
 
31
- We tested two separate exact-arithmetic systems **directly against NVIDIA's own optimized cuBLASLt FP16-input GEMM implementation** on the same class of NVIDIA Tesla T4 GPU across **1,024 different matrix-multiplication shapes**.
31
+ G4 Series 1 contains two separate exact-arithmetic systems tested **directly against NVIDIA's optimized cuBLASLt FP16-input GEMM implementation** on the same class of NVIDIA Tesla T4 GPU across **1,024 matrix-multiplication shapes**.
32
32
 
33
- The tests were run on **standard Tesla T4 hardware provided through Google Colab** — publicly available commodity cloud hardware, not a custom GPU, private lab rig, or specially modified machine.
33
+ The tests were run on **standard Tesla T4 hardware provided through Google Colab** — publicly available commodity cloud hardware, not a custom GPU or private lab rig.
34
34
 
35
35
  | Exact arithmetic tested | Faster than NVIDIA | Win rate |
36
36
  |---|---:|---:|
37
37
  | **Exact integer GEMM** | **938 / 1,024 shapes** | **91.60%** |
38
38
  | **Exact rational GEMM** | **870 / 1,024 shapes** | **84.96%** |
39
39
 
40
- These are **two separate results**. The integer benchmark and rational benchmark were run and scored independently.
40
+ These are **two separate benchmark results**. The integer and rational systems are run, certified, and scored independently.
41
41
 
42
- For the rational result, we also built a separate public replay runtime and reran all 1,024 shapes from scratch on a standard Google Colab Tesla T4:
42
+ > **Exact** describes correctness. **Win** describes speed. A calculation remains mathematically exact even on a shape where NVIDIA wins the timing comparison.
43
43
 
44
- - **1,024 / 1,024** exact rational calculations reproduced the correct mathematical result.
45
- - **834 / 1,024** were faster than NVIDIA's FP16 implementation on the fresh replay.
46
- - **114 / 1,024** were slower than NVIDIA's FP16 implementation.
47
- - **76 / 1,024** were statistical ties.
44
+ ---
45
+
46
+ ## XOPS: exact throughput
47
+
48
+ G4 uses a throughput metric for exact arithmetic:
49
+
50
+ **XOP** — one mathematically exact arithmetic operation.
51
+ **XOPS** — exact arithmetic operations per second.
52
+ **G4OPS** — XOPS delivered by a G4 implementation.
53
+
54
+ For GEMM, XOPS intentionally uses the **same conventional operation count as FLOPS**:
55
+
56
+ ```text
57
+ XOP count = 2 × M × N × K
58
+ ```
59
+
60
+ That keeps exact and floating-point throughput directly comparable instead of changing the counting rule.
61
+
62
+ The eligibility rule is strict:
63
+
64
+ ```text
65
+ exactness PASS -> operations may count toward XOPS
66
+ exactness FAIL -> 0 XOPS credit
67
+ ```
68
+
69
+ Every public benchmark prints this key before reporting XOPS/G4OPS, so a saved notebook is self-explaining even if the reader never opened this README.
70
+
71
+ For rational GEMM, the headline G4OPS timing boundary is deliberately **end-to-end**: exact GEMM execution plus the rational metadata/bookkeeping required to produce the exact rational result. The benchmark still credits only the conventional `2*M*N*K` GEMM operations, making that rate conservative rather than hiding bookkeeping outside the clock.
72
+
73
+ ---
74
+
75
+ ## Use G4 directly
76
+
77
+ Series 1 is not only a benchmark replay. The package carries the SHA-pinned, public-safe execution sources for the physically certified G4 runtime covering the current 1,024-shape catalog. On first Tesla T4 use, `rns_engine` verifies that source bundle, compiles the required execution family with the frozen V7 CUDA flags, and caches the resulting kernel locally:
48
78
 
49
- In both cases, we squared our exact arithmetic directly against **NVIDIA's own optimized FP16 GEMM implementation on the same publicly available Tesla T4 hardware** — and won the speed comparison across the large majority of the tested matrix sizes, **without accepting the usual tradeoff between speed and accuracy. You can have both.**
79
+ ```python
80
+ import numpy as np
81
+ import rns_engine as rns
82
+
83
+ A = np.arange(16 * 16, dtype=np.int16).reshape(16, 16) % 17 - 8
84
+ B = np.arange(16 * 16, dtype=np.int16).reshape(16, 16) % 13 - 6
85
+
86
+ # Inputs are converted only after the exact signed-INT8 range check.
87
+ C = rns.g4_matmul(A, B)
50
88
 
51
- > **Exact** describes correctness. **Win** describes speed. A shape can remain mathematically exact even when NVIDIA wins the timing comparison.
89
+ assert C.dtype == np.int32
90
+ ```
91
+
92
+ `g4_matmul()` accepts exact signed-INT8 integer matrices on the certified Series 1 shapes and returns exact signed-INT32 output.
93
+
94
+ Exact shared-scale rationals use the same API:
95
+
96
+ ```python
97
+ left = rns.SharedScaleMatrix(A, scale=3)
98
+ right = rns.SharedScaleMatrix(B, scale=5)
99
+
100
+ C = rns.g4_matmul(left, right)
101
+
102
+ # Exactly (A @ B) / 15. No floating conversion.
103
+ print(C.numerators)
104
+ print(C.scale)
105
+ ```
106
+
107
+ Current fast-path contract:
108
+
109
+ - hardware: **NVIDIA Tesla T4 / compute capability 7.5**;
110
+ - shapes: the frozen **1,024 Series 1 `(M,N,K)` shapes**;
111
+ - integer inputs: signed INT8 matrices;
112
+ - integer output: exact signed INT32 matrix;
113
+ - rational inputs: `SharedScaleMatrix` with signed-INT8 numerators and positive integer shared scales;
114
+ - rational output: exact `SharedScaleMatrix`;
115
+ - unsupported shapes or representations **fail closed** — no silent floating-point fallback.
116
+
117
+ The reusable execution path was physically certified on all **1,024 / 1,024** supported shapes with caller-supplied full-range signed-INT8 data. Additional extreme-value and sparse-extreme subsets also passed. The public package SHA-pins the exact stripped execution-source bodies, shape manifest, certification receipt, compile flags, and source archive provenance; private G4 search/learning code is not included.
118
+
119
+ **FP32-class G4 Series 2 support is in development and is intended to extend this same `g4_matmul()` API once physically certified.**
52
120
 
53
121
  ---
54
122
 
@@ -70,21 +138,61 @@ rns.g4_results("integer")
70
138
  rns.g4_results("rational")
71
139
  ```
72
140
 
73
- On a **Tesla T4 / compute capability 7.5**, physically rerun the exact-rational comparison:
141
+ On a **Tesla T4 / compute capability 7.5**, there are three benchmark entry points:
74
142
 
75
143
  ```python
76
144
  import rns_engine as rns
77
145
 
78
- rns.g4_benchmark("quick") # 24 shapes
79
- rns.g4_benchmark("standard") # 128 shapes
80
- rns.g4_benchmark("full") # all 1,024 shapes
146
+ # Integers first, then rationals. Scores remain separate.
147
+ rns.g4_benchmark("full")
148
+
149
+ # Run only one species if desired.
150
+ rns.g4_integer_benchmark("full")
151
+ rns.g4_rational_benchmark("full")
81
152
  ```
82
153
 
83
- `g4_benchmark()` is deliberately fail-closed. Series 1 is frozen to the Tesla T4; running on a different GPU would be a different benchmark.
154
+ Modes are shared across all three:
84
155
 
85
- The live benchmark is **replay-only**: it reruns the frozen Series 1 implementations rather than performing a new G4 search.
156
+ ```text
157
+ quick 24 shapes
158
+ standard 128 shapes
159
+ full 1,024 shapes
160
+ ```
161
+
162
+ The public runners print progress/ETA, exactness, speed wins/losses/ties, XOPS/G4OPS, reproducibility, source/runtime provenance SHA-256s, all-result-row SHA-256s, and cryptographic run receipts.
163
+
164
+ `g4_benchmark()` is a convenience runner. It runs **G4 INTEGERS first and G4 RATIONALS second**, but it does **not** combine them into one win percentage.
165
+
166
+ All Series 1 public GPU APIs fail closed outside the frozen Tesla T4 hardware contract. Running them on another GPU would be a different experiment.
167
+
168
+ The benchmark paths are **replay-only**: they rerun frozen Series 1 implementations rather than performing a new G4 search.
86
169
 
87
- See [`G4_SERIES1_EVIDENCE.md`](G4_SERIES1_EVIDENCE.md) for the benchmark protocol, claim boundaries, and replay provenance.
170
+ See [`G4_SERIES1_EVIDENCE.md`](G4_SERIES1_EVIDENCE.md) for benchmark protocol, claim boundaries, and replay provenance.
171
+
172
+ ---
173
+
174
+ ## Public physical validation
175
+
176
+ The reusable integer + user-math runtime was built and certified on a Google Colab Tesla T4 with compute capability 7.5, driver `580.82.07`, and CUDA `12.8 / nvcc V12.8.93`.
177
+
178
+ Its full integer certification run produced:
179
+
180
+ - **1,024 / 1,024** exact integer calculations correct;
181
+ - **874 / 1,024** fresh G4 speed wins;
182
+ - **112 / 1,024** NVIDIA speed wins;
183
+ - **38 / 1,024** statistical ties;
184
+ - **953 / 1,024** faster/slower/tie classifications matching the frozen integer archive.
185
+
186
+ Those fresh timing numbers are a **reproduction run**, not a replacement for the frozen headline result of **938 / 1,024 = 91.60%**. Timing classifications can move with clocks, driver state, and normal measurement noise; mathematical exactness must not move.
187
+
188
+ The earlier fresh rational replay produced:
189
+
190
+ - **1,024 / 1,024** exact rational calculations correct;
191
+ - **834 / 1,024** fresh G4 speed wins;
192
+ - **114 / 1,024** NVIDIA speed wins;
193
+ - **76 / 1,024** statistical ties.
194
+
195
+ The frozen rational headline remains **870 / 1,024 = 84.96%**.
88
196
 
89
197
  ---
90
198
 
@@ -92,7 +200,7 @@ See [`G4_SERIES1_EVIDENCE.md`](G4_SERIES1_EVIDENCE.md) for the benchmark protoco
92
200
 
93
201
  G4 is the autonomous optimization/research system that discovered the benchmarked implementations.
94
202
 
95
- This repository exposes the **results and a reproducible replay runtime**.
203
+ `rns_engine` exposes the frozen evidence, reproducible replay paths, and the certified Series 1 execution library. The public package contains only stripped execution-source bodies and their provenance/certification data; the private G4 search, candidate-generation, grammar, learner, and optimization machinery is not shipped.
96
204
 
97
205
  ---
98
206
 
@@ -109,9 +217,10 @@ The package includes:
109
217
  - local and global GEMM capacity planning;
110
218
  - multi-rail exact reconstruction tools;
111
219
  - Tensor-Core / CUDA integration contracts and fixtures;
112
- - frozen G4 Series 1 benchmark evidence and Tesla T4 replay.
220
+ - frozen G4 Series 1 integer and rational replay evidence;
221
+ - certified G4 Series 1 exact `g4_matmul()` on the current 1,024-shape T4 catalog.
113
222
 
114
- The core idea is simple: perform arithmetic across independent modular rails, then reconstruct the exact result when the declared range proves that the answer is unique.
223
+ The core RNS idea is simple: perform arithmetic across independent modular rails, then reconstruct the exact result when the declared range proves the answer is unique.
115
224
 
116
225
  ---
117
226
 
@@ -123,7 +232,7 @@ pip install rns_engine
123
232
 
124
233
  Supported Python versions: **3.10–3.14**.
125
234
 
126
- Prebuilt wheels are available for supported Linux x86-64, macOS Intel/Apple silicon, and Windows x64 Python targets.
235
+ Prebuilt wheels are available for supported Linux x86-64, macOS Intel/Apple silicon, and Windows x64 Python targets. The G4 Series 1 GPU execution path itself is currently Linux + Tesla T4 specific, requires `nvcc` to compile/cache the verified execution sources on first use, and fails closed elsewhere. Standard Google Colab T4 runtimes provide the required CUDA toolchain.
127
236
 
128
237
  ---
129
238
 
@@ -189,7 +298,6 @@ Use a range certificate:
189
298
  ```python
190
299
  certificate = rns.certify_signed_bound(max_abs_bound=1_000_000)
191
300
  certificate.require_unique()
192
-
193
301
  print(certificate.headroom)
194
302
  ```
195
303
 
@@ -201,25 +309,16 @@ certificate = rns.certify_signed_dot_bound(
201
309
  left_abs_bound=127,
202
310
  right_abs_bound=127,
203
311
  )
204
-
205
312
  certificate.require_unique()
206
313
  ```
207
314
 
208
- The conservative bound is:
209
-
210
- ```text
211
- output bound
212
- =
213
- inner dimension × left bound × right bound + addend bound
214
- ```
215
-
216
315
  `decode_signed()` gives the centered representative. **It does not, by itself, prove that an unknown mathematical result did not wrap.** Use the range-certificate APIs when uniqueness matters.
217
316
 
218
317
  ---
219
318
 
220
319
  ## Exact rational GEMM reference path
221
320
 
222
- `rns_engine` includes shared-scale exact matrix objects and a correctness-first wide-RNS reference path:
321
+ The package also includes a correctness-first, hardware-independent shared-scale reference path for wider exact-rational experiments:
223
322
 
224
323
  ```python
225
324
  import numpy as np
@@ -229,7 +328,6 @@ left = rns.SharedScaleMatrix(
229
328
  np.array([[2**40 + 3, -17], [29, 2**35 - 5]], dtype=object),
230
329
  scale=6,
231
330
  )
232
-
233
331
  right = rns.SharedScaleMatrix(
234
332
  np.array([[31, -(2**30) + 9], [2**33 + 1, 43]], dtype=object),
235
333
  scale=35,
@@ -248,7 +346,7 @@ assert receipt.output_scale == 210
248
346
  result = receipt.as_matrix()
249
347
  ```
250
348
 
251
- The public G4 T4 benchmark is a **frozen replay artifact** for the Series 1 exact-rational discoveries; it is not a general-purpose CUDA backend for arbitrary `rns_engine` operations.
349
+ This reference API and the G4 Series 1 T4 fast path serve different purposes: the reference path prioritizes general correctness machinery; `g4_matmul()` dispatches the frozen physically certified Series 1 implementations for its declared input/shape contract.
252
350
 
253
351
  ---
254
352
 
@@ -274,20 +372,9 @@ receipt = rns.accumulate_weighted_int32(
274
372
  weights=[1, -3, 8],
275
373
  require_unique=True,
276
374
  )
277
-
278
375
  exact = receipt.decode_signed()
279
376
  ```
280
377
 
281
- The conservative bound is:
282
-
283
- ```text
284
- max_abs_bound
285
- =
286
- sum(abs(weight[t]) × max_abs(partial[t]))
287
- ```
288
-
289
- The proof receipt retains the original arbitrary-precision weights while execution uses lawful residues modulo the RNS product.
290
-
291
378
  ---
292
379
 
293
380
  ## GEMM capacity planning
@@ -318,7 +405,7 @@ print(local.safe)
318
405
  print(global_plan.current_unique)
319
406
  ```
320
407
 
321
- See [`CAPACITY_PLANNING.md`](CAPACITY_PLANNING.md) for the exact laws and limits.
408
+ See [`CAPACITY_PLANNING.md`](CAPACITY_PLANNING.md) for exact laws and limits.
322
409
 
323
410
  ---
324
411
 
@@ -339,13 +426,7 @@ Their product is:
339
426
  M = 35,742,890,181,197,824
340
427
  ```
341
428
 
342
- Unsigned reconstruction lives in:
343
-
344
- ```text
345
- [0, M)
346
- ```
347
-
348
- The centered signed interpretation is:
429
+ Unsigned reconstruction lives in `[0, M)`. The centered signed interpretation is:
349
430
 
350
431
  ```text
351
432
  [-17,871,445,090,598,912,
@@ -354,8 +435,6 @@ The centered signed interpretation is:
354
435
 
355
436
  Arithmetic runs independently on the rails and reconstructs the canonical value with CRT/Garner-style reconstruction.
356
437
 
357
- For wider exact GEMM work, the package also contains correctness-first seven-rail reference configurations and capacity-planning tools.
358
-
359
438
  ---
360
439
 
361
440
  ## API at a glance
@@ -396,22 +475,23 @@ reconstruct_grouped_partials
396
475
  accumulate_weighted_int32_wide
397
476
  ```
398
477
 
399
- ### CUDA / backend verification
478
+ ### G4 Series 1
400
479
 
401
480
  ```text
402
- CudaGemmFixture
403
- ExactPipelineBackend
404
- CpuExactPipelineBackend
405
- build_cuda_gemm_fixture
406
- verify_backend
407
- run_pre_cuda_readiness
481
+ g4_results
482
+ g4_benchmark
483
+ g4_integer_benchmark
484
+ g4_rational_benchmark
485
+ g4_matmul
408
486
  ```
409
487
 
410
- ### G4 evidence and reproduction
488
+ The four active G4 execution/benchmark APIs are:
411
489
 
412
490
  ```text
413
- g4_results
414
- g4_benchmark
491
+ g4_benchmark -> integers first, then rationals
492
+ g4_integer_benchmark -> integers only
493
+ g4_rational_benchmark -> rationals only
494
+ g4_matmul -> use the certified exact G4 GEMM runtime
415
495
  ```
416
496
 
417
497
  Use `rns.info()` for the installed engine's current range, moduli, version, and native capability summary.
@@ -420,15 +500,17 @@ Use `rns.info()` for the installed engine's current range, moduli, version, and
420
500
 
421
501
  ## Scope and limitations
422
502
 
423
- The benchmark claims in this repository are intentionally narrow and reproducible:
503
+ The public claims are intentionally narrow and reproducible:
424
504
 
425
- - **G4 Series 1 is a Tesla T4 benchmark.** Results on another GPU are a different experiment.
426
- - The reported scores cover the declared **1,024 GEMM shapes**, not every possible matrix size.
427
- - The **integer and rational results are separate benchmarks** and should not be combined into one percentage.
428
- - `g4_benchmark()` replays frozen discoveries; it does not rerun G4's search process.
429
- - Fresh timing classifications can move with clocks, driver state, and normal measurement noise. Mathematical exactness must not move.
430
- - Exact signed reconstruction requires an independently valid range bound; modular correctness alone does not prove no wrap.
431
- - The public Series 1 replay runtime is a benchmark artifact, not a general CUDA implementation of every `rns_engine` API.
505
+ - **G4 Series 1 is frozen to Tesla T4 / compute capability 7.5.** Results on another GPU are a different experiment.
506
+ - The reported benchmarks cover the declared **1,024 GEMM shapes**, not every possible matrix size.
507
+ - The **integer and rational results are separate benchmarks** and are never combined into one percentage.
508
+ - `g4_benchmark()` is a convenience runner that executes those two separate benchmarks in sequence.
509
+ - `g4_integer_benchmark()` and `g4_rational_benchmark()` replay frozen discoveries; they do not rerun G4's search process.
510
+ - Fresh timing classifications can move with clocks, driver state, and measurement noise. Mathematical exactness must not move.
511
+ - `g4_matmul()` currently supports signed-INT8 integer inputs or signed-INT8 shared-scale rational numerators on the certified 1,024-shape Series 1 catalog.
512
+ - Unsupported G4 shapes/representations fail closed rather than silently approximating.
513
+ - Exact signed reconstruction elsewhere in the library still requires an independently valid range bound; modular correctness alone does not prove no wrap.
432
514
 
433
515
  ### Division
434
516
 
@@ -447,7 +529,6 @@ Division requires the divisor to be invertible on every default rail:
447
529
  - [`CAPACITY_PLANNING.md`](CAPACITY_PLANNING.md) — local/global exactness and accumulator capacity
448
530
  - [`PRE_CUDA_READINESS.md`](PRE_CUDA_READINESS.md) — correctness oracle and CUDA integration contract
449
531
  - [`CUDA_PARALLEL_LANES.md`](CUDA_PARALLEL_LANES.md) — parallel rail planning
450
- - [`colab/T4_EXACT_GEMM_BRINGUP.ipynb`](colab/T4_EXACT_GEMM_BRINGUP.ipynb) — earlier CUDA bring-up fixture
451
532
 
452
533
  ---
453
534