hypergraph-rewriting-engine 1.0.0rc3.post2__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 (266) hide show
  1. hypergraph_rewriting_engine-1.0.0rc3.post2/CMakeLists.txt +812 -0
  2. hypergraph_rewriting_engine-1.0.0rc3.post2/LICENSE.md +21 -0
  3. hypergraph_rewriting_engine-1.0.0rc3.post2/PKG-INFO +145 -0
  4. hypergraph_rewriting_engine-1.0.0rc3.post2/README.md +280 -0
  5. hypergraph_rewriting_engine-1.0.0rc3.post2/cmake/FindWolframLanguage.cmake +241 -0
  6. hypergraph_rewriting_engine-1.0.0rc3.post2/cmake/toolchains/linux-cross.cmake +159 -0
  7. hypergraph_rewriting_engine-1.0.0rc3.post2/cmake/toolchains/macos-cross.cmake +220 -0
  8. hypergraph_rewriting_engine-1.0.0rc3.post2/cmake/toolchains/windows-cross.cmake +277 -0
  9. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/affinity.hpp +208 -0
  10. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/branchial_overlap_core.hpp +63 -0
  11. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/branchial_rows_core.hpp +173 -0
  12. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/build_commit.hpp.in +10 -0
  13. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/build_stamp.hpp +102 -0
  14. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/cache_line.hpp +26 -0
  15. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/canonical_form_core.hpp +81 -0
  16. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/capacity.hpp +39 -0
  17. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/content_core.hpp +103 -0
  18. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/core.hpp +328 -0
  19. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/dedup_claim_core.hpp +112 -0
  20. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/depth_join.hpp +353 -0
  21. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/det_math.hpp +293 -0
  22. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/diag.hpp +32 -0
  23. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/equilibrium_core.hpp +86 -0
  24. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/event_core.hpp +166 -0
  25. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/explore_depth_core.hpp +99 -0
  26. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/hash_insert_core.hpp +82 -0
  27. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/initial_condition_core.hpp +694 -0
  28. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/ir_core.hpp +1875 -0
  29. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/join_core.hpp +311 -0
  30. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/key_order_core.hpp +209 -0
  31. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/list_core.hpp +69 -0
  32. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/match_core.hpp +90 -0
  33. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/memory_limit.hpp +101 -0
  34. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/namespace.hpp +51 -0
  35. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/park.hpp +194 -0
  36. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/park_gate.hpp +287 -0
  37. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/phase_timing.hpp +172 -0
  38. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/pool_core.hpp +53 -0
  39. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/portable_intrinsics.hpp +153 -0
  40. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/quotient_causal_core.hpp +57 -0
  41. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/quotient_multiplicity_core.hpp +209 -0
  42. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/quotient_replay_core.hpp +489 -0
  43. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/quotient_route.hpp +32 -0
  44. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/reach_core.hpp +124 -0
  45. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/rendezvous.hpp +132 -0
  46. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/rewrite_core.hpp +156 -0
  47. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/ring_core.hpp +86 -0
  48. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/sampling_core.hpp +590 -0
  49. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/signature_core.hpp +87 -0
  50. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/slot_core.hpp +72 -0
  51. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/state_alignment_core.hpp +255 -0
  52. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/state_cost_core.hpp +226 -0
  53. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/state_geometry_core.hpp +1993 -0
  54. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/state_invariants_core.hpp +551 -0
  55. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/state_topology_core.hpp +887 -0
  56. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/step_pool_core.hpp +234 -0
  57. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/step_select_core.hpp +71 -0
  58. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/termination_core.hpp +114 -0
  59. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/token_core.hpp +161 -0
  60. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/transition_cost_core.hpp +498 -0
  61. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/transitive_reduction.hpp +119 -0
  62. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/tuning.hpp +164 -0
  63. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/undirected_core.hpp +304 -0
  64. hypergraph_rewriting_engine-1.0.0rc3.post2/common/include/hgcommon/utf8.hpp +109 -0
  65. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/CMakeLists.txt +68 -0
  66. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/ancestry.hpp +96 -0
  67. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/arena.hpp +870 -0
  68. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/atomic_compat.hpp +78 -0
  69. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/bitset.hpp +368 -0
  70. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/canonical_types.hpp +44 -0
  71. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/causal_graph.hpp +416 -0
  72. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/concurrent_key_set.hpp +727 -0
  73. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/concurrent_map.hpp +986 -0
  74. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/debug_log.hpp +15 -0
  75. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/hypergraph.hpp +1962 -0
  76. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/ir_canonicalization.hpp +113 -0
  77. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/key_order_index.hpp +111 -0
  78. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/lock_free_list.hpp +364 -0
  79. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/match_join.hpp +109 -0
  80. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/parallel_evolution.hpp +1933 -0
  81. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/pattern.hpp +272 -0
  82. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/pattern_matcher.hpp +587 -0
  83. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/quotient_types.hpp +180 -0
  84. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/rewriter.hpp +120 -0
  85. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/rule_analysis.hpp +174 -0
  86. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/scratch_alloc.hpp +242 -0
  87. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/segmented_array.hpp +318 -0
  88. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/signature.hpp +79 -0
  89. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/types.hpp +399 -0
  90. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/include/hypergraph/zero_value_init.hpp +18 -0
  91. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/arena.cpp +798 -0
  92. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/bitset.cpp +101 -0
  93. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/causal_graph.cpp +349 -0
  94. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/hypergraph.cpp +3389 -0
  95. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/ir_canonicalization.cpp +364 -0
  96. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/parallel_evolution.cpp +3829 -0
  97. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/pattern.cpp +320 -0
  98. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/rewriter.cpp +322 -0
  99. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/rule_analysis.cpp +155 -0
  100. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/signature.cpp +83 -0
  101. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/src/types.cpp +315 -0
  102. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/ir_pinned_states.hpp +94 -0
  103. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_arena_shared_fallback.cpp +160 -0
  104. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_blackhole_idempotent.cpp +360 -0
  105. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_causal_branchial.cpp +1269 -0
  106. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_causal_determinism.cpp +777 -0
  107. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_causal_tr_exactness.cpp +246 -0
  108. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_concurrent_key_set.cpp +109 -0
  109. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_concurrent_map.cpp +106 -0
  110. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_concurrent_map_fuzz.cpp +102 -0
  111. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_determinism_fuzzing.cpp +668 -0
  112. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_diag_channel.cpp +39 -0
  113. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_equilibrium_core.cpp +54 -0
  114. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_event_canonicalization.cpp +243 -0
  115. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_event_identity_authority.cpp +133 -0
  116. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_event_ordering.cpp +174 -0
  117. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_evolution_limits.cpp +400 -0
  118. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_feature_matrix.cpp +457 -0
  119. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_golden_matrix.cpp +230 -0
  120. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_grid_performance.cpp +118 -0
  121. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_initial_conditions.cpp +304 -0
  122. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_ir_canonicalization.cpp +1078 -0
  123. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_join_core.cpp +250 -0
  124. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_match_completeness.cpp +171 -0
  125. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_match_dedup_exactness.cpp +118 -0
  126. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_multiple_initial_states.cpp +196 -0
  127. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_oracle_corpus.cpp +1702 -0
  128. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_parallel_evolution.cpp +383 -0
  129. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_pattern_matching.cpp +910 -0
  130. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_quotient_completeness.cpp +92 -0
  131. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_reference_oracle.cpp +136 -0
  132. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_repeated_invocation.cpp +188 -0
  133. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_sampled_soundness.cpp +145 -0
  134. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_sampling_reproducibility.cpp +1757 -0
  135. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_segmented_array.cpp +158 -0
  136. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_slot_core.cpp +161 -0
  137. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_sparse_bitset.cpp +96 -0
  138. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_state_geometry_core.cpp +391 -0
  139. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_state_measures.cpp +768 -0
  140. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_state_topology.cpp +213 -0
  141. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_transition_cost.cpp +573 -0
  142. hypergraph_rewriting_engine-1.0.0rc3.post2/hypergraph/tests/test_undirected.cpp +653 -0
  143. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/CMakeLists.txt +46 -0
  144. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/include/job_system/job.hpp +121 -0
  145. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/include/job_system/job_pool.hpp +109 -0
  146. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/include/job_system/job_system.hpp +1378 -0
  147. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/include/job_system/work_stealing_deque.hpp +146 -0
  148. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/src/affinity.cpp +616 -0
  149. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/src/capacity.cpp +14 -0
  150. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/src/diag.cpp +37 -0
  151. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/src/job_pool.cpp +157 -0
  152. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/src/memory_limit.cpp +183 -0
  153. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/src/park.cpp +106 -0
  154. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/tests/CMakeLists.txt +40 -0
  155. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/tests/test_job_system.cpp +1320 -0
  156. hypergraph_rewriting_engine-1.0.0rc3.post2/job_system/tests/test_work_stealing_deque.cpp +89 -0
  157. hypergraph_rewriting_engine-1.0.0rc3.post2/lockfree_deque/CMakeLists.txt +19 -0
  158. hypergraph_rewriting_engine-1.0.0rc3.post2/lockfree_deque/include/lockfree_deque/deque.hpp +217 -0
  159. hypergraph_rewriting_engine-1.0.0rc3.post2/lockfree_deque/tests/CMakeLists.txt +33 -0
  160. hypergraph_rewriting_engine-1.0.0rc3.post2/lockfree_deque/tests/test_deque.cpp +436 -0
  161. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/CMakeLists.txt +478 -0
  162. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/HypergraphRewriting.def +9 -0
  163. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/README.md +382 -0
  164. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/build_paclet.wls +25 -0
  165. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/cpu_engine_holder.hpp +120 -0
  166. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/delivery_cursor.hpp +67 -0
  167. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/ffi_job.hpp +218 -0
  168. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/frame_writer.cpp +299 -0
  169. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/frame_writer.hpp +205 -0
  170. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/graph_marshal.hpp +1297 -0
  171. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/hg_core.hpp +50 -0
  172. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/hg_evolve_main.cpp +457 -0
  173. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/hg_gpu_backend.cpp +1625 -0
  174. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/hg_gpu_backend.hpp +175 -0
  175. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/hypergraph_ffi.cpp +2739 -0
  176. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/initial_condition_job.hpp +220 -0
  177. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/paclet_support.cpp +2449 -0
  178. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/reply_out.hpp +289 -0
  179. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/session.hpp +141 -0
  180. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/state_statistics.hpp +440 -0
  181. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/tests/test_frame_writer.cpp +473 -0
  182. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/tests/test_option_surface.cpp +141 -0
  183. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/tests/test_paclet.cpp +465 -0
  184. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/tests/test_session.cpp +152 -0
  185. hypergraph_rewriting_engine-1.0.0rc3.post2/paclet_source/tests/test_wxf_serialization.cpp +7978 -0
  186. hypergraph_rewriting_engine-1.0.0rc3.post2/pyproject.toml +85 -0
  187. hypergraph_rewriting_engine-1.0.0rc3.post2/python/CMakeLists.txt +56 -0
  188. hypergraph_rewriting_engine-1.0.0rc3.post2/python/README.md +108 -0
  189. hypergraph_rewriting_engine-1.0.0rc3.post2/python/docs/API.md +144 -0
  190. hypergraph_rewriting_engine-1.0.0rc3.post2/python/examples/brill_lindquist_history.py +22 -0
  191. hypergraph_rewriting_engine-1.0.0rc3.post2/python/examples/generational_and_orderings.py +16 -0
  192. hypergraph_rewriting_engine-1.0.0rc3.post2/python/examples/multiway.py +26 -0
  193. hypergraph_rewriting_engine-1.0.0rc3.post2/python/examples/parallel_sweep.py +26 -0
  194. hypergraph_rewriting_engine-1.0.0rc3.post2/python/examples/sampled_history.py +19 -0
  195. hypergraph_rewriting_engine-1.0.0rc3.post2/python/examples/step_statistics.py +18 -0
  196. hypergraph_rewriting_engine-1.0.0rc3.post2/python/examples/undirected_edges.py +14 -0
  197. hypergraph_rewriting_engine-1.0.0rc3.post2/python/hgevolve/__init__.py +167 -0
  198. hypergraph_rewriting_engine-1.0.0rc3.post2/python/hgevolve/_cost.py +100 -0
  199. hypergraph_rewriting_engine-1.0.0rc3.post2/python/hgevolve/_options.py +328 -0
  200. hypergraph_rewriting_engine-1.0.0rc3.post2/python/hgevolve/_result.py +244 -0
  201. hypergraph_rewriting_engine-1.0.0rc3.post2/python/src/module.cpp +413 -0
  202. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/conftest.py +36 -0
  203. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/fixtures/HGEvolve.json.gz +0 -0
  204. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/generate_fixtures.wls +134 -0
  205. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/measure_fixture_jobs.py +47 -0
  206. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/memory_limit_child.py +24 -0
  207. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/repeated_calls_child.py +29 -0
  208. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/test_api.py +220 -0
  209. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/test_examples.py +18 -0
  210. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/test_memory_limit.py +39 -0
  211. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/test_parity.py +293 -0
  212. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/test_search.py +162 -0
  213. hypergraph_rewriting_engine-1.0.0rc3.post2/python/tests/test_views.py +94 -0
  214. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/arena_bump_bench.cpp +38 -0
  215. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/arena_reset_test.cpp +50 -0
  216. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/bench_cpu_evolve.cpp +554 -0
  217. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/bench_gpu_evolve.cpp +314 -0
  218. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/branchial_flux_probe.cpp +336 -0
  219. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/branchial_nondeterminism_probe.cpp +171 -0
  220. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/budget_collapse_probe.cpp +305 -0
  221. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/canonical_causal_oracle.cpp +139 -0
  222. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/causal_tr_determinism_probe.cpp +13 -0
  223. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/causal_tr_exactness_probe.cpp +61 -0
  224. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/cost_matrix.cpp +288 -0
  225. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/cpu_rank_order_probe.cpp +130 -0
  226. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/deque_aba_headroom.cpp +111 -0
  227. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/determinism_forwarding_repro.cpp +35 -0
  228. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/event_key_decomposition_probe.cpp +151 -0
  229. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/event_signature_stability_probe.cpp +126 -0
  230. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/generate_golden_matrix.cpp +170 -0
  231. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/higgs_shadow_probe.cpp +294 -0
  232. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/incremental_probe.cpp +692 -0
  233. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/ir_core_bench.cpp +130 -0
  234. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/ir_core_equivalence_probe.cpp +529 -0
  235. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/ir_edge_map_probe.cpp +101 -0
  236. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/ir_edge_orbit_probe.cpp +84 -0
  237. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/ir_malloc_bench.cpp +42 -0
  238. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/mode_matrix_probe.cpp +135 -0
  239. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/multi_init_rule_2x2_probe.cpp +29 -0
  240. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/multiplicity_propagation_probe.cpp +314 -0
  241. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/park_cost_bench.cpp +120 -0
  242. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/profile_evolve.cpp +70 -0
  243. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_branchial_diff.cpp +186 -0
  244. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_branchial_gap_probe.cpp +70 -0
  245. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_determinism_rate_probe.cpp +342 -0
  246. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_expansion_capture_probe.cpp +147 -0
  247. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_observable_gap_probe.cpp +56 -0
  248. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_pairs_reconstruction_probe.cpp +158 -0
  249. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_raw_causal_reconstruction_probe.cpp +217 -0
  250. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_reconstruction_cost_probe.cpp +74 -0
  251. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_reconstruction_events_probe.cpp +48 -0
  252. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_reconstruction_matrix_probe.cpp +163 -0
  253. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_reconstruction_observables_probe.cpp +101 -0
  254. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/quotient_reconstruction_probe.cpp +417 -0
  255. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/representation_prototype.cpp +762 -0
  256. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/sampling_cost_probe.cpp +188 -0
  257. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/sampling_cost_smoke.cpp +458 -0
  258. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/spine_probe.cpp +93 -0
  259. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/thinning_mode_probe.cpp +53 -0
  260. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/thinning_recovery_probe.cpp +98 -0
  261. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/timing_harness.cpp +280 -0
  262. hypergraph_rewriting_engine-1.0.0rc3.post2/tools/unfolding_ratio_probe.cpp +119 -0
  263. hypergraph_rewriting_engine-1.0.0rc3.post2/wxf/CMakeLists.txt +31 -0
  264. hypergraph_rewriting_engine-1.0.0rc3.post2/wxf/tests/test_wxf.cpp +1417 -0
  265. hypergraph_rewriting_engine-1.0.0rc3.post2/wxf/wxf.cpp +965 -0
  266. hypergraph_rewriting_engine-1.0.0rc3.post2/wxf/wxf.hpp +752 -0
