rns-engine 0.12.0__tar.gz → 0.13.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 (126) hide show
  1. rns_engine-0.13.0/MANIFEST.in +4 -0
  2. rns_engine-0.13.0/PKG-INFO +85 -0
  3. rns_engine-0.13.0/README.md +57 -0
  4. rns_engine-0.13.0/benchmarks/t4/archive/G4_SERIES1_EVIDENCE.md +170 -0
  5. {rns_engine-0.12.0 → rns_engine-0.13.0}/pyproject.toml +6 -5
  6. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/__init__.py +2 -39
  7. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_summary.json +8 -0
  8. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/g4_public.py +68 -3
  9. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/g4_results.py +42 -8
  10. rns_engine-0.13.0/src/rns_engine.egg-info/PKG-INFO +85 -0
  11. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine.egg-info/SOURCES.txt +2 -19
  12. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_public.py +7 -1
  13. rns_engine-0.13.0/tests/test_g4_results.py +64 -0
  14. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_packaging.py +2 -2
  15. rns_engine-0.13.0/tests/test_readme.py +9 -0
  16. rns_engine-0.12.0/CAPACITY_PLANNING.md +0 -178
  17. rns_engine-0.12.0/CUDA_PARALLEL_LANES.md +0 -100
  18. rns_engine-0.12.0/G4_SERIES1_EVIDENCE.md +0 -66
  19. rns_engine-0.12.0/MANIFEST.in +0 -9
  20. rns_engine-0.12.0/PKG-INFO +0 -562
  21. rns_engine-0.12.0/PRE_CUDA_READINESS.md +0 -72
  22. rns_engine-0.12.0/README.md +0 -536
  23. rns_engine-0.12.0/benchmarks/weighted_int32_baseline.py +0 -423
  24. rns_engine-0.12.0/colab/T4_EXACT_GEMM_BRINGUP.ipynb +0 -152
  25. rns_engine-0.12.0/src/rns_engine/cuda_contract.py +0 -281
  26. rns_engine-0.12.0/src/rns_engine/lane_plan.py +0 -66
  27. rns_engine-0.12.0/src/rns_engine/pre_cuda.py +0 -221
  28. rns_engine-0.12.0/src/rns_engine/rail_planning.py +0 -318
  29. rns_engine-0.12.0/src/rns_engine.egg-info/PKG-INFO +0 -562
  30. rns_engine-0.12.0/src/rns_engine.egg-info/entry_points.txt +0 -2
  31. rns_engine-0.12.0/tests/test_cuda_contract.py +0 -56
  32. rns_engine-0.12.0/tests/test_g4_no_combined_percentage.py +0 -9
  33. rns_engine-0.12.0/tests/test_g4_readme_contract.py +0 -14
  34. rns_engine-0.12.0/tests/test_g4_results.py +0 -46
  35. rns_engine-0.12.0/tests/test_g4_version.py +0 -9
  36. rns_engine-0.12.0/tests/test_pre_cuda.py +0 -45
  37. rns_engine-0.12.0/tests/test_pre_cuda_assets.py +0 -30
  38. rns_engine-0.12.0/tests/test_rail_planning.py +0 -170
  39. rns_engine-0.12.0/tests/test_weighted_benchmark.py +0 -71
  40. {rns_engine-0.12.0 → rns_engine-0.13.0}/LICENSE +0 -0
  41. {rns_engine-0.12.0 → rns_engine-0.13.0}/setup.cfg +0 -0
  42. {rns_engine-0.12.0 → rns_engine-0.13.0}/setup.py +0 -0
  43. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/_core.cpp +0 -0
  44. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/_weighted.cpp +0 -0
  45. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/capacity.py +0 -0
  46. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/coefficients.py +0 -0
  47. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_runtime.json +0 -0
  48. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c01.b64 +0 -0
  49. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c02.b64 +0 -0
  50. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c03.b64 +0 -0
  51. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c04.b64 +0 -0
  52. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c05.b64 +0 -0
  53. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c06.b64 +0 -0
  54. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c07.b64 +0 -0
  55. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c08.b64 +0 -0
  56. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c09.b64 +0 -0
  57. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c10.b64 +0 -0
  58. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c11.b64 +0 -0
  59. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_public_t4_source_c12.b64 +0 -0
  60. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part01.b64 +0 -0
  61. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part02.b64 +0 -0
  62. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part03.b64 +0 -0
  63. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part04.b64 +0 -0
  64. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part05.b64 +0 -0
  65. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part06a.b64 +0 -0
  66. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part06b.b64 +0 -0
  67. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part07.b64 +0 -0
  68. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part08a.b64 +0 -0
  69. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part08b.b64 +0 -0
  70. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part09.b64 +0 -0
  71. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part10a.b64 +0 -0
  72. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part10b1.b64 +0 -0
  73. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part10b2.b64 +0 -0
  74. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part10b4.b64 +0 -0
  75. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part11.b64 +0 -0
  76. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part12a.b64 +0 -0
  77. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part12b.b64 +0 -0
  78. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part13.b64 +0 -0
  79. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part14a.b64 +0 -0
  80. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part14b.b64 +0 -0
  81. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part15a.b64 +0 -0
  82. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part15b.b64 +0 -0
  83. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part16a.b64 +0 -0
  84. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part16b.b64 +0 -0
  85. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part17a.b64 +0 -0
  86. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part17b1.b64 +0 -0
  87. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part17b2a.b64 +0 -0
  88. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part17b2b1.b64 +0 -0
  89. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part17b2b2.b64 +0 -0
  90. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_replay.part17b2b3.b64 +0 -0
  91. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/data/g4s1_t4_runtime.json +0 -0
  92. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/engine.py +0 -0
  93. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/exact_gemm.py +0 -0
  94. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/g4_benchmark.py +0 -0
  95. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/g4_integer_benchmark.py +0 -0
  96. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/g4_matmul.py +0 -0
  97. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/g4_runtime.py +0 -0
  98. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/g4_trust.py +0 -0
  99. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/g4_xops.py +0 -0
  100. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/signed.py +0 -0
  101. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/weighted.py +0 -0
  102. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine/wide.py +0 -0
  103. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine.egg-info/dependency_links.txt +0 -0
  104. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine.egg-info/not-zip-safe +0 -0
  105. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine.egg-info/requires.txt +0 -0
  106. {rns_engine-0.12.0 → rns_engine-0.13.0}/src/rns_engine.egg-info/top_level.txt +0 -0
  107. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_capacity.py +0 -0
  108. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_coefficients.py +0 -0
  109. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_exact_gemm.py +0 -0
  110. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_api_exports.py +0 -0
  111. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_benchmark.py +0 -0
  112. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_matmul_api.py +0 -0
  113. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_runtime.py +0 -0
  114. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_runtime_metadata.py +0 -0
  115. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_runtime_payload_parts.py +0 -0
  116. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_source_privacy.py +0 -0
  117. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_species_labels.py +0 -0
  118. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_trust.py +0 -0
  119. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_xops.py +0 -0
  120. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_xops_key_text.py +0 -0
  121. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_g4_xops_rational_boundary.py +0 -0
  122. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_rns.py +0 -0
  123. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_session.py +0 -0
  124. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_signed.py +0 -0
  125. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_weighted.py +0 -0
  126. {rns_engine-0.12.0 → rns_engine-0.13.0}/tests/test_wide.py +0 -0
