fhelium 0.10.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 (494) hide show
  1. fhelium-0.10.0/.clang-format +26 -0
  2. fhelium-0.10.0/.clangd +29 -0
  3. fhelium-0.10.0/.dockerignore +15 -0
  4. fhelium-0.10.0/.github/FUNDING.yml +2 -0
  5. fhelium-0.10.0/.github/actionlint.yaml +4 -0
  6. fhelium-0.10.0/.github/workflows/release.yml +450 -0
  7. fhelium-0.10.0/.gitignore +204 -0
  8. fhelium-0.10.0/.gitmodules +3 -0
  9. fhelium-0.10.0/.pre-commit-config.yaml +57 -0
  10. fhelium-0.10.0/CITATION.cff +36 -0
  11. fhelium-0.10.0/CMakeLists.txt +25 -0
  12. fhelium-0.10.0/LICENSE +21 -0
  13. fhelium-0.10.0/PKG-INFO +219 -0
  14. fhelium-0.10.0/README.md +178 -0
  15. fhelium-0.10.0/cmake/FHEliumBackends.cmake +70 -0
  16. fhelium-0.10.0/cmake/FHEliumCuda.cmake +161 -0
  17. fhelium-0.10.0/cmake/FHEliumNativeInstall.cmake +88 -0
  18. fhelium-0.10.0/cmake/FHEliumNativeTargets.cmake +109 -0
  19. fhelium-0.10.0/cmake/FHEliumTorch.cmake +93 -0
  20. fhelium-0.10.0/csrc/ops/ckks/ckks.cpp +90 -0
  21. fhelium-0.10.0/csrc/ops/ckks/cpu/ckks_cpu.cpp +823 -0
  22. fhelium-0.10.0/csrc/ops/ckks/cuda/automorphism_cuda.cu +112 -0
  23. fhelium-0.10.0/csrc/ops/ckks/cuda/ckks_cuda.cpp +180 -0
  24. fhelium-0.10.0/csrc/ops/ckks/cuda/ckks_cuda.h +94 -0
  25. fhelium-0.10.0/csrc/ops/ckks/cuda/keyswitch_cuda.cu +292 -0
  26. fhelium-0.10.0/csrc/ops/ckks/cuda/plaintext_cuda.cu +424 -0
  27. fhelium-0.10.0/csrc/ops/ckks/cuda/rescale_cuda.cu +198 -0
  28. fhelium-0.10.0/csrc/ops/common/cpu/montgomery.h +216 -0
  29. fhelium-0.10.0/csrc/ops/common/cuda/kernel_support.cuh +14 -0
  30. fhelium-0.10.0/csrc/ops/common/cuda/montgomery.cuh +188 -0
  31. fhelium-0.10.0/csrc/ops/common/cuda/repetition.cuh +86 -0
  32. fhelium-0.10.0/csrc/ops/common/rns_batch.h +116 -0
  33. fhelium-0.10.0/csrc/ops/common/rns_parameters.h +16 -0
  34. fhelium-0.10.0/csrc/ops/ntt/cpu/indexed_ntt_cpu.cpp +479 -0
  35. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_compact_cuda.inc.cuh +151 -0
  36. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_compact_detail.cuh +296 -0
  37. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_compact_keyswitch_fused.inc.cuh +172 -0
  38. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_cuda.cpp +245 -0
  39. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_cuda.cu +25 -0
  40. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_cuda.h +78 -0
  41. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_indexed_cuda.inc.cuh +58 -0
  42. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_indexed_detail.cuh +45 -0
  43. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_power_of_two_radix_cuda.inc.cuh +156 -0
  44. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_power_of_two_radix_detail.cuh +769 -0
  45. fhelium-0.10.0/csrc/ops/ntt/cuda/forward_ntt_to_montgomery_indexed_cuda.inc.cuh +139 -0
  46. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_compact_cuda.inc.cuh +153 -0
  47. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_compact_detail.cuh +301 -0
  48. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_cuda.cpp +244 -0
  49. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_cuda.cu +26 -0
  50. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_cuda.h +91 -0
  51. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_indexed_detail.cuh +46 -0
  52. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_montgomery_indexed_cuda.inc.cuh +68 -0
  53. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_power_of_two_radix_cuda.inc.cuh +89 -0
  54. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_power_of_two_radix_detail.cuh +759 -0
  55. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_to_centered_indexed_cuda.inc.cuh +70 -0
  56. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_to_standard_indexed_cuda.inc.cuh +70 -0
  57. fhelium-0.10.0/csrc/ops/ntt/cuda/inverse_ntt_to_standard_lazy_indexed_cuda.inc.cuh +73 -0
  58. fhelium-0.10.0/csrc/ops/ntt/cuda/ntt_representation_kernels.cuh +120 -0
  59. fhelium-0.10.0/csrc/ops/ntt/cuda/power_of_two_radix_butterfly.cuh +227 -0
  60. fhelium-0.10.0/csrc/ops/ntt/forward_ntt.cpp +80 -0
  61. fhelium-0.10.0/csrc/ops/ntt/inverse_ntt.cpp +82 -0
  62. fhelium-0.10.0/csrc/ops/ntt/ntt_execution_constants.h +19 -0
  63. fhelium-0.10.0/csrc/ops/ntt/ntt_validation.h +160 -0
  64. fhelium-0.10.0/csrc/ops/rns/cpu/rns_arithmetic_cpu.cpp +752 -0
  65. fhelium-0.10.0/csrc/ops/rns/cpu/rns_canonical_arithmetic_cpu.cpp +260 -0
  66. fhelium-0.10.0/csrc/ops/rns/cuda/mixed_radix_cuda.cu +236 -0
  67. fhelium-0.10.0/csrc/ops/rns/cuda/mixed_radix_cuda.h +18 -0
  68. fhelium-0.10.0/csrc/ops/rns/cuda/rns_arithmetic_cuda.cpp +133 -0
  69. fhelium-0.10.0/csrc/ops/rns/cuda/rns_arithmetic_cuda.cu +431 -0
  70. fhelium-0.10.0/csrc/ops/rns/cuda/rns_arithmetic_cuda.h +54 -0
  71. fhelium-0.10.0/csrc/ops/rns/cuda/rns_canonical_arithmetic_cuda.cpp +45 -0
  72. fhelium-0.10.0/csrc/ops/rns/cuda/rns_canonical_arithmetic_cuda.cu +164 -0
  73. fhelium-0.10.0/csrc/ops/rns/cuda/rns_canonical_arithmetic_cuda.h +24 -0
  74. fhelium-0.10.0/csrc/ops/rns/rns_arithmetic.cpp +72 -0
  75. fhelium-0.10.0/csrc/ops/rns/rns_canonical_arithmetic.cpp +23 -0
  76. fhelium-0.10.0/csrc/runtime/cuda_info.cpp +614 -0
  77. fhelium-0.10.0/csrc/runtime/cuda_info.h +95 -0
  78. fhelium-0.10.0/docs/.vitepress/config.mts +704 -0
  79. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/components/BenchmarkCompare.vue +388 -0
  80. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/components/BenchmarkPortal.vue +173 -0
  81. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/components/BenchmarkPortalHeader.vue +80 -0
  82. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/components/BenchmarkPortalNav.vue +80 -0
  83. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/components/BenchmarkResultDetail.vue +269 -0
  84. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/components/BenchmarkRunRecord.vue +109 -0
  85. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/components/CkksParameterSummary.vue +398 -0
  86. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/data/catalog.data.mts +30 -0
  87. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/data/catalog.ts +452 -0
  88. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/data/catalogClient.ts +7 -0
  89. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/data/specification.ts +58 -0
  90. fhelium-0.10.0/docs/.vitepress/theme/benchmarks/v1/data/ui.ts +288 -0
  91. fhelium-0.10.0/docs/.vitepress/theme/components/BlogIndex.vue +113 -0
  92. fhelium-0.10.0/docs/.vitepress/theme/components/BsgsMatvecPerformance.vue +276 -0
  93. fhelium-0.10.0/docs/.vitepress/theme/components/DocCard.vue +25 -0
  94. fhelium-0.10.0/docs/.vitepress/theme/components/DocGrid.vue +5 -0
  95. fhelium-0.10.0/docs/.vitepress/theme/components/HomeControlDeck.vue +595 -0
  96. fhelium-0.10.0/docs/.vitepress/theme/components/HomeGraphXray.vue +653 -0
  97. fhelium-0.10.0/docs/.vitepress/theme/components/HomeHero.vue +35 -0
  98. fhelium-0.10.0/docs/.vitepress/theme/components/HomeOpeningRail.vue +61 -0
  99. fhelium-0.10.0/docs/.vitepress/theme/components/HomeProgrammingModel.vue +159 -0
  100. fhelium-0.10.0/docs/.vitepress/theme/components/HomeStackBuilder.vue +698 -0
  101. fhelium-0.10.0/docs/.vitepress/theme/components/InstallCommand.vue +155 -0
  102. fhelium-0.10.0/docs/.vitepress/theme/components/MermaidDiagram.vue +479 -0
  103. fhelium-0.10.0/docs/.vitepress/theme/components/pythonHighlight.ts +34 -0
  104. fhelium-0.10.0/docs/.vitepress/theme/custom.css +1680 -0
  105. fhelium-0.10.0/docs/.vitepress/theme/data/bsgsMatvecPerformance.ts +113 -0
  106. fhelium-0.10.0/docs/.vitepress/theme/data/install-catalog.json +122 -0
  107. fhelium-0.10.0/docs/.vitepress/theme/data/installResolver.ts +201 -0
  108. fhelium-0.10.0/docs/.vitepress/theme/data/installSelector.ts +63 -0
  109. fhelium-0.10.0/docs/.vitepress/theme/index.ts +71 -0
  110. fhelium-0.10.0/docs/about/branding.md +156 -0
  111. fhelium-0.10.0/docs/about/index.md +58 -0
  112. fhelium-0.10.0/docs/about/research.md +75 -0
  113. fhelium-0.10.0/docs/api/index.md +48 -0
  114. fhelium-0.10.0/docs/benchmarks/index.md +10 -0
  115. fhelium-0.10.0/docs/benchmarks/v1/compare.md +10 -0
  116. fhelium-0.10.0/docs/benchmarks/v1/methodology.md +126 -0
  117. fhelium-0.10.0/docs/benchmarks/v1/results/[slug].md +9 -0
  118. fhelium-0.10.0/docs/benchmarks/v1/results/[slug].paths.mts +20 -0
  119. fhelium-0.10.0/docs/blog/index.md +11 -0
  120. fhelium-0.10.0/docs/blog/posts/welcome.md +30 -0
  121. fhelium-0.10.0/docs/blog/posts.data.mts +62 -0
  122. fhelium-0.10.0/docs/concepts/architecture/ownership-and-responsibilities.md +151 -0
  123. fhelium-0.10.0/docs/concepts/architecture/system-overview.md +266 -0
  124. fhelium-0.10.0/docs/concepts/ckks/composable-bootstrapping.md +182 -0
  125. fhelium-0.10.0/docs/concepts/ckks/context-and-modulus-chain.md +209 -0
  126. fhelium-0.10.0/docs/concepts/ckks/evaluator-operation-transitions.md +217 -0
  127. fhelium-0.10.0/docs/concepts/ckks/key-lifecycle.md +125 -0
  128. fhelium-0.10.0/docs/concepts/ckks/scale-and-level-lifecycle.md +305 -0
  129. fhelium-0.10.0/docs/concepts/ckks/state-transitions-and-orthogonality.md +204 -0
  130. fhelium-0.10.0/docs/concepts/ckks/value-model-and-identity.md +261 -0
  131. fhelium-0.10.0/docs/concepts/distributed/communication-semantics.md +179 -0
  132. fhelium-0.10.0/docs/concepts/distributed/spmd-model.md +154 -0
  133. fhelium-0.10.0/docs/concepts/execution/cuda-graph-model.md +177 -0
  134. fhelium-0.10.0/docs/concepts/execution/exact-signatures-and-buffers.md +161 -0
  135. fhelium-0.10.0/docs/concepts/execution/residency-lifetimes.md +382 -0
  136. fhelium-0.10.0/docs/concepts/execution/serialization-and-artifacts.md +191 -0
  137. fhelium-0.10.0/docs/concepts/glossary.md +459 -0
  138. fhelium-0.10.0/docs/concepts/index.md +77 -0
  139. fhelium-0.10.0/docs/concepts/performance/cost-model.md +304 -0
  140. fhelium-0.10.0/docs/concepts/programming-model.md +136 -0
  141. fhelium-0.10.0/docs/concepts/unified-jit-programs.md +192 -0
  142. fhelium-0.10.0/docs/developer/artifact-store-v1.md +162 -0
  143. fhelium-0.10.0/docs/developer/binary-packaging-and-release.md +374 -0
  144. fhelium-0.10.0/docs/developer/composable-ckks-bootstrap.md +379 -0
  145. fhelium-0.10.0/docs/developer/compressed-plaintext-internals.md +122 -0
  146. fhelium-0.10.0/docs/developer/contributing.md +96 -0
  147. fhelium-0.10.0/docs/developer/distributed-internals.md +206 -0
  148. fhelium-0.10.0/docs/developer/documentation.md +207 -0
  149. fhelium-0.10.0/docs/developer/engine-native-stack.md +334 -0
  150. fhelium-0.10.0/docs/developer/execution-buffers-and-cuda-graphs.md +246 -0
  151. fhelium-0.10.0/docs/developer/index.md +110 -0
  152. fhelium-0.10.0/docs/developer/mathematical-notation-and-invariants.md +371 -0
  153. fhelium-0.10.0/docs/developer/multiplication-keyswitch-rescale.md +247 -0
  154. fhelium-0.10.0/docs/developer/native-operator-workflow.md +220 -0
  155. fhelium-0.10.0/docs/developer/residency-plans-and-execution.md +426 -0
  156. fhelium-0.10.0/docs/developer/residency-state-and-ownership.md +289 -0
  157. fhelium-0.10.0/docs/developer/rns-and-ntt.md +370 -0
  158. fhelium-0.10.0/docs/developer/source-tree.md +162 -0
  159. fhelium-0.10.0/docs/developer/unified-jit-internals.md +360 -0
  160. fhelium-0.10.0/docs/how-to/benchmark-a-workload.md +348 -0
  161. fhelium-0.10.0/docs/how-to/capture-repeated-evaluator.md +145 -0
  162. fhelium-0.10.0/docs/how-to/choose-homogeneous-batch-size.md +296 -0
  163. fhelium-0.10.0/docs/how-to/choose-multi-gpu-partition.md +162 -0
  164. fhelium-0.10.0/docs/how-to/choose-ntt-backend.md +251 -0
  165. fhelium-0.10.0/docs/how-to/choose-preset-and-depth.md +203 -0
  166. fhelium-0.10.0/docs/how-to/choose-residency-control-level.md +142 -0
  167. fhelium-0.10.0/docs/how-to/compose-bootstrap-circuit.md +237 -0
  168. fhelium-0.10.0/docs/how-to/diagnose-distributed-hang.md +141 -0
  169. fhelium-0.10.0/docs/how-to/diagnose-residency-failure.md +201 -0
  170. fhelium-0.10.0/docs/how-to/diagnose-value-state-mismatch.md +159 -0
  171. fhelium-0.10.0/docs/how-to/implement-bootstrap-component.md +302 -0
  172. fhelium-0.10.0/docs/how-to/index.md +133 -0
  173. fhelium-0.10.0/docs/how-to/inspect-runtime-and-cuda.md +85 -0
  174. fhelium-0.10.0/docs/how-to/manage-exact-artifacts.md +226 -0
  175. fhelium-0.10.0/docs/how-to/optimize-workload.md +147 -0
  176. fhelium-0.10.0/docs/how-to/provision-keyset.md +169 -0
  177. fhelium-0.10.0/docs/how-to/screen-ntt-backends.md +143 -0
  178. fhelium-0.10.0/docs/how-to/stream-bounded-memory.md +213 -0
  179. fhelium-0.10.0/docs/how-to/switch-cpu-cuda.md +124 -0
  180. fhelium-0.10.0/docs/how-to/use-multiparty-ckks.md +501 -0
  181. fhelium-0.10.0/docs/how-to/visualize-jit-program.md +242 -0
  182. fhelium-0.10.0/docs/index.md +69 -0
  183. fhelium-0.10.0/docs/package-lock.json +4457 -0
  184. fhelium-0.10.0/docs/package.json +23 -0
  185. fhelium-0.10.0/docs/public/assets/fhelium-workload.py +564 -0
  186. fhelium-0.10.0/docs/public/benchmarks/v1/catalog.json +38701 -0
  187. fhelium-0.10.0/docs/public/benchmarks/v1/runs/.gitkeep +0 -0
  188. fhelium-0.10.0/docs/public/benchmarks/v1/runs/sha256-31aca07aaa985fbec8732ed5d6d8ed6130dc3a84486f9ed180837d3fb5f5c700.json +26152 -0
  189. fhelium-0.10.0/docs/public/benchmarks/v1/runs/sha256-6ea6e626b39b38b03e6caf7d1869b2bd9c8b0ec14122807df274543c78a0b30a.json +26152 -0
  190. fhelium-0.10.0/docs/public/benchmarks/v1/runs/sha256-7c4d3825a48f67e997a7b6aeaf7aff1d359cd36c3baa0b65c4253cd1ee60c496.json +26152 -0
  191. fhelium-0.10.0/docs/public/benchmarks/v1/runs/sha256-b99e2a91072e1964f24d916ea2b2a7c7fd45d7227a737ec9246b50d304a5c5f8.json +26012 -0
  192. fhelium-0.10.0/docs/public/benchmarks/v1/runs/sha256-fc48f2dafaee311c92cfaa9c7ea332e67aef120cd5529ff0e6019da99b60d559.json +26152 -0
  193. fhelium-0.10.0/docs/public/brand/fhelium-github-social-card.png +0 -0
  194. fhelium-0.10.0/docs/public/brand/fhelium-github-social-card.svg +79 -0
  195. fhelium-0.10.0/docs/public/brand/fhelium-lockup-light.svg +32 -0
  196. fhelium-0.10.0/docs/public/brand/fhelium-lockup-mono-black.svg +20 -0
  197. fhelium-0.10.0/docs/public/brand/fhelium-lockup-mono-white.svg +20 -0
  198. fhelium-0.10.0/docs/public/brand/fhelium-lockup.svg +32 -0
  199. fhelium-0.10.0/docs/public/brand/fhelium-mark-1024.png +0 -0
  200. fhelium-0.10.0/docs/public/brand/fhelium-mark-128.png +0 -0
  201. fhelium-0.10.0/docs/public/brand/fhelium-mark-256.png +0 -0
  202. fhelium-0.10.0/docs/public/brand/fhelium-mark-512.png +0 -0
  203. fhelium-0.10.0/docs/public/brand/fhelium-mark-black-256.png +0 -0
  204. fhelium-0.10.0/docs/public/brand/fhelium-mark-black.svg +9 -0
  205. fhelium-0.10.0/docs/public/brand/fhelium-mark-flat-128.png +0 -0
  206. fhelium-0.10.0/docs/public/brand/fhelium-mark-flat-16.png +0 -0
  207. fhelium-0.10.0/docs/public/brand/fhelium-mark-flat-256.png +0 -0
  208. fhelium-0.10.0/docs/public/brand/fhelium-mark-flat-32.png +0 -0
  209. fhelium-0.10.0/docs/public/brand/fhelium-mark-flat-64.png +0 -0
  210. fhelium-0.10.0/docs/public/brand/fhelium-mark-flat.svg +9 -0
  211. fhelium-0.10.0/docs/public/brand/fhelium-mark-mono.svg +9 -0
  212. fhelium-0.10.0/docs/public/brand/fhelium-mark-white-256.png +0 -0
  213. fhelium-0.10.0/docs/public/brand/fhelium-mark-white.svg +9 -0
  214. fhelium-0.10.0/docs/public/brand/fhelium-mark.svg +21 -0
  215. fhelium-0.10.0/docs/public/brand/fhelium-social-card.png +0 -0
  216. fhelium-0.10.0/docs/public/brand/fhelium-social-card.svg +79 -0
  217. fhelium-0.10.0/docs/public/figures/jit-example19-lowered-program.svg +2669 -0
  218. fhelium-0.10.0/docs/public/figures/ntt-backend-recommendation-example-sm120.svg +29 -0
  219. fhelium-0.10.0/docs/tsconfig.json +20 -0
  220. fhelium-0.10.0/docs/tutorial/automatic-residency.md +201 -0
  221. fhelium-0.10.0/docs/tutorial/basic-ckks-workflow.md +96 -0
  222. fhelium-0.10.0/docs/tutorial/composable-ckks-bootstrap.md +256 -0
  223. fhelium-0.10.0/docs/tutorial/compressed-plaintext.md +354 -0
  224. fhelium-0.10.0/docs/tutorial/cuda-graph-matvec.md +168 -0
  225. fhelium-0.10.0/docs/tutorial/explicit-residency.md +311 -0
  226. fhelium-0.10.0/docs/tutorial/explicit-scale-management.md +128 -0
  227. fhelium-0.10.0/docs/tutorial/homogeneous-batching.md +214 -0
  228. fhelium-0.10.0/docs/tutorial/index.md +53 -0
  229. fhelium-0.10.0/docs/tutorial/installation.md +45 -0
  230. fhelium-0.10.0/docs/tutorial/jit-custom-pipeline.md +414 -0
  231. fhelium-0.10.0/docs/tutorial/jit-textual-ir.md +335 -0
  232. fhelium-0.10.0/docs/tutorial/key-materials.md +160 -0
  233. fhelium-0.10.0/docs/tutorial/late-relinearization-and-ntt-reuse.md +130 -0
  234. fhelium-0.10.0/docs/tutorial/modulus-chain-depth.md +150 -0
  235. fhelium-0.10.0/docs/tutorial/multiparty-ckks.md +327 -0
  236. fhelium-0.10.0/docs/tutorial/reusable-value-buffer.md +182 -0
  237. fhelium-0.10.0/docs/tutorial/rotation-hoisting.md +148 -0
  238. fhelium-0.10.0/docs/tutorial/spmd-independent-ciphertexts.md +151 -0
  239. fhelium-0.10.0/docs/tutorial/spmd-limb-parallel-pipeline.md +131 -0
  240. fhelium-0.10.0/docs/tutorial/spmd-rotation-parallel-matvec.md +162 -0
  241. fhelium-0.10.0/docs/tutorial/support-and-security.md +86 -0
  242. fhelium-0.10.0/docs/tutorial/tutorials.md +124 -0
  243. fhelium-0.10.0/docs/tutorial/unified-jit.md +464 -0
  244. fhelium-0.10.0/docs/tutorial/value-memory-and-persistence.md +307 -0
  245. fhelium-0.10.0/docs/vercel.json +6 -0
  246. fhelium-0.10.0/examples/01_basic_ckks_flow.py +77 -0
  247. fhelium-0.10.0/examples/02_key_materials.py +119 -0
  248. fhelium-0.10.0/examples/03_plaintext_ciphertext_memory.py +184 -0
  249. fhelium-0.10.0/examples/04_modulus_chain_depth.py +102 -0
  250. fhelium-0.10.0/examples/05_explicit_scale_management.py +246 -0
  251. fhelium-0.10.0/examples/06_explicit_state_late_relinearization_ntt.py +118 -0
  252. fhelium-0.10.0/examples/07_rotation_hoisting_benchmark.py +155 -0
  253. fhelium-0.10.0/examples/08_spmd_independent_ciphertexts.py +123 -0
  254. fhelium-0.10.0/examples/09_spmd_rotation_parallel_mxv.py +191 -0
  255. fhelium-0.10.0/examples/10_spmd_limb_parallel_pipeline.py +137 -0
  256. fhelium-0.10.0/examples/11_cuda_graph_matrix_vector.py +212 -0
  257. fhelium-0.10.0/examples/12_reusable_value_buffer.py +476 -0
  258. fhelium-0.10.0/examples/13_explicit_residency.py +311 -0
  259. fhelium-0.10.0/examples/14_automatic_residency.py +313 -0
  260. fhelium-0.10.0/examples/15_homogeneous_batching.py +370 -0
  261. fhelium-0.10.0/examples/16_compressed_plaintext.py +160 -0
  262. fhelium-0.10.0/examples/17_ckks_bootstrap_logn16.py +125 -0
  263. fhelium-0.10.0/examples/18_multiparty_ckks.py +360 -0
  264. fhelium-0.10.0/examples/19_unified_jit.py +262 -0
  265. fhelium-0.10.0/examples/20_jit_textual_ir.py +188 -0
  266. fhelium-0.10.0/examples/21_jit_custom_pipeline.py +260 -0
  267. fhelium-0.10.0/examples/README.md +98 -0
  268. fhelium-0.10.0/examples/common.py +232 -0
  269. fhelium-0.10.0/fhelium/__init__.py +92 -0
  270. fhelium-0.10.0/fhelium/_cli/__init__.py +0 -0
  271. fhelium-0.10.0/fhelium/_cli/cuda_view.py +242 -0
  272. fhelium-0.10.0/fhelium/_cli/main.py +394 -0
  273. fhelium-0.10.0/fhelium/artifacts/__init__.py +19 -0
  274. fhelium-0.10.0/fhelium/artifacts/_catalog.py +252 -0
  275. fhelium-0.10.0/fhelium/artifacts/artifact.py +72 -0
  276. fhelium-0.10.0/fhelium/artifacts/store.py +1224 -0
  277. fhelium-0.10.0/fhelium/benchmarks/__init__.py +29 -0
  278. fhelium-0.10.0/fhelium/benchmarks/cli.py +47 -0
  279. fhelium-0.10.0/fhelium/benchmarks/io.py +74 -0
  280. fhelium-0.10.0/fhelium/benchmarks/model.py +521 -0
  281. fhelium-0.10.0/fhelium/benchmarks/registry.py +107 -0
  282. fhelium-0.10.0/fhelium/benchmarks/render.py +82 -0
  283. fhelium-0.10.0/fhelium/benchmarks/standalone/__init__.py +1 -0
  284. fhelium-0.10.0/fhelium/benchmarks/standalone/ckks_operator_latency_and_rotation_hoisting.py +671 -0
  285. fhelium-0.10.0/fhelium/benchmarks/standalone/distributed_worker.py +957 -0
  286. fhelium-0.10.0/fhelium/benchmarks/standalone/ntt_backend_single_operation_latency.py +344 -0
  287. fhelium-0.10.0/fhelium/benchmarks/standalone/ntt_kernel.py +123 -0
  288. fhelium-0.10.0/fhelium/benchmarks/standalone/ntt_recommendation.py +652 -0
  289. fhelium-0.10.0/fhelium/benchmarks/standalone/packed_matrix_vector.py +496 -0
  290. fhelium-0.10.0/fhelium/benchmarks/standalone/spmd_collectives_and_rotation_matvec.py +320 -0
  291. fhelium-0.10.0/fhelium/benchmarks/synthetic.py +19 -0
  292. fhelium-0.10.0/fhelium/benchmarks/timing.py +244 -0
  293. fhelium-0.10.0/fhelium/benchmarks/tui.py +380 -0
  294. fhelium-0.10.0/fhelium/benchmarks/v1/__init__.py +41 -0
  295. fhelium-0.10.0/fhelium/benchmarks/v1/_validation.py +145 -0
  296. fhelium-0.10.0/fhelium/benchmarks/v1/cases.py +196 -0
  297. fhelium-0.10.0/fhelium/benchmarks/v1/io.py +56 -0
  298. fhelium-0.10.0/fhelium/benchmarks/v1/manifest.py +258 -0
  299. fhelium-0.10.0/fhelium/benchmarks/v1/matrix.py +413 -0
  300. fhelium-0.10.0/fhelium/benchmarks/v1/model.py +930 -0
  301. fhelium-0.10.0/fhelium/benchmarks/v1/ntt.py +330 -0
  302. fhelium-0.10.0/fhelium/benchmarks/v1/operations.py +1306 -0
  303. fhelium-0.10.0/fhelium/benchmarks/v1/platform.py +447 -0
  304. fhelium-0.10.0/fhelium/benchmarks/v1/polynomial.py +393 -0
  305. fhelium-0.10.0/fhelium/benchmarks/v1/runner.py +327 -0
  306. fhelium-0.10.0/fhelium/benchmarks/v1/specification.json +375 -0
  307. fhelium-0.10.0/fhelium/config/__init__.py +33 -0
  308. fhelium-0.10.0/fhelium/config/_prime_catalog.py +213 -0
  309. fhelium-0.10.0/fhelium/config/ckks.py +649 -0
  310. fhelium-0.10.0/fhelium/config/ntt.py +179 -0
  311. fhelium-0.10.0/fhelium/config/resources/__init__.py +1 -0
  312. fhelium-0.10.0/fhelium/config/resources/message_primes_v1.safetensors +0 -0
  313. fhelium-0.10.0/fhelium/config/resources/scale_primes_v1.safetensors +0 -0
  314. fhelium-0.10.0/fhelium/config/security.py +277 -0
  315. fhelium-0.10.0/fhelium/core/__init__.py +59 -0
  316. fhelium-0.10.0/fhelium/core/ciphertext.py +384 -0
  317. fhelium-0.10.0/fhelium/core/compressed_plaintext.py +563 -0
  318. fhelium-0.10.0/fhelium/core/context.py +96 -0
  319. fhelium-0.10.0/fhelium/core/keys.py +645 -0
  320. fhelium-0.10.0/fhelium/core/plaintext.py +441 -0
  321. fhelium-0.10.0/fhelium/core/rotation.py +107 -0
  322. fhelium-0.10.0/fhelium/core/scale.py +32 -0
  323. fhelium-0.10.0/fhelium/core/state.py +24 -0
  324. fhelium-0.10.0/fhelium/core/tensor_resident.py +201 -0
  325. fhelium-0.10.0/fhelium/core/validation.py +85 -0
  326. fhelium-0.10.0/fhelium/distributed/__init__.py +125 -0
  327. fhelium-0.10.0/fhelium/distributed/_ciphertext_reduction.py +232 -0
  328. fhelium-0.10.0/fhelium/distributed/_collective_common.py +283 -0
  329. fhelium-0.10.0/fhelium/distributed/_limb_collectives.py +203 -0
  330. fhelium-0.10.0/fhelium/distributed/_state.py +165 -0
  331. fhelium-0.10.0/fhelium/distributed/_transfer.py +274 -0
  332. fhelium-0.10.0/fhelium/distributed/_typed_collectives.py +42 -0
  333. fhelium-0.10.0/fhelium/distributed/_value_collectives.py +682 -0
  334. fhelium-0.10.0/fhelium/engine/__init__.py +5 -0
  335. fhelium-0.10.0/fhelium/engine/ckks_decryptor.py +375 -0
  336. fhelium-0.10.0/fhelium/engine/ckks_encryptor.py +363 -0
  337. fhelium-0.10.0/fhelium/engine/ckks_engine.py +3897 -0
  338. fhelium-0.10.0/fhelium/engine/ckks_plaintext_codec.py +457 -0
  339. fhelium-0.10.0/fhelium/engine/ckks_rescale.py +406 -0
  340. fhelium-0.10.0/fhelium/engine/direct_keyswitch_consumer.py +139 -0
  341. fhelium-0.10.0/fhelium/engine/galois.py +121 -0
  342. fhelium-0.10.0/fhelium/engine/hybrid_keyswitch.py +595 -0
  343. fhelium-0.10.0/fhelium/engine/key_generator.py +460 -0
  344. fhelium-0.10.0/fhelium/engine/ntt/__init__.py +29 -0
  345. fhelium-0.10.0/fhelium/engine/ntt/backends/__init__.py +1 -0
  346. fhelium-0.10.0/fhelium/engine/ntt/backends/compact_radix2.py +162 -0
  347. fhelium-0.10.0/fhelium/engine/ntt/backends/indexed_radix2.py +171 -0
  348. fhelium-0.10.0/fhelium/engine/ntt/backends/power_of_two_radix.py +218 -0
  349. fhelium-0.10.0/fhelium/engine/ntt/factory.py +71 -0
  350. fhelium-0.10.0/fhelium/engine/ntt/interface.py +176 -0
  351. fhelium-0.10.0/fhelium/engine/ntt/plans/__init__.py +11 -0
  352. fhelium-0.10.0/fhelium/engine/ntt/plans/compact_radix2.py +47 -0
  353. fhelium-0.10.0/fhelium/engine/ntt/plans/indexed_radix2.py +138 -0
  354. fhelium-0.10.0/fhelium/engine/ntt/plans/power_of_two_radix.py +63 -0
  355. fhelium-0.10.0/fhelium/engine/ntt/plans/twiddles.py +228 -0
  356. fhelium-0.10.0/fhelium/engine/ntt/tables.py +162 -0
  357. fhelium-0.10.0/fhelium/engine/rns/__init__.py +5 -0
  358. fhelium-0.10.0/fhelium/engine/rns/chain.py +86 -0
  359. fhelium-0.10.0/fhelium/engine/rns/decomposition.py +71 -0
  360. fhelium-0.10.0/fhelium/engine/rns/layout.py +178 -0
  361. fhelium-0.10.0/fhelium/engine/rns/montgomery.py +137 -0
  362. fhelium-0.10.0/fhelium/engine/rns/parameters.py +259 -0
  363. fhelium-0.10.0/fhelium/engine/rns/runtime.py +975 -0
  364. fhelium-0.10.0/fhelium/engine/slot_embedding.py +436 -0
  365. fhelium-0.10.0/fhelium/errors.py +542 -0
  366. fhelium-0.10.0/fhelium/execution/__init__.py +29 -0
  367. fhelium-0.10.0/fhelium/execution/buffer.py +721 -0
  368. fhelium-0.10.0/fhelium/execution/cuda_graph.py +641 -0
  369. fhelium-0.10.0/fhelium/execution/signature.py +411 -0
  370. fhelium-0.10.0/fhelium/experimental/__init__.py +3 -0
  371. fhelium-0.10.0/fhelium/experimental/bootstrap/__init__.py +43 -0
  372. fhelium-0.10.0/fhelium/experimental/bootstrap/_full_slot.py +490 -0
  373. fhelium-0.10.0/fhelium/experimental/bootstrap/_linear.py +716 -0
  374. fhelium-0.10.0/fhelium/experimental/bootstrap/_modraise.py +498 -0
  375. fhelium-0.10.0/fhelium/experimental/bootstrap/_modular.py +383 -0
  376. fhelium-0.10.0/fhelium/experimental/bootstrap/_ops.py +439 -0
  377. fhelium-0.10.0/fhelium/experimental/bootstrap/_polynomial.py +1050 -0
  378. fhelium-0.10.0/fhelium/experimental/bootstrap/presets/__init__.py +15 -0
  379. fhelium-0.10.0/fhelium/experimental/bootstrap/presets/cosine.py +128 -0
  380. fhelium-0.10.0/fhelium/experimental/bootstrap/presets/exponential.py +69 -0
  381. fhelium-0.10.0/fhelium/experimental/jit/__init__.py +173 -0
  382. fhelium-0.10.0/fhelium/experimental/jit/_analysis.py +277 -0
  383. fhelium-0.10.0/fhelium/experimental/jit/_capture.py +726 -0
  384. fhelium-0.10.0/fhelium/experimental/jit/_dialect.py +289 -0
  385. fhelium-0.10.0/fhelium/experimental/jit/_errors.py +23 -0
  386. fhelium-0.10.0/fhelium/experimental/jit/_execution.py +1214 -0
  387. fhelium-0.10.0/fhelium/experimental/jit/_ir.py +89 -0
  388. fhelium-0.10.0/fhelium/experimental/jit/_program.py +299 -0
  389. fhelium-0.10.0/fhelium/experimental/jit/_specs.py +183 -0
  390. fhelium-0.10.0/fhelium/experimental/jit/_workspace.py +27 -0
  391. fhelium-0.10.0/fhelium/experimental/jit/passes/__init__.py +50 -0
  392. fhelium-0.10.0/fhelium/experimental/jit/passes/_base.py +270 -0
  393. fhelium-0.10.0/fhelium/experimental/jit/passes/_default.py +42 -0
  394. fhelium-0.10.0/fhelium/experimental/jit/passes/_utils.py +215 -0
  395. fhelium-0.10.0/fhelium/experimental/jit/passes/eliminate_dead_values.py +131 -0
  396. fhelium-0.10.0/fhelium/experimental/jit/passes/insert_multiply_ntt_transitions.py +108 -0
  397. fhelium-0.10.0/fhelium/experimental/jit/passes/insert_plaintext_preparation.py +138 -0
  398. fhelium-0.10.0/fhelium/experimental/jit/passes/insert_relinearization.py +78 -0
  399. fhelium-0.10.0/fhelium/experimental/jit/passes/insert_rescale.py +125 -0
  400. fhelium-0.10.0/fhelium/experimental/jit/passes/late_relinearization.py +53 -0
  401. fhelium-0.10.0/fhelium/experimental/jit/passes/late_rescale.py +53 -0
  402. fhelium-0.10.0/fhelium/experimental/jit/passes/lower_logical_to_ckks.py +234 -0
  403. fhelium-0.10.0/fhelium/experimental/jit/passes/lower_semantic_to_logical.py +135 -0
  404. fhelium-0.10.0/fhelium/experimental/jit/passes/validate_cipher_states.py +39 -0
  405. fhelium-0.10.0/fhelium/experimental/jit/passes/validate_executable_graph.py +456 -0
  406. fhelium-0.10.0/fhelium/experimental/jit/passes/visualize_svg.py +815 -0
  407. fhelium-0.10.0/fhelium/experimental/mpc/__init__.py +51 -0
  408. fhelium-0.10.0/fhelium/experimental/mpc/_ops.py +1047 -0
  409. fhelium-0.10.0/fhelium/native/__init__.py +21 -0
  410. fhelium-0.10.0/fhelium/native/_abi.py +139 -0
  411. fhelium-0.10.0/fhelium/native/cuda/__init__.py +60 -0
  412. fhelium-0.10.0/fhelium/native/runtime.py +225 -0
  413. fhelium-0.10.0/fhelium/native/wrapper/__init__.py +136 -0
  414. fhelium-0.10.0/fhelium/native/wrapper/ckks_ops.py +448 -0
  415. fhelium-0.10.0/fhelium/native/wrapper/fake_op.py +667 -0
  416. fhelium-0.10.0/fhelium/native/wrapper/ntt_diagnostic_ops.py +111 -0
  417. fhelium-0.10.0/fhelium/native/wrapper/ntt_ops.py +660 -0
  418. fhelium-0.10.0/fhelium/native/wrapper/rns_ops.py +467 -0
  419. fhelium-0.10.0/fhelium/py.typed +0 -0
  420. fhelium-0.10.0/fhelium/residency/__init__.py +107 -0
  421. fhelium-0.10.0/fhelium/residency/controller.py +1322 -0
  422. fhelium-0.10.0/fhelium/residency/lease.py +389 -0
  423. fhelium-0.10.0/fhelium/residency/location.py +114 -0
  424. fhelium-0.10.0/fhelium/residency/manager.py +2574 -0
  425. fhelium-0.10.0/fhelium/residency/model.py +173 -0
  426. fhelium-0.10.0/fhelium/residency/plan.py +194 -0
  427. fhelium-0.10.0/fhelium/residency/policy.py +272 -0
  428. fhelium-0.10.0/fhelium/residency/request.py +102 -0
  429. fhelium-0.10.0/fhelium/residency/snapshot.py +645 -0
  430. fhelium-0.10.0/fhelium/rng/__init__.py +5 -0
  431. fhelium-0.10.0/fhelium/rng/csprng.py +237 -0
  432. fhelium-0.10.0/fhelium/serialization/__init__.py +27 -0
  433. fhelium-0.10.0/fhelium/serialization/safetensors.py +568 -0
  434. fhelium-0.10.0/fhelium/serialization/value.py +900 -0
  435. fhelium-0.10.0/fhelium.code-workspace +22 -0
  436. fhelium-0.10.0/justfile +73 -0
  437. fhelium-0.10.0/packaging/README.md +267 -0
  438. fhelium-0.10.0/packaging/build_manylinux_wheel.py +338 -0
  439. fhelium-0.10.0/packaging/build_release.py +120 -0
  440. fhelium-0.10.0/packaging/check_linux_wheel.py +239 -0
  441. fhelium-0.10.0/packaging/manylinux_2_28.Dockerfile +2 -0
  442. fhelium-0.10.0/packaging/manylinux_2_28_cuda12_9.Dockerfile +14 -0
  443. fhelium-0.10.0/packaging/manylinux_2_28_cuda13.Dockerfile +14 -0
  444. fhelium-0.10.0/packaging/merge_published_indexes.py +223 -0
  445. fhelium-0.10.0/packaging/prepare_static_index.py +305 -0
  446. fhelium-0.10.0/packaging/publish_static_index.py +198 -0
  447. fhelium-0.10.0/packaging/release_matrix.json +108 -0
  448. fhelium-0.10.0/packaging/release_matrix.py +412 -0
  449. fhelium-0.10.0/packaging/release_matrix.schema.json +183 -0
  450. fhelium-0.10.0/packaging/validate_cuda_wheel.py +123 -0
  451. fhelium-0.10.0/packaging/validate_release_ref.py +87 -0
  452. fhelium-0.10.0/packaging/validate_repository_routing.py +149 -0
  453. fhelium-0.10.0/packaging/validate_static_index.py +183 -0
  454. fhelium-0.10.0/packaging/verify_public_release.py +97 -0
  455. fhelium-0.10.0/packaging/verify_pypi_release.py +117 -0
  456. fhelium-0.10.0/pyproject.toml +121 -0
  457. fhelium-0.10.0/pytest.ini +10 -0
  458. fhelium-0.10.0/scripts/finalize_native_build.py +117 -0
  459. fhelium-0.10.0/scripts/generate_api_docs.py +1167 -0
  460. fhelium-0.10.0/scripts/generate_native_wrappers.py +621 -0
  461. fhelium-0.10.0/scripts/generate_prime_catalog.py +366 -0
  462. fhelium-0.10.0/scripts/publish_benchmark_v1.py +1441 -0
  463. fhelium-0.10.0/scripts/release_dependencies.py +45 -0
  464. fhelium-0.10.0/tests/conftest.py +81 -0
  465. fhelium-0.10.0/tests/test_artifact_store.py +597 -0
  466. fhelium-0.10.0/tests/test_batch_value_model.py +589 -0
  467. fhelium-0.10.0/tests/test_ckks_bootstrap.py +485 -0
  468. fhelium-0.10.0/tests/test_ckks_operation_correctness.py +1226 -0
  469. fhelium-0.10.0/tests/test_compressed_plaintext.py +336 -0
  470. fhelium-0.10.0/tests/test_context_identity.py +29 -0
  471. fhelium-0.10.0/tests/test_cpu_native_strides.py +547 -0
  472. fhelium-0.10.0/tests/test_cuda_graph_execution.py +147 -0
  473. fhelium-0.10.0/tests/test_distributed_transfer.py +180 -0
  474. fhelium-0.10.0/tests/test_execution_buffer.py +177 -0
  475. fhelium-0.10.0/tests/test_experimental_mpc.py +682 -0
  476. fhelium-0.10.0/tests/test_inplace_api_semantics.py +64 -0
  477. fhelium-0.10.0/tests/test_jit_api.py +133 -0
  478. fhelium-0.10.0/tests/test_jit_capture.py +124 -0
  479. fhelium-0.10.0/tests/test_jit_execution.py +332 -0
  480. fhelium-0.10.0/tests/test_jit_ir.py +166 -0
  481. fhelium-0.10.0/tests/test_jit_passes.py +248 -0
  482. fhelium-0.10.0/tests/test_native_operator_invariants.py +432 -0
  483. fhelium-0.10.0/tests/test_ntt_backend.py +578 -0
  484. fhelium-0.10.0/tests/test_preset_api.py +63 -0
  485. fhelium-0.10.0/tests/test_prime_catalog.py +366 -0
  486. fhelium-0.10.0/tests/test_residency.py +54 -0
  487. fhelium-0.10.0/tests/test_residency_controller.py +1128 -0
  488. fhelium-0.10.0/tests/test_residency_integration.py +303 -0
  489. fhelium-0.10.0/tests/test_resource_residency.py +2481 -0
  490. fhelium-0.10.0/tests/test_rng.py +170 -0
  491. fhelium-0.10.0/tests/test_scale_management.py +348 -0
  492. fhelium-0.10.0/tests/test_security.py +288 -0
  493. fhelium-0.10.0/tests/test_serialization.py +272 -0
  494. fhelium-0.10.0/tests/test_value_representation_invariants.py +549 -0