@@ -0,0 +1,812 @@
1
+ cmake_minimum_required(VERSION 3.14)
2
+ # CMP0091 (CMake 3.15+) makes CMAKE_MSVC_RUNTIME_LIBRARY take effect, so a Windows/MSVC build
3
+ # can select the static C runtime (/MT). Must be set before project(). Without NEW the property
4
+
5
+ # Per-phase cycle counters on the host (hgcommon/phase_timing.hpp).
6
+ #
7
+ # OFF for anything shipped. The counters are one cache line per worker per phase and the timer
8
+ # reads the cycle counter twice per phase entry, so a release build must not carry them -- with
9
+ # this off the header defines PhaseTimer as an empty object and no storage exists at all.
10
+ # Turn it on only to answer "where do this run's cycles go", which is a question the wall clock
11
+ # and the instruction count both answer wrongly here.
12
+ option(HG_ENGINE_STATS "Diagnostic counters the determinism gates and instruments read; ON for test and development builds, OFF for shipped and verified ones" ON)
13
+ add_compile_definitions(HG_ENGINE_STATS=$<BOOL:${HG_ENGINE_STATS}>)
14
+
15
+ option(HG_PHASE_TIMING "Host per-phase cycle counters (measurement builds only)" OFF)
16
+ if(HG_PHASE_TIMING)
17
+ add_compile_definitions(HG_PHASE_TIMING)
18
+ message(STATUS "Host phase timing ENABLED -- this build is for measurement, not for shipping")
19
+ endif()
20
+
21
+ option(HG_MATCH_BRANCH_STATS "Matcher candidate-branch coverage counters (measurement builds only)" OFF)
22
+ if(HG_MATCH_BRANCH_STATS)
23
+ add_compile_definitions(HG_MATCH_BRANCH_STATS)
24
+ endif()
25
+ # is silently ignored and the binary keeps a VCRUNTIME140 / MSVCP140 (VC++ redist) dependency.
26
+ if(POLICY CMP0091)
27
+ cmake_policy(SET CMP0091 NEW)
28
+ endif()
29
+ project(HypergraphEngine VERSION 1.0.0 LANGUAGES CXX)
30
+
31
+ # ENABLE_TESTING() MUST PRECEDE EVERY add_subdirectory(), AND DID NOT.
32
+ #
33
+ # A directory processed before this call gets no CTestTestfile.cmake, and its add_test() and
34
+ # gtest_discover_tests() registrations are dropped WITHOUT A WARNING. It used to sit near the
35
+ # end of this file, after all twenty-odd subdirectories, so `ctest -N` listed 49 tests -- the
36
+ # lockfree_deque and job_system suites, which call enable_testing() in their own scopes, plus
37
+ # four root tests -- and NONE of the engine suites. all_tests (296 tests), hg_gpu_tests and
38
+ # gpu_differential_tests were registered into files nothing included.
39
+ #
40
+ # That is not cosmetic: .github/workflows/windows.yml gates on `ctest -E genmc` and nothing
41
+ # else, so the Windows lane ran 49 concurrency tests and never once ran the engine suite. The
42
+ # Linux, macOS and GPU lanes invoke their binaries directly and were unaffected, which is why
43
+ # this stayed invisible.
44
+ enable_testing()
45
+
46
+ # Shared CPU/GPU definitions (hgcommon)
47
+ include_directories(${CMAKE_SOURCE_DIR}/common/include)
48
+
49
+ set(CMAKE_CXX_STANDARD 20)
50
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
51
+ set(CMAKE_CXX_EXTENSIONS OFF)
52
+
53
+ # Default to Release build if not specified
54
+ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
55
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
56
+ message(STATUS "Build type not specified, defaulting to Release")
57
+ endif()
58
+
59
+ # Detect WSL environment
60
+ # WSL (Windows Subsystem for Linux) requires special handling for:
61
+ # - File locking (Java/Lucene operations fail on WSL filesystem)
62
+ # - Path conversions between Linux and Windows
63
+ # Note: Use CMAKE_HOST_SYSTEM_NAME to detect the build host, not the target
64
+ set(IS_WSL FALSE)
65
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
66
+ if(EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop" OR DEFINED ENV{WSL_DISTRO_NAME})
67
+ set(IS_WSL TRUE)
68
+ message(STATUS "WSL environment detected")
69
+ endif()
70
+ endif()
71
+
72
+ # The commit every shipped artifact is stamped with (paclet_source/build_stamp.hpp).
73
+ #
74
+ # A release ships binaries for six platforms and the host that assembles them can run at most
75
+ # one, so "is this artifact current?" has to be answerable by READING the file. The stamp is how,
76
+ # and this is where the value it carries comes from.
77
+ #
78
+ # CMAKE_CONFIGURE_DEPENDS on .git/HEAD makes a branch switch or a checkout re-configure, so the
79
+ # stamp cannot outlive the commit it names. A commit ON the same branch does not touch HEAD's
80
+ # contents, which is why sign-off compares the stamp to `git rev-parse HEAD` rather than assuming
81
+ # a configured tree is up to date.
82
+ # PASSED IN WINS. build_windows_gpu.sh resolves the commit on the Linux side and hands it over
83
+ # with -D, because its configure runs under Windows cmake.exe against a \\wsl.localhost path where
84
+ # git finds no repository. An unconditional `set()` here would define a NORMAL variable that
85
+ # shadows that cache entry -- which is what left the one artifact the stamp exists for reading
86
+ # `commit=unknown` after the -D was already being passed.
87
+ find_package(Git QUIET)
88
+ # GIT WINS WHEN IT CAN ANSWER. A -D HG_BUILD_COMMIT (or a value a previous configure left in
89
+ # this build directory's cache) is used only where git cannot resolve HEAD -- the Windows
90
+ # configure against a \\wsl.localhost path is that case. A cached value taken over a live git
91
+ # answer stamped a whole build directory with the commit of an earlier release configure.
92
+ set(HG_GIT_COMMIT "")
93
+ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
94
+ execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
95
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
96
+ OUTPUT_VARIABLE HG_GIT_COMMIT
97
+ OUTPUT_STRIP_TRAILING_WHITESPACE
98
+ ERROR_QUIET)
99
+ # RECONFIGURE WHEN HEAD MOVES. A commit rewrites the branch ref and appends to the reflog;
100
+ # HEAD itself changes only on a checkout. Depending on HEAD alone left a warm build stamped
101
+ # with the commit of an earlier configure (measured: a build_release bench reading
102
+ # 9e8f39aa two commits later). The paths come from git so a worktree, whose .git is a
103
+ # file pointing elsewhere, resolves them too.
104
+ foreach(rel HEAD logs/HEAD)
105
+ execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --git-path "${rel}"
106
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
107
+ OUTPUT_VARIABLE HG_GIT_DEP
108
+ OUTPUT_STRIP_TRAILING_WHITESPACE
109
+ ERROR_QUIET)
110
+ if(HG_GIT_DEP AND NOT IS_ABSOLUTE "${HG_GIT_DEP}")
111
+ set(HG_GIT_DEP "${CMAKE_SOURCE_DIR}/${HG_GIT_DEP}")
112
+ endif()
113
+ if(HG_GIT_DEP AND EXISTS "${HG_GIT_DEP}")
114
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${HG_GIT_DEP}")
115
+ endif()
116
+ endforeach()
117
+ endif()
118
+ if(NOT HG_GIT_COMMIT STREQUAL "")
119
+ set(HG_BUILD_COMMIT "${HG_GIT_COMMIT}")
120
+ elseif(NOT HG_BUILD_COMMIT)
121
+ set(HG_BUILD_COMMIT "unknown")
122
+ endif()
123
+ message(STATUS "Build stamp commit: ${HG_BUILD_COMMIT}")
124
+
125
+ # The build stamp (common/include/hgcommon/build_stamp.hpp) carries the configuration of every
126
+ # artifact and bench: the commit, the build type and the flags come from here; the option
127
+ # macros the stamp reads (HG_ENGINE_STATS, HG_PHASE_TIMING, NDEBUG, the sanitizers) are the
128
+ # ones the options themselves set, so the record cannot disagree with the code it sits in.
129
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" HG_BUILD_TYPE_UPPER)
130
+ set(HG_BUILD_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${HG_BUILD_TYPE_UPPER}}")
131
+ string(STRIP "${HG_BUILD_FLAGS}" HG_BUILD_FLAGS)
132
+ # A generated header, not a definition on every target: only the translation units that
133
+ # define a stamp recompile when the commit changes.
134
+ configure_file("${CMAKE_SOURCE_DIR}/common/include/hgcommon/build_commit.hpp.in"
135
+ "${CMAKE_BINARY_DIR}/generated/hgcommon/build_commit.hpp" @ONLY)
136
+ include_directories("${CMAKE_BINARY_DIR}/generated")
137
+
138
+ # Export compile commands for clangd and other tooling
139
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
140
+
141
+ # Create symlink to compile_commands.json in project root for clangd
142
+ # This runs at configure time, not build time
143
+ execute_process(
144
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
145
+ ${CMAKE_BINARY_DIR}/compile_commands.json
146
+ ${CMAKE_SOURCE_DIR}/compile_commands.json
147
+ )
148
+
149
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
150
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
151
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
152
+
153
+ foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES})
154
+ string(TOUPPER ${CONFIG} CONFIG_UPPER)
155
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG_UPPER} ${CMAKE_BINARY_DIR})
156
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONFIG_UPPER} ${CMAKE_BINARY_DIR})
157
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_UPPER} ${CMAKE_BINARY_DIR})
158
+ endforeach()
159
+
160
+ # WebAssembly. The engine runs there in SERIAL mode -- no threads exist, which is why
161
+ # ParallelEvolutionEngine::ExecutionMode::Serial is the mode a wasm consumer selects.
162
+ #
163
+ # The link settings are not tuning. A wasm module gets a fixed 16 MB heap and a 64 KB stack
164
+ # unless told otherwise, and this engine outgrows both: the arena grows past 16 MB on any
165
+ # non-trivial evolution, and the matcher's per-frame scratch outgrows 64 KB. Without these an
166
+ # out-of-bounds trap is the FIRST thing a run produces.
167
+ if(EMSCRIPTEN)
168
+ add_link_options(
169
+ -sALLOW_MEMORY_GROWTH=1 # the arena grows; a fixed heap caps the reachable evolution
170
+ -sINITIAL_MEMORY=64MB
171
+ -sSTACK_SIZE=4MB
172
+ -sEXIT_RUNTIME=1 # main()'s exit code is the gate's verdict
173
+ )
174
+ endif()
175
+
176
+ # Benchmarking option for event relationship processing
177
+ option(SINGLE_THREADED_EVENT_RELATION_PROCESSING "Use single-threaded event relation processing for benchmarking" OFF)
178
+ if(SINGLE_THREADED_EVENT_RELATION_PROCESSING)
179
+ add_compile_definitions(SINGLE_THREADED_EVENT_RELATION_PROCESSING)
180
+ endif()
181
+
182
+ # Fuzzing tests option (disabled by default for faster builds)
183
+ option(ENABLE_FUZZING_TESTS "Enable determinism fuzzing tests (slow but comprehensive)" OFF)
184
+ if(ENABLE_FUZZING_TESTS)
185
+ add_compile_definitions(ENABLE_FUZZING_TESTS)
186
+ endif()
187
+
188
+ # Sanitizer options for detecting memory errors and race conditions
189
+ option(ENABLE_ASAN "Enable AddressSanitizer for memory error detection" OFF)
190
+ option(ENABLE_TSAN "Enable ThreadSanitizer for race condition detection" OFF)
191
+ option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer" OFF)
192
+
193
+ # Sanitizer configuration (only one can be enabled at a time for ASAN/TSAN)
194
+ if(ENABLE_ASAN AND ENABLE_TSAN)
195
+ message(FATAL_ERROR "Cannot enable both AddressSanitizer and ThreadSanitizer simultaneously")
196
+ endif()
197
+
198
+ if(ENABLE_ASAN)
199
+ message(STATUS "AddressSanitizer enabled")
200
+ add_compile_options(-fsanitize=address -fno-omit-frame-pointer -g -O1)
201
+ add_compile_definitions(HG_BUILD_ASAN=1)
202
+ add_link_options(-fsanitize=address)
203
+ endif()
204
+
205
+ if(ENABLE_TSAN)
206
+ message(STATUS "ThreadSanitizer enabled")
207
+ add_compile_options(-fsanitize=thread -fno-omit-frame-pointer -g -O1)
208
+ add_compile_definitions(HG_BUILD_TSAN=1)
209
+ add_link_options(-fsanitize=thread)
210
+ endif()
211
+
212
+ if(ENABLE_UBSAN)
213
+ message(STATUS "UndefinedBehaviorSanitizer enabled")
214
+ add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer -g)
215
+ add_compile_definitions(HG_BUILD_UBSAN=1)
216
+ add_link_options(-fsanitize=undefined)
217
+ endif()
218
+
219
+ # A name that shadows another is how two different things end up called one thing in a scope
220
+ # where both are live. Two were found in hypergraph_ffi.cpp by running this by hand -- `engine`
221
+ # re-bound to the same object it already named, and `key` meaning the OPTION name outside and a
222
+ # signature key inside, in the parse that decides event identity. Neither changed behaviour;
223
+ # both cost a reader the work of proving that.
224
+ #
225
+ # AN ERROR, NOT A WARNING. Both of those compiled and passed their tests, and a warning in a
226
+ # build that prints thousands of lines is a diagnostic nobody is required to read. The class is
227
+ # closed only if it cannot build. The whole host tree compiles clean under it -- engine, FFI,
228
+ # paclet and every test source -- so keeping it that way costs nothing, while a sweep run once
229
+ # protects only the day it was run.
230
+ #
231
+ # GNU/Clang only: MSVC spells its shadow diagnostics differently and the Windows leg has no
232
+ # equivalent to enable here.
233
+ #
234
+ # CXX ONLY, via the generator expression: add_compile_options applies to EVERY language, so an
235
+ # unscoped flag lands on the nvcc command line, changes it, and invalidates every .cu object --
236
+ # including persistent.cu, which needs about 12.5 GB to compile (#123) and cannot be rebuilt on a
237
+ # shared box. Scoped this way the CUDA compile lines are unchanged and nothing device-side
238
+ # rebuilds, while every .cpp the device targets carry is still covered.
239
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
240
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wshadow>
241
+ $<$<COMPILE_LANGUAGE:CXX>:-Werror=shadow>)
242
+
243
+ # A brace initializer that runs out before the members do is silently zero-filled, and the
244
+ # members it leaves behind are the ones added last -- so a struct that grows acquires
245
+ # zeroed fields at every existing construction site and nothing says so. The determinism
246
+ # test's failure diagnostic was built that way: four counters naming which drop mechanism
247
+ # lost a match were computed, never copied into the record that prints them, and reported
248
+ # clean whatever had happened.
249
+ #
250
+ # Not part of -Wall, and -Wextra is not enabled here, so nothing was checking. Measured
251
+ # across all 151 C++ translation units at zero, and over the engine sources at zero on
252
+ # clang, aarch64-linux-gnu-g++ and x86_64-w64-mingw32-g++ as well, so -Werror costs nothing
253
+ # on any toolchain this tree is built with.
254
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wmissing-field-initializers>
255
+ $<$<COMPILE_LANGUAGE:CXX>:-Werror=missing-field-initializers>)
256
+
257
+ # A switch over an enum that does not name every value falls to whatever the default does,
258
+ # and the default is usually a summary that is now wrong for the case it swallowed:
259
+ # JobSystem::get_error_description() described a CapacityExhausted run as "Unknown error",
260
+ # which is the opposite of what classifying that error separately achieves -- it is the one
261
+ # kind that is NOT a defect, and the whole point of the type is that a caller can tell.
262
+ #
263
+ # -Wswitch is in -Wall and was firing on every build of this tree; nothing acted on it.
264
+ # Measured at zero after that one case was added: 151 TUs in build_linux, 162 in build_gpu,
265
+ # and zero on clang, aarch64-linux-gnu-g++ and x86_64-w64-mingw32-g++ over the engine
266
+ # sources, so -Werror costs nothing on any toolchain this tree is built with.
267
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Werror=switch>)
268
+ endif()
269
+
270
+ # LINK-TIME OPTIMISATION, AND WHY IT IS NOT A MICRO-OPTIMISATION HERE.
271
+ #
272
+ # Without it the compiler can only inline what it can SEE, which is whatever a translation unit
273
+ # includes. That single fact is why an engine like this drifts into being written in headers:
274
+ # move a hot accessor into a .cpp and every other TU gets a real call plus the loss of constant
275
+ # propagation and register allocation across the boundary, so the header is the only place the
276
+ # optimiser can do its job. Structure then follows the optimiser instead of the other way round.
277
+ #
278
+ # With IPO the linker inlines across TUs, so where a body LIVES stops being a performance
279
+ # decision and becomes an organisational one -- which is the point.
280
+ #
281
+ # Release only: a debug build gains nothing and pays the link cost. CUDA targets are excluded
282
+ # below, because device code is linked by nvcc's own device-link step and IPO does not apply to
283
+ # it. Guarded by check_ipo_supported so a toolchain without it configures rather than fails.
284
+ include(CheckIPOSupported)
285
+ check_ipo_supported(RESULT HG_IPO_SUPPORTED OUTPUT HG_IPO_WHY)
286
+ if(HG_IPO_SUPPORTED)
287
+ # A PLAIN set() SHADOWS THE CACHE, so -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=FALSE
288
+ # was accepted and then overridden: the caller got LTO anyway and nothing said so. That is
289
+ # the same defect class as HG_GPU_ARCHS forcing CUDA_ARCHITECTURES, and it invalidated a
290
+ # measurement -- a Windows crash was tested with LTO "off" and the flag never took.
291
+ # Defaulted, not forced, and the choice is printed.
292
+ if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE)
293
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
294
+ endif()
295
+ if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO)
296
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
297
+ endif()
298
+ message(STATUS "Link-time optimisation (Release): ${CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE}")
299
+ else()
300
+ message(STATUS "Link-time optimisation: unavailable (${HG_IPO_WHY})")
301
+ endif()
302
+
303
+ # POPCNT, on the x86-64 hosts that have had it since 2008 (SSE4.2 / x86-64-v2). The baseline
304
+ # x86-64 ISA does not include the instruction, so __builtin_popcountll compiles to a libgcc CALL
305
+ # -- __popcountdi2 shows up in the engine's own profile, and the bitsets that call it are on the
306
+ # hot path. Scoped to CXX for the same reason as above: an unscoped flag reaches nvcc and
307
+ # invalidates every .cu object.
308
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND
309
+ CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|amd64")
310
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-mpopcnt>)
311
+ endif()
312
+
313
+ add_subdirectory(lockfree_deque)
314
+ add_subdirectory(job_system)
315
+
316
+ # When visualization is enabled, create viz_events library BEFORE hypergraph
317
+ # so hypergraph can link to it for the VizEventSink static variables
318
+ if(BUILD_VISUALIZATION)
319
+ add_library(viz_events STATIC
320
+ visualisation/events/src/viz_event_sink.cpp
321
+ )
322
+ target_include_directories(viz_events PUBLIC
323
+ ${CMAKE_CURRENT_SOURCE_DIR}/visualisation/events/include
324
+ )
325
+ endif()
326
+
327
+ add_subdirectory(hypergraph)
328
+ add_subdirectory(wxf)
329
+
330
+ # Unified test suite
331
+ option(BUILD_TESTS "Build unified test suite" ON)
332
+ # The engine suites read the diagnostic counters, which exist only with HG_ENGINE_STATS=ON.
333
+ if(BUILD_TESTS AND NOT HG_ENGINE_STATS)
334
+ message(STATUS "Engine test suites not built: they need HG_ENGINE_STATS=ON")
335
+ elseif(BUILD_TESTS)
336
+ add_subdirectory(testing)
337
+ endif()
338
+
339
+ # Examples - API documentation and usage examples
340
+ option(BUILD_EXAMPLES "Build examples" ON)
341
+ if(BUILD_EXAMPLES)
342
+ add_subdirectory(examples)
343
+ endif()
344
+
345
+ # Regenerates reference/golden_matrix.txt, which the identity-matrix tests read. A build target
346
+ # rather than an ad-hoc compile: the file it writes is the expected output of 216 runs, so
347
+ # reproducing it has to be one command with the project's own include paths and flags.
348
+ # The exactness-and-cost harness. It proves output EXACT against the brute-force oracle while
349
+ # reporting arena bytes_allocated(), which is durable and noise-free where RSS is not -- so a
350
+ # change can be shown to preserve correctness and to move memory in a reproducible direction.
351
+ add_executable(event_key_decomposition_probe tools/event_key_decomposition_probe.cpp)
352
+ target_include_directories(event_key_decomposition_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
353
+ target_link_libraries(event_key_decomposition_probe PRIVATE hypergraph)
354
+
355
+ # Reads the engine's draw counters, which exist only in stats builds.
356
+ if(HG_ENGINE_STATS)
357
+ add_executable(thinning_mode_probe tools/thinning_mode_probe.cpp)
358
+ target_include_directories(thinning_mode_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
359
+ target_link_libraries(thinning_mode_probe PRIVATE hypergraph)
360
+ endif()
361
+
362
+ # ---------------------------------------------------------------------------------------------
363
+ # EVERY REMAINING tools/ PROGRAM, REGISTERED.
364
+ #
365
+ # 55 of 66 files here were built by nothing. That is not a tidiness point: a probe nothing
366
+ # compiles rots invisibly and, worse, its FINDINGS go missing. Registering probes on
367
+ # 2026-08-18 is what closed the "IR 1100x high-symmetry
368
+ # pathology" as unreproducible AND found a per-call memset worth 1.09% of engine instructions --
369
+ # a real cost that survived precisely because its instrument was unregistered.
370
+ #
371
+ # All 48 below compile against the current tree. The one that does not, ir_incremental_probe.cpp,
372
+ # is deleted in this commit; the project's own developer notes already named it as broken.
373
+ #
374
+ # Registered with EXCLUDE_FROM_ALL: they build under `cmake --build . --target <name>` and on
375
+ # `--target probes`, but are not on the default build, so the ordinary path pays nothing while
376
+ # CI can compile them all and catch rot at the commit that causes it.
377
+ # ---------------------------------------------------------------------------------------------
378
+ add_custom_target(probes)
379
+
380
+ add_executable(park_cost_bench EXCLUDE_FROM_ALL tools/park_cost_bench.cpp)
381
+ target_include_directories(park_cost_bench PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
382
+ target_link_libraries(park_cost_bench PRIVATE job_system)
383
+ add_dependencies(probes park_cost_bench)
384
+ add_executable(arena_bump_bench EXCLUDE_FROM_ALL tools/arena_bump_bench.cpp)
385
+ target_include_directories(arena_bump_bench PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
386
+ target_link_libraries(arena_bump_bench PRIVATE hypergraph)
387
+ add_dependencies(probes arena_bump_bench)
388
+ add_executable(arena_reset_test EXCLUDE_FROM_ALL tools/arena_reset_test.cpp)
389
+ target_include_directories(arena_reset_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
390
+ target_link_libraries(arena_reset_test PRIVATE hypergraph)
391
+ add_dependencies(probes arena_reset_test)
392
+ add_executable(bench_cpu_evolve EXCLUDE_FROM_ALL tools/bench_cpu_evolve.cpp)
393
+ target_include_directories(bench_cpu_evolve PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
394
+ target_link_libraries(bench_cpu_evolve PRIVATE hypergraph)
395
+ if(WIN32)
396
+ target_link_libraries(bench_cpu_evolve PRIVATE psapi) # GetProcessMemoryInfo
397
+ endif()
398
+ add_dependencies(probes bench_cpu_evolve)
399
+ add_executable(branchial_flux_probe EXCLUDE_FROM_ALL tools/branchial_flux_probe.cpp)
400
+ target_include_directories(branchial_flux_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
401
+ target_link_libraries(branchial_flux_probe PRIVATE hypergraph)
402
+ add_dependencies(probes branchial_flux_probe)
403
+ add_executable(branchial_nondeterminism_probe EXCLUDE_FROM_ALL tools/branchial_nondeterminism_probe.cpp)
404
+ target_include_directories(branchial_nondeterminism_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
405
+ target_link_libraries(branchial_nondeterminism_probe PRIVATE hypergraph)
406
+ add_dependencies(probes branchial_nondeterminism_probe)
407
+ add_executable(budget_collapse_probe EXCLUDE_FROM_ALL tools/budget_collapse_probe.cpp)
408
+ target_include_directories(budget_collapse_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
409
+ target_link_libraries(budget_collapse_probe PRIVATE hypergraph)
410
+ add_dependencies(probes budget_collapse_probe)
411
+ add_executable(canonical_causal_oracle EXCLUDE_FROM_ALL tools/canonical_causal_oracle.cpp)
412
+ target_include_directories(canonical_causal_oracle PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
413
+ target_link_libraries(canonical_causal_oracle PRIVATE hypergraph)
414
+ add_dependencies(probes canonical_causal_oracle)
415
+ add_executable(causal_tr_determinism_probe EXCLUDE_FROM_ALL tools/causal_tr_determinism_probe.cpp)
416
+ target_include_directories(causal_tr_determinism_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
417
+ target_link_libraries(causal_tr_determinism_probe PRIVATE hypergraph)
418
+ add_dependencies(probes causal_tr_determinism_probe)
419
+ add_executable(causal_tr_exactness_probe EXCLUDE_FROM_ALL tools/causal_tr_exactness_probe.cpp)
420
+ target_include_directories(causal_tr_exactness_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
421
+ target_link_libraries(causal_tr_exactness_probe PRIVATE hypergraph)
422
+ add_dependencies(probes causal_tr_exactness_probe)
423
+ add_executable(deque_aba_headroom EXCLUDE_FROM_ALL tools/deque_aba_headroom.cpp)
424
+ target_include_directories(deque_aba_headroom PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
425
+ target_link_libraries(deque_aba_headroom PRIVATE hypergraph)
426
+ add_dependencies(probes deque_aba_headroom)
427
+ add_executable(determinism_forwarding_repro EXCLUDE_FROM_ALL tools/determinism_forwarding_repro.cpp)
428
+ target_include_directories(determinism_forwarding_repro PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
429
+ target_link_libraries(determinism_forwarding_repro PRIVATE hypergraph)
430
+ add_dependencies(probes determinism_forwarding_repro)
431
+ add_executable(higgs_shadow_probe EXCLUDE_FROM_ALL tools/higgs_shadow_probe.cpp)
432
+ target_include_directories(higgs_shadow_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
433
+ target_link_libraries(higgs_shadow_probe PRIVATE hypergraph)
434
+ add_dependencies(probes higgs_shadow_probe)
435
+ add_executable(incremental_probe EXCLUDE_FROM_ALL tools/incremental_probe.cpp)
436
+ target_include_directories(incremental_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
437
+ target_link_libraries(incremental_probe PRIVATE hypergraph)
438
+ add_dependencies(probes incremental_probe)
439
+ add_executable(ir_core_bench EXCLUDE_FROM_ALL tools/ir_core_bench.cpp)
440
+ target_include_directories(ir_core_bench PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
441
+ target_link_libraries(ir_core_bench PRIVATE hypergraph)
442
+ add_dependencies(probes ir_core_bench)
443
+ add_executable(ir_core_equivalence_probe EXCLUDE_FROM_ALL tools/ir_core_equivalence_probe.cpp)
444
+ target_include_directories(ir_core_equivalence_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
445
+ target_link_libraries(ir_core_equivalence_probe PRIVATE hypergraph)
446
+ add_dependencies(probes ir_core_equivalence_probe)
447
+ add_executable(ir_edge_map_probe EXCLUDE_FROM_ALL tools/ir_edge_map_probe.cpp)
448
+ target_include_directories(ir_edge_map_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
449
+ target_link_libraries(ir_edge_map_probe PRIVATE hypergraph)
450
+ add_dependencies(probes ir_edge_map_probe)
451
+ add_executable(ir_edge_orbit_probe EXCLUDE_FROM_ALL tools/ir_edge_orbit_probe.cpp)
452
+ target_include_directories(ir_edge_orbit_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
453
+ target_link_libraries(ir_edge_orbit_probe PRIVATE hypergraph)
454
+ add_dependencies(probes ir_edge_orbit_probe)
455
+ add_executable(ir_malloc_bench EXCLUDE_FROM_ALL tools/ir_malloc_bench.cpp)
456
+ target_include_directories(ir_malloc_bench PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
457
+ target_link_libraries(ir_malloc_bench PRIVATE hypergraph)
458
+ add_dependencies(probes ir_malloc_bench)
459
+ add_executable(mode_matrix_probe EXCLUDE_FROM_ALL tools/mode_matrix_probe.cpp)
460
+ target_include_directories(mode_matrix_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
461
+ target_link_libraries(mode_matrix_probe PRIVATE hypergraph)
462
+ add_dependencies(probes mode_matrix_probe)
463
+ add_executable(multi_init_rule_2x2_probe EXCLUDE_FROM_ALL tools/multi_init_rule_2x2_probe.cpp)
464
+ target_include_directories(multi_init_rule_2x2_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
465
+ target_link_libraries(multi_init_rule_2x2_probe PRIVATE hypergraph)
466
+ add_dependencies(probes multi_init_rule_2x2_probe)
467
+ add_executable(multiplicity_propagation_probe EXCLUDE_FROM_ALL tools/multiplicity_propagation_probe.cpp)
468
+ target_include_directories(multiplicity_propagation_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
469
+ target_link_libraries(multiplicity_propagation_probe PRIVATE hypergraph)
470
+ add_dependencies(probes multiplicity_propagation_probe)
471
+ add_executable(profile_evolve EXCLUDE_FROM_ALL tools/profile_evolve.cpp)
472
+ target_include_directories(profile_evolve PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
473
+ target_link_libraries(profile_evolve PRIVATE hypergraph)
474
+ add_dependencies(probes profile_evolve)
475
+ add_executable(quotient_branchial_diff EXCLUDE_FROM_ALL tools/quotient_branchial_diff.cpp)
476
+ target_include_directories(quotient_branchial_diff PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
477
+ target_link_libraries(quotient_branchial_diff PRIVATE hypergraph)
478
+ add_dependencies(probes quotient_branchial_diff)
479
+ add_executable(quotient_branchial_gap_probe EXCLUDE_FROM_ALL tools/quotient_branchial_gap_probe.cpp)
480
+ target_include_directories(quotient_branchial_gap_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
481
+ target_link_libraries(quotient_branchial_gap_probe PRIVATE hypergraph)
482
+ add_dependencies(probes quotient_branchial_gap_probe)
483
+ add_executable(quotient_expansion_capture_probe EXCLUDE_FROM_ALL tools/quotient_expansion_capture_probe.cpp)
484
+ target_include_directories(quotient_expansion_capture_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
485
+ target_link_libraries(quotient_expansion_capture_probe PRIVATE hypergraph)
486
+ add_dependencies(probes quotient_expansion_capture_probe)
487
+ add_executable(quotient_observable_gap_probe EXCLUDE_FROM_ALL tools/quotient_observable_gap_probe.cpp)
488
+ target_include_directories(quotient_observable_gap_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
489
+ target_link_libraries(quotient_observable_gap_probe PRIVATE hypergraph)
490
+ add_dependencies(probes quotient_observable_gap_probe)
491
+ add_executable(quotient_pairs_reconstruction_probe EXCLUDE_FROM_ALL tools/quotient_pairs_reconstruction_probe.cpp)
492
+ target_include_directories(quotient_pairs_reconstruction_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
493
+ target_link_libraries(quotient_pairs_reconstruction_probe PRIVATE hypergraph)
494
+ add_dependencies(probes quotient_pairs_reconstruction_probe)
495
+ add_executable(quotient_raw_causal_reconstruction_probe EXCLUDE_FROM_ALL tools/quotient_raw_causal_reconstruction_probe.cpp)
496
+ target_include_directories(quotient_raw_causal_reconstruction_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
497
+ target_link_libraries(quotient_raw_causal_reconstruction_probe PRIVATE hypergraph)
498
+ add_dependencies(probes quotient_raw_causal_reconstruction_probe)
499
+ add_executable(quotient_reconstruction_cost_probe EXCLUDE_FROM_ALL tools/quotient_reconstruction_cost_probe.cpp)
500
+ target_include_directories(quotient_reconstruction_cost_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
501
+ target_link_libraries(quotient_reconstruction_cost_probe PRIVATE hypergraph)
502
+ add_dependencies(probes quotient_reconstruction_cost_probe)
503
+ add_executable(quotient_reconstruction_events_probe EXCLUDE_FROM_ALL tools/quotient_reconstruction_events_probe.cpp)
504
+ target_include_directories(quotient_reconstruction_events_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
505
+ target_link_libraries(quotient_reconstruction_events_probe PRIVATE hypergraph)
506
+ add_dependencies(probes quotient_reconstruction_events_probe)
507
+ add_executable(quotient_reconstruction_matrix_probe EXCLUDE_FROM_ALL tools/quotient_reconstruction_matrix_probe.cpp)
508
+ target_include_directories(quotient_reconstruction_matrix_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
509
+ target_link_libraries(quotient_reconstruction_matrix_probe PRIVATE hypergraph)
510
+ add_dependencies(probes quotient_reconstruction_matrix_probe)
511
+ add_executable(quotient_reconstruction_observables_probe EXCLUDE_FROM_ALL tools/quotient_reconstruction_observables_probe.cpp)
512
+ target_include_directories(quotient_reconstruction_observables_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
513
+ target_link_libraries(quotient_reconstruction_observables_probe PRIVATE hypergraph)
514
+ add_dependencies(probes quotient_reconstruction_observables_probe)
515
+ add_executable(quotient_reconstruction_probe EXCLUDE_FROM_ALL tools/quotient_reconstruction_probe.cpp)
516
+ target_include_directories(quotient_reconstruction_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
517
+ target_link_libraries(quotient_reconstruction_probe PRIVATE hypergraph)
518
+ add_dependencies(probes quotient_reconstruction_probe)
519
+ add_executable(representation_prototype EXCLUDE_FROM_ALL tools/representation_prototype.cpp)
520
+ target_include_directories(representation_prototype PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
521
+ target_link_libraries(representation_prototype PRIVATE hypergraph)
522
+ add_dependencies(probes representation_prototype)
523
+ add_executable(sampling_cost_probe EXCLUDE_FROM_ALL tools/sampling_cost_probe.cpp)
524
+ target_include_directories(sampling_cost_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
525
+ target_link_libraries(sampling_cost_probe PRIVATE hypergraph)
526
+ add_dependencies(probes sampling_cost_probe)
527
+ add_executable(sampling_cost_smoke EXCLUDE_FROM_ALL tools/sampling_cost_smoke.cpp)
528
+ target_include_directories(sampling_cost_smoke PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
529
+ target_link_libraries(sampling_cost_smoke PRIVATE hypergraph)
530
+ add_dependencies(probes sampling_cost_smoke)
531
+ add_executable(spine_probe EXCLUDE_FROM_ALL tools/spine_probe.cpp)
532
+ target_include_directories(spine_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
533
+ target_link_libraries(spine_probe PRIVATE hypergraph)
534
+ add_dependencies(probes spine_probe)
535
+ add_executable(thinning_recovery_probe EXCLUDE_FROM_ALL tools/thinning_recovery_probe.cpp)
536
+ target_include_directories(thinning_recovery_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
537
+ target_link_libraries(thinning_recovery_probe PRIVATE hypergraph)
538
+ add_dependencies(probes thinning_recovery_probe)
539
+ add_executable(timing_harness EXCLUDE_FROM_ALL tools/timing_harness.cpp)
540
+ target_include_directories(timing_harness PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
541
+ target_link_libraries(timing_harness PRIVATE hypergraph)
542
+ add_dependencies(probes timing_harness)
543
+ add_executable(unfolding_ratio_probe EXCLUDE_FROM_ALL tools/unfolding_ratio_probe.cpp)
544
+ target_include_directories(unfolding_ratio_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
545
+ target_link_libraries(unfolding_ratio_probe PRIVATE hypergraph)
546
+ add_dependencies(probes unfolding_ratio_probe)
547
+
548
+ add_executable(cost_matrix tools/cost_matrix.cpp)
549
+ target_include_directories(cost_matrix PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
550
+ target_link_libraries(cost_matrix PRIVATE hypergraph)
551
+
552
+ add_executable(generate_golden_matrix tools/generate_golden_matrix.cpp)
553
+ target_include_directories(generate_golden_matrix PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
554
+ target_link_libraries(generate_golden_matrix PRIVATE hypergraph)
555
+
556
+ # Repeat-count instrument for event identity stability. The gate compares one worker count
557
+ # against one other; this asks the same question many times over a spread of worker counts, which
558
+ # is what makes a "stable" reading evidence rather than a single agreement.
559
+ add_executable(event_signature_stability_probe tools/event_signature_stability_probe.cpp)
560
+ target_include_directories(event_signature_stability_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
561
+ target_link_libraries(event_signature_stability_probe PRIVATE hypergraph)
562
+
563
+ # Failure RATE of quotient causal determinism, over the sweep the pass/fail gate runs once.
564
+ # A gate that answers pass/fail cannot tell "fixed" from "did not fire this time", which is the
565
+ # whole question for a defect observed once in ~90 runs. --load runs background threads, since
566
+ # the one observation came from inside a full suite run.
567
+ # Reads the quotient capture counters, which exist only in stats builds.
568
+ if(HG_ENGINE_STATS)
569
+ add_executable(quotient_determinism_rate_probe tools/quotient_determinism_rate_probe.cpp)
570
+ target_include_directories(quotient_determinism_rate_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
571
+ target_link_libraries(quotient_determinism_rate_probe PRIVATE hypergraph)
572
+ endif()
573
+
574
+ # Host counterpart of gpu_rank_order_probe: separates a stable presentation order from an
575
+ # order-independent rank rule as the reason the CPU's event identities do not move.
576
+ add_executable(cpu_rank_order_probe tools/cpu_rank_order_probe.cpp)
577
+ target_include_directories(cpu_rank_order_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
578
+ target_link_libraries(cpu_rank_order_probe PRIVATE hypergraph)
579
+
580
+ # Benchmarks - Performance measurement tools
581
+ option(BUILD_BENCHMARKS "Build benchmarks" ON)
582
+ if(BUILD_BENCHMARKS)
583
+ add_subdirectory(benchmarking)
584
+ add_subdirectory(benchmarks)
585
+ endif()
586
+
587
+ # Optional: Build GPU acceleration (requires CUDA). Added before the paclet so
588
+ # the paclet's optional GPU binary (hg_evolve_gpu) can link the hg_gpu target.
589
+ option(BUILD_GPU "Build GPU-accelerated evolution engine" OFF)
590
+ if(BUILD_GPU)
591
+ include(CheckLanguage)
592
+ check_language(CUDA)
593
+ if(CMAKE_CUDA_COMPILER)
594
+ enable_language(CUDA)
595
+ message(STATUS "CUDA found: ${CMAKE_CUDA_COMPILER}")
596
+ message(STATUS "CUDA version: ${CMAKE_CUDA_COMPILER_VERSION}")
597
+ add_subdirectory(gpu)
598
+ else()
599
+ message(WARNING "CUDA not found - GPU support disabled")
600
+ endif()
601
+ endif()
602
+
603
+ # paclet_source/ builds hg_evolve in every configuration except WebAssembly, and the LibraryLink
604
+ # library and the paclet targets with BUILD_WOLFRAM_LANGUAGE_PACLET=ON (that part needs the Wolfram
605
+ # Language).
606
+ option(BUILD_WOLFRAM_LANGUAGE_PACLET "Build the Wolfram Language paclet library" ON)
607
+ if(NOT EMSCRIPTEN)
608
+ add_subdirectory(paclet_source)
609
+ endif()
610
+
611
+ # The Python client package hgevolve (python/): an extension module that runs the CPU engine
612
+ # in-process. Needs Python 3.9+ with its development headers and nanobind.
613
+ option(HG_BUILD_PYTHON "Build the hgevolve Python extension module" OFF)
614
+ if(HG_BUILD_PYTHON)
615
+ add_subdirectory(python)
616
+ endif()
617
+
618
+ # The JavaScript package hgevolve (js/): the CPU engine compiled to WebAssembly. An Emscripten
619
+ # build only; js/build.sh configures the single-threaded and the threaded build.
620
+ if(EMSCRIPTEN)
621
+ add_subdirectory(js)
622
+ endif()
623
+
624
+ # Viz-event emission. The interactive renderer lives in its own repo
625
+ # (../hypergraph_viz, split with history 2026-08-01); this switch builds the
626
+ # event-stream side it consumes: viz_events (above) plus the engine's
627
+ # VIZ_EMIT_* instrumentation (hypergraph/CMakeLists.txt). visualisation/ here
628
+ # retains only that interface (events/) and the blackhole analysis library the
629
+ # paclet compiles directly.
630
+ option(BUILD_VISUALIZATION "Emit visualization events for the external renderer" OFF)
631
+
632
+
633
+
634
+ # Every host tool gets a build target, automatically.
635
+ #
636
+ # 51 of 57 files under tools/ had none. `make <tool>` answered "No rule to make target", so each
637
+ # was compiled by hand once, produced its number, and then rotted -- including cost_matrix,
638
+ # which describes itself as the harness the paper's ablation uses. A measurement whose instrument
639
+ # cannot be rebuilt cannot be repeated, and a number that cannot be repeated is not evidence.
640
+ #
641
+ # EVERY tool now has one, and `make host_tools` compiles them all, so a tool that falls behind
642
+ # the API it measures is found on purpose rather than when someone next needs it.
643
+ #
644
+ # EXCLUDE_FROM_ALL so a probe that has fallen behind the API it measures does not break the
645
+ # default build or CI, while `make <tool>` still works and the rot is discoverable rather than
646
+ # invisible. `make host_tools` builds them all, which is what turns "this probe no longer
647
+ # compiles" into something a person finds on purpose instead of by needing it.
648
+ #
649
+ # Tools declared explicitly above keep their own targets; this skips those names.
650
+ file(GLOB HG_TOOL_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/tools/*.cpp)
651
+ add_custom_target(host_tools)
652
+ foreach(tool_src ${HG_TOOL_SOURCES})
653
+ get_filename_component(tool_name ${tool_src} NAME_WE)
654
+ # A tool that includes the CUDA headers belongs to the GPU build, not this one, and would
655
+ # fail here for a reason that says nothing about the tool.
656
+ file(READ ${tool_src} tool_text)
657
+ string(FIND "${tool_text}" "hg_gpu/" tool_needs_gpu)
658
+ # A tool that is not part of the repository. ir_incremental_probe.cpp is one clone's local
659
+ # scratch (.git/info/exclude), and it reads IRCanonicalizer::last_stats, which the class
660
+ # does not have -- so the glob, which sees the working tree rather than the index, would
661
+ # break host_tools for everyone who happens to have it. Named rather than silently skipped:
662
+ # a skip by pattern is how an unbuilt file stops being noticed.
663
+ set(HG_UNTRACKED_TOOLS ir_incremental_probe)
664
+ list(FIND HG_UNTRACKED_TOOLS ${tool_name} tool_untracked)
665
+ if(NOT TARGET ${tool_name} AND tool_needs_gpu EQUAL -1 AND tool_untracked EQUAL -1)
666
+ add_executable(${tool_name} EXCLUDE_FROM_ALL ${tool_src})
667
+ target_include_directories(${tool_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
668
+ target_link_libraries(${tool_name} PRIVATE hypergraph)
669
+ add_dependencies(host_tools ${tool_name})
670
+ endif()
671
+ endforeach()
672
+
673
+ # Probes that already decide a verdict and exit non-zero become CTest gates.
674
+ #
675
+ # quotient_reconstruction_probe verifies the KEYSTONE claim of the quotient optimisation --
676
+ # that the full-expansion causal multiset is recoverable from the quotient skeleton -- across 24
677
+ # workloads, and returns 1 if any of them disagrees with the oracle. It ran in 0.04 s and nothing
678
+ # in the suite asserted it: the claim was checked by hand, when someone remembered.
679
+ #
680
+ # It stays EXCLUDE_FROM_ALL as a tool; `ctest` builds and runs it. A probe that already computes
681
+ # a pass/fail is a gate that was never wired up, not a tool.
682
+ # enable_testing() is called immediately after project(); see the note there.
683
+ #
684
+ # causal_tr_exactness_probe is the second: it checks that online transitive reduction emits
685
+ # exactly the minimal edge set, at every thread count, and likewise returns non-zero on any
686
+ # disagreement. Also 0.06 s, also previously unasserted.
687
+ #
688
+ # The other reconstruction probes (events, matrix, observables) PRINT rather than decide, so they
689
+ # stay tools -- a probe with no verdict cannot be a gate without first being given one.
690
+ add_test(NAME quotient_reconstruction
691
+ COMMAND $<TARGET_FILE:quotient_reconstruction_probe>)
692
+ add_test(NAME causal_tr_exactness
693
+ COMMAND $<TARGET_FILE:causal_tr_exactness_probe>)
694
+ set_tests_properties(quotient_reconstruction causal_tr_exactness PROPERTIES TIMEOUT 300)
695
+ add_dependencies(host_tools quotient_reconstruction_probe causal_tr_exactness_probe)
696
+
697
+ # The GenMC harnesses, for the same reason as the two probes above: they already decide, and a
698
+ # check nobody runs is a check that stops being true. Two defects reached the tree while the
699
+ # stress tests covering those structures were green, so these run with the rest of the suite.
700
+ #
701
+ # The harnesses transcribe or include memory orders from the engine headers, and one of them
702
+ # (job_system_no_lost_wakeup) proved it can go stale the moment the header it mirrors is fixed
703
+ # without it. Running on every `ctest` is what surfaces that.
704
+ #
705
+ # SKIPPED, not failed, where genmc is absent: it is a separate build against LLVM 18 and is not a
706
+ # dependency of this project. run.sh exits 2 in that case, which is mapped to a skip so a machine
707
+ # without it reports honestly rather than either lying green or failing red.
708
+ # SPEC 5.4 as a standing gate: every quotient golden row must equal its full-capture twin on
709
+ # every count column AND the state fingerprint. Pure python over the checked-in golden file, so
710
+ # it costs milliseconds and cannot drift from what the golden gate itself compares.
711
+ add_test(NAME quotient_twin_check
712
+ COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/tools/golden_quotient_twin_check.py
713
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
714
+ set_tests_properties(quotient_twin_check PROPERTIES TIMEOUT 60)
715
+
716
+ # THE TIMEOUT IS MEASURED, NOT GUESSED, and it has to be: a model-checking gate that is cut off
717
+ # mid-enumeration reports a failure indistinguishable from a real violation, and one set below
718
+ # what the suite costs is a gate that can only ever fail. Per-harness wall clock, measured
719
+ # 2026-08-23 on this box at each harness's own recorded bound, box load 4-8:
720
+ #
721
+ # concurrent_map_double_growth_3t 140.58 s (26,573 executions, --sc, four-context bound)
722
+ # concurrent_map_repeated_offer 88.57 s
723
+ # key_set_exactly_once_3t 80.86 s
724
+ # concurrent_map_double_growth_2t 68.14 s (34,485 executions, RC11, no bound)
725
+ # concurrent_map_resize 37.76 s
726
+ # the remaining fourteen ~15 s combined
727
+ #
728
+ # About 430 s of enumeration plus a clang compile per harness. The expensive ones are the
729
+ # three-worker shapes across a table growth, which is where the defects are: every double-claim
730
+ # this project has found needed a growth concurrent with two claimants.
731
+ #
732
+ # REDUCING THEM IS NOT AVAILABLE, tested rather than assumed. Dropping a three-worker harness
733
+ # from --bound=4 to --bound=3 makes it finish sooner and STOP DETECTING its defect: with the
734
+ # guard it exists for deleted, it reports no violation in 21,041 executions at three, where at
735
+ # four it reports one. Shrinking the table instead (working_capacity 16 -> 4) does not help,
736
+ # since the cost is the three-thread interleaving space and not the table width. So the budget
737
+ # is stated from the measurement, with room for a loaded box.
738
+ # NOT REGISTERED ON WINDOWS. All three of these gates are driven by a POSIX shell script, and
739
+ # ctest on a Windows runner cannot launch one: it reports BAD_COMMAND, which is a FAILURE and not
740
+ # a skip, so SKIP_RETURN_CODE never gets a chance to apply. That is not a hypothetical -- it is
741
+ # what the Windows leg reported for tla_cells and mingw_tls_teardown, two failures out of 348.
742
+ #
743
+ # Nothing is lost. Each of the three is a host-side gate whose toolchain is Linux: genmc needs a
744
+ # local LLVM/GenMC build, the TLA cells need a JVM and tla2tools.jar, and the mingw cells need the
745
+ # mingw-w64 CROSS compiler, which is by definition not what a native Windows runner has. They run
746
+ # on Linux CI and locally; registering them here only manufactures red.
747
+ if(NOT WIN32)
748
+ add_test(NAME genmc_harnesses
749
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/verification/genmc/run.sh all)
750
+ set_tests_properties(genmc_harnesses PROPERTIES
751
+ TIMEOUT 1500
752
+ SKIP_RETURN_CODE 2)
753
+
754
+ # THE TLC CELLS RUN TOO, and for the same reason the GenMC harnesses do. Each .cfg declares its
755
+ # own verdict on line 1 -- `Expected: PASS` or `Expected: VIOLATION` -- and run.sh checks the
756
+ # verdict TLC produces against it. Five of the twelve cells are CALIBRATIONS that must VIOLATE
757
+ # (the cells whose line 1 says so). A spec edit that quietly turns one of those into a pass has
758
+ # disabled the calibration, and only a runner that knows the expected verdict can see that; a
759
+ # table of results in a README cannot.
760
+ #
761
+ # SKIPPED where the toolchain is absent, as with genmc: TLC needs a JVM and tla2tools.jar, and
762
+ # neither is a dependency of this project, so run.sh exits 2 and that is mapped to a skip.
763
+ add_test(NAME tla_cells
764
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/verification/tla/run.sh)
765
+ set_tests_properties(tla_cells PROPERTIES
766
+ TIMEOUT 600
767
+ SKIP_RETURN_CODE 2)
768
+
769
+ # THE GPUMC CELLS, the device's model checks under scoped-RC11: every harness under
770
+ # verification/gpumc, each cell checked against its declared verdict. SKIPPED (exit 2) where the
771
+ # GPUMC image is absent (verification/gpumc/checker/build.sh builds it), which is every CI runner.
772
+ # The cells take about 15 minutes on this box, most of it evolve_ring_termination's 3.1 million
773
+ # executions.
774
+ add_test(NAME gpumc_cells
775
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/verification/gpumc/run.sh cells)
776
+ set_tests_properties(gpumc_cells PROPERTIES
777
+ TIMEOUT 2400
778
+ SKIP_RETURN_CODE 2)
779
+
780
+ # THE MINGW TEARDOWN CELLS RUN TOO, for the same reason the other two suites do: the decision to
781
+ # build the shipped Windows x86-64 artifacts natively with MSVC rests on mingw-w64 corrupting the
782
+ # heap at worker-thread exit, and until these cells existed the only account of that was a comment
783
+ # in build_all_platforms.sh that nothing checked. Each cell declares CLEAN or CORRUPT and the
784
+ # runner checks it, so a toolchain that fixes the defect is noticed instead of assumed. SKIPS
785
+ # (exit 2) where the mingw cross-compiler is absent or a Windows binary cannot be executed, which
786
+ # is every Linux CI runner.
787
+ add_test(NAME mingw_tls_teardown
788
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/verification/mingw/run.sh)
789
+ set_tests_properties(mingw_tls_teardown PROPERTIES
790
+ TIMEOUT 600
791
+ SKIP_RETURN_CODE 2)
792
+ endif()
793
+
794
+ # Each bench names itself in its build stamp, as the shipped artifacts do, so a measuring script
795
+ # can read the configuration it is about to time from the binary itself.
796
+ foreach(_hg_bench bench_cpu_evolve sampling_cost_smoke cost_matrix
797
+ mode_matrix_probe quotient_reconstruction_cost_probe)
798
+ if(NOT TARGET ${_hg_bench})
799
+ # A bench named here and defined nowhere is how bench_cpu_evolve went unbuilt: the guard
800
+ # that skipped it also hid it, and the quiet gate went on looking for a binary no target
801
+ # produces. Naming a bench is the claim that it builds.
802
+ message(FATAL_ERROR "bench '${_hg_bench}' is named for a build stamp but no target "
803
+ "defines it; register it or take it off this list")
804
+ endif()
805
+ target_compile_definitions(${_hg_bench} PRIVATE HG_BUILD_VARIANT="${_hg_bench}")
806
+ endforeach()
807
+
808
+ # bench_gpu_evolve is defined in gpu/CMakeLists.txt and only when the CUDA toolchain is present,
809
+ # so its absence is a configuration, not an omission.
810
+ if(TARGET bench_gpu_evolve)
811
+ target_compile_definitions(bench_gpu_evolve PRIVATE HG_BUILD_VARIANT="bench_gpu_evolve")
812
+ endif()