truestar 0.1.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 (509) hide show
  1. truestar-0.1.0/LICENSE +202 -0
  2. truestar-0.1.0/PKG-INFO +337 -0
  3. truestar-0.1.0/README.md +293 -0
  4. truestar-0.1.0/pyproject.toml +75 -0
  5. truestar-0.1.0/setup.cfg +4 -0
  6. truestar-0.1.0/src/truestar/__init__.py +80 -0
  7. truestar-0.1.0/src/truestar/__main__.py +5 -0
  8. truestar-0.1.0/src/truestar/agent.py +436 -0
  9. truestar-0.1.0/src/truestar/autotune.py +235 -0
  10. truestar-0.1.0/src/truestar/backends.py +261 -0
  11. truestar-0.1.0/src/truestar/bias.py +324 -0
  12. truestar-0.1.0/src/truestar/capture.py +192 -0
  13. truestar-0.1.0/src/truestar/check.py +771 -0
  14. truestar-0.1.0/src/truestar/cli.py +692 -0
  15. truestar-0.1.0/src/truestar/codes.py +1462 -0
  16. truestar-0.1.0/src/truestar/compare.py +232 -0
  17. truestar-0.1.0/src/truestar/compile_cache.py +378 -0
  18. truestar-0.1.0/src/truestar/compiler/__init__.py +22 -0
  19. truestar-0.1.0/src/truestar/compiler/attention_bwd.py +285 -0
  20. truestar-0.1.0/src/truestar/compiler/checks.py +659 -0
  21. truestar-0.1.0/src/truestar/compiler/conv_rules.py +665 -0
  22. truestar-0.1.0/src/truestar/compiler/coverage_rules.py +319 -0
  23. truestar-0.1.0/src/truestar/compiler/dynamic.py +333 -0
  24. truestar-0.1.0/src/truestar/compiler/executor.py +261 -0
  25. truestar-0.1.0/src/truestar/compiler/gather_native.py +793 -0
  26. truestar-0.1.0/src/truestar/compiler/graphs.py +282 -0
  27. truestar-0.1.0/src/truestar/compiler/lower.py +1318 -0
  28. truestar-0.1.0/src/truestar/compiler/memory.py +1000 -0
  29. truestar-0.1.0/src/truestar/compiler/profile.py +542 -0
  30. truestar-0.1.0/src/truestar/compiler/recompute.py +207 -0
  31. truestar-0.1.0/src/truestar/compiler/remat.py +485 -0
  32. truestar-0.1.0/src/truestar/compiler/report.py +140 -0
  33. truestar-0.1.0/src/truestar/compiler/runtime.py +2855 -0
  34. truestar-0.1.0/src/truestar/conform/__init__.py +11 -0
  35. truestar-0.1.0/src/truestar/conform/artifact.py +514 -0
  36. truestar-0.1.0/src/truestar/conform/bundle.py +286 -0
  37. truestar-0.1.0/src/truestar/conform/cli.py +353 -0
  38. truestar-0.1.0/src/truestar/conform/core.py +907 -0
  39. truestar-0.1.0/src/truestar/conform/coreml.py +426 -0
  40. truestar-0.1.0/src/truestar/conform/golden.py +159 -0
  41. truestar-0.1.0/src/truestar/conform/llamacpp.py +854 -0
  42. truestar-0.1.0/src/truestar/conform/llamacpp_driver.cpp +207 -0
  43. truestar-0.1.0/src/truestar/conform/qaihub.py +361 -0
  44. truestar-0.1.0/src/truestar/conform/qaihub_battery.py +390 -0
  45. truestar-0.1.0/src/truestar/conform/runtimes.py +865 -0
  46. truestar-0.1.0/src/truestar/conform/serving.py +404 -0
  47. truestar-0.1.0/src/truestar/conform/serving_battery.py +344 -0
  48. truestar-0.1.0/src/truestar/conform/serving_model.py +165 -0
  49. truestar-0.1.0/src/truestar/conform/tflite_build.py +347 -0
  50. truestar-0.1.0/src/truestar/conform/tflite_graph.py +432 -0
  51. truestar-0.1.0/src/truestar/conform/tpu.py +196 -0
  52. truestar-0.1.0/src/truestar/conform/tpu_battery.py +619 -0
  53. truestar-0.1.0/src/truestar/customop/__init__.py +16 -0
  54. truestar-0.1.0/src/truestar/customop/executor.py +215 -0
  55. truestar-0.1.0/src/truestar/customop/lower.py +283 -0
  56. truestar-0.1.0/src/truestar/customop/op.py +345 -0
  57. truestar-0.1.0/src/truestar/data/__init__.py +17 -0
  58. truestar-0.1.0/src/truestar/data/collate.py +95 -0
  59. truestar-0.1.0/src/truestar/data/errors.py +35 -0
  60. truestar-0.1.0/src/truestar/data/loader.py +262 -0
  61. truestar-0.1.0/src/truestar/data/order.py +78 -0
  62. truestar-0.1.0/src/truestar/data/sources.py +245 -0
  63. truestar-0.1.0/src/truestar/data/transforms.py +77 -0
  64. truestar-0.1.0/src/truestar/deps.py +76 -0
  65. truestar-0.1.0/src/truestar/devsim/__init__.py +12 -0
  66. truestar-0.1.0/src/truestar/devsim/hexagon.py +75 -0
  67. truestar-0.1.0/src/truestar/devsim/kernels.py +352 -0
  68. truestar-0.1.0/src/truestar/devsim/mode.py +307 -0
  69. truestar-0.1.0/src/truestar/devsim/profiles.py +569 -0
  70. truestar-0.1.0/src/truestar/devsim/specials.py +279 -0
  71. truestar-0.1.0/src/truestar/devsim/sweep.py +206 -0
  72. truestar-0.1.0/src/truestar/devsim/tensorcore.py +412 -0
  73. truestar-0.1.0/src/truestar/diag/__init__.py +21 -0
  74. truestar-0.1.0/src/truestar/diag/collectives.py +688 -0
  75. truestar-0.1.0/src/truestar/diag/memory.py +570 -0
  76. truestar-0.1.0/src/truestar/engines/__init__.py +1 -0
  77. truestar-0.1.0/src/truestar/engines/cli.py +104 -0
  78. truestar-0.1.0/src/truestar/engines/engine_port.py +873 -0
  79. truestar-0.1.0/src/truestar/engines/gguf.py +441 -0
  80. truestar-0.1.0/src/truestar/engines/llama_ref.py +205 -0
  81. truestar-0.1.0/src/truestar/engines/llamacpp.py +325 -0
  82. truestar-0.1.0/src/truestar/engines/xport.py +489 -0
  83. truestar-0.1.0/src/truestar/engines/xport_child.py +335 -0
  84. truestar-0.1.0/src/truestar/export/__init__.py +30 -0
  85. truestar-0.1.0/src/truestar/export/deploy/__init__.py +613 -0
  86. truestar-0.1.0/src/truestar/export/deploy/coreml_writer.py +537 -0
  87. truestar-0.1.0/src/truestar/export/deploy/lower.py +112 -0
  88. truestar-0.1.0/src/truestar/export/deploy/onnx_writer.py +268 -0
  89. truestar-0.1.0/src/truestar/export/deploy/pte_writer.py +167 -0
  90. truestar-0.1.0/src/truestar/export/deploy/tflite_writer.py +373 -0
  91. truestar-0.1.0/src/truestar/export/exporter.py +666 -0
  92. truestar-0.1.0/src/truestar/export/runner.py +205 -0
  93. truestar-0.1.0/src/truestar/fingerprint/__init__.py +22 -0
  94. truestar-0.1.0/src/truestar/fingerprint/cli.py +114 -0
  95. truestar-0.1.0/src/truestar/fingerprint/compare.py +277 -0
  96. truestar-0.1.0/src/truestar/fingerprint/data.py +124 -0
  97. truestar-0.1.0/src/truestar/fingerprint/models.py +269 -0
  98. truestar-0.1.0/src/truestar/fingerprint/run.py +444 -0
  99. truestar-0.1.0/src/truestar/fitting.py +660 -0
  100. truestar-0.1.0/src/truestar/fix/__init__.py +35 -0
  101. truestar-0.1.0/src/truestar/fix/cli.py +122 -0
  102. truestar-0.1.0/src/truestar/fix/engine.py +463 -0
  103. truestar-0.1.0/src/truestar/fix/mode.py +281 -0
  104. truestar-0.1.0/src/truestar/fix/output.py +194 -0
  105. truestar-0.1.0/src/truestar/fix/precision.py +322 -0
  106. truestar-0.1.0/src/truestar/fix/table.py +335 -0
  107. truestar-0.1.0/src/truestar/frontend/__init__.py +20 -0
  108. truestar-0.1.0/src/truestar/frontend/custom_grad.py +377 -0
  109. truestar-0.1.0/src/truestar/frontend/errors.py +118 -0
  110. truestar-0.1.0/src/truestar/frontend/function.py +739 -0
  111. truestar-0.1.0/src/truestar/frontend/ops.py +555 -0
  112. truestar-0.1.0/src/truestar/frontend/translate.py +1900 -0
  113. truestar-0.1.0/src/truestar/frontend/types.py +95 -0
  114. truestar-0.1.0/src/truestar/gradcheck.py +1670 -0
  115. truestar-0.1.0/src/truestar/gradfault.py +106 -0
  116. truestar-0.1.0/src/truestar/gradties.py +222 -0
  117. truestar-0.1.0/src/truestar/interop/__init__.py +8 -0
  118. truestar-0.1.0/src/truestar/interop/dlpack.py +382 -0
  119. truestar-0.1.0/src/truestar/interop/safetensors.py +520 -0
  120. truestar-0.1.0/src/truestar/interop/safetensors_np.py +400 -0
  121. truestar-0.1.0/src/truestar/intref/__init__.py +1 -0
  122. truestar-0.1.0/src/truestar/intref/cases.py +188 -0
  123. truestar-0.1.0/src/truestar/intref/cli.py +144 -0
  124. truestar-0.1.0/src/truestar/intref/conventions.py +217 -0
  125. truestar-0.1.0/src/truestar/intref/data/npu_s24_conv1.json +606 -0
  126. truestar-0.1.0/src/truestar/intref/fixedpoint.py +183 -0
  127. truestar-0.1.0/src/truestar/intref/golden.py +258 -0
  128. truestar-0.1.0/src/truestar/intref/match.py +264 -0
  129. truestar-0.1.0/src/truestar/intref/npu.py +239 -0
  130. truestar-0.1.0/src/truestar/intref/ops.py +267 -0
  131. truestar-0.1.0/src/truestar/intref/qairt.py +484 -0
  132. truestar-0.1.0/src/truestar/invariance.py +1313 -0
  133. truestar-0.1.0/src/truestar/invariant_ops.py +316 -0
  134. truestar-0.1.0/src/truestar/invariants/__init__.py +419 -0
  135. truestar-0.1.0/src/truestar/ir/__init__.py +50 -0
  136. truestar-0.1.0/src/truestar/ir/attention_grad.py +174 -0
  137. truestar-0.1.0/src/truestar/ir/autodiff.py +333 -0
  138. truestar-0.1.0/src/truestar/ir/autodiff_cf.py +468 -0
  139. truestar-0.1.0/src/truestar/ir/core.py +369 -0
  140. truestar-0.1.0/src/truestar/ir/custom_vjp.py +160 -0
  141. truestar-0.1.0/src/truestar/ir/forward.py +928 -0
  142. truestar-0.1.0/src/truestar/ir/grad_rules.py +837 -0
  143. truestar-0.1.0/src/truestar/ir/grad_rules_extra.py +439 -0
  144. truestar-0.1.0/src/truestar/ir/hf_linattn.py +182 -0
  145. truestar-0.1.0/src/truestar/ir/importer.py +2626 -0
  146. truestar-0.1.0/src/truestar/ir/importer_current.py +303 -0
  147. truestar-0.1.0/src/truestar/ir/importer_extra.py +1211 -0
  148. truestar-0.1.0/src/truestar/ir/importer_gen.py +146 -0
  149. truestar-0.1.0/src/truestar/ir/importer_text.py +219 -0
  150. truestar-0.1.0/src/truestar/ir/importer_vision.py +177 -0
  151. truestar-0.1.0/src/truestar/ir/linattn_ops.py +187 -0
  152. truestar-0.1.0/src/truestar/ir/random_batched.py +40 -0
  153. truestar-0.1.0/src/truestar/ir/reference.py +1414 -0
  154. truestar-0.1.0/src/truestar/ir/refusals.py +264 -0
  155. truestar-0.1.0/src/truestar/ir/regions.py +67 -0
  156. truestar-0.1.0/src/truestar/ir/serialize.py +596 -0
  157. truestar-0.1.0/src/truestar/ir/shapes.py +1146 -0
  158. truestar-0.1.0/src/truestar/ir/train_ops.py +103 -0
  159. truestar-0.1.0/src/truestar/ir/transform_util.py +184 -0
  160. truestar-0.1.0/src/truestar/ir/vmap.py +1009 -0
  161. truestar-0.1.0/src/truestar/kernel/__init__.py +26 -0
  162. truestar-0.1.0/src/truestar/kernel/checks.py +154 -0
  163. truestar-0.1.0/src/truestar/kernel/compiler.py +1230 -0
  164. truestar-0.1.0/src/truestar/kernel/cpu_backend.py +372 -0
  165. truestar-0.1.0/src/truestar/kernel/f64emu.py +401 -0
  166. truestar-0.1.0/src/truestar/kernel/graph.py +397 -0
  167. truestar-0.1.0/src/truestar/kernel/ir.py +938 -0
  168. truestar-0.1.0/src/truestar/kernel/library.py +203 -0
  169. truestar-0.1.0/src/truestar/kernel/metal_backend.py +1525 -0
  170. truestar-0.1.0/src/truestar/kernel/ordersum.py +350 -0
  171. truestar-0.1.0/src/truestar/kernel/reference.py +667 -0
  172. truestar-0.1.0/src/truestar/kernel/rocm.py +483 -0
  173. truestar-0.1.0/src/truestar/kernel/rocm_cases.py +107 -0
  174. truestar-0.1.0/src/truestar/kernel/roundonce.py +661 -0
  175. truestar-0.1.0/src/truestar/kernel/softf64_metal.py +243 -0
  176. truestar-0.1.0/src/truestar/kernel/tcexact.py +339 -0
  177. truestar-0.1.0/src/truestar/kernel/triton_backend.py +2470 -0
  178. truestar-0.1.0/src/truestar/kernel/triton_conv.py +573 -0
  179. truestar-0.1.0/src/truestar/kernel/tune.py +274 -0
  180. truestar-0.1.0/src/truestar/kernel/verify.py +490 -0
  181. truestar-0.1.0/src/truestar/kernelbench.py +510 -0
  182. truestar-0.1.0/src/truestar/kernelbench_triton.py +216 -0
  183. truestar-0.1.0/src/truestar/kernelcheck.py +844 -0
  184. truestar-0.1.0/src/truestar/kvquant/__init__.py +668 -0
  185. truestar-0.1.0/src/truestar/kvquant/low.py +300 -0
  186. truestar-0.1.0/src/truestar/linattn/__init__.py +22 -0
  187. truestar-0.1.0/src/truestar/linattn/chunked.py +115 -0
  188. truestar-0.1.0/src/truestar/linattn/coverage.py +69 -0
  189. truestar-0.1.0/src/truestar/linattn/invariance.py +77 -0
  190. truestar-0.1.0/src/truestar/linattn/metal_kernels.py +299 -0
  191. truestar-0.1.0/src/truestar/linattn/op.py +259 -0
  192. truestar-0.1.0/src/truestar/linattn/reference.py +104 -0
  193. truestar-0.1.0/src/truestar/linattn/torch_op.py +60 -0
  194. truestar-0.1.0/src/truestar/linattn/triton_kernels.py +242 -0
  195. truestar-0.1.0/src/truestar/logitbound/__init__.py +413 -0
  196. truestar-0.1.0/src/truestar/lora/__init__.py +631 -0
  197. truestar-0.1.0/src/truestar/lpgemm/__init__.py +506 -0
  198. truestar-0.1.0/src/truestar/mcp_server.py +859 -0
  199. truestar-0.1.0/src/truestar/mla/__init__.py +20 -0
  200. truestar-0.1.0/src/truestar/mla/build.py +79 -0
  201. truestar-0.1.0/src/truestar/mla/hf.py +159 -0
  202. truestar-0.1.0/src/truestar/mla/latent.py +218 -0
  203. truestar-0.1.0/src/truestar/mla/model.py +280 -0
  204. truestar-0.1.0/src/truestar/mla/prove.py +101 -0
  205. truestar-0.1.0/src/truestar/models/__init__.py +19 -0
  206. truestar-0.1.0/src/truestar/models/config.py +277 -0
  207. truestar-0.1.0/src/truestar/models/decoder.py +309 -0
  208. truestar-0.1.0/src/truestar/models/loader.py +240 -0
  209. truestar-0.1.0/src/truestar/models/runner.py +85 -0
  210. truestar-0.1.0/src/truestar/moe/__init__.py +9 -0
  211. truestar-0.1.0/src/truestar/moe/codes.py +7 -0
  212. truestar-0.1.0/src/truestar/moe/coverage.py +212 -0
  213. truestar-0.1.0/src/truestar/moe/experts.py +153 -0
  214. truestar-0.1.0/src/truestar/moe/routing.py +44 -0
  215. truestar-0.1.0/src/truestar/moe/ties.py +298 -0
  216. truestar-0.1.0/src/truestar/nn/__init__.py +41 -0
  217. truestar-0.1.0/src/truestar/nn/core.py +402 -0
  218. truestar-0.1.0/src/truestar/nn/layers.py +503 -0
  219. truestar-0.1.0/src/truestar/nn/layers_more.py +436 -0
  220. truestar-0.1.0/src/truestar/nn/llama.py +191 -0
  221. truestar-0.1.0/src/truestar/nn/losses.py +187 -0
  222. truestar-0.1.0/src/truestar/nn/summary.py +108 -0
  223. truestar-0.1.0/src/truestar/opbounds.py +168 -0
  224. truestar-0.1.0/src/truestar/opdrill.py +445 -0
  225. truestar-0.1.0/src/truestar/optim/__init__.py +678 -0
  226. truestar-0.1.0/src/truestar/optim/muon.py +464 -0
  227. truestar-0.1.0/src/truestar/orderprobe.py +1099 -0
  228. truestar-0.1.0/src/truestar/parallel/__init__.py +11 -0
  229. truestar-0.1.0/src/truestar/parallel/check.py +797 -0
  230. truestar-0.1.0/src/truestar/parallel/cli.py +144 -0
  231. truestar-0.1.0/src/truestar/parallel/comm.py +251 -0
  232. truestar-0.1.0/src/truestar/parallel/devices.py +380 -0
  233. truestar-0.1.0/src/truestar/parallel/gradsync.py +152 -0
  234. truestar-0.1.0/src/truestar/parallel/layout.py +245 -0
  235. truestar-0.1.0/src/truestar/parallel/native.py +86 -0
  236. truestar-0.1.0/src/truestar/parallel/realranks.py +172 -0
  237. truestar-0.1.0/src/truestar/parallel/runtime.py +453 -0
  238. truestar-0.1.0/src/truestar/parallel/sharded.py +78 -0
  239. truestar-0.1.0/src/truestar/parallel/tree.py +691 -0
  240. truestar-0.1.0/src/truestar/parallel/tree_kernel.py +125 -0
  241. truestar-0.1.0/src/truestar/parallel/worker.py +51 -0
  242. truestar-0.1.0/src/truestar/portcheck.py +1530 -0
  243. truestar-0.1.0/src/truestar/precision_probe.py +123 -0
  244. truestar-0.1.0/src/truestar/precplan/__init__.py +7 -0
  245. truestar-0.1.0/src/truestar/precplan/cli.py +130 -0
  246. truestar-0.1.0/src/truestar/precplan/output.py +81 -0
  247. truestar-0.1.0/src/truestar/precplan/planner.py +1259 -0
  248. truestar-0.1.0/src/truestar/precplan/units.py +423 -0
  249. truestar-0.1.0/src/truestar/prefixcheck/__init__.py +148 -0
  250. truestar-0.1.0/src/truestar/prefixcheck/cli.py +58 -0
  251. truestar-0.1.0/src/truestar/pytest_plugin.py +30 -0
  252. truestar-0.1.0/src/truestar/pytree.py +322 -0
  253. truestar-0.1.0/src/truestar/quant/__init__.py +0 -0
  254. truestar-0.1.0/src/truestar/quant/formats.py +447 -0
  255. truestar-0.1.0/src/truestar/quant/fp8variant.py +271 -0
  256. truestar-0.1.0/src/truestar/quant/kernels.py +489 -0
  257. truestar-0.1.0/src/truestar/quant/model.py +294 -0
  258. truestar-0.1.0/src/truestar/quant/mx.py +217 -0
  259. truestar-0.1.0/src/truestar/quant/mx_kernels.py +111 -0
  260. truestar-0.1.0/src/truestar/quant/sround.py +423 -0
  261. truestar-0.1.0/src/truestar/quant/verify.py +387 -0
  262. truestar-0.1.0/src/truestar/rangecheck/__init__.py +7 -0
  263. truestar-0.1.0/src/truestar/rangecheck/analysis.py +437 -0
  264. truestar-0.1.0/src/truestar/rangecheck/cli.py +90 -0
  265. truestar-0.1.0/src/truestar/rangecheck/composite.py +177 -0
  266. truestar-0.1.0/src/truestar/rangecheck/engine.py +337 -0
  267. truestar-0.1.0/src/truestar/rangecheck/formats.py +106 -0
  268. truestar-0.1.0/src/truestar/rangecheck/groundtruth.py +303 -0
  269. truestar-0.1.0/src/truestar/rangecheck/interval.py +346 -0
  270. truestar-0.1.0/src/truestar/rangecheck/output.py +203 -0
  271. truestar-0.1.0/src/truestar/rangecheck/remedy.py +303 -0
  272. truestar-0.1.0/src/truestar/recdiff/__init__.py +48 -0
  273. truestar-0.1.0/src/truestar/recdiff/cli.py +180 -0
  274. truestar-0.1.0/src/truestar/recdiff/diff.py +705 -0
  275. truestar-0.1.0/src/truestar/recdiff/fingerprint.py +174 -0
  276. truestar-0.1.0/src/truestar/recdiff/record.py +336 -0
  277. truestar-0.1.0/src/truestar/recdiff/report.py +229 -0
  278. truestar-0.1.0/src/truestar/recdiff/repro.py +55 -0
  279. truestar-0.1.0/src/truestar/recdiff/store.py +287 -0
  280. truestar-0.1.0/src/truestar/remote/__init__.py +1 -0
  281. truestar-0.1.0/src/truestar/remote/agreement.py +279 -0
  282. truestar-0.1.0/src/truestar/remote/qai_hub_backend.py +161 -0
  283. truestar-0.1.0/src/truestar/remote/qai_hub_quant.py +683 -0
  284. truestar-0.1.0/src/truestar/remote/synthetic.py +104 -0
  285. truestar-0.1.0/src/truestar/report.py +130 -0
  286. truestar-0.1.0/src/truestar/repro.py +198 -0
  287. truestar-0.1.0/src/truestar/rlkernels/__init__.py +12 -0
  288. truestar-0.1.0/src/truestar/rlkernels/kernels.py +532 -0
  289. truestar-0.1.0/src/truestar/rlkernels/llama.py +371 -0
  290. truestar-0.1.0/src/truestar/rlkernels/mode.py +418 -0
  291. truestar-0.1.0/src/truestar/rlkernels/tp.py +62 -0
  292. truestar-0.1.0/src/truestar/rlpair.py +1751 -0
  293. truestar-0.1.0/src/truestar/rng.py +866 -0
  294. truestar-0.1.0/src/truestar/rotate/__init__.py +0 -0
  295. truestar-0.1.0/src/truestar/rotate/fold.py +462 -0
  296. truestar-0.1.0/src/truestar/rotate/hadamard.py +141 -0
  297. truestar-0.1.0/src/truestar/rotate/learned.py +124 -0
  298. truestar-0.1.0/src/truestar/rotate/qerror.py +178 -0
  299. truestar-0.1.0/src/truestar/rotate/walsh_kernel.py +100 -0
  300. truestar-0.1.0/src/truestar/runtime/__init__.py +15 -0
  301. truestar-0.1.0/src/truestar/runtime/graphs.py +523 -0
  302. truestar-0.1.0/src/truestar/runtime/timing.py +91 -0
  303. truestar-0.1.0/src/truestar/runtime/workloads.py +150 -0
  304. truestar-0.1.0/src/truestar/serve/__init__.py +12 -0
  305. truestar-0.1.0/src/truestar/serve/check.py +139 -0
  306. truestar-0.1.0/src/truestar/serve/cli.py +130 -0
  307. truestar-0.1.0/src/truestar/serve/engine.py +462 -0
  308. truestar-0.1.0/src/truestar/serve/http.py +277 -0
  309. truestar-0.1.0/src/truestar/serve/model.py +257 -0
  310. truestar-0.1.0/src/truestar/specdec/__init__.py +147 -0
  311. truestar-0.1.0/src/truestar/spikes/__init__.py +8 -0
  312. truestar-0.1.0/src/truestar/spikes/cli.py +50 -0
  313. truestar-0.1.0/src/truestar/spikes/replay.py +258 -0
  314. truestar-0.1.0/src/truestar/spikes/watch.py +256 -0
  315. truestar-0.1.0/src/truestar/stackcheck.py +388 -0
  316. truestar-0.1.0/src/truestar/stackrepro.py +226 -0
  317. truestar-0.1.0/src/truestar/stacks.py +767 -0
  318. truestar-0.1.0/src/truestar/testing.py +156 -0
  319. truestar-0.1.0/src/truestar/testing_hf.py +433 -0
  320. truestar-0.1.0/src/truestar/testing_hf_text.py +440 -0
  321. truestar-0.1.0/src/truestar/testing_ops.py +208 -0
  322. truestar-0.1.0/src/truestar/testing_vision.py +470 -0
  323. truestar-0.1.0/src/truestar/tolerance.py +1115 -0
  324. truestar-0.1.0/src/truestar/train/__init__.py +23 -0
  325. truestar-0.1.0/src/truestar/train/amp.py +319 -0
  326. truestar-0.1.0/src/truestar/train/checkpoint.py +65 -0
  327. truestar-0.1.0/src/truestar/train/compiled.py +246 -0
  328. truestar-0.1.0/src/truestar/train/distributed.py +53 -0
  329. truestar-0.1.0/src/truestar/train/edit.py +204 -0
  330. truestar-0.1.0/src/truestar/train/losses.py +177 -0
  331. truestar-0.1.0/src/truestar/train/ops.py +157 -0
  332. truestar-0.1.0/src/truestar/train/optim.py +314 -0
  333. truestar-0.1.0/src/truestar/train/step.py +301 -0
  334. truestar-0.1.0/src/truestar/train/trainer.py +316 -0
  335. truestar-0.1.0/src/truestar/trainmode.py +283 -0
  336. truestar-0.1.0/src/truestar/webgpu/__init__.py +162 -0
  337. truestar-0.1.0/src/truestar/webgpu/client.py +115 -0
  338. truestar-0.1.0/src/truestar/webgpu/dawn.py +363 -0
  339. truestar-0.1.0/src/truestar/webgpu/onnx_check.py +756 -0
  340. truestar-0.1.0/src/truestar/webgpu/worker.py +314 -0
  341. truestar-0.1.0/src/truestar/webnn/__init__.py +283 -0
  342. truestar-0.1.0/src/truestar/webnn/page.js +171 -0
  343. truestar-0.1.0/src/truestar/webnn/translate.py +195 -0
  344. truestar-0.1.0/src/truestar/winml/__init__.py +283 -0
  345. truestar-0.1.0/src/truestar/winml/worker.py +257 -0
  346. truestar-0.1.0/src/truestar.egg-info/PKG-INFO +337 -0
  347. truestar-0.1.0/src/truestar.egg-info/SOURCES.txt +507 -0
  348. truestar-0.1.0/src/truestar.egg-info/dependency_links.txt +1 -0
  349. truestar-0.1.0/src/truestar.egg-info/entry_points.txt +2 -0
  350. truestar-0.1.0/src/truestar.egg-info/requires.txt +19 -0
  351. truestar-0.1.0/src/truestar.egg-info/top_level.txt +1 -0
  352. truestar-0.1.0/tests/test_agent.py +711 -0
  353. truestar-0.1.0/tests/test_attention_grad.py +206 -0
  354. truestar-0.1.0/tests/test_autodiff.py +1179 -0
  355. truestar-0.1.0/tests/test_autodiff_cf.py +415 -0
  356. truestar-0.1.0/tests/test_autograph.py +116 -0
  357. truestar-0.1.0/tests/test_autotune.py +84 -0
  358. truestar-0.1.0/tests/test_bias.py +306 -0
  359. truestar-0.1.0/tests/test_bound_crosscheck.py +108 -0
  360. truestar-0.1.0/tests/test_check.py +392 -0
  361. truestar-0.1.0/tests/test_check_docs_snippets.py +119 -0
  362. truestar-0.1.0/tests/test_check_localized.py +203 -0
  363. truestar-0.1.0/tests/test_codes_unique.py +60 -0
  364. truestar-0.1.0/tests/test_compile_cache.py +230 -0
  365. truestar-0.1.0/tests/test_compiler.py +853 -0
  366. truestar-0.1.0/tests/test_compiler_coverage.py +177 -0
  367. truestar-0.1.0/tests/test_compiler_elementwise_more.py +112 -0
  368. truestar-0.1.0/tests/test_compiler_tf32.py +200 -0
  369. truestar-0.1.0/tests/test_conform.py +511 -0
  370. truestar-0.1.0/tests/test_conform_coreml.py +117 -0
  371. truestar-0.1.0/tests/test_conform_llamacpp.py +224 -0
  372. truestar-0.1.0/tests/test_conform_serving.py +204 -0
  373. truestar-0.1.0/tests/test_conform_tpu.py +130 -0
  374. truestar-0.1.0/tests/test_constant_tables_export.py +78 -0
  375. truestar-0.1.0/tests/test_contraction_split.py +222 -0
  376. truestar-0.1.0/tests/test_conv_kernels.py +464 -0
  377. truestar-0.1.0/tests/test_cookbook.py +78 -0
  378. truestar-0.1.0/tests/test_custom_grad.py +290 -0
  379. truestar-0.1.0/tests/test_customop.py +425 -0
  380. truestar-0.1.0/tests/test_dataio.py +320 -0
  381. truestar-0.1.0/tests/test_detautotune.py +118 -0
  382. truestar-0.1.0/tests/test_devsim.py +296 -0
  383. truestar-0.1.0/tests/test_diag_collectives.py +123 -0
  384. truestar-0.1.0/tests/test_diag_memory.py +237 -0
  385. truestar-0.1.0/tests/test_dlpack.py +209 -0
  386. truestar-0.1.0/tests/test_dynamic_shapes.py +234 -0
  387. truestar-0.1.0/tests/test_engine_port.py +286 -0
  388. truestar-0.1.0/tests/test_error_messages.py +108 -0
  389. truestar-0.1.0/tests/test_examples.py +310 -0
  390. truestar-0.1.0/tests/test_export.py +769 -0
  391. truestar-0.1.0/tests/test_export_deploy.py +194 -0
  392. truestar-0.1.0/tests/test_export_structured.py +280 -0
  393. truestar-0.1.0/tests/test_f64emu.py +117 -0
  394. truestar-0.1.0/tests/test_fingerprint.py +305 -0
  395. truestar-0.1.0/tests/test_fit.py +231 -0
  396. truestar-0.1.0/tests/test_fix.py +478 -0
  397. truestar-0.1.0/tests/test_fixed_scatter.py +90 -0
  398. truestar-0.1.0/tests/test_forward.py +418 -0
  399. truestar-0.1.0/tests/test_frontend.py +694 -0
  400. truestar-0.1.0/tests/test_frontend_pytree.py +171 -0
  401. truestar-0.1.0/tests/test_frontend_random.py +187 -0
  402. truestar-0.1.0/tests/test_gather_native.py +265 -0
  403. truestar-0.1.0/tests/test_gradcheck.py +636 -0
  404. truestar-0.1.0/tests/test_hexagon_sim.py +211 -0
  405. truestar-0.1.0/tests/test_hf_models.py +435 -0
  406. truestar-0.1.0/tests/test_hf_text.py +151 -0
  407. truestar-0.1.0/tests/test_import_controlflow.py +261 -0
  408. truestar-0.1.0/tests/test_importer_text.py +307 -0
  409. truestar-0.1.0/tests/test_importer_vision.py +113 -0
  410. truestar-0.1.0/tests/test_intref.py +249 -0
  411. truestar-0.1.0/tests/test_invariance.py +628 -0
  412. truestar-0.1.0/tests/test_invariants.py +160 -0
  413. truestar-0.1.0/tests/test_ir.py +354 -0
  414. truestar-0.1.0/tests/test_ir_ops.py +647 -0
  415. truestar-0.1.0/tests/test_islands.py +207 -0
  416. truestar-0.1.0/tests/test_islands_convention.py +68 -0
  417. truestar-0.1.0/tests/test_kernel.py +625 -0
  418. truestar-0.1.0/tests/test_kernel_gpu_verify.py +205 -0
  419. truestar-0.1.0/tests/test_kernel_magnitude.py +77 -0
  420. truestar-0.1.0/tests/test_kernel_tune.py +631 -0
  421. truestar-0.1.0/tests/test_kernel_verify_elements.py +165 -0
  422. truestar-0.1.0/tests/test_kernelcheck.py +241 -0
  423. truestar-0.1.0/tests/test_kvquant.py +303 -0
  424. truestar-0.1.0/tests/test_kvquant_decode.py +223 -0
  425. truestar-0.1.0/tests/test_kvquant_low.py +237 -0
  426. truestar-0.1.0/tests/test_lean_constants.py +95 -0
  427. truestar-0.1.0/tests/test_linattn.py +356 -0
  428. truestar-0.1.0/tests/test_litert_npu.py +131 -0
  429. truestar-0.1.0/tests/test_llm_ops.py +742 -0
  430. truestar-0.1.0/tests/test_logitbound.py +127 -0
  431. truestar-0.1.0/tests/test_lora.py +362 -0
  432. truestar-0.1.0/tests/test_lowp.py +354 -0
  433. truestar-0.1.0/tests/test_lpgemm.py +114 -0
  434. truestar-0.1.0/tests/test_memory.py +427 -0
  435. truestar-0.1.0/tests/test_metal.py +576 -0
  436. truestar-0.1.0/tests/test_mla.py +343 -0
  437. truestar-0.1.0/tests/test_models_native.py +244 -0
  438. truestar-0.1.0/tests/test_moe.py +328 -0
  439. truestar-0.1.0/tests/test_multigpu.py +321 -0
  440. truestar-0.1.0/tests/test_multirank.py +246 -0
  441. truestar-0.1.0/tests/test_muon.py +219 -0
  442. truestar-0.1.0/tests/test_near_tie_diagnosis.py +159 -0
  443. truestar-0.1.0/tests/test_nn.py +369 -0
  444. truestar-0.1.0/tests/test_nn_init.py +107 -0
  445. truestar-0.1.0/tests/test_nn_losses.py +174 -0
  446. truestar-0.1.0/tests/test_nn_more.py +215 -0
  447. truestar-0.1.0/tests/test_nn_summary.py +30 -0
  448. truestar-0.1.0/tests/test_op_coverage.py +520 -0
  449. truestar-0.1.0/tests/test_opbounds.py +106 -0
  450. truestar-0.1.0/tests/test_opdrill.py +344 -0
  451. truestar-0.1.0/tests/test_optim.py +180 -0
  452. truestar-0.1.0/tests/test_optim_more.py +358 -0
  453. truestar-0.1.0/tests/test_optional_deps.py +144 -0
  454. truestar-0.1.0/tests/test_orderprobe.py +176 -0
  455. truestar-0.1.0/tests/test_ordersum.py +271 -0
  456. truestar-0.1.0/tests/test_paged_kv.py +179 -0
  457. truestar-0.1.0/tests/test_parallel.py +264 -0
  458. truestar-0.1.0/tests/test_plain_einsum.py +35 -0
  459. truestar-0.1.0/tests/test_portcheck.py +366 -0
  460. truestar-0.1.0/tests/test_precision_probe.py +56 -0
  461. truestar-0.1.0/tests/test_precplan.py +275 -0
  462. truestar-0.1.0/tests/test_prefixcheck.py +96 -0
  463. truestar-0.1.0/tests/test_prepack_kn.py +114 -0
  464. truestar-0.1.0/tests/test_profile.py +139 -0
  465. truestar-0.1.0/tests/test_qaihub.py +231 -0
  466. truestar-0.1.0/tests/test_qairt.py +204 -0
  467. truestar-0.1.0/tests/test_quant.py +248 -0
  468. truestar-0.1.0/tests/test_rangecheck.py +285 -0
  469. truestar-0.1.0/tests/test_recdiff.py +469 -0
  470. truestar-0.1.0/tests/test_region_gpu_verify.py +501 -0
  471. truestar-0.1.0/tests/test_remat.py +141 -0
  472. truestar-0.1.0/tests/test_remote_npu.py +436 -0
  473. truestar-0.1.0/tests/test_rlkernels.py +419 -0
  474. truestar-0.1.0/tests/test_rlpair.py +320 -0
  475. truestar-0.1.0/tests/test_rng.py +333 -0
  476. truestar-0.1.0/tests/test_rocm.py +347 -0
  477. truestar-0.1.0/tests/test_rotate.py +172 -0
  478. truestar-0.1.0/tests/test_roundonce.py +441 -0
  479. truestar-0.1.0/tests/test_runtime.py +304 -0
  480. truestar-0.1.0/tests/test_safetensors.py +283 -0
  481. truestar-0.1.0/tests/test_sentinels.py +502 -0
  482. truestar-0.1.0/tests/test_serve.py +250 -0
  483. truestar-0.1.0/tests/test_sm_aware.py +336 -0
  484. truestar-0.1.0/tests/test_sort_grad.py +203 -0
  485. truestar-0.1.0/tests/test_specdec.py +98 -0
  486. truestar-0.1.0/tests/test_spikes.py +132 -0
  487. truestar-0.1.0/tests/test_splitkv.py +298 -0
  488. truestar-0.1.0/tests/test_stacks.py +224 -0
  489. truestar-0.1.0/tests/test_tcexact.py +189 -0
  490. truestar-0.1.0/tests/test_tcexact_gpu.py +55 -0
  491. truestar-0.1.0/tests/test_tensorcore_model.py +236 -0
  492. truestar-0.1.0/tests/test_tolerance.py +298 -0
  493. truestar-0.1.0/tests/test_train.py +921 -0
  494. truestar-0.1.0/tests/test_train_amp_compiled.py +284 -0
  495. truestar-0.1.0/tests/test_train_compiled.py +266 -0
  496. truestar-0.1.0/tests/test_train_ir.py +176 -0
  497. truestar-0.1.0/tests/test_trainmode.py +174 -0
  498. truestar-0.1.0/tests/test_trainverify.py +322 -0
  499. truestar-0.1.0/tests/test_tree_kernel.py +90 -0
  500. truestar-0.1.0/tests/test_tree_tp.py +212 -0
  501. truestar-0.1.0/tests/test_value_and_grad.py +55 -0
  502. truestar-0.1.0/tests/test_vision_models.py +139 -0
  503. truestar-0.1.0/tests/test_vision_ops.py +159 -0
  504. truestar-0.1.0/tests/test_vmap.py +709 -0
  505. truestar-0.1.0/tests/test_webgpu.py +368 -0
  506. truestar-0.1.0/tests/test_webnn.py +135 -0
  507. truestar-0.1.0/tests/test_winml.py +163 -0
  508. truestar-0.1.0/tests/test_xfmr_perf.py +379 -0
  509. truestar-0.1.0/tests/test_xport.py +131 -0