@@ -0,0 +1,4 @@
1
+ include LICENSE
2
+ include README.md
3
+ include benchmarks/t4/archive/G4_SERIES1_EVIDENCE.md
4
+ recursive-include tests *.py
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: rns_engine
3
+ Version: 0.13.0
4
+ Summary: Exact modular arithmetic and matrix multiplication over integers and rationals.
5
+ Author: Evan Wesley
6
+ License-Expression: AGPL-3.0-only
7
+ Project-URL: Repository, https://github.com/playfularchitect/rns_engine
8
+ Project-URL: Benchmarks, https://github.com/playfularchitect/rns_engine/tree/main/benchmarks
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Programming Language :: C++
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: <3.15,>=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: numpy>=1.23
22
+ Provides-Extra: test
23
+ Requires-Dist: pytest; extra == "test"
24
+ Requires-Dist: tomli>=1; python_version < "3.11" and extra == "test"
25
+ Requires-Dist: numpy==2.2.6; python_version < "3.14" and extra == "test"
26
+ Requires-Dist: numpy==2.4.5; python_version >= "3.14" and extra == "test"
27
+ Dynamic: license-file
28
+
29
+ # RNS Engine
30
+
31
+ RNS Engine is a Python library for exact arithmetic with a native C++ core. It began as an AVX2 CPU engine for modular integer arithmetic and now includes exact integer and shared-scale rational matrix multiplication.
32
+
33
+ ## Install and run
34
+
35
+ Use Python 3.10–3.14. The CPU engine runs without a GPU. The x86-64 builds require AVX2. [PyPI package](https://pypi.org/project/rns-engine/)
36
+
37
+ ```bash
38
+ python -m pip install rns_engine
39
+ ```
40
+
41
+ Compute 1,000 exact updates of `x ← (1_000_003 × x + 7) mod M` per input and check the result against Python integers.
42
+
43
+ ```python
44
+ import numpy as np
45
+ import rns_engine as rns
46
+
47
+ values = np.array([1, 5, 123_456_789], dtype=np.uint64)
48
+ result = rns.affine_repeat_u64_io(values, 1_000_003, 7, 1_000)
49
+
50
+ reference = [int(value) for value in values]
51
+ for _ in range(1_000):
52
+ reference = [(1_000_003 * value + 7) % rns.M for value in reference]
53
+
54
+ assert result.tolist() == reference
55
+ print(result.tolist())
56
+ ```
57
+
58
+ ## Original CPU engine
59
+
60
+ The engine encodes integers as residues modulo **127, 8,191, 65,536, and 524,287**. It performs arithmetic on those residues and reconstructs the result with Garner-style Chinese remainder reconstruction. The base engine works modulo **35,742,890,181,197,824**.
61
+
62
+ In the original **two-core Google Colab CPU benchmark**, AVX2 and two OpenMP threads averaged **108.92 billion equivalent exact modular multiply-add steps per second**, with a best run of **112.07 billion**. The workload applied 1,000 repeated updates to one million inputs. The engine composes the updates into one exact transformation per input, so the rate counts the logical steps that transformation represents.
63
+
64
+ [Original Colab notebook](https://colab.research.google.com/drive/18RIQSLf4Vf5xUnwEmDwYNPJDLSM_Stqa?usp=sharing) · [Original source (v0.4.1)](https://github.com/playfularchitect/rns_engine/tree/v0.4.1) · [CPU benchmark details](https://github.com/playfularchitect/rns_engine/tree/main/benchmarks/cpu)
65
+
66
+ ## Exact matrix multiplication on NVIDIA Tesla T4
67
+
68
+ The published benchmark compared RNS Engine's exact matrix multiplication (GEMM) with NVIDIA **cuBLASLt FP16-input GEMM** across 1,024 shapes on a Tesla T4.
69
+
70
+ | Exact workload | Wins | Losses | Ties | Errors | Geometric mean speedup |
71
+ | --- | ---: | ---: | ---: | ---: | --- |
72
+ | Signed INT8 inputs, INT32 output | **938** | 86 | 0 | 0 | **1.235×** across all shapes |
73
+ | Shared-scale rational inputs | **870** | 110 | 41 | 3 | **1.417×** across wins |
74
+
75
+ Shared-scale rational matrices use one common denominator per matrix. The integer benchmark timed GPU-resident computation. The rational benchmark also included the bookkeeping needed to return the exact rational result. Python call overhead and host–device transfers are outside the comparison.
76
+
77
+ [T4 benchmark methodology and evidence](https://github.com/playfularchitect/rns_engine/tree/main/benchmarks/t4)
78
+
79
+ ## Repository
80
+
81
+ - [Source](https://github.com/playfularchitect/rns_engine/tree/main/src/rns_engine) contains the native CPU core, Python API, and matrix multiplication implementations.
82
+ - [Benchmarks](https://github.com/playfularchitect/rns_engine/tree/main/benchmarks) contains CPU reproduction material and the frozen Tesla T4 evidence.
83
+ - [Tests](https://github.com/playfularchitect/rns_engine/tree/main/tests) covers arithmetic, exactness, and packaging.
84
+
85
+ Licensed under [AGPL-3.0-only](https://github.com/playfularchitect/rns_engine/blob/main/LICENSE).
@@ -0,0 +1,57 @@
1
+ # RNS Engine
2
+
3
+ RNS Engine is a Python library for exact arithmetic with a native C++ core. It began as an AVX2 CPU engine for modular integer arithmetic and now includes exact integer and shared-scale rational matrix multiplication.
4
+
5
+ ## Install and run
6
+
7
+ Use Python 3.10–3.14. The CPU engine runs without a GPU. The x86-64 builds require AVX2. [PyPI package](https://pypi.org/project/rns-engine/)
8
+
9
+ ```bash
10
+ python -m pip install rns_engine
11
+ ```
12
+
13
+ Compute 1,000 exact updates of `x ← (1_000_003 × x + 7) mod M` per input and check the result against Python integers.
14
+
15
+ ```python
16
+ import numpy as np
17
+ import rns_engine as rns
18
+
19
+ values = np.array([1, 5, 123_456_789], dtype=np.uint64)
20
+ result = rns.affine_repeat_u64_io(values, 1_000_003, 7, 1_000)
21
+
22
+ reference = [int(value) for value in values]
23
+ for _ in range(1_000):
24
+ reference = [(1_000_003 * value + 7) % rns.M for value in reference]
25
+
26
+ assert result.tolist() == reference
27
+ print(result.tolist())
28
+ ```
29
+
30
+ ## Original CPU engine
31
+
32
+ The engine encodes integers as residues modulo **127, 8,191, 65,536, and 524,287**. It performs arithmetic on those residues and reconstructs the result with Garner-style Chinese remainder reconstruction. The base engine works modulo **35,742,890,181,197,824**.
33
+
34
+ In the original **two-core Google Colab CPU benchmark**, AVX2 and two OpenMP threads averaged **108.92 billion equivalent exact modular multiply-add steps per second**, with a best run of **112.07 billion**. The workload applied 1,000 repeated updates to one million inputs. The engine composes the updates into one exact transformation per input, so the rate counts the logical steps that transformation represents.
35
+
36
+ [Original Colab notebook](https://colab.research.google.com/drive/18RIQSLf4Vf5xUnwEmDwYNPJDLSM_Stqa?usp=sharing) · [Original source (v0.4.1)](https://github.com/playfularchitect/rns_engine/tree/v0.4.1) · [CPU benchmark details](https://github.com/playfularchitect/rns_engine/tree/main/benchmarks/cpu)
37
+
38
+ ## Exact matrix multiplication on NVIDIA Tesla T4
39
+
40
+ The published benchmark compared RNS Engine's exact matrix multiplication (GEMM) with NVIDIA **cuBLASLt FP16-input GEMM** across 1,024 shapes on a Tesla T4.
41
+
42
+ | Exact workload | Wins | Losses | Ties | Errors | Geometric mean speedup |
43
+ | --- | ---: | ---: | ---: | ---: | --- |
44
+ | Signed INT8 inputs, INT32 output | **938** | 86 | 0 | 0 | **1.235×** across all shapes |
45
+ | Shared-scale rational inputs | **870** | 110 | 41 | 3 | **1.417×** across wins |
46
+
47
+ Shared-scale rational matrices use one common denominator per matrix. The integer benchmark timed GPU-resident computation. The rational benchmark also included the bookkeeping needed to return the exact rational result. Python call overhead and host–device transfers are outside the comparison.
48
+
49
+ [T4 benchmark methodology and evidence](https://github.com/playfularchitect/rns_engine/tree/main/benchmarks/t4)
50
+
51
+ ## Repository
52
+
53
+ - [Source](https://github.com/playfularchitect/rns_engine/tree/main/src/rns_engine) contains the native CPU core, Python API, and matrix multiplication implementations.
54
+ - [Benchmarks](https://github.com/playfularchitect/rns_engine/tree/main/benchmarks) contains CPU reproduction material and the frozen Tesla T4 evidence.
55
+ - [Tests](https://github.com/playfularchitect/rns_engine/tree/main/tests) covers arithmetic, exactness, and packaging.
56
+
57
+ Licensed under [AGPL-3.0-only](https://github.com/playfularchitect/rns_engine/blob/main/LICENSE).
@@ -0,0 +1,170 @@
1
+ # G4 Series 1 — Frozen Tesla T4 Evidence
2
+
3
+ G4 Series 1 is frozen. This public layer exposes the frozen headline benchmark evidence plus replay-only Tesla T4 runtimes.
4
+
5
+ Speedup ratios in this document are **NVIDIA time / G4 time**, so values above `1.0x` mean G4 is faster.
6
+
7
+ ## Two separate frozen claims
8
+
9
+ ### Exact integer clean sweep
10
+
11
+ On the frozen `T4GL-1024-v1` suite, the final decision record contains:
12
+
13
+ - 1,024 declared GEMM shapes
14
+ - 938 exact integer G4 wins
15
+ - 86 NVIDIA floating wins
16
+ - 0 statistical ties
17
+ - 0 errors
18
+ - 91.60% G4-win coverage
19
+ - exact replay passed before and after timing on all 1,024 shapes
20
+ - Tesla T4, compute capability 7.5
21
+ - resident-data GEMM kernel benchmark
22
+
23
+ Aggregate speed over **all 1,024 frozen shapes**, including NVIDIA-winning shapes:
24
+
25
+ - geometric mean: **1.235383x**
26
+ - median: **1.256704x**
27
+
28
+ Among the 938 G4-winning shapes:
29
+
30
+ - geometric mean: **1.311052x**
31
+ - median: **1.289235x**
32
+ - best frozen G4 win: **2.647061x**
33
+
34
+ Across the 86 NVIDIA-winning shapes, G4 retained **64.5959% of NVIDIA throughput on geometric average**. Equivalently, the execution-time ratio implied by that geometric mean is a **54.8086% G4 time penalty** on those losses.
35
+
36
+ That loss-side figure is exactly derivable from the frozen aggregate record because the suite contains only 938 G4 wins + 86 NVIDIA wins = 1,024 shapes with no ties/errors:
37
+
38
+ ```text
39
+ all_shape_geomean^1024
40
+ = g4_win_geomean^938 * nvidia_win_ratio_geomean^86
41
+ ```
42
+
43
+ The floating landscape uses FP16-input cuBLASLt configurations; the retained accumulation mode may be FP16 or FP32 for a given shape. FP16 is the **speed baseline**, not the exactness baseline. Series 1 asks whether exact arithmetic can reach floating-point-class throughput; it does not claim to beat every possible NVIDIA integer GEMM configuration.
44
+
45
+ #### Signed-INT32 range contract
46
+
47
+ The frozen shape manifest has `K <= 4096`. For full-range signed-INT8 inputs, the largest possible product magnitude is `128 × 128 = 16,384`, so the conservative worst-case dot-product magnitude is:
48
+
49
+ ```text
50
+ 4096 × 128 × 128 = 67,108,864
51
+ ```
52
+
53
+ That is safely inside signed INT32 range. Thus all 1,024 certified Series 1 shapes are safe for full-range signed-INT8 inputs under the published exact signed-INT32 output contract.
54
+
55
+ The historical integer archive preserves its actual measurement depth rather than pretending every shape used one block count:
56
+
57
+ - 827 shapes used 21 paired timing blocks
58
+ - 190 shapes used 31 paired timing blocks
59
+ - 7 shapes used 127 paired timing blocks
60
+
61
+ The current public integer replay uses a uniform 31-paired-block classification rule with 20,000 bootstrap resamples, a 95% confidence interval, a 1.002 promotion threshold, and at least 20 / 31 G4 block wins. Runtime or exactness failures fail closed.
62
+
63
+ ### Dynamic exact-rational campaign
64
+
65
+ The separately frozen G416 campaign records:
66
+
67
+ - 1,024 evaluated shapes
68
+ - 870 certified exact-rational G4 wins
69
+ - 110 NVIDIA wins
70
+ - 41 statistical ties
71
+ - 3 final errors
72
+ - 84.96% certified exact-rational G4-win coverage
73
+ - 31 paired timing blocks for every certified winner
74
+ - actual non-integer inputs for every certified winner
75
+ - range proof passed for every certified winner
76
+ - FP16 value-set proof passed for every certified winner
77
+
78
+ Among the 870 certified G4-winning shapes:
79
+
80
+ - geometric mean: **1.417436x**
81
+ - median: **1.406441x**
82
+ - best certified G4 win: **2.978048x**
83
+ - slowest certified G4 win: **1.004345x**
84
+
85
+ The frozen public rational summary does **not** expose an all-1,024 speedup aggregate or a loss-side aggregate, so this document does not invent either one.
86
+
87
+ #### What the three final rational errors were
88
+
89
+ The three shapes left in final `ERROR` state were:
90
+
91
+ - `T4GL0140`
92
+ - `T4GL0879`
93
+ - `T4GL1020`
94
+
95
+ Each final row records the same post-measurement bookkeeping exception: `KeyError: 'forecast_debt_bits'`. These were not silent arithmetic mismatches. Each row had already produced 31 paired timings, used actual non-integer inputs, and recorded `range_proved=True` plus `fp16_value_set_proved=True`. The campaign conservatively retained them as `ERROR` rather than reclassifying them from partial evidence.
96
+
97
+ #### Shared-scale rational representation
98
+
99
+ `SharedScaleMatrix` represents one integer numerator matrix divided by one positive integer scale. In the public Series 1 API:
100
+
101
+ - numerator matrices must fit the signed-INT8 fast-input contract;
102
+ - scales are positive Python integers, so scale metadata is not limited by a fixed-width integer type;
103
+ - the output scale is exactly `left.scale * right.scale`;
104
+ - `reduce=True` optionally divides a common factor from the numerator matrix and scale;
105
+ - arbitrary per-element denominators are not part of the Series 1 fast-path contract.
106
+
107
+ **Do not conflate the two percentages.** `938/1024` is the frozen exact-integer clean-sweep result. `870/1024` is the separately certified dynamic exact-rational result.
108
+
109
+ ## Benchmark timing boundary vs user-API wall time
110
+
111
+ The frozen **integer** headline is a resident-data GEMM kernel benchmark: GPU data movement, Python-call overhead, and one-shot CPU-array wrapper/runtime work are outside that timing boundary.
112
+
113
+ The frozen **rational** benchmark has its own documented exact-result timing boundary and includes the rational metadata/bookkeeping required to produce the exact rational result. It still is not a one-shot CPU-NumPy `g4_matmul()` wall-time claim.
114
+
115
+ The public `g4_matmul()` API has a different boundary. It accepts CPU NumPy arrays (or `SharedScaleMatrix` objects backed by CPU arrays) and returns a CPU NumPy-backed result. End-to-end `g4_matmul()` wall time therefore includes data movement and wrapper/runtime work that the resident-data integer benchmark excludes.
116
+
117
+ A benchmark that times PyTorch only after tensors are already resident on the GPU must be compared against the same resident-data boundary on the G4 side. Comparing that PyTorch kernel time directly with CPU→CPU `g4_matmul()` wall time mixes two different measurements.
118
+
119
+ Series 1 does **not** claim that one-shot CPU-NumPy→CPU-NumPy `g4_matmul()` wall time beats a pre-resident PyTorch GPU GEMM call.
120
+
121
+ ## Python API
122
+
123
+ ```python
124
+ import rns_engine as rns
125
+
126
+ # Frozen evidence; no GPU required.
127
+ rns.g4_results()
128
+ rns.g4_results("integer")
129
+ rns.g4_results("rational")
130
+
131
+ # Tesla T4 only: physical replay of frozen implementations.
132
+ rns.g4_benchmark("quick")
133
+ rns.g4_benchmark("standard")
134
+ rns.g4_benchmark("full")
135
+
136
+ # Or run either species independently.
137
+ rns.g4_integer_benchmark("full")
138
+ rns.g4_rational_benchmark("full")
139
+ ```
140
+
141
+ `g4_results()` reports the frozen scorecards above.
142
+
143
+ `g4_benchmark()` is a convenience runner that physically replays **both** public Series 1 benchmarks on a Tesla T4: G4 INTEGERS first, then G4 RATIONALS. The scores remain separate and no combined win percentage is reported. It does not run G4 search.
144
+
145
+ `g4_integer_benchmark()` and `g4_rational_benchmark()` replay either benchmark independently.
146
+
147
+ ## Replay-config provenance boundary
148
+
149
+ Most full rational configs are preserved directly by the frozen work artifacts. Where the frozen result row retained the winner identity but omitted physical fields such as padding or stage ID, the one-time private build enumerated every full frozen candidate matching that retained identity. The public replay selects only within that identity class before measurement and does not claim which omitted member was historical. No timing-based historical config guess is permitted.
150
+
151
+ For floating cuBLASLt baselines, Series 1 originally retained the opaque algorithm object returned by `cublasLtMatmulAlgoGetHeuristic`. The public replay therefore re-queries that same heuristic API on the frozen T4 descriptor/padding context and accepts only returned algorithms whose visible identity and workspace match the archived option. It does not attempt to reconstruct NVIDIA's opaque algorithm object from visible fields with `cublasLtMatmulAlgoInit`.
152
+
153
+ The resulting provenance counts are stored in the packaged runtime metadata and included in benchmark output.
154
+
155
+ ## Packaged public evidence/runtime
156
+
157
+ The public package contains:
158
+
159
+ - `g4s1_public_summary.json` — the two frozen headline claims, full scorecard fields available from the archive, and provenance metadata.
160
+ - `g4s1_public_t4_runtime.json` — integer/runtime integrity, hardware boundary, source-family metadata, shape manifest, compile contract, and public-source hashes.
161
+ - rational replay runtime metadata and payload chunks used by the frozen rational replay path.
162
+ - public execution sources required for the Series 1 integer and `g4_matmul()` paths.
163
+
164
+ Every packaged execution/runtime component is SHA-256 integrity checked before use. If the packaged hashes do not match, the public path refuses to run.
165
+
166
+ The detailed G4 search machinery is not needed to reproduce the public replay result. The public package contains the frozen evidence and runtime required by `g4_results()`, `g4_benchmark()`, and the certified Series 1 `g4_matmul()` path.
167
+
168
+ ## Claim boundary
169
+
170
+ Series 1 claims only the frozen Tesla T4 / compute capability 7.5 contract documented above. Results on another GPU are a different experiment. Future G4 generations are kept as separate Series rather than rewriting Series 1 evidence.
@@ -11,8 +11,8 @@ build-backend = "setuptools.build_meta"
11
11
 
12
12
  [project]
13
13
  name = "rns_engine"
14
- version = "0.12.0"
15
- description = "Exact RNS engine with session/cache API."
14
+ version = "0.13.0"
15
+ description = "Exact modular arithmetic and matrix multiplication over integers and rationals."
16
16
  readme = "README.md"
17
17
  requires-python = ">=3.10,<3.15"
18
18
  authors = [
@@ -33,6 +33,10 @@ classifiers = [
33
33
  "Operating System :: OS Independent",
34
34
  ]
35
35
 
36
+ [project.urls]
37
+ Repository = "https://github.com/playfularchitect/rns_engine"
38
+ Benchmarks = "https://github.com/playfularchitect/rns_engine/tree/main/benchmarks"
39
+
36
40
  [project.optional-dependencies]
37
41
  test = [
38
42
  "pytest",
@@ -41,9 +45,6 @@ test = [
41
45
  "numpy==2.4.5; python_version >= '3.14'",
42
46
  ]
43
47
 
44
- [project.scripts]
45
- rns-pre-cuda = "rns_engine.pre_cuda:main"
46
-
47
48
  [tool.setuptools]
48
49
  package-dir = {"" = "src"}
49
50
  include-package-data = true
@@ -68,13 +68,6 @@ from .coefficients import (
68
68
  GroupedCoefficientCapacityPlan,
69
69
  plan_grouped_coefficient_capacity,
70
70
  )
71
- from .rail_planning import (
72
- MersenneRailCandidate,
73
- MersenneRailSearchResult,
74
- MersenneRailSetPlan,
75
- search_mersenne_rail_sets,
76
- search_mersenne_rails_for_capacity,
77
- )
78
71
  from .wide import (
79
72
  BALANCED_EXTRA_EXPONENTS,
80
73
  BASE_MODULI,
@@ -95,26 +88,6 @@ from .exact_gemm import (
95
88
  reconstruct_grouped_partials,
96
89
  reconstruct_signed_radix,
97
90
  )
98
- from .cuda_contract import (
99
- BackendVerification,
100
- CpuExactPipelineBackend,
101
- CpuGroupedPartialsBackend,
102
- CudaGemmFixture,
103
- ExactPipelineBackend,
104
- build_cuda_gemm_fixture,
105
- verify_backend,
106
- )
107
- from .lane_plan import (
108
- ParallelRailPrior,
109
- RailLearningLane,
110
- build_parallel_rail_prior,
111
- )
112
- from .pre_cuda import (
113
- PreCudaReadinessReport,
114
- build_default_pre_cuda_fixture,
115
- default_pre_cuda_matrices,
116
- run_pre_cuda_readiness,
117
- )
118
91
  from .g4_results import g4_results
119
92
  from .g4_public import g4_benchmark, g4_integer_benchmark, g4_rational_benchmark
120
93
  from .g4_matmul import g4_matmul
@@ -149,8 +122,6 @@ __all__ = [
149
122
  "GroupedCoefficientCapacityPlan",
150
123
  "plan_signed_capacity", "plan_weighted_sum_capacity",
151
124
  "plan_digit_plane_gemm_capacity", "plan_grouped_coefficient_capacity",
152
- "MersenneRailCandidate", "MersenneRailSetPlan", "MersenneRailSearchResult",
153
- "search_mersenne_rail_sets", "search_mersenne_rails_for_capacity",
154
125
  "BASE_MODULI", "SMALLEST_PRODUCT_EXTRA_EXPONENTS",
155
126
  "BALANCED_EXTRA_EXPONENTS", "WideRNSConfig", "WideWeightedResult",
156
127
  "mersenne_modulus", "moduli_from_mersenne_exponents",
@@ -159,12 +130,6 @@ __all__ = [
159
130
  "exact_integer_matmul", "decompose_signed_radix",
160
131
  "reconstruct_signed_radix", "grouped_plane_gemm",
161
132
  "reconstruct_grouped_partials", "exact_shared_scale_gemm",
162
- "CudaGemmFixture", "BackendVerification", "ExactPipelineBackend",
163
- "CpuExactPipelineBackend", "CpuGroupedPartialsBackend",
164
- "build_cuda_gemm_fixture", "verify_backend",
165
- "RailLearningLane", "ParallelRailPrior", "build_parallel_rail_prior",
166
- "PreCudaReadinessReport", "default_pre_cuda_matrices",
167
- "build_default_pre_cuda_fixture", "run_pre_cuda_readiness",
168
133
  "g4_results", "g4_benchmark", "g4_integer_benchmark", "g4_rational_benchmark", "g4_matmul",
169
134
  "info",
170
135
  ]
@@ -177,8 +142,6 @@ def info():
177
142
  print(f" Unique bound : |x| < {HALF_M:,}")
178
143
  print(f" Moduli : {M0} x {M1} x {M2} x {M3}")
179
144
  print(f" AVX2 : {'yes' if HAS_AVX2 else 'no'}")
180
- print(" Core APIs : add/sub/mul/fma + raw/omp/auto scalar-broadcast family")
181
- print(" Bridge APIs : weighted signed INT32 accumulation with range receipts")
182
- print(" Planning APIs : local/global capacity + exact Mersenne rail-set search")
183
- print(" Pre-CUDA APIs : seven-rail oracle + exact shared-scale GEMM fixtures")
184
145
  print(" G4 APIs : combined/integer/rational T4 replay + certified exact g4_matmul")
146
+ print(" Exact tools : signed certificates + exact integer/shared-scale reference GEMM")
147
+ print(" Core APIs : encode/decode + add/sub/mul/fma + Session/SignedSession")
@@ -14,6 +14,7 @@
14
14
  "certified_speedup_geometric_mean": 1.417436071329068,
15
15
  "certified_speedup_median": 1.4064410325,
16
16
  "compute_capability": "7.5",
17
+ "errors": 3,
17
18
  "evaluated_shapes": 1024,
18
19
  "final_unresolved_decisions": {
19
20
  "ERROR": 3,
@@ -21,8 +22,10 @@
21
22
  "STATISTICAL_TIE": 41
22
23
  },
23
24
  "hardware": "Tesla T4",
25
+ "nvidia_wins": 110,
24
26
  "remaining_unresolved": 154,
25
27
  "slowest_certified_speedup": 1.004344702,
28
+ "statistical_ties": 41,
26
29
  "target_shapes": 1024
27
30
  },
28
31
  "integer_fp16_input_clean_sweep": {
@@ -31,6 +34,7 @@
31
34
  "best_exact_win_speedup": 2.64706111,
32
35
  "compute_capability": "7.5",
33
36
  "declared_shapes": 1024,
37
+ "errors": 0,
34
38
  "exact_win_rate": 0.916015625,
35
39
  "exact_win_speedup_geometric_mean": 1.311051665330303,
36
40
  "exact_win_speedup_median": 1.289234996,
@@ -38,6 +42,9 @@
38
42
  "floating_baseline": "NVIDIA FP16-input cuBLASLt configuration landscape; accumulation mode may be FP16 or FP32 per retained configuration",
39
43
  "floating_wins": 86,
40
44
  "hardware": "Tesla T4",
45
+ "nvidia_win_g4_execution_time_penalty_from_geomean": 0.5480858262741786,
46
+ "nvidia_win_g4_throughput_retained_geometric_mean": 0.6459590179226226,
47
+ "nvidia_win_loss_metric_derivation": "Derived exactly from the frozen all-shape geometric mean, frozen G4-win geometric mean, and the 938 G4 wins + 86 NVIDIA wins = 1024 shapes with no ties/errors.",
41
48
  "overall_speedup_geometric_mean": 1.235383405277301,
42
49
  "overall_speedup_median": 1.256704092,
43
50
  "paired_block_counts": {
@@ -45,6 +52,7 @@
45
52
  "21": 827,
46
53
  "31": 190
47
54
  },
55
+ "statistical_ties": 0,
48
56
  "suite_id": "T4GL-1024-v1"
49
57
  }
50
58
  },
@@ -1,10 +1,12 @@
1
1
  """Public G4 Series 1 benchmark entry points."""
2
2
  from __future__ import annotations
3
3
 
4
+ import math
5
+ import statistics
4
6
  import sys
5
7
  from typing import TextIO
6
8
 
7
- from .g4_integer_benchmark import _g4_integer_benchmark, g4_integer_benchmark
9
+ from .g4_integer_benchmark import _g4_integer_benchmark
8
10
  from .g4_trust import g4_benchmark as _legacy_rational_benchmark, _sha256_json
9
11
  from .g4_xops import build_xops_summary, format_xops, print_xops_key, print_xops_summary
10
12
 
@@ -52,6 +54,50 @@ def _validate_mode(mode: str) -> str:
52
54
  return selected
53
55
 
54
56
 
57
+ def _geomean(values: list[float]) -> float:
58
+ if not values:
59
+ return 0.0
60
+ if any(value <= 0.0 for value in values):
61
+ raise RuntimeError("speedup ratios must be positive")
62
+ return math.exp(sum(math.log(value) for value in values) / len(values))
63
+
64
+
65
+ def _print_fresh_integer_scorecard(result: dict, stream: TextIO) -> None:
66
+ rows = result["rows"]
67
+ all_ratios = [float(row["speedup_fp16_over_exact"]) for row in rows]
68
+ win_ratios = [
69
+ float(row["speedup_fp16_over_exact"])
70
+ for row in rows
71
+ if row["live_decision"] == "EXACT_WIN"
72
+ ]
73
+ loss_ratios = [
74
+ float(row["speedup_fp16_over_exact"])
75
+ for row in rows
76
+ if row["live_decision"] == "FLOATING_WIN"
77
+ ]
78
+
79
+ lines = [
80
+ "Speedup ratio = NVIDIA time / G4 time; >1.0x means G4 is faster.",
81
+ f"All {len(all_ratios)} shapes: {_geomean(all_ratios):.3f}x geomean | {statistics.median(all_ratios):.3f}x median",
82
+ ]
83
+ if win_ratios:
84
+ lines.append(
85
+ f"G4-winning shapes: {_geomean(win_ratios):.3f}x geomean | "
86
+ f"{statistics.median(win_ratios):.3f}x median | {max(win_ratios):.3f}x best"
87
+ )
88
+ else:
89
+ lines.append("G4-winning shapes: none in this run")
90
+ if loss_ratios:
91
+ retained = _geomean(loss_ratios)
92
+ lines.append(
93
+ f"NVIDIA-winning shapes: G4 retains {retained * 100.0:.2f}% throughput on geomean | "
94
+ f"G4 time penalty {(1.0 / retained - 1.0) * 100.0:.2f}%"
95
+ )
96
+ else:
97
+ lines.append("NVIDIA-winning shapes: none in this run")
98
+ _box("G4 INTEGERS - SPEED DISTRIBUTION - FRESH RUN", lines, stream)
99
+
100
+
55
101
  def _g4_rational_benchmark(
56
102
  mode: str = "quick",
57
103
  *,
@@ -89,6 +135,22 @@ def _g4_rational_benchmark(
89
135
  return result
90
136
 
91
137
 
138
+ def g4_integer_benchmark(
139
+ mode: str = "quick",
140
+ *,
141
+ display: bool = True,
142
+ stream: TextIO | None = None,
143
+ ) -> dict:
144
+ """Rerun the frozen G4 Series 1 exact-integer benchmark on a Tesla T4."""
145
+ selected = _validate_mode(mode)
146
+ out = stream if stream is not None else sys.stdout
147
+ result = _g4_integer_benchmark(selected, display=display, stream=out, show_xops_key=True)
148
+ if display:
149
+ print(file=out)
150
+ _print_fresh_integer_scorecard(result, out)
151
+ return result
152
+
153
+
92
154
  def g4_rational_benchmark(
93
155
  mode: str = "quick",
94
156
  *,
@@ -133,7 +195,9 @@ def g4_benchmark(
133
195
 
134
196
  if display:
135
197
  print(file=out)
136
- print("=== PART 2 / 2: G4 RATIONALS ===", file=out, flush=True)
198
+ _print_fresh_integer_scorecard(integer, out)
199
+ print(file=out)
200
+ print("=== PART 2 / 2: G4 RATIONALS ===", file=out)
137
201
 
138
202
  rational = _g4_rational_benchmark(
139
203
  selected,
@@ -161,7 +225,8 @@ def g4_benchmark(
161
225
  }
162
226
 
163
227
  if display:
164
- isum = integer["summary"]; rsum = rational["summary"]
228
+ isum = integer["summary"]
229
+ rsum = rational["summary"]
165
230
  _box(
166
231
  "G4 SERIES 1 - COMBINED RUN SUMMARY (SCORES REMAIN SEPARATE)",
167
232
  [
@@ -42,9 +42,31 @@ def _print_integer(campaign: dict, stream: TextIO) -> None:
42
42
  file=stream,
43
43
  )
44
44
  print(f"NVIDIA FP16 faster: {campaign['floating_wins']} / {campaign['declared_shapes']}", file=stream)
45
+ print(
46
+ f"Statistical ties / errors: {campaign['statistical_ties']} / {campaign['errors']}",
47
+ file=stream,
48
+ )
45
49
  print("Integer exactness: replay before + after timing PASS on all 1,024 shapes", file=stream)
46
- print(f"Median integer speedup among G4 wins: {campaign['exact_win_speedup_median']:.3f}x", file=stream)
47
- print(f"Best integer G4 speedup: {campaign['best_exact_win_speedup']:.3f}x", file=stream)
50
+ print(
51
+ f"Overall integer speedup across all 1,024 shapes: "
52
+ f"{campaign['overall_speedup_geometric_mean']:.3f}x geometric mean | "
53
+ f"{campaign['overall_speedup_median']:.3f}x median",
54
+ file=stream,
55
+ )
56
+ print(
57
+ f"Among {campaign['exact_wins']} G4 wins: "
58
+ f"{campaign['exact_win_speedup_geometric_mean']:.3f}x geometric mean | "
59
+ f"{campaign['exact_win_speedup_median']:.3f}x median | "
60
+ f"{campaign['best_exact_win_speedup']:.3f}x best",
61
+ file=stream,
62
+ )
63
+ print(
64
+ f"Across {campaign['floating_wins']} NVIDIA wins, G4 retained "
65
+ f"{_pct(campaign['nvidia_win_g4_throughput_retained_geometric_mean'])} of NVIDIA throughput "
66
+ f"on geometric average ({_pct(campaign['nvidia_win_g4_execution_time_penalty_from_geomean'])} "
67
+ f"longer execution time).",
68
+ file=stream,
69
+ )
48
70
 
49
71
 
50
72
  def _print_rational(campaign: dict, stream: TextIO) -> None:
@@ -55,10 +77,21 @@ def _print_rational(campaign: dict, stream: TextIO) -> None:
55
77
  f"({_pct(campaign['certified_exact_win_rate'])})",
56
78
  file=stream,
57
79
  )
58
- print(f"Rational shapes unresolved at archive freeze: {campaign['remaining_unresolved']}", file=stream)
80
+ print(f"NVIDIA FP16 wins: {campaign['nvidia_wins']} / {campaign['target_shapes']}", file=stream)
81
+ print(
82
+ f"Statistical ties / errors: {campaign['statistical_ties']} / {campaign['errors']}",
83
+ file=stream,
84
+ )
59
85
  print("Certified rational winners: non-integer inputs PASS | range proof PASS | FP16 value-set proof PASS", file=stream)
60
- print(f"Median rational speedup among certified G4 wins: {campaign['certified_speedup_median']:.3f}x", file=stream)
61
- print(f"Best certified rational G4 speedup: {campaign['best_certified_speedup']:.3f}x", file=stream)
86
+ print(
87
+ f"Among {campaign['certified_exact_wins']} certified G4 wins: "
88
+ f"{campaign['certified_speedup_geometric_mean']:.3f}x geometric mean | "
89
+ f"{campaign['certified_speedup_median']:.3f}x median | "
90
+ f"{campaign['best_certified_speedup']:.3f}x best | "
91
+ f"{campaign['slowest_certified_speedup']:.3f}x slowest certified win",
92
+ file=stream,
93
+ )
94
+ print("No all-1,024 rational speedup aggregate is claimed by the frozen public summary.", file=stream)
62
95
 
63
96
 
64
97
  def g4_results(
@@ -100,6 +133,7 @@ def g4_results(
100
133
  out = stream if stream is not None else sys.stdout
101
134
  print("=== G4 SERIES 1 — TESLA T4 RESULTS ===", file=out)
102
135
  print("Two separate tests are reported below. Do not combine their scores.", file=out)
136
+ print("Speedup ratios are NVIDIA time / G4 time; >1.0x means G4 is faster.", file=out)
103
137
  print(file=out)
104
138
  if selected in ("all", "integer_fp16_input_clean_sweep"):
105
139
  _print_integer(evidence["campaigns"]["integer_fp16_input_clean_sweep"], out)
@@ -109,11 +143,11 @@ def g4_results(
109
143
  _print_rational(evidence["campaigns"]["dynamic_exact_rational"], out)
110
144
  if selected == "all":
111
145
  print(file=out)
112
- print("INTEGER RESULT: 938 / 1024 = 91.60%", file=out)
113
- print("RATIONAL RESULT: 870 / 1024 = 84.96%", file=out)
146
+ print("INTEGER RESULT: 938 G4 wins / 86 NVIDIA wins / 0 ties / 0 errors", file=out)
147
+ print("RATIONAL RESULT: 870 G4 wins / 110 NVIDIA wins / 41 ties / 3 errors", file=out)
114
148
  print("These are separate benchmark results against NVIDIA FP16 cuBLASLt.", file=out)
115
149
 
116
150
  return result
117
151
 
118
152
 
119
- __all__ = ["g4_results"]
153
+ __all__ = ["g4_results"]