@@ -0,0 +1,26 @@
1
+ # The clang-format is part of llvm toolchain.
2
+ # It need to install llvm and clang to format source code style.
3
+ #
4
+ # The basic usage is,
5
+ # clang-format -i -style=file PATH/TO/SOURCE/CODE
6
+ #
7
+ # The -style=file implicit use ".clang-format" file located in one of
8
+ # parent directory.
9
+ # The -i means inplace change.
10
+ #
11
+ # The document of clang-format is
12
+ # http://clang.llvm.org/docs/ClangFormat.html
13
+ # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
14
+ ---
15
+ Language: Cpp
16
+ BasedOnStyle: Google
17
+ IndentWidth: 2
18
+ TabWidth: 2
19
+ ContinuationIndentWidth: 4
20
+ AccessModifierOffset: -1 # The private/protected/public has no indent in class
21
+ Standard: Cpp11
22
+ AllowAllParametersOfDeclarationOnNextLine: true
23
+ BinPackParameters: false
24
+ BinPackArguments: false
25
+ IncludeBlocks: Preserve
26
+ IncludeIsMainSourceRegex: (\.cu)$
fhelium-0.10.0/.clangd ADDED
@@ -0,0 +1,29 @@
1
+ CompileFlags:
2
+ Compiler: clang++
3
+ CompilationDatabase: .
4
+ Add:
5
+ - -x
6
+ - cuda
7
+ - "-std=c++17"
8
+ - "--cuda-gpu-arch=sm_86"
9
+ Remove:
10
+ # strip CUDA fatbin args
11
+ - "-Xfatbin*"
12
+ - "-Xcompiler*"
13
+ - "-Xcudafe*"
14
+ - "-rdc=*"
15
+ - "-gpu=*"
16
+ - "--diag_suppress*"
17
+ # strip CUDA arch flags
18
+ - "-gencode*"
19
+ - "--generate-code*"
20
+ # strip gcc's -fcoroutines
21
+ - -fcoroutines
22
+ # strip CUDA flags unknown to clang
23
+ - "-rdc=true"
24
+ - "-ccbin*"
25
+ - "--compiler-options*"
26
+ - "--expt-extended-lambda"
27
+ - "--expt-relaxed-constexpr"
28
+ - "-forward-unknown-to-host-compiler"
29
+ - "-Werror=cross-execution-space-call"
@@ -0,0 +1,15 @@
1
+ .git
2
+ .gitignore
3
+ .venv
4
+ build
5
+ dist
6
+ release-output
7
+ docs/.vitepress/cache
8
+ docs/.vitepress/dist
9
+ docs/node_modules
10
+ experiments
11
+ node_modules
12
+ third_party/triton-csprng
13
+ **/__pycache__
14
+ **/*.pyc
15
+ **/*.so
@@ -0,0 +1,2 @@
1
+ github: [visualDust]
2
+ custom: ["https://buymeacoffee.com/gavingong"]
@@ -0,0 +1,4 @@
1
+ self-hosted-runner:
2
+ labels:
3
+ - fhelium-release
4
+ - gpu
@@ -0,0 +1,450 @@
1
+ name: Release FHElium
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ tag:
7
+ description: Existing release tag matching pyproject.toml
8
+ required: true
9
+ type: string
10
+ initialize_repository:
11
+ description: Establish empty Simple Repository roots
12
+ required: true
13
+ default: false
14
+ type: boolean
15
+ prerelease:
16
+ description: Mark the GitHub Release as a pre-release
17
+ required: true
18
+ default: false
19
+ type: boolean
20
+
21
+ run-name: Release ${{ inputs.tag }}
22
+
23
+ permissions:
24
+ contents: read
25
+
26
+ concurrency:
27
+ group: fhelium-release
28
+ cancel-in-progress: false
29
+
30
+ env:
31
+ RELEASE_OUTPUT: ${{ github.workspace }}/release-output
32
+
33
+ jobs:
34
+ build-and-prepare:
35
+ runs-on: [self-hosted, linux, x64, fhelium-release, gpu]
36
+ outputs:
37
+ version: ${{ steps.version.outputs.version }}
38
+ source_commit: ${{ steps.version.outputs.source_commit }}
39
+ steps:
40
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
41
+ with:
42
+ ref: ${{ inputs.tag }}
43
+ fetch-depth: 0
44
+ - name: Validate immutable release ref
45
+ id: version
46
+ shell: bash
47
+ env:
48
+ RELEASE_TAG: ${{ inputs.tag }}
49
+ run: |
50
+ set -euo pipefail
51
+ source_commit=$(git rev-parse HEAD)
52
+ version=$(python packaging/validate_release_ref.py \
53
+ --tag "$RELEASE_TAG" \
54
+ --source-commit "$source_commit" \
55
+ --remote origin)
56
+ git tag --points-at HEAD | grep -Fx "$RELEASE_TAG"
57
+ printf 'version=%s\n' "$version" >> "$GITHUB_OUTPUT"
58
+ printf 'source_commit=%s\n' "$source_commit" >> "$GITHUB_OUTPUT"
59
+ python -m pip install \
60
+ "jsonschema==4.26.0" \
61
+ "scikit-build-core==1.0.3"
62
+ python packaging/release_matrix.py validate
63
+ - name: Verify source tree
64
+ shell: bash
65
+ run: |
66
+ set -euo pipefail
67
+ configuration_json=$(python packaging/release_matrix.py show torch213-cu130)
68
+ torch_requirement=$(python -c \
69
+ 'import json,sys; print(json.load(sys.stdin)["torch_requirement"])' \
70
+ <<<"$configuration_json")
71
+ torch_index_url=$(python -c \
72
+ 'import json,sys; print(json.load(sys.stdin)["torch_index_url"])' \
73
+ <<<"$configuration_json")
74
+ python -m pip install \
75
+ --index-url "$torch_index_url" \
76
+ "$torch_requirement"
77
+ python -m pip install --group dev --no-build-isolation
78
+ python -m pip install \
79
+ --editable . \
80
+ --no-build-isolation \
81
+ --no-cache-dir \
82
+ --verbose
83
+ python -m ruff check fhelium tests examples scripts packaging
84
+ python -m ruff format --check fhelium tests examples scripts packaging
85
+ python -m pyright
86
+ python -m pytest -q
87
+ npm --prefix docs ci
88
+ npm --prefix docs run build
89
+ git diff --check
90
+ - name: Build release wheels
91
+ shell: bash
92
+ run: |
93
+ set -euo pipefail
94
+ rm -rf "$RELEASE_OUTPUT"
95
+ docker build \
96
+ --file packaging/manylinux_2_28.Dockerfile \
97
+ --tag fhelium-manylinux-cpu \
98
+ .
99
+ docker build \
100
+ --file packaging/manylinux_2_28_cuda12_9.Dockerfile \
101
+ --tag fhelium-manylinux-cuda-12.9 \
102
+ .
103
+ docker build \
104
+ --file packaging/manylinux_2_28_cuda13.Dockerfile \
105
+ --tag fhelium-manylinux-cuda-13.0 \
106
+ .
107
+ for configuration in \
108
+ torch213-cu130 torch212-cu129 torch213-cpu torch212-cpu; do
109
+ for python_abi in cp312-cp312 cp313-cp313; do
110
+ python packaging/build_release.py \
111
+ --configuration "$configuration" \
112
+ --python-abi "$python_abi" \
113
+ --output "$RELEASE_OUTPUT" \
114
+ --smoke
115
+ done
116
+ done
117
+ - name: Execute native CUDA validation
118
+ shell: bash
119
+ run: |
120
+ set -euo pipefail
121
+ for configuration in torch213-cu130 torch212-cu129; do
122
+ for python_abi in cp312-cp312 cp313-cp313; do
123
+ case "$python_abi" in
124
+ cp312-cp312) python_bin=python3.12 ;;
125
+ cp313-cp313) python_bin=python3.13 ;;
126
+ esac
127
+ wheel=$(find \
128
+ "$RELEASE_OUTPUT/$configuration/$python_abi/wheelhouse" \
129
+ -maxdepth 1 -type f -name '*.whl' -print -quit)
130
+ test -n "$wheel"
131
+ python packaging/validate_cuda_wheel.py \
132
+ "$wheel" \
133
+ --configuration "$configuration" \
134
+ --python "$python_bin"
135
+ done
136
+ done
137
+ - name: Build source distribution
138
+ shell: bash
139
+ run: |
140
+ set -euo pipefail
141
+ python -m pip install "build==1.5.0" "twine==6.2.0"
142
+ python -m build --sdist --no-isolation --outdir "$RELEASE_OUTPUT/sdist"
143
+ python -m twine check "$RELEASE_OUTPUT"/sdist/*
144
+ rm -rf "$RUNNER_TEMP/sdist-wheel"
145
+ mkdir -p "$RUNNER_TEMP/sdist-wheel"
146
+ CMAKE_ARGS='-DFHELIUM_NATIVE_BACKENDS=CPU' \
147
+ python -m pip wheel \
148
+ "$RELEASE_OUTPUT"/sdist/fhelium-*.tar.gz \
149
+ --no-build-isolation \
150
+ --no-deps \
151
+ --no-cache-dir \
152
+ --wheel-dir "$RUNNER_TEMP/sdist-wheel"
153
+ - name: Prepare static repository
154
+ shell: bash
155
+ run: |
156
+ set -euo pipefail
157
+ python packaging/prepare_static_index.py \
158
+ --input "$RELEASE_OUTPUT" \
159
+ --output "$RELEASE_OUTPUT/prepared-site" \
160
+ --prepared-at "$(git show -s --format=%cI HEAD)"
161
+ merge_args=()
162
+ if [ '${{ inputs.initialize_repository }}' = true ]; then
163
+ merge_args+=(--allow-missing-repository)
164
+ fi
165
+ python packaging/merge_published_indexes.py \
166
+ "$RELEASE_OUTPUT/prepared-site" "${merge_args[@]}"
167
+ python packaging/validate_static_index.py \
168
+ "$RELEASE_OUTPUT/prepared-site" \
169
+ --source-commit "$(git rev-parse HEAD)"
170
+ - name: Preserve release bundle
171
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
172
+ with:
173
+ name: fhelium-${{ inputs.tag }}
174
+ path: |
175
+ ${{ env.RELEASE_OUTPUT }}/sdist/*
176
+ ${{ env.RELEASE_OUTPUT }}/prepared-site/**
177
+ if-no-files-found: error
178
+ retention-days: 30
179
+
180
+ publish:
181
+ needs: build-and-prepare
182
+ runs-on: [self-hosted, linux, x64, fhelium-release, gpu]
183
+ environment: release
184
+ permissions:
185
+ contents: read
186
+ id-token: write
187
+ steps:
188
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
189
+ with:
190
+ ref: ${{ needs.build-and-prepare.outputs.source_commit }}
191
+ fetch-depth: 0
192
+ - name: Restore release bundle
193
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
194
+ with:
195
+ name: fhelium-${{ inputs.tag }}
196
+ path: ${{ env.RELEASE_OUTPUT }}
197
+ - name: Install publication clients
198
+ shell: bash
199
+ run: |
200
+ set -euo pipefail
201
+ python -m pip install "awscli==1.46.0" "twine==6.2.0"
202
+ - name: Validate restored repository
203
+ shell: bash
204
+ env:
205
+ RELEASE_TAG: ${{ inputs.tag }}
206
+ SOURCE_COMMIT: ${{ needs.build-and-prepare.outputs.source_commit }}
207
+ run: |
208
+ set -euo pipefail
209
+ python packaging/validate_release_ref.py \
210
+ --tag "$RELEASE_TAG" \
211
+ --source-commit "$SOURCE_COMMIT" \
212
+ --remote origin
213
+ python packaging/validate_static_index.py \
214
+ "$RELEASE_OUTPUT/prepared-site" \
215
+ --source-commit "$(git rev-parse HEAD)"
216
+ python -m twine check "$RELEASE_OUTPUT"/sdist/*
217
+ - name: Validate public Simple Repository routing
218
+ shell: bash
219
+ env:
220
+ INITIALIZE_REPOSITORY: ${{ inputs.initialize_repository }}
221
+ run: |
222
+ set -euo pipefail
223
+ if [ "$INITIALIZE_REPOSITORY" = true ]; then
224
+ python packaging/validate_repository_routing.py \
225
+ --expect-empty-or-matching \
226
+ "$RELEASE_OUTPUT/prepared-site"
227
+ else
228
+ python packaging/validate_repository_routing.py
229
+ fi
230
+ - name: Publish immutable release objects to R2
231
+ shell: bash
232
+ env:
233
+ AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
234
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
235
+ AWS_DEFAULT_REGION: auto
236
+ FHELIUM_R2_ENDPOINT_URL: ${{ vars.R2_ENDPOINT_URL }}
237
+ FHELIUM_R2_BUCKET: ${{ vars.R2_BUCKET }}
238
+ RELEASE_TAG: ${{ inputs.tag }}
239
+ SOURCE_COMMIT: ${{ needs.build-and-prepare.outputs.source_commit }}
240
+ run: |
241
+ set -euo pipefail
242
+ python packaging/validate_release_ref.py \
243
+ --tag "$RELEASE_TAG" \
244
+ --source-commit "$SOURCE_COMMIT" \
245
+ --remote origin
246
+ python packaging/publish_static_index.py \
247
+ "$RELEASE_OUTPUT/prepared-site" \
248
+ --phase artifacts
249
+ python packaging/verify_public_release.py \
250
+ "$RELEASE_OUTPUT/prepared-site/release-manifest.json"
251
+ - name: Validate PyPI release identity
252
+ shell: bash
253
+ env:
254
+ RELEASE_TAG: ${{ inputs.tag }}
255
+ SOURCE_COMMIT: ${{ needs.build-and-prepare.outputs.source_commit }}
256
+ run: |
257
+ set -euo pipefail
258
+ python packaging/validate_release_ref.py \
259
+ --tag "$RELEASE_TAG" \
260
+ --source-commit "$SOURCE_COMMIT" \
261
+ --remote origin
262
+ python packaging/verify_pypi_release.py \
263
+ "$RELEASE_OUTPUT"/sdist/fhelium-*.tar.gz \
264
+ --allow-missing
265
+ - name: Publish source distribution to PyPI
266
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
267
+ with:
268
+ packages-dir: release-output/sdist/
269
+ print-hash: true
270
+ skip-existing: true
271
+ - name: Verify PyPI release identity
272
+ shell: bash
273
+ env:
274
+ RELEASE_TAG: ${{ inputs.tag }}
275
+ SOURCE_COMMIT: ${{ needs.build-and-prepare.outputs.source_commit }}
276
+ run: |
277
+ set -euo pipefail
278
+ python packaging/validate_release_ref.py \
279
+ --tag "$RELEASE_TAG" \
280
+ --source-commit "$SOURCE_COMMIT" \
281
+ --remote origin
282
+ python packaging/verify_pypi_release.py \
283
+ "$RELEASE_OUTPUT"/sdist/fhelium-*.tar.gz \
284
+ --attempts 24 \
285
+ --interval 5
286
+ - name: Publish cumulative Simple Repository indexes
287
+ shell: bash
288
+ env:
289
+ AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
290
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
291
+ AWS_DEFAULT_REGION: auto
292
+ FHELIUM_R2_ENDPOINT_URL: ${{ vars.R2_ENDPOINT_URL }}
293
+ FHELIUM_R2_BUCKET: ${{ vars.R2_BUCKET }}
294
+ RELEASE_TAG: ${{ inputs.tag }}
295
+ SOURCE_COMMIT: ${{ needs.build-and-prepare.outputs.source_commit }}
296
+ run: |
297
+ set -euo pipefail
298
+ python packaging/validate_release_ref.py \
299
+ --tag "$RELEASE_TAG" \
300
+ --source-commit "$SOURCE_COMMIT" \
301
+ --remote origin
302
+ python packaging/publish_static_index.py \
303
+ "$RELEASE_OUTPUT/prepared-site" \
304
+ --phase indexes
305
+ - name: Verify public package indexes
306
+ shell: bash
307
+ run: |
308
+ set -euo pipefail
309
+ version='${{ needs.build-and-prepare.outputs.version }}'
310
+ for configuration in \
311
+ torch213-cu130 torch212-cu129 torch213-cpu torch212-cpu; do
312
+ configuration_json=$(
313
+ python packaging/release_matrix.py show "$configuration"
314
+ )
315
+ torch_requirement=$(python -c \
316
+ 'import json,sys; print(json.load(sys.stdin)["torch_requirement"])' \
317
+ <<<"$configuration_json")
318
+ torch_index_url=$(python -c \
319
+ 'import json,sys; print(json.load(sys.stdin)["torch_index_url"])' \
320
+ <<<"$configuration_json")
321
+ expected_backends=$(python -c \
322
+ 'import json,sys; print(",".join(json.load(sys.stdin)["native_backends"]))' \
323
+ <<<"$configuration_json")
324
+ expected_torch=$(python -c \
325
+ 'import json,sys; print(json.load(sys.stdin)["torch_runtime_version"])' \
326
+ <<<"$configuration_json")
327
+ for python_abi in cp312-cp312 cp313-cp313; do
328
+ case "$python_abi" in
329
+ cp312-cp312) python_bin=python3.12 ;;
330
+ cp313-cp313) python_bin=python3.13 ;;
331
+ esac
332
+ environment="$RUNNER_TEMP/public-$configuration-$python_abi"
333
+ rm -rf "$environment"
334
+ "$python_bin" -m venv "$environment"
335
+ "$environment/bin/python" -m pip install \
336
+ --index-url "$torch_index_url" \
337
+ "$torch_requirement"
338
+ for attempt in $(seq 1 24); do
339
+ if "$environment/bin/python" -m pip install \
340
+ --only-binary=fhelium \
341
+ --extra-index-url \
342
+ "https://download.fhelium.550w.host/$configuration/simple/" \
343
+ "fhelium==$version"; then
344
+ break
345
+ fi
346
+ test "$attempt" -lt 24
347
+ sleep 10
348
+ done
349
+ EXPECTED_BACKENDS="$expected_backends" \
350
+ EXPECTED_TORCH="$expected_torch" \
351
+ EXPECTED_VERSION="$version" \
352
+ "$environment/bin/python" -I - <<'PY'
353
+ import os
354
+
355
+ import torch
356
+ import fhelium
357
+ from fhelium.native import native_status
358
+
359
+ assert fhelium.__version__ == os.environ["EXPECTED_VERSION"]
360
+ assert str(torch.__version__) == os.environ["EXPECTED_TORCH"]
361
+ status = native_status()
362
+ assert status.available, status
363
+ assert set(status.backends) == set(
364
+ os.environ["EXPECTED_BACKENDS"].split(",")
365
+ ), status
366
+ lhs = torch.tensor([[[1, 2, 3, 4]]], dtype=torch.int64)
367
+ parameters = torch.zeros((8, 1), dtype=torch.int64)
368
+ parameters[0, 0] = 34
369
+ actual = torch.ops.fhelium_rns_ops.add_canonical(
370
+ lhs, lhs, parameters
371
+ )
372
+ expected = torch.tensor([[[2, 4, 6, 8]]], dtype=torch.int64)
373
+ assert torch.equal(actual, expected)
374
+ PY
375
+ done
376
+ done
377
+ publish-github-release:
378
+ needs: [build-and-prepare, publish]
379
+ runs-on: [self-hosted, linux, x64, fhelium-release, gpu]
380
+ permissions:
381
+ contents: write
382
+ steps:
383
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
384
+ with:
385
+ ref: ${{ needs.build-and-prepare.outputs.source_commit }}
386
+ fetch-depth: 0
387
+ - name: Restore release bundle
388
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
389
+ with:
390
+ name: fhelium-${{ inputs.tag }}
391
+ path: ${{ env.RELEASE_OUTPUT }}
392
+ - name: Prepare installation-catalog patch
393
+ shell: bash
394
+ env:
395
+ RELEASE_TAG: ${{ inputs.tag }}
396
+ SOURCE_COMMIT: ${{ needs.build-and-prepare.outputs.source_commit }}
397
+ run: |
398
+ set -euo pipefail
399
+ python packaging/validate_release_ref.py \
400
+ --tag "$RELEASE_TAG" \
401
+ --source-commit "$SOURCE_COMMIT" \
402
+ --remote origin
403
+ git switch --detach
404
+ cp \
405
+ "$RELEASE_OUTPUT/prepared-site/install-catalog.json" \
406
+ docs/.vitepress/theme/data/install-catalog.json
407
+ git config user.name github-actions[bot]
408
+ git config user.email \
409
+ 41898282+github-actions[bot]@users.noreply.github.com
410
+ git add docs/.vitepress/theme/data/install-catalog.json
411
+ git commit -m "docs: publish FHElium $RELEASE_TAG install recipes"
412
+ git format-patch -1 HEAD \
413
+ --stdout \
414
+ > "$RELEASE_OUTPUT/install-catalog.patch"
415
+ git switch --detach "$SOURCE_COMMIT"
416
+ - name: Publish GitHub release record
417
+ shell: bash
418
+ env:
419
+ GH_TOKEN: ${{ github.token }}
420
+ PRERELEASE: ${{ inputs.prerelease }}
421
+ RELEASE_TAG: ${{ inputs.tag }}
422
+ SOURCE_COMMIT: ${{ needs.build-and-prepare.outputs.source_commit }}
423
+ run: |
424
+ set -euo pipefail
425
+ python packaging/validate_release_ref.py \
426
+ --tag "$RELEASE_TAG" \
427
+ --source-commit "$SOURCE_COMMIT" \
428
+ --remote origin
429
+ if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
430
+ gh release upload "$RELEASE_TAG" \
431
+ "$RELEASE_OUTPUT"/sdist/* \
432
+ "$RELEASE_OUTPUT/prepared-site/release-manifest.json" \
433
+ "$RELEASE_OUTPUT/install-catalog.patch" \
434
+ --clobber
435
+ else
436
+ release_flags=()
437
+ if [ "$PRERELEASE" = true ]; then
438
+ release_flags+=(--prerelease)
439
+ fi
440
+ gh release create "$RELEASE_TAG" \
441
+ "$RELEASE_OUTPUT"/sdist/* \
442
+ "$RELEASE_OUTPUT/prepared-site/release-manifest.json" \
443
+ "$RELEASE_OUTPUT/install-catalog.patch" \
444
+ --verify-tag \
445
+ --generate-notes \
446
+ --title "FHElium $RELEASE_TAG" \
447
+ "${release_flags[@]}"
448
+ fi
449
+ gh release edit "$RELEASE_TAG" \
450
+ --prerelease="$PRERELEASE"