meep-gpu 0.9.2__py3-none-any.whl

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 (537) hide show
  1. meep_gpu/LICENSE +339 -0
  2. meep_gpu/NOTICE +21 -0
  3. meep_gpu/__init__.py +208 -0
  4. meep_gpu/absorber.py +316 -0
  5. meep_gpu/amp_interpolation.py +158 -0
  6. meep_gpu/backends.py +362 -0
  7. meep_gpu/code_identity.py +144 -0
  8. meep_gpu/conftest.py +399 -0
  9. meep_gpu/cuda_kernels/__init__.py +6 -0
  10. meep_gpu/cuda_kernels/ade_kernels.py +519 -0
  11. meep_gpu/cuda_kernels/arms.py +1311 -0
  12. meep_gpu/cuda_kernels/bfast_curl.py +757 -0
  13. meep_gpu/cuda_kernels/bfast_fused_electric_pair.py +730 -0
  14. meep_gpu/cuda_kernels/bfast_fused_magnetic_pair.py +611 -0
  15. meep_gpu/cuda_kernels/certification.json +21804 -0
  16. meep_gpu/cuda_kernels/compile_cache.py +259 -0
  17. meep_gpu/cuda_kernels/complex_beta_fused_electric_pair.py +593 -0
  18. meep_gpu/cuda_kernels/complex_beta_fused_hd_pair.py +1067 -0
  19. meep_gpu/cuda_kernels/complex_beta_fused_magnetic_pair.py +560 -0
  20. meep_gpu/cuda_kernels/complex_beta_kernels.py +857 -0
  21. meep_gpu/cuda_kernels/complex_electric_fill_carry.py +766 -0
  22. meep_gpu/cuda_kernels/complex_emitter.py +645 -0
  23. meep_gpu/cuda_kernels/complex_fill_carry.py +717 -0
  24. meep_gpu/cuda_kernels/complex_folded_fused_electric_pair.py +561 -0
  25. meep_gpu/cuda_kernels/complex_folded_fused_magnetic_pair.py +652 -0
  26. meep_gpu/cuda_kernels/complex_folded_kernels.py +895 -0
  27. meep_gpu/cuda_kernels/complex_fused_electric_pair.py +1024 -0
  28. meep_gpu/cuda_kernels/complex_fused_hd_pair.py +1270 -0
  29. meep_gpu/cuda_kernels/complex_fused_magnetic_pair.py +885 -0
  30. meep_gpu/cuda_kernels/complex_no_pml_fused_polarization_pair.py +677 -0
  31. meep_gpu/cuda_kernels/complex_no_pml_kernels.py +1709 -0
  32. meep_gpu/cuda_kernels/complex_no_pml_offdiag_fused_electric_pair.py +754 -0
  33. meep_gpu/cuda_kernels/complex_no_pml_three_slot_dispersive_weld.py +824 -0
  34. meep_gpu/cuda_kernels/complex_offdiag_stencil_weld.py +1090 -0
  35. meep_gpu/cuda_kernels/complex_offdiag_update_e.py +1941 -0
  36. meep_gpu/cuda_kernels/complex_pml_kernels.py +473 -0
  37. meep_gpu/cuda_kernels/conductive_bfast_fused_hd_pair.py +1445 -0
  38. meep_gpu/cuda_kernels/conductive_fused_electric_pair.py +1006 -0
  39. meep_gpu/cuda_kernels/conductive_kernels.py +1104 -0
  40. meep_gpu/cuda_kernels/constitutive_kernels.py +606 -0
  41. meep_gpu/cuda_kernels/coverage.py +3151 -0
  42. meep_gpu/cuda_kernels/cylindrical_complex_kernels.py +1101 -0
  43. meep_gpu/cuda_kernels/cylindrical_coverage.py +540 -0
  44. meep_gpu/cuda_kernels/cylindrical_fused_electric_pair.py +1316 -0
  45. meep_gpu/cuda_kernels/cylindrical_fused_hd_pair.py +771 -0
  46. meep_gpu/cuda_kernels/cylindrical_fused_magnetic_pair.py +1143 -0
  47. meep_gpu/cuda_kernels/cylindrical_kernels.py +534 -0
  48. meep_gpu/cuda_kernels/cylindrical_prefix.py +83 -0
  49. meep_gpu/cuda_kernels/cylindrical_real_fused_electric_pair.py +837 -0
  50. meep_gpu/cuda_kernels/cylindrical_real_fused_hd_pair.py +685 -0
  51. meep_gpu/cuda_kernels/cylindrical_real_fused_magnetic_pair.py +708 -0
  52. meep_gpu/cuda_kernels/dispersive_fused_electric_pair.py +950 -0
  53. meep_gpu/cuda_kernels/dispersive_kernels.py +1403 -0
  54. meep_gpu/cuda_kernels/dispersive_offdiag_fused_polarization_pair.py +649 -0
  55. meep_gpu/cuda_kernels/dispersive_offdiag_update_e.py +1719 -0
  56. meep_gpu/cuda_kernels/fingerprints.json +4694 -0
  57. meep_gpu/cuda_kernels/folded_complex_offdiag_fused_electric_pair.py +858 -0
  58. meep_gpu/cuda_kernels/folded_offdiag_fused_electric_pair.py +931 -0
  59. meep_gpu/cuda_kernels/folded_offdiag_kernels.py +1375 -0
  60. meep_gpu/cuda_kernels/fused_electric_pair.py +1706 -0
  61. meep_gpu/cuda_kernels/fused_hd_pair.py +1313 -0
  62. meep_gpu/cuda_kernels/fused_magnetic_pair.py +1880 -0
  63. meep_gpu/cuda_kernels/fused_pairs.py +5127 -0
  64. meep_gpu/cuda_kernels/fused_polarization_pair.py +1145 -0
  65. meep_gpu/cuda_kernels/in_seam_coverage.py +504 -0
  66. meep_gpu/cuda_kernels/in_seam_passes.py +736 -0
  67. meep_gpu/cuda_kernels/no_pml_complex_fused_electric_pair.py +1387 -0
  68. meep_gpu/cuda_kernels/no_pml_constitutive.py +733 -0
  69. meep_gpu/cuda_kernels/no_pml_curl.py +1055 -0
  70. meep_gpu/cuda_kernels/no_pml_dispersive_fused_electric_pair.py +1100 -0
  71. meep_gpu/cuda_kernels/no_pml_three_slot_dispersive_weld.py +244 -0
  72. meep_gpu/cuda_kernels/nonlinear_constitutive.py +989 -0
  73. meep_gpu/cuda_kernels/offdiag_constitutive_kernels.py +401 -0
  74. meep_gpu/cuda_kernels/offdiag_emitter.py +504 -0
  75. meep_gpu/cuda_kernels/offdiag_fused_electric_pair.py +979 -0
  76. meep_gpu/cuda_kernels/offdiag_stencil_weld.py +763 -0
  77. meep_gpu/cuda_kernels/own_cell_hoist.py +266 -0
  78. meep_gpu/cuda_kernels/own_cell_hoist_reference.json +2150 -0
  79. meep_gpu/cuda_kernels/registry.py +763 -0
  80. meep_gpu/cuda_kernels/special_kz_curl.py +677 -0
  81. meep_gpu/cuda_kernels/special_kz_fused_electric_pair.py +722 -0
  82. meep_gpu/cuda_kernels/special_kz_fused_hd_pair.py +847 -0
  83. meep_gpu/cuda_kernels/special_kz_fused_magnetic_pair.py +724 -0
  84. meep_gpu/cuda_kernels/step_curl_kernels.py +833 -0
  85. meep_gpu/cuda_kernels/test_ade_strings_parse_cache.py +186 -0
  86. meep_gpu/cuda_kernels/test_ade_update_p.py +1200 -0
  87. meep_gpu/cuda_kernels/test_arms.py +614 -0
  88. meep_gpu/cuda_kernels/test_bfast_curl.py +450 -0
  89. meep_gpu/cuda_kernels/test_certification_metadata.py +532 -0
  90. meep_gpu/cuda_kernels/test_certification_record.py +798 -0
  91. meep_gpu/cuda_kernels/test_compile_cache.py +431 -0
  92. meep_gpu/cuda_kernels/test_complex_beta.py +642 -0
  93. meep_gpu/cuda_kernels/test_complex_beta_fused_hd_pair.py +340 -0
  94. meep_gpu/cuda_kernels/test_complex_folded.py +969 -0
  95. meep_gpu/cuda_kernels/test_complex_fused_electric_pairs.py +1181 -0
  96. meep_gpu/cuda_kernels/test_complex_no_pml.py +1000 -0
  97. meep_gpu/cuda_kernels/test_complex_no_pml_three_slot_dispersive_weld.py +315 -0
  98. meep_gpu/cuda_kernels/test_complex_offdiag_stencil_welds.py +702 -0
  99. meep_gpu/cuda_kernels/test_complex_offdiag_update_e.py +1503 -0
  100. meep_gpu/cuda_kernels/test_complex_pml.py +1211 -0
  101. meep_gpu/cuda_kernels/test_conductive_bfast_fused_hd_pair.py +392 -0
  102. meep_gpu/cuda_kernels/test_conductive_fused_electric_pair.py +573 -0
  103. meep_gpu/cuda_kernels/test_conductive_kernels.py +988 -0
  104. meep_gpu/cuda_kernels/test_constitutive_pml_real.py +2671 -0
  105. meep_gpu/cuda_kernels/test_cylindrical_complex.py +842 -0
  106. meep_gpu/cuda_kernels/test_cylindrical_fused_electric_pair_hoist.py +95 -0
  107. meep_gpu/cuda_kernels/test_cylindrical_fused_magnetic_pair_hoist.py +91 -0
  108. meep_gpu/cuda_kernels/test_cylindrical_pml_real.py +727 -0
  109. meep_gpu/cuda_kernels/test_dispersive.py +910 -0
  110. meep_gpu/cuda_kernels/test_dispersive_fused_electric_pair.py +761 -0
  111. meep_gpu/cuda_kernels/test_dispersive_offdiag_polarization_pair.py +354 -0
  112. meep_gpu/cuda_kernels/test_dispersive_offdiag_update_e.py +1590 -0
  113. meep_gpu/cuda_kernels/test_folded_offdiag.py +1625 -0
  114. meep_gpu/cuda_kernels/test_fused_electric_pair.py +896 -0
  115. meep_gpu/cuda_kernels/test_fused_hd_pair.py +370 -0
  116. meep_gpu/cuda_kernels/test_fused_magnetic_pair_fill_carry.py +982 -0
  117. meep_gpu/cuda_kernels/test_fused_pair_held_source.py +701 -0
  118. meep_gpu/cuda_kernels/test_fused_pairs.py +1046 -0
  119. meep_gpu/cuda_kernels/test_fused_polarization_pair.py +583 -0
  120. meep_gpu/cuda_kernels/test_in_seam_passes.py +685 -0
  121. meep_gpu/cuda_kernels/test_kernel_partition.py +378 -0
  122. meep_gpu/cuda_kernels/test_no_pml_complex_fused_electric_pair.py +1366 -0
  123. meep_gpu/cuda_kernels/test_no_pml_constitutive.py +1061 -0
  124. meep_gpu/cuda_kernels/test_no_pml_curl.py +1067 -0
  125. meep_gpu/cuda_kernels/test_no_pml_dispersive_fused_electric_pair.py +648 -0
  126. meep_gpu/cuda_kernels/test_nonlinear_constitutive.py +1038 -0
  127. meep_gpu/cuda_kernels/test_offdiag_constitutive_pml_real.py +2315 -0
  128. meep_gpu/cuda_kernels/test_offdiag_stencil_welds.py +858 -0
  129. meep_gpu/cuda_kernels/test_own_cell_hoist_store_sequence.py +1248 -0
  130. meep_gpu/cuda_kernels/test_residual_fused_electric_pairs.py +451 -0
  131. meep_gpu/cuda_kernels/test_residual_fused_magnetic_pairs.py +574 -0
  132. meep_gpu/cuda_kernels/test_single_arm_launches.py +822 -0
  133. meep_gpu/cuda_kernels/test_special_kz_bfast_admission.py +260 -0
  134. meep_gpu/cuda_kernels/test_special_kz_curl.py +470 -0
  135. meep_gpu/cuda_kernels/test_special_kz_fused_hd_pair.py +284 -0
  136. meep_gpu/cuda_kernels/test_step_curl_pml_real.py +1662 -0
  137. meep_gpu/cuda_kernels/test_three_slot_dispersive_weld.py +570 -0
  138. meep_gpu/cuda_kernels/three_slot_dispersive_weld.py +778 -0
  139. meep_gpu/cuda_kernels/timing_cc86.json +1154 -0
  140. meep_gpu/cuda_kernels/timing_cc86.report.txt +64 -0
  141. meep_gpu/deposit_repair.py +1854 -0
  142. meep_gpu/device_identity.py +265 -0
  143. meep_gpu/dft.py +5538 -0
  144. meep_gpu/dispatch_preference.py +977 -0
  145. meep_gpu/dispersion.py +769 -0
  146. meep_gpu/driver.py +4617 -0
  147. meep_gpu/expansion_refusal.py +439 -0
  148. meep_gpu/fastpath.py +7652 -0
  149. meep_gpu/fastpath_cuda.py +2371 -0
  150. meep_gpu/fields.py +1957 -0
  151. meep_gpu/from_meep.py +8638 -0
  152. meep_gpu/gaussian_beam.py +303 -0
  153. meep_gpu/grid.py +1479 -0
  154. meep_gpu/harminv.py +680 -0
  155. meep_gpu/host_writes.py +331 -0
  156. meep_gpu/metal_dispatch.py +3120 -0
  157. meep_gpu/metal_kernels/__init__.py +104 -0
  158. meep_gpu/metal_kernels/ade_update_p.py +493 -0
  159. meep_gpu/metal_kernels/arms.py +289 -0
  160. meep_gpu/metal_kernels/barrier.py +367 -0
  161. meep_gpu/metal_kernels/beta_complex_fused_electric_pair.py +671 -0
  162. meep_gpu/metal_kernels/beta_complex_fused_hd_pair.py +1265 -0
  163. meep_gpu/metal_kernels/beta_complex_fused_magnetic_pair.py +549 -0
  164. meep_gpu/metal_kernels/beta_fused_electric_pair.py +640 -0
  165. meep_gpu/metal_kernels/beta_fused_magnetic_pair.py +573 -0
  166. meep_gpu/metal_kernels/beta_real_fused_hd_pair.py +1048 -0
  167. meep_gpu/metal_kernels/bfast_curl.py +1081 -0
  168. meep_gpu/metal_kernels/bfast_fused_electric_pair.py +681 -0
  169. meep_gpu/metal_kernels/bfast_fused_hd_pair.py +852 -0
  170. meep_gpu/metal_kernels/bfast_fused_magnetic_pair.py +568 -0
  171. meep_gpu/metal_kernels/coefficient_pack.py +201 -0
  172. meep_gpu/metal_kernels/complex_conductive_fused_pair.py +885 -0
  173. meep_gpu/metal_kernels/complex_conductive_pml.py +525 -0
  174. meep_gpu/metal_kernels/complex_dispersive_spine.py +173 -0
  175. meep_gpu/metal_kernels/complex_dispersive_update_e.py +300 -0
  176. meep_gpu/metal_kernels/complex_fields.py +1393 -0
  177. meep_gpu/metal_kernels/complex_folded_offdiag_update_e.py +365 -0
  178. meep_gpu/metal_kernels/complex_fused_ade_chain.py +825 -0
  179. meep_gpu/metal_kernels/complex_fused_electric_pair.py +920 -0
  180. meep_gpu/metal_kernels/complex_fused_hd_pair.py +1267 -0
  181. meep_gpu/metal_kernels/complex_fused_magnetic_pair.py +1010 -0
  182. meep_gpu/metal_kernels/complex_no_pml_conductive.py +446 -0
  183. meep_gpu/metal_kernels/complex_no_pml_curl.py +199 -0
  184. meep_gpu/metal_kernels/complex_no_pml_offdiag_fused_electric_pair.py +579 -0
  185. meep_gpu/metal_kernels/complex_no_pml_offdiag_update_e.py +391 -0
  186. meep_gpu/metal_kernels/complex_no_pml_stored_e.py +272 -0
  187. meep_gpu/metal_kernels/conductive_fused_electric_pair.py +675 -0
  188. meep_gpu/metal_kernels/conductive_fused_hd_pair.py +944 -0
  189. meep_gpu/metal_kernels/conductive_pml.py +273 -0
  190. meep_gpu/metal_kernels/corpus.py +170 -0
  191. meep_gpu/metal_kernels/coverage.py +631 -0
  192. meep_gpu/metal_kernels/cylindrical_complex.py +1780 -0
  193. meep_gpu/metal_kernels/cylindrical_complex_fused_hd_pair.py +841 -0
  194. meep_gpu/metal_kernels/cylindrical_complex_scan.py +273 -0
  195. meep_gpu/metal_kernels/cylindrical_fused_electric_pair.py +1073 -0
  196. meep_gpu/metal_kernels/cylindrical_fused_magnetic_pair.py +1087 -0
  197. meep_gpu/metal_kernels/cylindrical_real.py +1426 -0
  198. meep_gpu/metal_kernels/cylindrical_real_fused_electric_pair.py +1022 -0
  199. meep_gpu/metal_kernels/cylindrical_real_fused_hd_pair.py +955 -0
  200. meep_gpu/metal_kernels/cylindrical_real_fused_magnetic_pair.py +876 -0
  201. meep_gpu/metal_kernels/device.py +1659 -0
  202. meep_gpu/metal_kernels/dispersive_update_e.py +310 -0
  203. meep_gpu/metal_kernels/fingerprints.json +35997 -0
  204. meep_gpu/metal_kernels/folded_beta.py +1710 -0
  205. meep_gpu/metal_kernels/folded_beta_complex_fused_magnetic_pair.py +1443 -0
  206. meep_gpu/metal_kernels/folded_beta_complex_fused_pair.py +872 -0
  207. meep_gpu/metal_kernels/folded_beta_real_fused_magnetic_pair.py +638 -0
  208. meep_gpu/metal_kernels/folded_beta_real_fused_pair.py +670 -0
  209. meep_gpu/metal_kernels/folded_complex.py +1804 -0
  210. meep_gpu/metal_kernels/folded_complex_fused_hd_pair.py +889 -0
  211. meep_gpu/metal_kernels/folded_complex_fused_magnetic_pair.py +1918 -0
  212. meep_gpu/metal_kernels/folded_complex_fused_pair.py +1478 -0
  213. meep_gpu/metal_kernels/folded_complex_offdiag_fused_electric_pair.py +637 -0
  214. meep_gpu/metal_kernels/folded_dispersive_update_e.py +187 -0
  215. meep_gpu/metal_kernels/folded_fused_dispersive_pair.py +1043 -0
  216. meep_gpu/metal_kernels/folded_fused_hd_pair.py +796 -0
  217. meep_gpu/metal_kernels/folded_fused_magnetic_pair.py +1542 -0
  218. meep_gpu/metal_kernels/folded_fused_pair.py +1449 -0
  219. meep_gpu/metal_kernels/folded_offdiag_dispersive_update_e.py +457 -0
  220. meep_gpu/metal_kernels/folded_offdiag_fused_electric_pair.py +572 -0
  221. meep_gpu/metal_kernels/folded_offdiag_update_e.py +1422 -0
  222. meep_gpu/metal_kernels/fused_ade_chain.py +882 -0
  223. meep_gpu/metal_kernels/fused_dispersive_pair.py +821 -0
  224. meep_gpu/metal_kernels/fused_electric_pair.py +843 -0
  225. meep_gpu/metal_kernels/fused_hd_pair.py +1167 -0
  226. meep_gpu/metal_kernels/fused_magnetic_pair.py +765 -0
  227. meep_gpu/metal_kernels/launch.py +2125 -0
  228. meep_gpu/metal_kernels/no_pml_conductive.py +383 -0
  229. meep_gpu/metal_kernels/no_pml_conductive_fused_electric_pair.py +797 -0
  230. meep_gpu/metal_kernels/no_pml_constitutive.py +737 -0
  231. meep_gpu/metal_kernels/no_pml_curl.py +339 -0
  232. meep_gpu/metal_kernels/no_pml_fused_electric_pair.py +553 -0
  233. meep_gpu/metal_kernels/no_pml_stored_e.py +285 -0
  234. meep_gpu/metal_kernels/nonlinear_fused_magnetic_pair.py +305 -0
  235. meep_gpu/metal_kernels/nonlinear_update_e.py +1575 -0
  236. meep_gpu/metal_kernels/offdiag_fused_electric_pair.py +720 -0
  237. meep_gpu/metal_kernels/offdiag_update_e.py +1134 -0
  238. meep_gpu/metal_kernels/offdiag_weld_common.py +588 -0
  239. meep_gpu/metal_kernels/plans.py +90 -0
  240. meep_gpu/metal_kernels/preconditions.py +265 -0
  241. meep_gpu/metal_kernels/registry.py +385 -0
  242. meep_gpu/metal_kernels/shaders.py +430 -0
  243. meep_gpu/metal_kernels/special_kz.py +1804 -0
  244. meep_gpu/metal_kernels/subnormal.py +313 -0
  245. meep_gpu/metal_kernels/symmetry.py +1829 -0
  246. meep_gpu/metal_kernels/templates.py +224 -0
  247. meep_gpu/metal_runs.py +329 -0
  248. meep_gpu/pml.py +857 -0
  249. meep_gpu/sigma_lookup.py +327 -0
  250. meep_gpu/sigma_recovery.py +261 -0
  251. meep_gpu/smoothing.py +1440 -0
  252. meep_gpu/sources.py +2272 -0
  253. meep_gpu/stepping.py +2544 -0
  254. meep_gpu/subnormal_policy.py +2332 -0
  255. meep_gpu/test_absorber.py +311 -0
  256. meep_gpu/test_backends.py +311 -0
  257. meep_gpu/test_bytecode_cache_matches_source.py +117 -0
  258. meep_gpu/test_capability_records.py +667 -0
  259. meep_gpu/test_code_identity.py +148 -0
  260. meep_gpu/test_compile_cache_consistency.py +122 -0
  261. meep_gpu/test_conftest_guards.py +281 -0
  262. meep_gpu/test_cuda_certified_fused_products.py +1072 -0
  263. meep_gpu/test_cuda_complex_fused_hd_pair.py +464 -0
  264. meep_gpu/test_cuda_cylindrical_fused_hd_pair.py +268 -0
  265. meep_gpu/test_cuda_cylindrical_real_fused_hd_pair.py +284 -0
  266. meep_gpu/test_cuda_weld_contract.py +1760 -0
  267. meep_gpu/test_cylindrical.py +727 -0
  268. meep_gpu/test_cylindrical_near2far.py +626 -0
  269. meep_gpu/test_deposit_repair.py +1227 -0
  270. meep_gpu/test_deposit_repair_component_restriction.py +1867 -0
  271. meep_gpu/test_deposit_repair_linear_route.py +817 -0
  272. meep_gpu/test_deposit_repair_restriction_bench_record.py +156 -0
  273. meep_gpu/test_device_identity.py +159 -0
  274. meep_gpu/test_dft.py +3829 -0
  275. meep_gpu/test_diagonal_epsilon.py +180 -0
  276. meep_gpu/test_dispatch_contract.py +5493 -0
  277. meep_gpu/test_dispatch_expansion_refusal.py +1033 -0
  278. meep_gpu/test_dispatch_policy_uniformity.py +584 -0
  279. meep_gpu/test_dispatch_preference.py +1008 -0
  280. meep_gpu/test_dispatch_route_tables_are_complete.py +86 -0
  281. meep_gpu/test_dispatch_subnormal_gate.py +426 -0
  282. meep_gpu/test_dispersion.py +1057 -0
  283. meep_gpu/test_driver_integration.py +4886 -0
  284. meep_gpu/test_driver_vs_meep.py +5330 -0
  285. meep_gpu/test_fastpath.py +618 -0
  286. meep_gpu/test_field_reducers.py +633 -0
  287. meep_gpu/test_fields.py +1237 -0
  288. meep_gpu/test_folded_deposit_closure.py +192 -0
  289. meep_gpu/test_folded_fused_pair_routing.py +822 -0
  290. meep_gpu/test_from_meep.py +8694 -0
  291. meep_gpu/test_fused_pair_deposit_wiring.py +2543 -0
  292. meep_gpu/test_gate_provenance.py +336 -0
  293. meep_gpu/test_gaussian_beam.py +392 -0
  294. meep_gpu/test_grid_pml.py +1498 -0
  295. meep_gpu/test_harminv.py +1404 -0
  296. meep_gpu/test_meep_precision_notice.py +173 -0
  297. meep_gpu/test_metal_ade_update_p.py +332 -0
  298. meep_gpu/test_metal_artifact_provenance.py +1011 -0
  299. meep_gpu/test_metal_below_the_cut_fused_pairs.py +749 -0
  300. meep_gpu/test_metal_beta_complex_fused_hd_pair.py +571 -0
  301. meep_gpu/test_metal_beta_real_fused_hd_pair.py +546 -0
  302. meep_gpu/test_metal_bfast.py +803 -0
  303. meep_gpu/test_metal_bfast_fused_hd_pair.py +421 -0
  304. meep_gpu/test_metal_coefficient_pack.py +223 -0
  305. meep_gpu/test_metal_complex_conductive_fused_pair.py +412 -0
  306. meep_gpu/test_metal_complex_conductive_pml.py +284 -0
  307. meep_gpu/test_metal_complex_dispersive_update_e.py +195 -0
  308. meep_gpu/test_metal_complex_fields.py +818 -0
  309. meep_gpu/test_metal_complex_folded_offdiag_update_e.py +131 -0
  310. meep_gpu/test_metal_complex_fused_ade_chain.py +341 -0
  311. meep_gpu/test_metal_complex_fused_hd_pair.py +668 -0
  312. meep_gpu/test_metal_complex_fused_magnetic_pair.py +549 -0
  313. meep_gpu/test_metal_complex_no_pml_conductive.py +226 -0
  314. meep_gpu/test_metal_complex_no_pml_curl.py +220 -0
  315. meep_gpu/test_metal_complex_no_pml_offdiag_update_e.py +167 -0
  316. meep_gpu/test_metal_complex_no_pml_stored_e.py +162 -0
  317. meep_gpu/test_metal_conductive_fused_hd_pair.py +527 -0
  318. meep_gpu/test_metal_conductive_pml.py +174 -0
  319. meep_gpu/test_metal_cylindrical_complex.py +1132 -0
  320. meep_gpu/test_metal_cylindrical_complex_fused_hd_pair.py +378 -0
  321. meep_gpu/test_metal_cylindrical_complex_scan.py +367 -0
  322. meep_gpu/test_metal_cylindrical_fused_electric_pair.py +612 -0
  323. meep_gpu/test_metal_cylindrical_fused_magnetic_pair.py +453 -0
  324. meep_gpu/test_metal_cylindrical_real.py +721 -0
  325. meep_gpu/test_metal_cylindrical_real_fused_electric_pair.py +912 -0
  326. meep_gpu/test_metal_cylindrical_real_fused_hd_pair.py +397 -0
  327. meep_gpu/test_metal_cylindrical_real_fused_magnetic_pair.py +678 -0
  328. meep_gpu/test_metal_dispatch.py +1096 -0
  329. meep_gpu/test_metal_dispersive_update_e.py +147 -0
  330. meep_gpu/test_metal_environment.py +316 -0
  331. meep_gpu/test_metal_folded_beta.py +1043 -0
  332. meep_gpu/test_metal_folded_complex.py +1353 -0
  333. meep_gpu/test_metal_folded_complex_fused_hd_pair.py +566 -0
  334. meep_gpu/test_metal_folded_complex_fused_magnetic_pair.py +590 -0
  335. meep_gpu/test_metal_folded_dispersive_update_e.py +139 -0
  336. meep_gpu/test_metal_folded_fused_hd_pair.py +953 -0
  337. meep_gpu/test_metal_folded_fused_magnetic_pair.py +507 -0
  338. meep_gpu/test_metal_folded_fused_pair.py +425 -0
  339. meep_gpu/test_metal_folded_offdiag.py +1194 -0
  340. meep_gpu/test_metal_folded_offdiag_dispersive_update_e.py +128 -0
  341. meep_gpu/test_metal_fused_ade_chain.py +420 -0
  342. meep_gpu/test_metal_fused_dispersive_pair.py +331 -0
  343. meep_gpu/test_metal_fused_electric_pair.py +447 -0
  344. meep_gpu/test_metal_fused_hd_pair.py +1546 -0
  345. meep_gpu/test_metal_fused_hd_pair_nonlinear.py +420 -0
  346. meep_gpu/test_metal_fused_magnetic_pair.py +365 -0
  347. meep_gpu/test_metal_fused_pair_deposit_wiring.py +1177 -0
  348. meep_gpu/test_metal_held_fallback.py +706 -0
  349. meep_gpu/test_metal_kernels.py +624 -0
  350. meep_gpu/test_metal_no_pml_conductive.py +219 -0
  351. meep_gpu/test_metal_no_pml_constitutive.py +1470 -0
  352. meep_gpu/test_metal_no_pml_curl.py +197 -0
  353. meep_gpu/test_metal_no_pml_fused_electric_pairs.py +535 -0
  354. meep_gpu/test_metal_no_pml_stored_e.py +174 -0
  355. meep_gpu/test_metal_nonlinear_update_e.py +820 -0
  356. meep_gpu/test_metal_offdiag.py +798 -0
  357. meep_gpu/test_metal_offdiag_stencil_welds.py +505 -0
  358. meep_gpu/test_metal_planner_composition.py +646 -0
  359. meep_gpu/test_metal_residency_barrier.py +246 -0
  360. meep_gpu/test_metal_residency_ownership.py +913 -0
  361. meep_gpu/test_metal_residue_fused_pairs.py +348 -0
  362. meep_gpu/test_metal_runs.py +294 -0
  363. meep_gpu/test_metal_special_kz.py +999 -0
  364. meep_gpu/test_metal_symmetry.py +1190 -0
  365. meep_gpu/test_metal_weld_contract.py +1013 -0
  366. meep_gpu/test_package_boundary.py +441 -0
  367. meep_gpu/test_prefer_gpu.py +799 -0
  368. meep_gpu/test_regate_writers.py +1078 -0
  369. meep_gpu/test_sigma_lookup.py +916 -0
  370. meep_gpu/test_sigma_recovery.py +689 -0
  371. meep_gpu/test_smoothing.py +2389 -0
  372. meep_gpu/test_sources.py +2493 -0
  373. meep_gpu/test_stepping.py +3420 -0
  374. meep_gpu/test_subnormal_policy.py +2184 -0
  375. meep_gpu/test_sync_pass_channel.py +578 -0
  376. meep_gpu/test_tensor_epsilon.py +562 -0
  377. meep_gpu/test_triton_beta_fused_electric_pair.py +669 -0
  378. meep_gpu/test_triton_beta_fused_magnetic_pair.py +363 -0
  379. meep_gpu/test_triton_bfast.py +1339 -0
  380. meep_gpu/test_triton_bfast_fused_electric_pair.py +657 -0
  381. meep_gpu/test_triton_bfast_fused_magnetic_pair.py +358 -0
  382. meep_gpu/test_triton_certified_fused_products.py +1409 -0
  383. meep_gpu/test_triton_complex_ade.py +291 -0
  384. meep_gpu/test_triton_complex_beta_fused_electric_pair.py +391 -0
  385. meep_gpu/test_triton_complex_beta_fused_magnetic_pair.py +407 -0
  386. meep_gpu/test_triton_complex_conductive_fused_pair.py +512 -0
  387. meep_gpu/test_triton_complex_fields.py +2900 -0
  388. meep_gpu/test_triton_complex_fused_ade_chain.py +700 -0
  389. meep_gpu/test_triton_complex_fused_electric_pair.py +856 -0
  390. meep_gpu/test_triton_complex_fused_hd_pair.py +747 -0
  391. meep_gpu/test_triton_complex_fused_magnetic_pair.py +857 -0
  392. meep_gpu/test_triton_complex_no_pml_conductive.py +301 -0
  393. meep_gpu/test_triton_complex_no_pml_curl.py +699 -0
  394. meep_gpu/test_triton_complex_no_pml_stored_e.py +394 -0
  395. meep_gpu/test_triton_complex_offdiag_update_e.py +306 -0
  396. meep_gpu/test_triton_conductive_fused_electric_pair.py +792 -0
  397. meep_gpu/test_triton_conductivity.py +628 -0
  398. meep_gpu/test_triton_cylindrical.py +669 -0
  399. meep_gpu/test_triton_cylindrical_complex.py +2523 -0
  400. meep_gpu/test_triton_cylindrical_composition.py +253 -0
  401. meep_gpu/test_triton_cylindrical_fused_electric_pair.py +695 -0
  402. meep_gpu/test_triton_cylindrical_fused_hd_pair.py +578 -0
  403. meep_gpu/test_triton_cylindrical_fused_magnetic_pair.py +440 -0
  404. meep_gpu/test_triton_cylindrical_real_fused_electric_pair.py +760 -0
  405. meep_gpu/test_triton_cylindrical_real_fused_hd_pair.py +675 -0
  406. meep_gpu/test_triton_cylindrical_real_fused_magnetic_pair.py +529 -0
  407. meep_gpu/test_triton_device_identity.py +142 -0
  408. meep_gpu/test_triton_dispersive_fused_pair.py +365 -0
  409. meep_gpu/test_triton_dispersive_update_e.py +682 -0
  410. meep_gpu/test_triton_folded_beta_complex_fused_magnetic_pair.py +698 -0
  411. meep_gpu/test_triton_folded_beta_complex_fused_pair.py +649 -0
  412. meep_gpu/test_triton_folded_beta_fused_electric_pair.py +617 -0
  413. meep_gpu/test_triton_folded_beta_fused_magnetic_pair.py +546 -0
  414. meep_gpu/test_triton_folded_complex.py +3538 -0
  415. meep_gpu/test_triton_folded_complex_fused_magnetic_pair.py +1377 -0
  416. meep_gpu/test_triton_folded_complex_fused_pair.py +1349 -0
  417. meep_gpu/test_triton_folded_complex_offdiag_admission.py +543 -0
  418. meep_gpu/test_triton_folded_dispersive_fused_pair.py +873 -0
  419. meep_gpu/test_triton_folded_dispersive_update_e.py +460 -0
  420. meep_gpu/test_triton_folded_fused_hd_pair.py +810 -0
  421. meep_gpu/test_triton_folded_fused_magnetic_pair.py +1088 -0
  422. meep_gpu/test_triton_folded_fused_pair.py +1129 -0
  423. meep_gpu/test_triton_folded_offdiag_dispersive_update_e.py +385 -0
  424. meep_gpu/test_triton_folded_offdiag_fused_ade_chain.py +987 -0
  425. meep_gpu/test_triton_folded_offdiag_fused_electric_pair.py +604 -0
  426. meep_gpu/test_triton_folded_offdiag_update_e.py +1217 -0
  427. meep_gpu/test_triton_fused_ade_chain.py +665 -0
  428. meep_gpu/test_triton_fused_ade_state.py +256 -0
  429. meep_gpu/test_triton_fused_dispersive_chain.py +489 -0
  430. meep_gpu/test_triton_fused_hd_pair.py +827 -0
  431. meep_gpu/test_triton_hd_tail_products.py +650 -0
  432. meep_gpu/test_triton_kernels.py +1580 -0
  433. meep_gpu/test_triton_no_pml.py +819 -0
  434. meep_gpu/test_triton_no_pml_ade.py +553 -0
  435. meep_gpu/test_triton_no_pml_conductive.py +686 -0
  436. meep_gpu/test_triton_no_pml_constitutive.py +2310 -0
  437. meep_gpu/test_triton_no_pml_fused_electric_pair.py +775 -0
  438. meep_gpu/test_triton_no_pml_stored_e.py +515 -0
  439. meep_gpu/test_triton_nonlinear_fused_magnetic_pair.py +292 -0
  440. meep_gpu/test_triton_nonlinear_update_e.py +1187 -0
  441. meep_gpu/test_triton_offdiag_fused_electric_pair.py +662 -0
  442. meep_gpu/test_triton_offdiag_update_e.py +1041 -0
  443. meep_gpu/test_triton_planner_composition.py +4064 -0
  444. meep_gpu/test_triton_residual_group_wiring.py +503 -0
  445. meep_gpu/test_triton_residual_probe_discipline.py +401 -0
  446. meep_gpu/test_triton_source_seams.py +261 -0
  447. meep_gpu/test_triton_special_kz.py +1142 -0
  448. meep_gpu/test_triton_symmetry.py +548 -0
  449. meep_gpu/test_triton_symmetry_composition.py +252 -0
  450. meep_gpu/test_triton_weld_contract.py +2365 -0
  451. meep_gpu/test_uncertified_opt_in.py +1032 -0
  452. meep_gpu/test_version.py +87 -0
  453. meep_gpu/test_weld_record_walk.py +504 -0
  454. meep_gpu/test_withdraw_hoist.py +600 -0
  455. meep_gpu/triton_kernels/__init__.py +959 -0
  456. meep_gpu/triton_kernels/beta_complex_fused_hd_pair.py +1376 -0
  457. meep_gpu/triton_kernels/beta_fused_electric_pair.py +755 -0
  458. meep_gpu/triton_kernels/beta_fused_magnetic_pair.py +648 -0
  459. meep_gpu/triton_kernels/beta_real_fused_hd_pair.py +1118 -0
  460. meep_gpu/triton_kernels/bfast_curl.py +1032 -0
  461. meep_gpu/triton_kernels/bfast_fused_electric_pair.py +782 -0
  462. meep_gpu/triton_kernels/bfast_fused_magnetic_pair.py +697 -0
  463. meep_gpu/triton_kernels/complex_ade.py +400 -0
  464. meep_gpu/triton_kernels/complex_beta_fused_electric_pair.py +880 -0
  465. meep_gpu/triton_kernels/complex_beta_fused_magnetic_pair.py +838 -0
  466. meep_gpu/triton_kernels/complex_conductive_fused_pair.py +892 -0
  467. meep_gpu/triton_kernels/complex_fields.py +2295 -0
  468. meep_gpu/triton_kernels/complex_fused_ade_chain.py +1118 -0
  469. meep_gpu/triton_kernels/complex_fused_electric_pair.py +1038 -0
  470. meep_gpu/triton_kernels/complex_fused_hd_pair.py +1558 -0
  471. meep_gpu/triton_kernels/complex_fused_magnetic_pair.py +867 -0
  472. meep_gpu/triton_kernels/complex_no_pml_conductive.py +497 -0
  473. meep_gpu/triton_kernels/complex_no_pml_curl.py +415 -0
  474. meep_gpu/triton_kernels/complex_no_pml_stored_e.py +432 -0
  475. meep_gpu/triton_kernels/complex_offdiag_update_e.py +639 -0
  476. meep_gpu/triton_kernels/conductive_bfast_fused_hd_pair.py +1255 -0
  477. meep_gpu/triton_kernels/conductive_fused_electric_pair.py +868 -0
  478. meep_gpu/triton_kernels/conductivity.py +810 -0
  479. meep_gpu/triton_kernels/coverage.py +761 -0
  480. meep_gpu/triton_kernels/cylindrical_complex.py +1718 -0
  481. meep_gpu/triton_kernels/cylindrical_fused_electric_pair.py +1284 -0
  482. meep_gpu/triton_kernels/cylindrical_fused_hd_pair.py +882 -0
  483. meep_gpu/triton_kernels/cylindrical_fused_magnetic_pair.py +1071 -0
  484. meep_gpu/triton_kernels/cylindrical_real_fused_electric_pair.py +750 -0
  485. meep_gpu/triton_kernels/cylindrical_real_fused_hd_pair.py +745 -0
  486. meep_gpu/triton_kernels/cylindrical_real_fused_magnetic_pair.py +744 -0
  487. meep_gpu/triton_kernels/cylindrical_triton.py +983 -0
  488. meep_gpu/triton_kernels/dispersive_fused_pair.py +451 -0
  489. meep_gpu/triton_kernels/dispersive_update_e.py +719 -0
  490. meep_gpu/triton_kernels/fingerprints.json +8359 -0
  491. meep_gpu/triton_kernels/folded_beta_complex_fused_magnetic_pair.py +1470 -0
  492. meep_gpu/triton_kernels/folded_beta_complex_fused_pair.py +1764 -0
  493. meep_gpu/triton_kernels/folded_beta_fused_electric_pair.py +1031 -0
  494. meep_gpu/triton_kernels/folded_beta_fused_magnetic_pair.py +919 -0
  495. meep_gpu/triton_kernels/folded_complex.py +3244 -0
  496. meep_gpu/triton_kernels/folded_complex_fused_hd_pair.py +1187 -0
  497. meep_gpu/triton_kernels/folded_complex_fused_magnetic_pair.py +1747 -0
  498. meep_gpu/triton_kernels/folded_complex_fused_pair.py +1905 -0
  499. meep_gpu/triton_kernels/folded_dispersive_fused_pair.py +1200 -0
  500. meep_gpu/triton_kernels/folded_dispersive_update_e.py +340 -0
  501. meep_gpu/triton_kernels/folded_fused_hd_pair.py +991 -0
  502. meep_gpu/triton_kernels/folded_fused_magnetic_pair.py +1171 -0
  503. meep_gpu/triton_kernels/folded_fused_pair.py +1408 -0
  504. meep_gpu/triton_kernels/folded_offdiag_dispersive_update_e.py +587 -0
  505. meep_gpu/triton_kernels/folded_offdiag_fused_ade_chain.py +1238 -0
  506. meep_gpu/triton_kernels/folded_offdiag_fused_electric_pair.py +1124 -0
  507. meep_gpu/triton_kernels/folded_offdiag_update_e.py +1396 -0
  508. meep_gpu/triton_kernels/fused_ade_chain.py +1299 -0
  509. meep_gpu/triton_kernels/fused_ade_state.py +315 -0
  510. meep_gpu/triton_kernels/fused_dispersive_chain.py +673 -0
  511. meep_gpu/triton_kernels/fused_hd_pair.py +1200 -0
  512. meep_gpu/triton_kernels/kernels.py +728 -0
  513. meep_gpu/triton_kernels/launch.py +4402 -0
  514. meep_gpu/triton_kernels/no_pml.py +819 -0
  515. meep_gpu/triton_kernels/no_pml_ade.py +413 -0
  516. meep_gpu/triton_kernels/no_pml_conductive.py +943 -0
  517. meep_gpu/triton_kernels/no_pml_constitutive.py +889 -0
  518. meep_gpu/triton_kernels/no_pml_fused_electric_pair.py +1043 -0
  519. meep_gpu/triton_kernels/no_pml_stored_e.py +759 -0
  520. meep_gpu/triton_kernels/nonlinear_fused_hd_pair.py +473 -0
  521. meep_gpu/triton_kernels/nonlinear_fused_magnetic_pair.py +392 -0
  522. meep_gpu/triton_kernels/nonlinear_update_e.py +1384 -0
  523. meep_gpu/triton_kernels/offdiag_fused_electric_pair.py +994 -0
  524. meep_gpu/triton_kernels/offdiag_scratch_weld.py +366 -0
  525. meep_gpu/triton_kernels/offdiag_update_e.py +958 -0
  526. meep_gpu/triton_kernels/special_kz.py +1637 -0
  527. meep_gpu/triton_kernels/symmetry.py +1190 -0
  528. meep_gpu/triton_kernels/timing_cc86.json +2375 -0
  529. meep_gpu/triton_kernels/timing_cc86.report.txt +93 -0
  530. meep_gpu/weld_record_walk.py +646 -0
  531. meep_gpu/withdraw_hoist.py +581 -0
  532. meep_gpu-0.9.2.dist-info/METADATA +652 -0
  533. meep_gpu-0.9.2.dist-info/RECORD +537 -0
  534. meep_gpu-0.9.2.dist-info/WHEEL +5 -0
  535. meep_gpu-0.9.2.dist-info/licenses/LICENSE +339 -0
  536. meep_gpu-0.9.2.dist-info/licenses/NOTICE +21 -0
  537. meep_gpu-0.9.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1013 @@