truestar-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Sharven Rane
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,337 @@
1
+ Metadata-Version: 2.4
2
+ Name: truestar
3
+ Version: 0.1.0
4
+ Summary: The same answer on every chip: find where an ML model's results diverge across backends.
5
+ Author: Sharven Rane
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/SharvenRane/truestar
8
+ Project-URL: Repository, https://github.com/SharvenRane/truestar
9
+ Project-URL: Documentation, https://github.com/SharvenRane/truestar/tree/main/docs
10
+ Project-URL: Issues, https://github.com/SharvenRane/truestar/issues
11
+ Project-URL: Changelog, https://github.com/SharvenRane/truestar/blob/main/CHANGELOG.md
12
+ Keywords: pytorch,numerics,debugging,cuda,mps,rocm,compiler,verification
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Compilers
24
+ Classifier: Topic :: Software Development :: Debuggers
25
+ Classifier: Topic :: Software Development :: Testing
26
+ Requires-Python: >=3.10
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: torch<2.16,>=2.11
30
+ Requires-Dist: numpy>=1.22
31
+ Requires-Dist: sympy>=1.12
32
+ Provides-Extra: mcp
33
+ Requires-Dist: mcp>=1.10; extra == "mcp"
34
+ Provides-Extra: cpu-kernels
35
+ Requires-Dist: numba>=0.60; extra == "cpu-kernels"
36
+ Provides-Extra: onnx
37
+ Requires-Dist: onnx>=1.15; extra == "onnx"
38
+ Requires-Dist: onnxruntime>=1.17; extra == "onnx"
39
+ Provides-Extra: litert
40
+ Requires-Dist: ai-edge-litert>=1.2; extra == "litert"
41
+ Provides-Extra: executorch
42
+ Requires-Dist: executorch; extra == "executorch"
43
+ Dynamic: license-file
44
+
45
+ # Truestar
46
+
47
+ Every backend, checked against float64.
48
+
49
+ Truestar tells you when PyTorch gives a different answer on another backend, names the module and
50
+ the ATen op where it starts, and writes a repro script that runs on stock PyTorch. It runs your
51
+ unmodified model on every backend on the machine (CPU, CUDA, MPS) and compares each one with a
52
+ float64 CPU reference.
53
+
54
+ Version 0.1.0, the first public release. Every number on this page was measured in 2026-11 and
55
+ links to the doc or result file it comes from. Losses are listed next to the wins.
56
+
57
+ ## Install
58
+
59
+ ```
60
+ pip install truestar
61
+ ```
62
+
63
+ Requirements: Python 3.10 or newer (3.10 and 3.12 run in CI on Linux and Windows) and PyTorch
64
+ `>=2.11,<2.16` (2.11, 2.14.1 and 2.15.0 tested). Install PyTorch the way pytorch.org says for your
65
+ machine first. `truestar check` and the other checks are pure Python: no CUDA toolkit, no compiler.
66
+
67
+ Optional extras:
68
+
69
+ ```
70
+ pip install "truestar[mcp]" # official MCP SDK for `truestar mcp` (a builtin server is used without it)
71
+ pip install "truestar[cpu-kernels]" # numba, for the experimental compiler's CPU kernels
72
+ pip install "truestar[onnx]" # `truestar export --to onnx` and ONNX Runtime backends
73
+ pip install "truestar[litert]" # `truestar export --to litert`
74
+ pip install "truestar[executorch]" # `truestar export --to executorch` (must match your torch)
75
+ ```
76
+
77
+ The experimental compiler's GPU kernels are written in Triton. PyTorch's CUDA wheels for Linux
78
+ bring Triton with them; its CUDA wheels for Windows do not, so on Windows install the community
79
+ `triton-windows` package in the version its README pairs with your PyTorch. Without Triton,
80
+ `truestar check` still works; the compiled executor on `cuda` does not.
81
+
82
+ The examples are not part of the package. They come with a checkout:
83
+
84
+ ```
85
+ git clone https://github.com/SharvenRane/truestar
86
+ cd truestar
87
+ pip install .
88
+ truestar check examples/cpu_check.py
89
+ python examples/nn_mlp.py
90
+ ```
91
+
92
+ ## The five minute demo
93
+
94
+ [examples/notebooks/five_minute_check.ipynb](examples/notebooks/five_minute_check.ipynb) runs on a
95
+ CPU with stock PyTorch. It plants a bug in the CPU kernel of `aten::addmm` (float32 only: the bias
96
+ is added twice), leaves the model code clean, and runs one command:
97
+
98
+ ```
99
+ $ truestar check planted_model.py --backends cpu
100
+ truestar check: planted_model (float32), reference CPU float64
101
+
102
+ [DIVERGENT] cpu: CPU TS010 TS013
103
+ final output: relative error 7.1e-01
104
+ TS013 decisions: 3/8 predictions changed (0 near ties, 3 real)
105
+ TS010 first divergent module: blocks.0.up#0 (Linear), own error 1.2e-01 vs threshold 1.0e-04
106
+ source: planted_model.py:36 (planted_model.Block)
107
+ first divergent op: aten.addmm.default (op 3 of 4 in blocks.0.up#0), own error 1.2e-01 vs threshold 1.0e-04
108
+ inputs: float32[256], float32[96, 64], float32[64, 256]
109
+ repro: python truestar_repro/cpu_blocks.0.up_0/repro.py
110
+ op repro: python truestar_repro/cpu_blocks.0.up_0/op_repro.py
111
+ ...
112
+ overall: DIVERGENT
113
+ ```
114
+
115
+ Real output from the saved notebook run on 2026-11-24 (Linux, CPU only, Python 3.12, torch 2.11;
116
+ one precision line and the module list cut). The same model with the planted kernel switched off
117
+ reports `OK` with exit code 0. The generated `repro.py` exits 1 with the planted kernel loaded and
118
+ 0 on stock PyTorch, and `op_repro.py` isolates the single `aten.addmm` call.
119
+
120
+ ## Run it on your model
121
+
122
+ A model file defines three functions:
123
+
124
+ ```python
125
+ def get_model(): # an nn.Module
126
+ def get_inputs(): # a tensor, or a tuple of forward arguments
127
+ def get_kwargs(): # optional
128
+ ```
129
+
130
+ Then:
131
+
132
+ ```
133
+ truestar check my_model.py # every backend found on this machine
134
+ truestar check my_model.py --backends cpu,cuda # or cpu,mps
135
+ truestar check my_model.py --format agent # one JSON document for scripts and coding agents
136
+ ```
137
+
138
+ Exit codes: 0 every backend matches the reference, 1 a finding, 2 a usage error. From Python:
139
+
140
+ ```python
141
+ import truestar
142
+ report = truestar.check(model, inputs)
143
+ print(report.to_text())
144
+ ```
145
+
146
+ How it decides: the model runs once in float64 on the CPU as the reference. Every module is then
147
+ replayed alone on each backend with the reference inputs, so the error a module shows is its own
148
+ and never inherited from upstream. Each module's error is the relative L2 error of its output.
149
+ Thresholds start from a fixed floor per dtype (float32 1e-4, float16 5e-3, bfloat16 4e-2, TF32 5e-3)
150
+ and are raised to 10 times the error a correct CPU float32 run shows on the same module when that
151
+ is larger. Inside the first module over its threshold, ATen ops are traced on both sides and the
152
+ first op over its own threshold is named.
153
+
154
+ ## Same compiled answer on two GPU architectures
155
+
156
+ `truestar fingerprint` hashes the raw output bytes of small float32 models for Truestar's compiled
157
+ executor, eager PyTorch and `torch.compile`. The claim, scoped to what was measured
158
+ ([docs/CROSS_CHIP.md](docs/CROSS_CHIP.md), files in [docs/cross_chip/](docs/cross_chip/), measured
159
+ 2026-11-24):
160
+
161
+ > On an NVIDIA RTX 5070 Ti (Blackwell, 70 SMs, Windows, CUDA 12.8) and a Tesla T4 (Turing, 40 SMs,
162
+ > Linux, CUDA 13.0), both with PyTorch 2.11.0 and Triton 3.7.1, Truestar's compiled float32 outputs
163
+ > with `deterministic=True` and TF32 off were bitwise identical across the two GPUs for an MLP, a
164
+ > TransformerEncoderLayer and a two layer Llama style decode step, at batch sizes 1, 7, 64 and 256
165
+ > (12 of 12 rows), and identical run to run on each GPU. Eager PyTorch and `torch.compile` differed
166
+ > between the two GPUs in every one of those 12 rows.
167
+
168
+ It does not hold, or has not been run, for: float16, bfloat16 and TF32; resnet18 (its convolutions
169
+ are cuDNN calls); a different Triton version (Triton 3.6.0 on the same T4 changed the transformer
170
+ and decode step bits); AMD, Apple and Intel GPUs; Ampere, Ada and Hopper. Truestar does not claim
171
+ bitwise equality with PyTorch or with float64; its compiled results are checked against float64
172
+ within a stated bound. An earlier run on an RTX 5060 Laptop GPU (26 SMs) matched the 5070 Ti on the
173
+ legacy cases ([docs/data/cross_chip/](docs/data/cross_chip/)).
174
+
175
+ ## What it found
176
+
177
+ * Injected faults (a scaled output, zeroed channels, a NaN, a fault in some rows only) are blamed on
178
+ the exact module in small models and inside resnet18 and ViT, and downstream modules are not
179
+ blamed. The generated repro exits 1 under the fault and 0 without it.
180
+ * Clean real architectures report clean on CPU and an RTX 5070 Ti: MobileNetV3, EfficientNet B0,
181
+ ViT B/16, ResNet50 and BERT, all with random weights.
182
+ * On a real Apple M2 (macOS 26.6.2), the combined copy `t.to("cpu", torch.float64)` from MPS
183
+ returned all zeros with torch 2.14.1 and raised with torch 2.15.0; the two step copy is right on
184
+ both ([docs/METAL.md](docs/METAL.md) section 5, measured 2026-11-25).
185
+ * On GitHub hosted macOS 26 runners, `truestar check` flagged every `nn.Linear` on MPS. The same
186
+ probe is clean on the real M2, so that fault belongs to the runners' paravirtual GPU, not to
187
+ PyTorch ([docs/METAL.md](docs/METAL.md)).
188
+ * `truestar kernel` on 403 held out kernels written outside this project (KernelBench samples and
189
+ METR's KernelBenchFiltered best agent solutions, Modal L4, measured 2026-11-25): false fails
190
+ 3.6% (KB 6/168, METR 3/84) and false passes 6.4% and 7.1% (KB 7/109, METR 3/42), against
191
+ `torch.testing.assert_close` at 35.1% and 38.1% false fails. Not every kernel finished: 37 ran out
192
+ of GPU memory and 17 did not build or finish in time. Protocol, bounds written before the run, and
193
+ every table: [docs/KERNEL_CHECK.md](docs/KERNEL_CHECK.md); per kernel results in
194
+ [results/heldout_runs/](results/heldout_runs/).
195
+
196
+ ## Speed, measured (2026-11)
197
+
198
+ These numbers are for the experimental compiled executor; `truestar check` does not use it.
199
+
200
+ * Training, Llama style decoder (94M params, batch 8 x 512, float32, AdamW, Modal L4): 305.4 ms per
201
+ step against torch.compile 263.0 ms (**1.16x slower**) and eager 277.8 ms (1.10x slower)
202
+ ([docs/TRAINING.md](docs/TRAINING.md)).
203
+ * Mixed precision training, MLP at batch 512 (Modal L4): **0.82x the speed** of the best of eager
204
+ AMP and torch.compile AMP in both bfloat16 and float16, with loss curves within 7.4e-6 relative of
205
+ `torch.autocast` over 200 steps ([docs/TRAINING.md](docs/TRAINING.md)).
206
+ * Training, small models (RTX 5070 Ti, provisional: the GPU was shared): with a CUDA graph, 1.7x faster than eager on an MLP at batch
207
+ 64 and 1.6x on a six layer LM at batch 8; resnet18 is 2x slower than eager and 1.4x slower than
208
+ torch.compile, and max-autotune is 1.7x faster on the LM ([docs/TRAINING.md](docs/TRAINING.md)).
209
+ * Causal attention kernel against FlexAttention: 1.18x to 2.14x faster across six sizes (float16,
210
+ head dims 64 and 128, sequence 2048 to 8192, RTX 5070 Ti) ([docs/QUALITY_BAR.md](docs/QUALITY_BAR.md)).
211
+ * Inference (RTX 5070 Ti, provisional until a rerun on an idle GPU,
212
+ [docs/bench/xfmr_2026-11-24_provisional.json](docs/bench/xfmr_2026-11-24_provisional.json)):
213
+ TransformerEncoderLayer 1.21x faster than the best of eager and torch.compile in TF32 and 1.37x in
214
+ bfloat16, but 1.13x slower in strict float32; Llama style decode steps 1.5x to 3.0x faster than
215
+ eager with CUDA graphs, yet **0.48x to 0.78x the speed of torch.compile max-autotune** in every
216
+ decode case ([docs/QUALITY_BAR.md](docs/QUALITY_BAR.md), 2026-11-24 entry).
217
+
218
+ ## What it checks today
219
+
220
+ Status words come from the pain ledger in [docs/QUALITY_BAR.md](docs/QUALITY_BAR.md). "Detects"
221
+ means Truestar names the problem and writes a repro; it does not fix it.
222
+
223
+ | question | command | status |
224
+ |---|---|---|
225
+ | does a backend give a different answer, and where | `truestar check` ([GETTING_STARTED](docs/GETTING_STARTED.md)) | detects; `truestar fix` swaps a blamed ATen op for a verified decomposition ([FIX](docs/FIX.md)) |
226
+ | are the gradients right | `truestar check --backward` ([GRAD_CHECK](docs/GRAD_CHECK.md)) | detects |
227
+ | does Inductor, ONNX Runtime or TensorRT change the result | `truestar check --backends cuda+inductor,ort:cpu,trt:fp16` ([BACKENDS](docs/BACKENDS.md)) | detects: 5 of 5 injected faults named, 0 false alarms in 10 clean runs |
228
+ | what did an upgrade change | `truestar record`, then `truestar diff` ([RECORD_DIFF](docs/RECORD_DIFF.md)) | detects injected changes; two real torch versions not compared yet |
229
+ | does a row depend on the rest of the batch | `truestar invariance` ([INVARIANCE](docs/INVARIANCE.md)) | detects |
230
+ | does a port compute the same model | `truestar port` ([PORT_CHECK](docs/PORT_CHECK.md), [PORT_ENGINES](docs/PORT_ENGINES.md)) | detects: injected port bugs named at the right module, correct ports clean |
231
+ | does the deployed file compute the model in its own runtime | `truestar conform` ([CONFORM](docs/CONFORM.md)) | detects; solves the float16 runtime case |
232
+ | where does it overflow in float16 | `truestar range --target fp16` ([RANGE](docs/RANGE.md)) | in emulation only: 6 of 6 cited causes found, 0 false positives on 9 model and target pairs |
233
+ | is a hand or AI written kernel right | `truestar kernel ref.py cand.py` ([KERNEL_CHECK](docs/KERNEL_CHECK.md)) | detects; held out rates above |
234
+
235
+ ## Limits
236
+
237
+ * Hardware actually run: Windows with CPU and an RTX 5070 Ti; an RTX 5060 Laptop GPU; a Tesla T4 and
238
+ Modal L4 GPUs on Linux; Linux and Windows CPU in CI; a real Apple M2 Mac mini (Metal tests 109
239
+ passed, 1 skipped; the full suite on the Mac still had 13 failures and 3 errors,
240
+ [docs/METAL.md](docs/METAL.md) section 5). **AMD is unverified on hardware**: the ROCm code paths
241
+ compile for gfx942, gfx1100 and gfx1103 but have not run on an AMD GPU
242
+ ([docs/ROCM.md](docs/ROCM.md)). Intel XPU has not been run.
243
+ * The compiled executor is slower than PyTorch in several measured cases: transformer training 1.16x
244
+ behind torch.compile, mixed precision training at 0.82x of PyTorch AMP, resnet18 training 2x
245
+ behind eager, decode steps at 0.48x to 0.78x of torch.compile max-autotune (Speed, above).
246
+ * The verdict per module is a relative L2 error over the whole tensor. One wrong row in a large
247
+ bfloat16 tensor can stay under the floor: 1 bad row in 1024 gives about 0.031 against a 0.04
248
+ floor.
249
+ * The float64 reference is only float64 where the model lets it be. Models that cast explicitly
250
+ (`.float()`, `.to(torch.float32)`, `softmax(dtype=torch.float32)`) round the reference at those
251
+ points, and Truestar does not flag such casts yet. PyTorch CPU float64 kernel bugs are inherited.
252
+ * Op blame names the first op whose output error crosses its threshold. When a formula loses its
253
+ digits in float32 (catastrophic cancellation), that op can be a correctly rounded one;
254
+ `examples/check_model.py` shows this with `aten.sub`.
255
+ * Modules are replayed in eval mode by default; `--train` covers training mode batch norm and
256
+ dropout.
257
+ * Compiled kernels are verified on the first call per shape signature in each process: data
258
+ dependent faults on later calls with the same shapes are not seen unless `TRUESTAR_VERIFY=all`.
259
+ * macOS install is not in CI. Python 3.11 and 3.13 are not tested.
260
+ * Every doc ends with its own Limits section.
261
+
262
+ ## For coding agents
263
+
264
+ `check`, `record`, `diff`, `invariance` and `port` take `--format agent` and print one versioned
265
+ JSON document with stable `TS` codes, the blamed file and line, and a `next_actions` list with shell
266
+ commands. `truestar mcp` exposes the same checks as MCP tools. Start with [AGENTS.md](AGENTS.md);
267
+ the schema is in [docs/AGENT_INTERFACE.md](docs/AGENT_INTERFACE.md).
268
+
269
+ ## Also in the box (experimental)
270
+
271
+ These are libraries and commands outside the main claims. They are tested, each doc ends with its
272
+ own Limits section, and none of them is covered by the claims above. Index: [docs/index.md](docs/index.md).
273
+
274
+ * `truestar.assert_close(fn, inputs, out)`: a test assertion with a float64 derived tolerance
275
+ ([TOLERANCE](docs/TOLERANCE.md)).
276
+ * `@truestar.verified_autotune(...)`: Triton autotuning that drops configs whose answer is wrong
277
+ ([KERNEL_CHECK](docs/KERNEL_CHECK.md)).
278
+ * `truestar export model.py -o model.tsx` and `truestar run model.tsx inputs.pt`: an artifact
279
+ written only if it matches PyTorch at two batch sizes ([EXPORT](docs/EXPORT.md)).
280
+ * A native front end, `@truestar.function` (typed shapes, loops and branches compiled from source,
281
+ [FRONTEND](docs/FRONTEND.md)).
282
+ * A shape typed IR with autodiff and transforms (`truestar.ir.vmap`, `jvp`, `jacfwd`, `jacrev`,
283
+ [TRANSFORMS](docs/TRANSFORMS.md)).
284
+ * A compiled executor that lowers the IR onto Triton and numba kernels and checks each kernel
285
+ against float64 on its first call per shape signature ([COMPILER](docs/COMPILER.md)), with a
286
+ Metal backend for Apple GPUs ([METAL](docs/METAL.md)).
287
+ * Portable tensor cores: an opt in mode where float16, bfloat16 and TF32 dot products run on tensor
288
+ cores and give the same bits on every NVIDIA generation from sm_80 on
289
+ ([PORTABLE_TC](docs/PORTABLE_TC.md)), with Lean proofs of the core lemmas in [proofs/](proofs/)
290
+ ([PROOFS](docs/PROOFS.md)).
291
+ * Keyed random ops that give the same bits on this CPU and this GPU: 0 of 1e8 draws differ per
292
+ distribution ([RANDOM](docs/RANDOM.md)).
293
+ * An RL kernel set with bitwise equal per token logprobs across the training forward, prefill and
294
+ decode on a small Llama style model ([RL_KERNELS](docs/RL_KERNELS.md)).
295
+
296
+ ## Why not torch.compile, deterministic algorithms or JAX
297
+
298
+ They solve other problems. `torch.compile` and XLA change how a model runs; Truestar checks how it
299
+ runs, and treats Inductor, ONNX Runtime and TensorRT as backends to check. PyTorch's own notes limit
300
+ reproducibility to one platform and one release, and say results are not reproducible between CPU
301
+ and GPU even with identical seeds. Deterministic flags make one GPU repeat itself; they do not say
302
+ which of two GPUs is right. Details and sources: [docs/FAQ.md](docs/FAQ.md).
303
+
304
+ ## Prior art and credits
305
+
306
+ Truestar builds on, borrows ideas from, or is checked against:
307
+
308
+ * Batch invariant kernels: Thinking Machines Lab, "Defeating Nondeterminism in LLM Inference" and
309
+ [batch_invariant_ops](https://github.com/thinking-machines-lab/batch_invariant_ops); SGLang's
310
+ [deterministic inference](https://www.lmsys.org/blog/2025-09-22-sglang-deterministic); vLLM's
311
+ [batch invariance](https://docs.vllm.ai/en/latest/features/batch_invariance/) and its bitwise
312
+ consistent trainer and sampler work. They ship batch invariance in production engines; Truestar's
313
+ `invariance` and `rlpair` commands check it.
314
+ * Keyed, counter based random numbers: JAX's PRNG keys (Threefry) and the Philox and Threefry
315
+ generators of Salmon et al., "Parallel random numbers: as easy as 1, 2, 3" (SC 2011). SplitMix64
316
+ (Steele, Lea and Flood, 2014). Normal draws use Acklam's and Wichura's (AS241) published
317
+ approximations.
318
+ * [Triton](https://github.com/triton-lang/triton), which generates every Truestar GPU kernel; the
319
+ Triton fused attention tutorial and FlashAttention (Dao et al.) for the attention schedule.
320
+ * [ONNX Runtime](https://onnxruntime.ai/), TensorRT and Polygraphy, torch.compile and Inductor,
321
+ FlexAttention, LiteRT, ExecuTorch and llama.cpp, all run or checked as backends and engines.
322
+ * Integer rounding conventions from gemmlowp, CMSIS-NN and TFLite, reproduced bit for bit by
323
+ `truestar intref`.
324
+ * [DLPack](https://github.com/dmlc/dlpack) and [safetensors](https://github.com/huggingface/safetensors)
325
+ for interop; numba for CPU kernels.
326
+ * Held out test data: [KernelBench](https://github.com/ScalingIntelligence/KernelBench) (MIT) and
327
+ its kernelbench-samples dataset (Apache 2.0), stored with attribution in
328
+ [tests/data/heldout/kernelbench/](tests/data/heldout/kernelbench/README.md); METR's
329
+ KernelBenchFiltered is downloaded on demand and not redistributed.
330
+ * The evidence for the pain ledger: PyTorch's reproducibility notes, NVIDIA's cuDNN determinism
331
+ notes, "Mind the Gap" (arXiv 2511.11601), KernelBench (Stanford) and HUD's YAKK, and the issue
332
+ threads cited row by row in [docs/QUALITY_BAR.md](docs/QUALITY_BAR.md).
333
+
334
+ ## License
335
+
336
+ Apache 2.0, see [LICENSE](LICENSE). Author: Sharven Rane. No telemetry: nothing leaves the machine
337
+ unless you share a report. Security issues: see [SECURITY.md](SECURITY.md).