1
+ """Every Metal weld is bound to the bytes its gate executed.
2
+
3
+ The Triton counterpart is test_dispatch_contract.py's weld test. This is the same
4
+ guarantee for the Metal track, and it is ENUMERATED for the reason that one was
5
+ rewritten on 2026-08-19: it named three gates by hand, so six welds added the same
6
+ day recorded a source_sha256 that nothing recomputed. A hand-maintained list is a
7
+ second place to forget a weld; the record IS the list.
8
+
9
+ WHY THIS BECAME POSSIBLE. A weld needs two things from a gate - which bytes ran,
10
+ and whether it passed. Neither was mechanically available on this track until
11
+ 2026-08-19: the 30 gates now stamp imported_source_sha256 through gate_provenance,
12
+ and their verdicts are readable through read_verdict, which understands the ten
13
+ different spellings the fleet uses. The artifacts themselves share NO common
14
+ top-level key, so nothing gate-specific could ever have been required.
15
+
16
+ THE WALK, added 2026-08-30 (third round), and it is why this file grew. Until
17
+ today the enumerator here read `entry["source_sha256"]` for each top-level entry
18
+ and nothing else, so it compared 259 of the record's 694 digests and reported that
19
+ as "every Metal weld is bound to the live sources". The 435 it did not look at:
20
+
21
+ 259 code_sha256 compared by NOTHING at the merge bar. The code tier is the
22
+ one that licenses a comment-only edit to stand, so leaving
23
+ it unchecked is exactly how a stale record keeps looking
24
+ current - the raw pin goes red, the code pin is read as the
25
+ reason that is fine, and nothing ever established that the
26
+ code pin still describes anything.
27
+ 56 host_sha256 recomputed by test_metal_kernels.py - excluded, and the
28
+ 36 kernel slots exclusion now says WHERE instead of being a missing key.
29
+ 44 artifact digests of gitignored run artifacts.
30
+ 40 device_sha256 the shader source strings that actually reached the Metal
31
+ compiler, read by no laptop test at all.
32
+
33
+ meep_gpu.weld_record_walk now recurses the whole record - dicts and lists, at any
34
+ depth - and every 64-hex digest it finds is either CHECKED against this tree in a
35
+ named tier or EXCLUDED BY A NAMED RULE carrying its reason. A digest matching
36
+ neither is UNCLASSIFIED, which fails.
37
+
38
+ THE FOURTH ROUND, 2026-08-30, took the two "excluded, and the exclusion says
39
+ WHERE" lines above at their word and checked them. An exclusion is a DECISION NOT
40
+ TO COMPARE and rests on a reason; a reason that points at another test is a
41
+ CITATION, and until this round nothing established that the cited test made the
42
+ claim the citation advertised. It did not, on the other track: Triton's
43
+ `host_sha256` deferred to a test that recomputes each digest and then calls
44
+ `device_identity.weld_survives_edit` on a mismatch - the allowance both weld
45
+ contracts refuse by name. So:
46
+
47
+ * the 56 `host_sha256` digests are CHECKED HERE now, raw, with no allowance;
48
+ the citation is deleted rather than watched, because a reference that cannot
49
+ go stale beats one that has to be. Measured after promotion: 56 of 56 match.
50
+ `metal_kernels` therefore leaves NOT_A_GATE_RECORD and enters
51
+ NOT_A_DEVICE_GATE - it owns checked digests, and it has no gate script.
52
+ * the 36 generated kernel-source slots stay excluded, because nothing in this
53
+ checkout is their subject - and their citation is now ASSERTED rather than
54
+ trusted: test_the_generated_slot_delegation_is_real_and_admits_no_allowance
55
+ requires the delegate to exist, to compare the whole dict, and to admit no
56
+ allowance call.
57
+
58
+ Measured 2026-08-30, fourth round:
59
+
60
+ discovered 694 checked 614 excluded 80 unclassified 0 drifted 0
61
+
62
+ and the DISCOVERED count is asserted too, so a digest that stops being found fails
63
+ here rather than shrinking every count derived from it.
64
+
65
+ Stdlib, pytest, and two in-package identity helpers. No device.
66
+ """
67
+
68
+ from __future__ import annotations
69
+
70
+ import ast
71
+ import hashlib
72
+ import json
73
+ import pathlib
74
+
75
+ import pytest
76
+
77
+ from . import fastpath, metal_runs
78
+ from . import weld_record_walk as walk
79
+ from .code_identity import code_digest
80
+ from .device_identity import device_digests
81
+
82
+ PACKAGE = pathlib.Path(__file__).resolve().parent
83
+ RECORD = PACKAGE / "metal_kernels" / "fingerprints.json"
84
+ REPO = PACKAGE.parent
85
+
86
+
87
+ #: Entries that own NO checked digest, excluded BY NAME with the reason. There is
88
+ #: no predicate that quietly drops an entry - see the rule below.
89
+ #: EMPTY FROM 2026-08-30 (fourth round) until the per-architecture migration, and
90
+ #: kept rather than deleted. Its one member then, `metal_kernels`, moved to
91
+ #: NOT_A_DEVICE_GATE when its 56 host digests stopped being deferred and became
92
+ #: checked here. The dict stayed because the RULE stays - an entry that pins
93
+ #: nothing must be named here with a reason, never dropped by a predicate - and
94
+ #: `test_every_record_entry_is_checked_or_excluded_by_name` fails on the first
95
+ #: entry that tries. The migration note is the first block since that is no gate
96
+ #: record.
97
+ NOT_A_GATE_RECORD = {
98
+ # ARRIVED with the per-architecture run records, the first member since the
99
+ # list emptied. A BLOCK, so the rule above applies to it by name.
100
+ "_architecture_runs_migration":
101
+ "the migration's own stamp: which tool moved each weld's run fields under "
102
+ "`runs[<GPU architecture>]`, when, where each entry's architecture was read "
103
+ "from (its own host line), how many entries it touched and the environment "
104
+ "certified before. It records a COUNT and names, and no digest, so there is "
105
+ "nothing here to compare against the tree; "
106
+ "test_the_migration_note_states_no_digest asserts that absence",
107
+ }
108
+
109
+ #: Entries that own checked digests but are NOT device gate records, so the
110
+ #: gate-script requirement below does not apply to them. Named, with the reason,
111
+ #: for the same argument as everything else here: a predicate that decided this
112
+ #: by shape would be the next filter.
113
+ #:
114
+ #: `metal_kernels` moved OUT of NOT_A_GATE_RECORD on 2026-08-30 and into this
115
+ #: list, because its 56 `host_sha256` digests are now CHECKED here rather than
116
+ #: deferred. The old exclusion read "they ARE recomputed against the tree, by
117
+ #: test_metal_kernels.py - checking them twice is two places to disagree". That
118
+ #: argument holds only where the two places make the SAME claim, and on the
119
+ #: Triton side the corresponding delegate recomputes THROUGH
120
+ #: device_identity.weld_survives_edit - an allowance this contract refuses by
121
+ #: name. Rather than verify a citation per track, the citation is gone: the raw
122
+ #: bytes are compared in the record that makes the claim.
123
+ NOT_A_DEVICE_GATE = {
124
+ "metal_kernels":
125
+ "the package-level block (host_sha256, kernel_source_sha256, validated "
126
+ "frontend/torch versions). It pins the shipped host side, which is why "
127
+ "its digests are checked; it is not a device run, so it has no gate "
128
+ "script to pin and requiring one would be a red for a shape that has "
129
+ "none",
130
+ }
131
+
132
+ #: Measured 2026-08-30. THE DENOMINATOR IS PART OF THE CHECK: these fail when
133
+ #: coverage SHRINKS, so an entry cannot leave the strict comparison by dropping a
134
+ #: key. That is exactly how the Triton track lost ten entries and 88 pinned pairs
135
+ #: - 31 of them live drifts - to a `status == "PASS"` filter for eleven days.
136
+ #: 44 device gate records + the `metal_kernels` package block, which entered the
137
+ #: checked set on 2026-08-30 when its 56 host digests stopped being delegated.
138
+ ENTRY_FLOOR = 45
139
+ PIN_FLOOR = 315
140
+
141
+ #: THE TOTAL, and the tier floors under it. DISCOVERED is the one the other
142
+ #: floors cannot substitute for: a digest that stops being FOUND also stops being
143
+ #: counted by every floor derived from the walk, so only the total can report it.
144
+ #: Measured 2026-08-30 (third round) by recursing the record.
145
+ DISCOVERED_FLOOR = 694
146
+ CHECKED_FLOOR = 614 # 558 + the 56 host digests, promoted 2026-08-30
147
+ RAW_TIER_FLOOR = 315 # 259 source-map + 56 host-side
148
+ CODE_TIER_FLOOR = 259
149
+ DEVICE_TIER_FLOOR = 40
150
+
151
+ #: Which rules the walk fires on THIS record, and how many times at the floor.
152
+ #: BOTH DIRECTIONS: a rule that stops firing means its shape has left the record
153
+ #: (and an unexercised rule is where the next omission hides); a rule that starts
154
+ #: firing means a shape arrived that nobody wrote down.
155
+ EXPECTED_RULES = {
156
+ walk.TIER_CODE + ":code_digest_map": 259,
157
+ walk.TIER_RAW + ":source_digest_map": 259,
158
+ walk.TIER_RAW + ":host_side_digest_map": 56,
159
+ "artifact_or_log_digest": 44,
160
+ walk.TIER_DEVICE + ":device_kernel_digest": 40,
161
+ "generated_kernel_source_slot": 36,
162
+ # ARRIVED 2026-09-12, on the FIRST recut this record has ever had. The recut
163
+ # writes `driver_dispatch._source_sha256_recut_log`, a from/to pair per file
164
+ # whose digest moved, and the walk already had a rule and a written reason for
165
+ # the shape (weld_record_walk.RULE_REASONS["historical_recut_log"]): half of
166
+ # every pair is stale by construction, because a log that had to match the tree
167
+ # could not record a change. So it is EXCLUDED from the checked set, not pinned.
168
+ #
169
+ # THE FLOOR IS 2 AND NOT TODAY'S 4, which is the one judgement here. Every other
170
+ # floor in this dict counts COVERAGE, and shrinking coverage is the failure they
171
+ # exist to catch. This one counts how many files the LAST recut happened to move
172
+ # — today two, hence four digests — which is not a coverage property at all. A
173
+ # future recut that moves one file writes a well-formed log of 2 and must not
174
+ # fail. 2 is the smallest well-formed log: one file, its from and its to. Zero
175
+ # would be wrong too, since the `missing` check above already requires the rule
176
+ # to fire at all, and a recut that moved nothing should not have been cut.
177
+ "historical_recut_log": 2,
178
+ # ARRIVED with the per-architecture run records: one `bound_sha256` per run,
179
+ # the digest of the digests that run certified (weld_record_walk.RULE_REASONS
180
+ # ["run_bound_digest"]). Excluded from the byte tiers because it names no file;
181
+ # what it decides -- whether the run is LIVE -- is asserted by
182
+ # test_every_metal_weld_has_a_live_run_in_the_per_architecture_shape. 62: one
183
+ # run per weld entry after the migration. A second architecture adds 62 more.
184
+ "run_bound_digest": 62,
185
+ }
186
+
187
+
188
+ def _record():
189
+ return json.loads(RECORD.read_text(encoding="utf-8"))
190
+
191
+
192
+ def _census(record=None):
193
+ """EVERY digest in the record, classified. The denominator, structurally derived.
194
+
195
+ THE ONE ENUMERATOR. Nothing in this file walks a shape any more - no
196
+ `record.items()` loop that assumes a top level, no `entry["source_sha256"]`
197
+ that assumes a key. What the record holds is what gets classified, and a
198
+ digest the classifier has no rule for is UNCLASSIFIED: a failure, not silence.
199
+ """
200
+ return walk.census(_record() if record is None else record)
201
+
202
+
203
+ def _checked(found):
204
+ return [f for f in found if f.tier is not None]
205
+
206
+
207
+ def _of_tier(found, tier):
208
+ return [f for f in found if f.tier == tier]
209
+
210
+
211
+ def _resolve(name, root=REPO):
212
+ """A pinned path, under both spellings this record uses.
213
+
214
+ ELEVEN OF THE DEVICE PINS ARE ABSOLUTE - `<repo>/meep_gpu/
215
+ metal_kernels/shaders.py` and friends, written by whichever machine minted the
216
+ weld. That is a portability defect in the record (a clean checkout elsewhere
217
+ would report eleven MISSING lines, a red for the wrong reason), and it is
218
+ cleared by rebinding those blocks repo-relative with mint_metal_weld.py. Until
219
+ then an absolute path that lies INSIDE this repo is rewritten to its
220
+ repo-relative form - the same file under another name, never a different one -
221
+ and one that does not is left alone so it reports MISSING rather than
222
+ resolving to something on whichever machine happens to run this.
223
+
224
+ A BARE BASENAME means this record's own directory, then the package root.
225
+ The `host_sha256` map keys its 56 entries that way (`launch.py`,
226
+ `shaders.py`), which is why promoting that map from excluded to CHECKED needs
227
+ this branch and not a special case: `root / "launch.py"` is `<repo>/
228
+ launch.py` and does not exist, so all 56 would have reported MISSING FROM THE
229
+ TREE - a red for the wrong reason, and indistinguishable from a red for the
230
+ right one. The FIRST EXISTING candidate wins and no digest is consulted, so
231
+ resolution cannot be steered toward whatever would make a comparison pass.
232
+ """
233
+ if name.startswith("/"):
234
+ absolute = pathlib.Path(name)
235
+ try:
236
+ return root / absolute.relative_to(REPO)
237
+ except ValueError:
238
+ return absolute
239
+ if "/" not in name:
240
+ for base in ("meep_gpu/metal_kernels", "meep_gpu"):
241
+ candidate = root / base / name
242
+ if candidate.is_file():
243
+ return candidate
244
+ return root / "meep_gpu" / "metal_kernels" / name
245
+ return root / name
246
+
247
+
248
+ def _raw_digest(path):
249
+ return hashlib.sha256(path.read_bytes()).hexdigest()
250
+
251
+
252
+ def _code_digest_of(path):
253
+ """``None`` for a file with no code identity, which walk.compare REPORTS.
254
+
255
+ `code_digest` parses Python and nothing else, so a `code_sha256` recorded for
256
+ a `.metal` shader or a JSON is a digest nothing can recompute. Returning None
257
+ rather than falling back to a byte hash keeps that a report instead of a
258
+ silently-passing comparison - the difference between a rule and a hole.
259
+ """
260
+ if path.suffix != ".py":
261
+ return None
262
+ return code_digest(path.read_text(encoding="utf-8"))
263
+
264
+
265
+ def _device_digests_of(path):
266
+ try:
267
+ _, digests = device_digests(path)
268
+ except (SyntaxError, OSError, ValueError):
269
+ return None
270
+ return digests
271
+
272
+
273
+ def _drifted(found, root=REPO):
274
+ """Every CHECKED digest the tree does not support, ACROSS ALL THREE TIERS.
275
+
276
+ THE RULE IS THE RAW BYTES in the raw tier, WITH NO ALLOWANCE, and there is
277
+ deliberately no fall-through to a laxer digest. A weld says "this gate ran
278
+ THESE bytes on a device"; anything that decides an edit is harmless is a
279
+ judgement made on the host about a claim only the device can settle, and a
280
+ general allowance can license the very edit it is asked to judge - including
281
+ an edit to the module that implements the allowance. The code tier is NOT such
282
+ a fall-through: it is compared to the live file's own code identity, never
283
+ consulted to excuse a raw mismatch. If a specific entry ever needs an
284
+ exception, name that entry here and say why; a drifted weld is otherwise fixed
285
+ by re-running its gate, never by relaxing this comparison or typing a digest
286
+ in.
287
+
288
+ Factored out because an assertion nobody has watched FAIL is a measurement
289
+ that cannot fail: `test_the_drift_check_refuses_a_planted_digest` drives this
290
+ same function with a deliberately wrong digest in each tier.
291
+ """
292
+ return walk.compare(
293
+ found,
294
+ resolve=lambda name: _resolve(name, root),
295
+ raw_digest=_raw_digest,
296
+ code_digest_of=_code_digest_of,
297
+ device_digests_of=_device_digests_of,
298
+ rebind_tool="parity/meep_gpu/rebind_metal_welds.py",
299
+ )
300
+
301
+
302
+ def _measured_drift(name, entry, root=REPO):
303
+ """The set of paths this entry pins in the RAW tier that no longer match the tree.
304
+
305
+ Derived from the census over ``{name: entry}`` rather than from
306
+ ``entry["source_sha256"]``, so a raw pin the entry grows in some other shape is
307
+ measured here too. The same measurement, under the same name, as the CUDA
308
+ contract's, so the route-record rule below reads drift the same way in all three.
309
+ """
310
+ raw = _of_tier(_census({name: entry}), walk.TIER_RAW)
311
+ return {subject for _, subject, _ in _drifted(raw, root=root)}
312
+
313
+
314
+ def _pinned(record=None):
315
+ """Every top-level entry owning at least one CHECKED digest.
316
+
317
+ AN ENTRY IS CHECKED IF IT PINS A FILE DIGEST - anywhere in it, in any tier.
318
+ Not whether it passed, not whether it carries a `status` key, and no longer
319
+ whether that digest happens to sit under a top-level `source_sha256`. A
320
+ recorded digest is a claim about this tree and can be checked against this
321
+ tree whatever the run concluded; a filter on a field a gate record need not
322
+ carry is a hand-maintained list wearing an enumeration's clothes.
323
+ """
324
+ record = _record() if record is None else record
325
+ owners = {f.trail[0] for f in _checked(_census(record))}
326
+ return {name: entry for name, entry in record.items()
327
+ if name in owners and isinstance(entry, dict)}
328
+
329
+
330
+ def _welds():
331
+ """The PASS subset - the METADATA tier. The byte tier is :func:`_pinned`."""
332
+ record = _record()
333
+ return {name: entry for name, entry in record.items()
334
+ if isinstance(entry, dict) and entry.get("status") == "PASS"
335
+ and entry.get("source_sha256")}
336
+
337
+
338
+ # ---------------------------------------------------------------------------
339
+ # THE DENOMINATOR
340
+ # ---------------------------------------------------------------------------
341
+
342
+
343
+ def test_every_discovered_digest_is_checked_or_excluded_by_a_named_rule():
344
+ """THE WALK. Every digest in the record, wherever it lives, has a fate.
345
+
346
+ THE TEST THAT REMOVES THE CLASS. The round before it removed a status filter
347
+ and left a shape filter: an enumerator that knew about top-level entries and
348
+ one key. Here the record is RECURSED - dicts and lists, at any depth - and
349
+ each digest is either CHECKED in a named tier or EXCLUDED BY A NAMED RULE
350
+ carrying its reason. There is no third outcome.
351
+
352
+ THE TOTAL IS ASSERTED, not only the checked count: a digest that stops being
353
+ DISCOVERED is the failure no count of what is checked can see.
354
+ """
355
+ found = _census()
356
+ assert len(found) >= DISCOVERED_FLOOR, (
357
+ f"the walk discovered {len(found)} digests, was {DISCOVERED_FLOOR} - "
358
+ f"digests have stopped being FOUND, which is a shrunken denominator that "
359
+ f"no count of what is CHECKED can report")
360
+ unclassified = [walk.dotted(f.trail) for f in found
361
+ if f.rule == walk.UNCLASSIFIED]
362
+ assert not unclassified, (
363
+ f"{len(unclassified)} digest(s) matched no rule: {unclassified[:12]} - "
364
+ f"write a rule in meep_gpu/weld_record_walk.py, in this change: check it, "
365
+ f"or exclude it by name with the reason")
366
+ checked = _checked(found)
367
+ assert len(checked) >= CHECKED_FLOOR, (
368
+ f"only {len(checked)} of {len(found)} discovered digests are checked, was "
369
+ f"{CHECKED_FLOOR} - digests moved from checked to excluded, which is a "
370
+ f"decision that has to be argued, not a count that may drift")
371
+ fired = walk.rules_that_fired(found)
372
+ reasonless = sorted(set(fired) - set(walk.RULE_REASONS))
373
+ assert not reasonless, f"rules fired with no written reason: {reasonless}"
374
+ missing = sorted(set(EXPECTED_RULES) - set(fired))
375
+ assert not missing, (
376
+ f"declared rules that no longer fire on this record: {missing} - the "
377
+ f"shape each was written for has left, and a rule nothing exercises is "
378
+ f"where the next real omission hides")
379
+ surprise = sorted(set(fired) - set(EXPECTED_RULES) - {walk.UNCLASSIFIED})
380
+ assert not surprise, (
381
+ f"rules fired that this record never declared: {surprise} - a new shape "
382
+ f"arrived; declare it in EXPECTED_RULES with its count")
383
+ shrunk = {name: (fired[name], floor) for name, floor in EXPECTED_RULES.items()
384
+ if fired[name] < floor}
385
+ assert not shrunk, (
386
+ f"rules whose digest count SHRANK (got, was): {shrunk} - coverage does "
387
+ f"not fall silently")
388
+
389
+
390
+ def test_every_record_entry_is_checked_or_excluded_by_name():
391
+ """Nothing leaves coverage by omitting a field, in either direction."""
392
+ record = _record()
393
+ dict_entries = {name for name, entry in record.items() if isinstance(entry, dict)}
394
+ checked = set(_pinned(record))
395
+ unaccounted = sorted(dict_entries - checked - set(NOT_A_GATE_RECORD))
396
+ assert not unaccounted, (
397
+ f"{len(unaccounted)} record entries are neither checked nor excluded by "
398
+ f"name: {unaccounted} - pin the bytes the gate executed, or name each "
399
+ f"here with the reason it is not a gate record")
400
+ stale = sorted(set(NOT_A_GATE_RECORD) - dict_entries)
401
+ assert not stale, f"the exclusion list names entries the record lacks: {stale}"
402
+ assert not sorted(checked & set(NOT_A_GATE_RECORD)), (
403
+ "an entry that pins bytes is checked; delete the exclusion, not the coverage")
404
+ # THE SECOND EXCLUSION LIST, held to the same rule, in both directions. An
405
+ # entry named here must EXIST and must be CHECKED - a name that has stopped
406
+ # matching an entry, or that quietly moved out of the checked set, is a place
407
+ # the next omission hides.
408
+ absent = sorted(set(NOT_A_DEVICE_GATE) - dict_entries)
409
+ assert not absent, f"NOT_A_DEVICE_GATE names entries the record lacks: {absent}"
410
+ unchecked = sorted(set(NOT_A_DEVICE_GATE) - checked)
411
+ assert not unchecked, (
412
+ f"{unchecked} is excused the gate-script requirement while owning no "
413
+ f"checked digest - that is two exemptions, not one; name it in "
414
+ f"NOT_A_GATE_RECORD or pin its bytes")
415
+
416
+
417
+ def test_no_exclusion_on_this_record_rests_on_an_unevaluated_premise(tmp_path):
418
+ """AN EXCLUSION IS ONLY AS GOOD AS ITS PREMISE - the fifth sub-form.
419
+
420
+ BOTH DIRECTIONS, and on this record the first is a NEGATIVE result worth
421
+ asserting: no digest here is excluded on a claim about the checkout, so the
422
+ premise checker has nothing to report. A negative that is not also ARMED is
423
+ indistinguishable from a checker that never ran, which is the failure mode
424
+ this whole file exists to remove - so the same function is driven against a
425
+ planted census in which the premise IS violated, and must report it.
426
+ """
427
+ found = _census()
428
+ premised = [f for f in found if f.rule in walk.PREMISE_ABSENT_FROM_TREE]
429
+ assert premised == [], (
430
+ f"{len(premised)} digests now rest on a not-in-this-checkout premise on "
431
+ f"the Metal record; assert it the way the Triton contract does")
432
+
433
+ planted = walk.census(
434
+ {"g": {"staging": {"staging_only_file":
435
+ {"path": "meep_gpu/metal_kernels/launch.py",
436
+ "sha256": "a" * 64}}}})
437
+ armed = walk.premise_violations(
438
+ planted,
439
+ is_file=lambda name: _resolve(name).is_file(),
440
+ inside_repo=lambda name: True,
441
+ )
442
+ assert len(armed) == 1 and "IS in this checkout" in armed[0][2], armed
443
+
444
+
445
+ def test_the_generated_slot_delegation_is_real_and_admits_no_allowance():
446
+ """THE ONE EXCLUSION HERE THAT STILL CITES ANOTHER TEST, and it is asserted.
447
+
448
+ 36 `kernel_source_sha256` slots are digests of GENERATED shader source
449
+ strings keyed by slot name. Nothing in this checkout is their subject, so
450
+ there is no raw comparison to promote them to - which is exactly the argument
451
+ `host_sha256` could NOT make, and why that map is now checked here instead.
452
+
453
+ A citation is not a comparison. This one is therefore checked as a citation:
454
+ the delegate module exists, the named test is in it, and the comparison it
455
+ makes is a WHOLE-DICT equality with no allowance call. That last clause is the
456
+ one that matters, because the Triton delegate `host_sha256` used to defer to
457
+ recomputes each digest and then calls `device_identity.weld_survives_edit` on
458
+ a mismatch - a strictly weaker claim than the exclusion advertised, and
459
+ invisible from the citation alone.
460
+ """
461
+ # ONE delegating exclusion on this record, and it is this one. A second would
462
+ # be a second unasserted citation, which is the shape the whole test is about.
463
+ # Read from the walker's DELEGATED_COVERAGE register rather than sniffed out
464
+ # of reason text: several reasons cross-reference a test that EARNS an
465
+ # exclusion, and that is a different claim from "compared over there".
466
+ delegating = sorted({f.rule for f in _census()
467
+ if f.tier is None and f.rule in walk.DELEGATED_COVERAGE})
468
+ assert delegating == ["generated_kernel_source_slot"], (
469
+ f"exclusions delegating their comparison: {delegating} - each one needs "
470
+ f"its citation asserted here, or its digests checked")
471
+
472
+ # THE CITATION IS READ FROM THE REGISTER, not restated here, so the delegate
473
+ # this test drives is by construction the one the exclusion names.
474
+ filename, function = walk.DELEGATED_COVERAGE[
475
+ "generated_kernel_source_slot"].split("::")
476
+ delegate = PACKAGE / filename
477
+ assert delegate.is_file(), f"the cited delegate is not in the tree: {delegate}"
478
+ tree = ast.parse(delegate.read_text(encoding="utf-8"))
479
+ named = [node for node in ast.walk(tree)
480
+ if isinstance(node, ast.FunctionDef) and node.name == function]
481
+ assert len(named) == 1, (
482
+ f"{filename} no longer defines {function}, which 36 excluded digests are "
483
+ f"cited to - check them here, or fix the citation")
484
+ body = ast.dump(named[0])
485
+ assert "'kernel_source_sha256'" in body, (
486
+ "the cited test no longer compares kernel_source_sha256 - the 36 slots "
487
+ "it is credited with covering are covered by nothing")
488
+ allowances = sorted({node.func.id for node in ast.walk(named[0])
489
+ if isinstance(node, ast.Call)
490
+ and isinstance(node.func, ast.Name)
491
+ and node.func.id in ("weld_survives_edit", "code_digest")})
492
+ assert not allowances, (
493
+ f"the cited test now admits {allowances} - it makes a weaker claim than "
494
+ f"this exclusion states, which is precisely how host_sha256 went "
495
+ f"unchecked for eleven days. Check the slots here, or restate the "
496
+ f"exclusion as the weaker claim it actually rests on")
497
+
498
+
499
+ # ---------------------------------------------------------------------------
500
+ # THE THREE TIERS
501
+ # ---------------------------------------------------------------------------
502
+
503
+
504
+ def test_every_metal_weld_pins_the_script_that_gated_it():
505
+ """44 of 44 today. The sources say which implementation ran; the gate script
506
+ says what was asked of it, and a gate that changes underneath an unpinned weld
507
+ rewrites the result while every source digest still verifies."""
508
+ naked = sorted(name for name, entry in _pinned().items()
509
+ if name not in NOT_A_DEVICE_GATE
510
+ and not any(p.startswith("parity/")
511
+ for p in (entry.get("source_sha256") or {})))
512
+ assert not naked, (
513
+ f"{len(naked)} Metal welds pin no gate or probe script under "
514
+ f"parity/meep_gpu/: {naked}")
515
+
516
+
517
+ def test_the_metal_welds_are_bound_to_the_live_sources():
518
+ welded = _pinned()
519
+ raw = _of_tier(_census(), walk.TIER_RAW)
520
+ assert len(welded) >= ENTRY_FLOOR, (
521
+ f"only {len(welded)} Metal entries own a checked digest, was {ENTRY_FLOOR} "
522
+ f"- coverage SHRANK; an entry does not leave this check by losing a key")
523
+ assert len(raw) >= PIN_FLOOR, (
524
+ f"only {len(raw)} raw-tier digests to compare across {len(welded)} "
525
+ f"entries, was {PIN_FLOOR} - the shape changed and this test is inert")
526
+ drift = _drifted(raw)
527
+ assert not drift, (
528
+ f"{len(drift)} of {len(raw)} pinned path(s) drifted from the bytes the "
529
+ f"gate executed - re-run the gate, do not edit this record: "
530
+ + "; ".join(f"{where} -> {name} ({why})" for where, name, why in drift[:12]))
531
+
532
+
533
+ def test_the_metal_code_tier_recomputes_against_the_tree():
534
+ """259 ``code_sha256`` pins, read by NOTHING at the merge bar until today.
535
+
536
+ WHY THIS TIER IS THE DANGEROUS ONE TO LEAVE UNCHECKED. `code_sha256` is the
537
+ digest that licenses a weld to stand after a comment-only edit - the one field
538
+ whose whole job is to say "the raw bytes moved and it did not matter". An
539
+ unchecked field with that job is how a stale record keeps looking current.
540
+
541
+ THE RULE, and it is a rule rather than a skip: a `code_sha256` is compared to
542
+ `code_identity.code_digest` OF THE LIVE FILE, never to the file's source
543
+ digest. The two tiers MAY legitimately disagree, and exactly one thing makes
544
+ that so - a comment or docstring edit since the gate ran, which is the entire
545
+ clause code_identity licenses. Every other disagreement is a defect: a code
546
+ digest that no longer recomputes describes neither the bytes that ran nor the
547
+ bytes on disk.
548
+
549
+ Measured 2026-08-30: 259 of 259 recompute.
550
+ """
551
+ code = _of_tier(_census(), walk.TIER_CODE)
552
+ assert len(code) >= CODE_TIER_FLOOR, (
553
+ f"only {len(code)} code_sha256 pins found, was {CODE_TIER_FLOOR} - the "
554
+ f"tier left the comparison, which is how it went unread")
555
+ drift = _drifted(code)
556
+ assert not drift, (
557
+ f"{len(drift)} of {len(code)} code digest(s) no longer recompute against "
558
+ f"the tree - the recorded code identity describes neither the bytes the "
559
+ f"gate ran nor the bytes on disk. Re-run the gate and rebind; do not "
560
+ f"hand-edit the digest: "
561
+ + "; ".join(f"{where} -> {name} ({why})" for where, name, why in drift[:12]))
562
+
563
+
564
+ def test_no_entry_backfills_a_code_digest_beside_a_stale_source_digest():
565
+ """THE CLAUSE `code_identity` WITHHOLDS, enforced on this record too.
566
+
567
+ `code_identity.py` states the rule in its own docstring and it is a rule about
568
+ every track: "Backfilling `code_sha256` is only honest for a weld whose
569
+ `source_sha256` still matches, because only then is the file on disk the bytes
570
+ the gate actually ran." A code digest recomputed today and written beside a
571
+ source digest that has ALREADY moved describes the current tree, not the gate,
572
+ and MANUFACTURES the licence the clause withholds - the next reader finds a
573
+ green code pin beside a red source pin and reads the green one as the reason
574
+ the red one is fine.
575
+
576
+ Until 2026-08-30 (fourth round) only the CUDA contract enforced this, over its
577
+ 39 pins. A rule universal in its statement and partial in its coverage is the
578
+ same shape as every other defect removed here, so it is brought across: 259
579
+ pins here, 183 on the Triton side.
580
+
581
+ MEASURED: 0 offenders, and 0 source pins drifted - so the green says nothing
582
+ on its own, which is what the planted control is for.
583
+ """
584
+ found = _census()
585
+ source = [f for f in found if f.rule == walk.TIER_RAW + ":source_digest_map"]
586
+ code = _of_tier(found, walk.TIER_CODE)
587
+ assert len(source) >= 259 and len(code) >= CODE_TIER_FLOOR, (len(source), len(code))
588
+ moved_names = {where for where, _, _ in _drifted(source)}
589
+ moved = {(f.trail[0], f.subject) for f in source
590
+ if walk.dotted(f.trail) in moved_names}
591
+ offenders = sorted(walk.dotted(f.trail) for f in code
592
+ if (f.trail[0], f.subject) in moved)
593
+ assert not offenders, (
594
+ f"{len(offenders)} code digest(s) sit beside a STALE source digest: "
595
+ f"{offenders[:8]} - that manufactures the licence code_identity "
596
+ f"withholds. Re-run the gate; do not backfill the code digest")
597
+
598
+ # ARMED, in both directions, with a CURRENT code digest so the leg being
599
+ # exercised is the pairing rule and not the code tier.
600
+ victim = "meep_gpu/metal_kernels/launch.py"
601
+ live_code = code_digest(_resolve(victim).read_text(encoding="utf-8"))
602
+ plant = {"w": {"source_sha256": {victim: "a" * 64},
603
+ "code_sha256": {victim: live_code}}}
604
+ planted = _census(plant)
605
+ assert _drifted(_of_tier(planted, walk.TIER_CODE)) == []
606
+ stale_names = {where for where, _, _ in _drifted(
607
+ [f for f in planted if f.rule == walk.TIER_RAW + ":source_digest_map"])}
608
+ stale = {(f.trail[0], f.subject) for f in planted
609
+ if f.rule == walk.TIER_RAW + ":source_digest_map"
610
+ and walk.dotted(f.trail) in stale_names}
611
+ caught = sorted(walk.dotted(f.trail) for f in planted
612
+ if f.tier == walk.TIER_CODE and (f.trail[0], f.subject) in stale)
613
+ assert caught == [f"w.code_sha256.{victim}"], caught
614
+
615
+ plant["w"]["source_sha256"][victim] = _raw_digest(_resolve(victim))
616
+ honest = _census(plant)
617
+ assert not {where for where, _, _ in _drifted(
618
+ [f for f in honest if f.rule == walk.TIER_RAW + ":source_digest_map"])}
619
+
620
+
621
+ def test_the_metal_device_tier_recomputes_against_the_tree():
622
+ """40 ``device_sha256`` shader digests, likewise read by no laptop test.
623
+
624
+ This is the identity that actually reached the Metal compiler:
625
+ `device_identity.device_digests` parses the module and hashes the shader
626
+ source string it emits. A module can be edited so its FILE moves while every
627
+ shader it emits is unchanged, and so a shader changes while the file's code
628
+ identity barely does - which is why this tier is neither of the other two.
629
+
630
+ A declared shader the module no longer generates is REPORTED, not skipped: a
631
+ digest naming a shader that has left the file is a claim about nothing.
632
+ """
633
+ device = _of_tier(_census(), walk.TIER_DEVICE)
634
+ assert len(device) >= DEVICE_TIER_FLOOR, (
635
+ f"only {len(device)} device_sha256 shader digests found, was "
636
+ f"{DEVICE_TIER_FLOOR} - the tier left the comparison")
637
+ drift = _drifted(device)
638
+ assert not drift, (
639
+ f"{len(drift)} of {len(device)} device shader digest(s) no longer "
640
+ f"recompute - re-run the gate and rebind: "
641
+ + "; ".join(f"{where} -> {name} ({why})" for where, name, why in drift[:12]))
642
+
643
+
644
+ # ---------------------------------------------------------------------------
645
+ # THE ARMED CONTROLS
646
+ # ---------------------------------------------------------------------------
647
+
648
+
649
+ def _plant(root, rel, text):
650
+ path = root / rel
651
+ path.parent.mkdir(parents=True, exist_ok=True)
652
+ path.write_text(text, encoding="utf-8")
653
+ return root
654
+
655
+
656
+ def test_the_drift_check_refuses_a_planted_digest(tmp_path):
657
+ """THE ARMED CONTROL. This record is green in all three tiers, so without a
658
+ control its greens are indistinguishable from a comparison that never ran.
659
+
660
+ Driven through the WALK rather than a hand-built pin list, so the classifier
661
+ is exercised too: a rule that stopped claiming these shapes would take the
662
+ planted digest out of the checked set and this test would go red.
663
+ """
664
+ victim = PACKAGE / "metal_kernels" / "shaders.py"
665
+ rel = victim.relative_to(REPO).as_posix()
666
+ source = victim.read_text(encoding="utf-8")
667
+ raw_now = hashlib.sha256(victim.read_bytes()).hexdigest()
668
+ code_now = code_digest(source)
669
+ wrong = "f" * 64
670
+
671
+ planted = {"a_synthetic_weld": {"source_sha256": {rel: wrong}}}
672
+ honest = {"a_synthetic_weld": {"source_sha256": {rel: raw_now}}}
673
+ assert _drifted(_census(planted)) == [
674
+ (f"a_synthetic_weld.source_sha256.{rel}", rel,
675
+ f"recorded {wrong[:12]} live {raw_now[:12]}")]
676
+ assert _drifted(_census(honest)) == []
677
+
678
+ # A DIGEST INSIDE A LIST. This record holds none today, which is exactly why
679
+ # the control is here: the shape that hid 22 Triton pins must fail the moment
680
+ # it appears, not the day someone notices it appeared.
681
+ in_list = {"g": {"runs": [{"source_sha256": {rel: wrong}}]}}
682
+ assert _drifted(_census(in_list)) == [
683
+ (f"g.runs[0].source_sha256.{rel}", rel,
684
+ f"recorded {wrong[:12]} live {raw_now[:12]}")]
685
+
686
+ # A MISSING FILE IS REPORTED, not skipped.
687
+ assert _drifted(_census({"g": {"source_sha256": {"meep_gpu/nope.py": raw_now}}})) == [
688
+ ("g.source_sha256.meep_gpu/nope.py", "meep_gpu/nope.py",
689
+ "MISSING FROM THE TREE")]
690
+
691
+
692
+ def test_the_code_tier_is_the_clause_code_identity_licenses(tmp_path):
693
+ """THE ARMED CONTROL FOR THE CODE TIER, in both directions, on a real file.
694
+
695
+ 1. A COMMENT-ONLY EDIT: the raw digest MOVES and the code digest HOLDS.
696
+ This is the whole clause code_identity licenses and the only reason the
697
+ two tiers are allowed to disagree.
698
+ 2. A REAL CODE EDIT: both move. The licence does not stretch to it.
699
+ 3. A PLANTED CODE DIGEST on an unedited file: reported.
700
+ 4. A CODE DIGEST ON A FILE WITH NO CODE IDENTITY: reported, never skipped.
701
+ """
702
+ victim = PACKAGE / "metal_kernels" / "shaders.py"
703
+ rel = victim.relative_to(REPO).as_posix()
704
+ source = victim.read_text(encoding="utf-8")
705
+ raw_now = hashlib.sha256(victim.read_bytes()).hexdigest()
706
+ code_now = code_digest(source)
707
+ record = {"w": {"source_sha256": {rel: raw_now}, "code_sha256": {rel: code_now}}}
708
+
709
+ commented = _plant(tmp_path / "commented", rel,
710
+ source + "\n# a comment appended, changing no execution\n")
711
+ assert hashlib.sha256((commented / rel).read_bytes()).hexdigest() != raw_now
712
+ assert len(_drifted(_of_tier(_census(record), walk.TIER_RAW), root=commented)) == 1
713
+ assert _drifted(_of_tier(_census(record), walk.TIER_CODE), root=commented) == [], (
714
+ "a comment-only edit was reported as code drift - the tier is stricter "
715
+ "than code_identity licenses and will make doc fixes expensive")
716
+
717
+ edited = _plant(tmp_path / "edited", rel,
718
+ source + "\nA_NEW_MODULE_CONSTANT = 1\n")
719
+ assert len(_drifted(_of_tier(_census(record), walk.TIER_RAW), root=edited)) == 1
720
+ assert len(_drifted(_of_tier(_census(record), walk.TIER_CODE), root=edited)) == 1, (
721
+ "a new module-level constant did not move the code digest - the tier "
722
+ "would license a real code change as a comment")
723
+
724
+ reported = _drifted(_of_tier(_census({"w": {"code_sha256": {rel: "f" * 64}}}),
725
+ walk.TIER_CODE))
726
+ assert len(reported) == 1 and reported[0][1] == rel, reported
727
+
728
+ non_python = {"w": {"code_sha256": {"meep_gpu/metal_kernels/fingerprints.json":
729
+ "f" * 64}}}
730
+ reported = _drifted(_of_tier(_census(non_python), walk.TIER_CODE))
731
+ assert len(reported) == 1 and "no code identity" in reported[0][2], reported
732
+
733
+
734
+ def test_the_walker_finds_a_digest_planted_at_a_new_nesting_depth():
735
+ """THE ARMED CONTROL FOR THE WALK ITSELF. Plant one deeper than anything real.
736
+
737
+ Without this, a walker that stopped at depth 4 would report zero unclassified
738
+ digests and a perfectly stable discovered count, because this record's deepest
739
+ real digest sits at depth 4. Both halves are required: the walk must SURFACE
740
+ the planted digest, and it must classify it UNCLASSIFIED. The second is the
741
+ load-bearing one - a walker that found it and quietly excluded it would be the
742
+ original defect wearing this test as cover.
743
+ """
744
+ digest = "a" * 64
745
+ deep = {"an_entry": {"a": [{"b": {"c": [{"d": {"a_key_nobody_wrote": digest}}]}}]}}
746
+ found = walk.census(deep)
747
+ assert [f.value for f in found] == [digest], (
748
+ "the walk did not surface a digest nested eight levels down through two "
749
+ "lists - it is not recursing")
750
+ planted = found[0]
751
+ assert walk.dotted(planted.trail) == "an_entry.a[0].b.c[0].d.a_key_nobody_wrote"
752
+ assert len(planted.trail) > max(len(f.trail) for f in _census()), (
753
+ "the planted digest is no deeper than the record's own - the control has "
754
+ "stopped testing anything the real walk does not already reach")
755
+ assert planted.rule == walk.UNCLASSIFIED and planted.tier is None, (
756
+ f"a digest under an unanticipated key was classified {planted.rule!r} "
757
+ f"instead of failing - an unknown shape must be a red somebody writes a "
758
+ f"rule for, never a silent exclusion")
759
+
760
+
761
+ # ---------------------------------------------------------------------------
762
+ # THE ROUTE RECORD: checked through its runs, not as a weld
763
+ # ---------------------------------------------------------------------------
764
+ #
765
+ # The same rule, in the same words, as the other two weld contracts. What differs
766
+ # per suite is only where this suite declares the record a non-weld, how it spells a
767
+ # run's key, and which route-run fields its shape check reads.
768
+
769
+ #: This ledger's dispatch record, and the table that declares it a non-weld.
770
+ DISPATCH_RECORD = "driver_dispatch"
771
+ DISPATCH_RECORD_DECLARED_BY = metal_runs.NOT_WELDS
772
+
773
+ #: The key the armed control files a planted route run under: a GPU architecture.
774
+ PLANTED_RUN_KEY = "applegpu_g13s"
775
+
776
+
777
+ def _dispatch_shape_reasons(entry):
778
+ """Why the record is not in the per-architecture shape, read against the
779
+ ROUTE-run fields, which name ``status``; the weld run fields do not."""
780
+ return metal_runs.shape_reasons(entry, run_fields=metal_runs.DISPATCH_RUN_FIELDS)
781
+
782
+
783
+ def _tree_digest(name):
784
+ """The live raw digest of a path the record pins, resolved as this suite's drift
785
+ check resolves it."""
786
+ return _raw_digest(_resolve(name))
787
+
788
+
789
+ def _dispatch_record_problems(record):
790
+ """What ``weld_record_walk.route_record_problems`` reports for this ledger's
791
+ dispatch record, from this suite's own measurements: liveness by
792
+ ``fastpath.live_capabilities``, drift by :func:`_measured_drift` (the raw tier,
793
+ as for a weld), and shape by :func:`_dispatch_shape_reasons`."""
794
+ entry = record[DISPATCH_RECORD]
795
+ return walk.route_record_problems(
796
+ entry, live=fastpath.live_capabilities(entry),
797
+ moved=sorted(_measured_drift(DISPATCH_RECORD, entry)),
798
+ stranded=_dispatch_shape_reasons(entry))
799
+
800
+
801
+ def test_the_dispatch_record_stands_on_a_live_passing_route_run():
802
+ """The dispatch record is not a weld: it stands on its route runs and the tree.
803
+
804
+ ``driver_dispatch`` pins the bytes of the dispatch wiring, and no single gate
805
+ produced it, so the weld status rule does not apply to it. Its verdict is the
806
+ route campaign's: ``recut_driver_dispatch_record.py`` files each run under
807
+ ``runs[<key>]``, one per environment, with that run's ``status``. The rule is the
808
+ same in the three weld contracts (``weld_record_walk.route_record_problems``):
809
+
810
+ (a) at least one run is live (``fastpath.live_capabilities``), so an empty
811
+ ``runs``, or one whose every run binds bytes that have since moved, fails;
812
+ (b) every live run reads ``status`` PASS;
813
+ (c) every file the record pins in the raw tier matches the tree. A run stays
814
+ live after the files move, because it binds the record's digests and not
815
+ the tree, so liveness alone cannot say the record describes what ships;
816
+ (d) the route-run fields, ``status`` among them, appear only under
817
+ ``runs[<key>]``. A status beside the digests would be a second answer to
818
+ what the route campaign measured, and is refused.
819
+
820
+ Cleared by a route campaign that releases on these bytes and a recut that files
821
+ its run; never by writing a status beside the digests.
822
+ """
823
+ record = _record()
824
+ assert DISPATCH_RECORD in DISPATCH_RECORD_DECLARED_BY, (
825
+ f"{DISPATCH_RECORD} is no longer declared a non-weld, so the weld rules would "
826
+ f"apply to it as well as this one; declare it, or retire this test")
827
+ assert isinstance(record.get(DISPATCH_RECORD), dict), (
828
+ f"the ledger carries no {DISPATCH_RECORD} record")
829
+ problems = _dispatch_record_problems(record)
830
+ assert not problems, (
831
+ f"{DISPATCH_RECORD}: {problems} - run the route campaign on these bytes and "
832
+ f"cut its run with parity/meep_gpu/recut_driver_dispatch_record.py; never "
833
+ f"write a status beside the digests")
834
+
835
+
836
+ def test_the_dispatch_record_rule_refuses_what_its_route_runs_do_not_support():
837
+ """ARMED, on this ledger's own record, because the test above fails until a route
838
+ campaign has run on these bytes, and a rule watched only while it fails has not
839
+ been watched refusing what it is meant to refuse.
840
+
841
+ The control first: a copy of the record re-pinned to the tree, holding one live
842
+ run that reads PASS, is accepted, so the rule can pass. Then four plants on that
843
+ control, each refused by its own clause and by nothing else: an entry-level
844
+ ``status`` (d), an emptied ``runs`` (a), a run that reads PASS but binds bytes
845
+ other than the record's, so that no run is live (a), and the live run reading
846
+ FAIL (b). The stale run is what holds liveness to ``fastpath.live_capabilities``:
847
+ a check that read every recorded run as live would accept it."""
848
+ record = _record()
849
+ source = {name: _tree_digest(name)
850
+ for name in record[DISPATCH_RECORD]["source_sha256"]}
851
+ bound = fastpath.bound_digest(dict(record[DISPATCH_RECORD], source_sha256=source))
852
+
853
+ def problems_with(**fields):
854
+ planted = json.loads(json.dumps(record))
855
+ planted[DISPATCH_RECORD].update({"source_sha256": source, fastpath.RUNS: {
856
+ PLANTED_RUN_KEY: {"status": "PASS", "bound_sha256": bound}}})
857
+ planted[DISPATCH_RECORD].update(fields)
858
+ return _dispatch_record_problems(planted)
859
+
860
+ control = problems_with()
861
+ assert control == [], control
862
+ stated = problems_with(status="PASS")
863
+ assert len(stated) == 1 and "beside the digests" in stated[0], stated
864
+ assert "'status'" in stated[0], stated
865
+ emptied = problems_with(**{fastpath.RUNS: {}})
866
+ assert len(emptied) == 1 and emptied[0].startswith("no live run"), emptied
867
+ other_bytes = "0" * 64
868
+ assert other_bytes != bound
869
+ stale = problems_with(**{fastpath.RUNS: {
870
+ PLANTED_RUN_KEY: {"status": "PASS", "bound_sha256": other_bytes}}})
871
+ assert len(stale) == 1 and stale[0].startswith("no live run"), stale
872
+ failed = problems_with(**{fastpath.RUNS: {
873
+ PLANTED_RUN_KEY: {"status": "FAIL", "bound_sha256": bound}}})
874
+ assert len(failed) == 1 and failed[0].startswith(
875
+ f"{fastpath.RUNS}[{PLANTED_RUN_KEY!r}] reads status 'FAIL', not PASS"), failed
876
+
877
+
878
+ # ---------------------------------------------------------------------------
879
+ # WHAT A WELD MUST CARRY
880
+ # ---------------------------------------------------------------------------
881
+
882
+
883
+ def _declares_a_weld_is_owed():
884
+ """Families whose own module declares ``WELD_OWED`` non-empty, by name and reason.
885
+
886
+ READ OUT OF THE SOURCE, not by import: this file runs on hosts with no Metal
887
+ frontend, and a partition that could only be evaluated on a Mac would be a
888
+ partition nobody checks. The declaration is the Metal spelling of the CUDA
889
+ track's ``UNCERTIFIED_KERNELS`` - a family may stand unwelded only by SAYING
890
+ it does, in the module a reader of the family opens, with the measurement that
891
+ refused it.
892
+ """
893
+ owed = {}
894
+ for path in sorted((PACKAGE / "metal_kernels").glob("*.py")):
895
+ tree = ast.parse(path.read_text(encoding="utf-8"))
896
+ for node in tree.body:
897
+ target = None
898
+ if isinstance(node, ast.AnnAssign) and isinstance(node.target, ast.Name):
899
+ target = node.target.id
900
+ elif (isinstance(node, ast.Assign) and len(node.targets) == 1
901
+ and isinstance(node.targets[0], ast.Name)):
902
+ target = node.targets[0].id
903
+ if target != "WELD_OWED" or node.value is None:
904
+ continue
905
+ reason = ast.literal_eval(node.value)
906
+ if reason:
907
+ owed[path.stem] = reason
908
+ return owed
909
+
910
+
911
+ def test_every_metal_family_is_welded():
912
+ """All 30. cylindrical_real was the last, and its history is why this test changed.
913
+
914
+ It refused until 2026-08-19 on a NON-DETERMINISTIC needle: prefix_wall_row_dropped
915
+ read past the end of the prefix volume, so it was caught 5/8, then 7/8 on the same
916
+ bytes, then 8/8 alone. Re-armed in bounds it is 8/8 on five consecutive runs. This
917
+ test used to pin its ABSENCE; pinning the absence of a product is exactly the shape
918
+ that goes red when the gap closes, so it now pins the completeness instead.
919
+
920
+ THE ONE EXEMPTION IS A DECLARATION, ADDED 2026-09-05, AND IT IS A PARTITION.
921
+ ``fused_hd_pair``'s gate runs to completion and does not release, so the family
922
+ must NOT be welded - and until this change the only way to say so was to leave the
923
+ test red, which makes an honest refusal indistinguishable from a forgotten weld.
924
+ A gated family may stand unwelded only by declaring ``WELD_OWED`` in its own
925
+ module, and the two sets must be DISJOINT and must EXHAUST the fleet: a declaring
926
+ family that is welded anyway is as much a failure as an unwelded one that declares
927
+ nothing.
928
+ """
929
+ welded = _welds()
930
+ gates = {p.stem[len("gate_metal_"):] for p in
931
+ (PACKAGE.parent / "parity" / "meep_gpu").glob("gate_metal_*.py")}
932
+ named = {name[len("metal_"):-len("_device_gate")] for name in welded}
933
+ owed = _declares_a_weld_is_owed()
934
+ missing = sorted(gates - named - set(owed))
935
+ assert not missing, (
936
+ f"{len(missing)} Metal families have a gate but no weld: {missing}. A family "
937
+ f"whose gate REFUSES must stay unwelded - fix the gate, do not weld it - but it "
938
+ f"must then declare WELD_OWED in its own module rather than passing unnoticed.")
939
+ both = sorted(set(owed) & named)
940
+ assert not both, (
941
+ f"{both} declare WELD_OWED and are welded anyway. The declaration says the "
942
+ f"gate refused; the weld says it released. Delete whichever is false - never "
943
+ f"both, and never neither.")
944
+ stray = sorted(set(owed) - gates)
945
+ assert not stray, (
946
+ f"{stray} declare WELD_OWED but have no gate_metal_*.py at all. WELD_OWED is "
947
+ f"what a family whose GATE refused says; a family with no gate owes a gate.")
948
+ for family, reason in owed.items():
949
+ assert len(reason) > 200 and "results/" in reason, (
950
+ f"{family}'s WELD_OWED must name the artifact that refused and what a "
951
+ f"release still owes, not merely that one is owed: {reason[:120]!r}")
952
+
953
+
954
+ @pytest.mark.parametrize("field", ["recorded_utc", "host", "artifact_sha256",
955
+ "subnormal_policy", "environment_read_from",
956
+ "torch", "metal_frontend"])
957
+ def test_every_metal_weld_carries_its_metadata(field):
958
+ """The gap the CUDA comparison identified in certification.json - 0 of 4 blocks
959
+ carried recorded_utc - is not reintroduced here.
960
+
961
+ ASKED OF EVERY LIVE RUN, because these describe one run of the gate and live in
962
+ ``runs[<architecture>]`` (``metal_runs.RUN_FIELDS``), not beside the digests. A
963
+ weld with no live run fails the test below rather than passing this one vacuously.
964
+ """
965
+ missing = sorted(f"{name}:runs[{architecture}]"
966
+ for name, entry in _welds().items()
967
+ for architecture, run in metal_runs.live_runs(entry).items()
968
+ if not run.get(field))
969
+ assert not missing, f"{len(missing)} Metal weld runs lack {field}: {missing[:5]}"
970
+
971
+
972
+ def test_every_metal_weld_has_a_live_run_in_the_per_architecture_shape():
973
+ """Every weld holds its runs under ``runs[<GPU architecture>]``, and at least one is live.
974
+
975
+ THE SHAPE IS REFUSED BY NAME (``metal_runs.shape_reasons``): no run field beside
976
+ the digests, every key an ``applegpu_*`` architecture, every run carrying its
977
+ ``bound_sha256`` and nothing that describes bytes, and every run's host line naming
978
+ the architecture it is keyed by and the torch and frontend it records. A run is
979
+ live while its ``bound_sha256`` is ``fastpath.bound_digest`` of the entry; a weld
980
+ whose every run binds bytes that have since moved certifies nothing.
981
+ """
982
+ welds = _welds()
983
+ assert len(welds) >= ENTRY_FLOOR - len(NOT_A_DEVICE_GATE), len(welds)
984
+ retired = {name: metal_runs.shape_reasons(entry) for name, entry in welds.items()}
985
+ retired = {name: why for name, why in retired.items() if why}
986
+ assert not retired, (
987
+ f"{len(retired)} Metal welds are not in the per-architecture shape - run "
988
+ f"parity/meep_gpu/migrate_metal_runs.py, never edit the ledger by hand: "
989
+ f"{dict(sorted(retired.items())[:3])}")
990
+ dead = sorted(name for name, entry in welds.items()
991
+ if not metal_runs.live_architectures(entry))
992
+ assert not dead, (f"{len(dead)} Metal welds have no live run: {dead[:5]} - re-run "
993
+ f"their gates and rebind")
994
+
995
+
996
+ def test_the_cited_welds_admit_an_architecture_every_one_of_them_ran_on():
997
+ """The intersection the admission certifies is non-empty, and each blocker is named."""
998
+ report = metal_runs.admission_report(_record(), metal_runs.cited_keys())
999
+ blocked = {key: row["problem"] for key, row in report["by_key"].items()
1000
+ if row["problem"]}
1001
+ assert not blocked, blocked
1002
+ assert report["admitted"], (
1003
+ f"the {len(report['by_key'])} cited Metal welds share no live GPU "
1004
+ f"architecture: {dict(sorted((k, v['live']) for k, v in report['by_key'].items()))}")
1005
+
1006
+
1007
+ def test_the_migration_note_states_no_digest():
1008
+ """The note says what moved and from where; a digest in it would be a pin no tier checks."""
1009
+ note = _record().get("_architecture_runs_migration")
1010
+ assert isinstance(note, dict), "the ledger carries no per-architecture migration note"
1011
+ assert note["entries"] >= ENTRY_FLOOR - len(NOT_A_DEVICE_GATE), note
1012
+ assert note["architectures"], note
1013
+ assert not [f for f in walk.census({"note": note})], note