diffneusim 1.0.0__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 (682) hide show
  1. diffneusim/__init__.py +1 -0
  2. diffneusim/_cache.py +42 -0
  3. diffneusim/_paths.py +5 -0
  4. diffneusim/bindings/rew14_ext.cu +115 -0
  5. diffneusim/bindings/soft14_capi.cpp +443 -0
  6. diffneusim/bindings/soft14_engine_ext.cu +596 -0
  7. diffneusim/bindings/soft_capi.cpp +782 -0
  8. diffneusim/bindings/soft_engine_ext.cu +495 -0
  9. diffneusim/core/cpu_engine/build.sh +40 -0
  10. diffneusim/core/cpu_engine/fiber/cuda_runtime.h +445 -0
  11. diffneusim/core/cpu_engine/x14_cpu.cpp +283 -0
  12. diffneusim/core/diff/dual.h +126 -0
  13. diffneusim/core/include/diffneusim/macros.h +35 -0
  14. diffneusim/core/kin/kinematic_tree.h +273 -0
  15. diffneusim/core/math/so3.h +182 -0
  16. diffneusim/core/soft/adj/out_adj.h +102 -0
  17. diffneusim/core/soft/adj/rnea_adj.h +425 -0
  18. diffneusim/core/soft/adj/rows_adj.h +439 -0
  19. diffneusim/core/soft/adj/rows_functor.h +89 -0
  20. diffneusim/core/soft/adj/rows_lanes.h +443 -0
  21. diffneusim/core/soft/adj/shell_adj.h +243 -0
  22. diffneusim/core/soft/adj/tree_adj.h +356 -0
  23. diffneusim/core/soft/collide.h +183 -0
  24. diffneusim/core/soft/gpu/adj14.cuh +233 -0
  25. diffneusim/core/soft/gpu/adj14_mus.cuh +98 -0
  26. diffneusim/core/soft/gpu/adj_shell.cuh +50 -0
  27. diffneusim/core/soft/gpu/adj_tab.cuh +49 -0
  28. diffneusim/core/soft/gpu/body14.cuh +47 -0
  29. diffneusim/core/soft/gpu/chol_rn.cuh +458 -0
  30. diffneusim/core/soft/gpu/chol_small.cuh +123 -0
  31. diffneusim/core/soft/gpu/chol_split.cuh +193 -0
  32. diffneusim/core/soft/gpu/engine_launch.cuh +263 -0
  33. diffneusim/core/soft/gpu/fk_rn.cuh +109 -0
  34. diffneusim/core/soft/gpu/generated/body_019e20820f86_mmfloor.cuh +28 -0
  35. diffneusim/core/soft/gpu/generated/body_62f77a4bb16b_mmfloor.cuh +52 -0
  36. diffneusim/core/soft/gpu/generated/body_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +28 -0
  37. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +28 -0
  38. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +28 -0
  39. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +28 -0
  40. diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +28 -0
  41. diffneusim/core/soft/gpu/generated/body_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +52 -0
  42. diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor.cuh +25 -0
  43. diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +25 -0
  44. diffneusim/core/soft/gpu/generated/g1_soft_5db44fd45286.cuh +74 -0
  45. diffneusim/core/soft/gpu/generated/split_62f77a4bb16b_mmfloor.cuh +18 -0
  46. diffneusim/core/soft/gpu/generated/split_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +18 -0
  47. diffneusim/core/soft/gpu/generated/x14_soft_019e20820f86_mmfloor.cuh +123 -0
  48. diffneusim/core/soft/gpu/generated/x14_soft_62f77a4bb16b_mmfloor.cuh +129 -0
  49. diffneusim/core/soft/gpu/generated/x14_soft_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +123 -0
  50. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +123 -0
  51. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +123 -0
  52. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +123 -0
  53. diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +123 -0
  54. diffneusim/core/soft/gpu/generated/x14_soft_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +129 -0
  55. diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor.cuh +123 -0
  56. diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +123 -0
  57. diffneusim/core/soft/gpu/k_mus.cuh +1038 -0
  58. diffneusim/core/soft/gpu/k_mus_host.cuh +377 -0
  59. diffneusim/core/soft/gpu/k_pre.cuh +52 -0
  60. diffneusim/core/soft/gpu/kernel_p.cuh +490 -0
  61. diffneusim/core/soft/gpu/kp14.cuh +465 -0
  62. diffneusim/core/soft/gpu/l2v2.cuh +367 -0
  63. diffneusim/core/soft/gpu/l2x14.cuh +319 -0
  64. diffneusim/core/soft/gpu/l3.cuh +1483 -0
  65. diffneusim/core/soft/gpu/model_view.cuh +48 -0
  66. diffneusim/core/soft/gpu/mus_case_fits.h +15 -0
  67. diffneusim/core/soft/gpu/mus_classes.h +182 -0
  68. diffneusim/core/soft/gpu/mus_row_cf.h +44 -0
  69. diffneusim/core/soft/gpu/rew14.cuh +177 -0
  70. diffneusim/core/soft/gpu/rows_ctab.cuh +44 -0
  71. diffneusim/core/soft/gpu/tree_m.cuh +247 -0
  72. diffneusim/core/soft/gpu/x14_engine_kernels.cuh +260 -0
  73. diffneusim/core/soft/gpu/x14_rowcf.h +14 -0
  74. diffneusim/core/soft/hand.h +124 -0
  75. diffneusim/core/soft/impedance.h +115 -0
  76. diffneusim/core/soft/jvp.h +202 -0
  77. diffneusim/core/soft/kin.h +250 -0
  78. diffneusim/core/soft/muscle.h +1208 -0
  79. diffneusim/core/soft/newton.h +371 -0
  80. diffneusim/core/soft/rows.h +176 -0
  81. diffneusim/core/soft/step.h +188 -0
  82. diffneusim/core/soft/tape.h +313 -0
  83. diffneusim/core/soft/x14/collide14.h +69 -0
  84. diffneusim/core/soft/x14/jvp14.h +182 -0
  85. diffneusim/core/soft/x14/law14.h +453 -0
  86. diffneusim/core/soft/x14adj/collide14_adj.h +134 -0
  87. diffneusim/core/soft/x14adj/passive14_adj.h +162 -0
  88. diffneusim/core/soft/x14adj/reward14.h +484 -0
  89. diffneusim/core/soft/x14adj/rows14_adj.h +400 -0
  90. diffneusim/core/soft/x14adj/scan14.h +349 -0
  91. diffneusim/core/soft/x14adj/shell14_adj.h +122 -0
  92. diffneusim/core/soft/x14adj/sweep14.h +255 -0
  93. diffneusim/core/soft/x14adj/tree14_adj.h +500 -0
  94. diffneusim/core/soft/x14adj/x14adj_common.h +96 -0
  95. diffneusim/data/mirror/H1622v2k_geyer_hfdeq.npz +0 -0
  96. diffneusim/data/mirror/H1622v2k_hfd.npz +0 -0
  97. diffneusim/data/mirror/H1622v2k_millard_hfdeq.npz +0 -0
  98. diffneusim/data/mirror/fullbody_contact.npz +0 -0
  99. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard.npz +0 -0
  100. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str.npz +0 -0
  101. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str_rigid.npz +0 -0
  102. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.npz +0 -0
  103. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.npz +0 -0
  104. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq.npz +0 -0
  105. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin.npz +0 -0
  106. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_calf2_pe.npz +0 -0
  107. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  108. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfix.npz +0 -0
  109. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.npz +0 -0
  110. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01.npz +0 -0
  111. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01legs.npz +0 -0
  112. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01lumbar.npz +0 -0
  113. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfix.npz +0 -0
  114. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfixlegs01.npz +0 -0
  115. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
  116. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
  117. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
  118. diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
  119. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair.npz +0 -0
  120. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  121. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_hinge.npz +0 -0
  122. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
  123. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
  124. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
  125. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
  126. diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_lspine_girdle_osimeq.npz +0 -0
  127. diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_millard.npz +0 -0
  128. diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_osimeq.npz +0 -0
  129. diffneusim/data/mirror/myoleg26_3d_compound_g14eq.npz +0 -0
  130. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq.npz +0 -0
  131. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose.npz +0 -0
  132. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin.npz +0 -0
  133. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30.npz +0 -0
  134. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30.npz +0 -0
  135. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_luispe.npz +0 -0
  136. diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_trunk0701.npz +0 -0
  137. diffneusim/data/muscle_fit/wang_mass_volume_14t.json +91 -0
  138. diffneusim/data/muscle_fit/wang_mass_volume_14t_axfix.json +91 -0
  139. diffneusim/data/muscle_fit/wang_mass_volume_14t_axfixlegs01.json +91 -0
  140. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01.json +91 -0
  141. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01legs.json +91 -0
  142. diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01lumbar.json +91 -0
  143. diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfix.json +91 -0
  144. diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfixlegs01.json +91 -0
  145. diffneusim/data/muscle_fit/wang_mass_volume_14t_n1.json +91 -0
  146. diffneusim/data/muscle_fit/wang_mass_volume_14t_n1a.json +91 -0
  147. diffneusim/data/muscle_fit/wang_mass_volume_14t_n2.json +91 -0
  148. diffneusim/data/muscle_fit/wang_mass_volume_14t_rom23.json +91 -0
  149. diffneusim/data/reference/musclemimic/myofullbody_mimic_sites.json +261 -0
  150. diffneusim/data/reference/pose3/pose3_scone.json +305 -0
  151. diffneusim/data/reference/pose3/pose3_scone.txt +3 -0
  152. diffneusim/data/reference/pose3/pose3_scone_gait.npz +0 -0
  153. diffneusim/data/reference/pose3/pose3_scone_mirror.npz +0 -0
  154. diffneusim/data/reference/pose3/pose3_scone_stand.npz +0 -0
  155. diffneusim/data/reference/x016run/MD5SUMS +241 -0
  156. diffneusim/data/reference/x016run/x016run_states.txt +240 -0
  157. diffneusim/data/reference/x016run/x016run_v3p00_s0_l0.npz +0 -0
  158. diffneusim/data/reference/x016run/x016run_v3p00_s0_l1.npz +0 -0
  159. diffneusim/data/reference/x016run/x016run_v3p00_s0_l2.npz +0 -0
  160. diffneusim/data/reference/x016run/x016run_v3p00_s0_l3.npz +0 -0
  161. diffneusim/data/reference/x016run/x016run_v3p00_s0_r0.npz +0 -0
  162. diffneusim/data/reference/x016run/x016run_v3p00_s0_r1.npz +0 -0
  163. diffneusim/data/reference/x016run/x016run_v3p00_s0_r2.npz +0 -0
  164. diffneusim/data/reference/x016run/x016run_v3p00_s0_r3.npz +0 -0
  165. diffneusim/data/reference/x016run/x016run_v3p00_s1_l0.npz +0 -0
  166. diffneusim/data/reference/x016run/x016run_v3p00_s1_l1.npz +0 -0
  167. diffneusim/data/reference/x016run/x016run_v3p00_s1_l2.npz +0 -0
  168. diffneusim/data/reference/x016run/x016run_v3p00_s1_l3.npz +0 -0
  169. diffneusim/data/reference/x016run/x016run_v3p00_s1_r0.npz +0 -0
  170. diffneusim/data/reference/x016run/x016run_v3p00_s1_r1.npz +0 -0
  171. diffneusim/data/reference/x016run/x016run_v3p00_s1_r2.npz +0 -0
  172. diffneusim/data/reference/x016run/x016run_v3p00_s1_r3.npz +0 -0
  173. diffneusim/data/reference/x016run/x016run_v3p00_s2_l0.npz +0 -0
  174. diffneusim/data/reference/x016run/x016run_v3p00_s2_l1.npz +0 -0
  175. diffneusim/data/reference/x016run/x016run_v3p00_s2_l2.npz +0 -0
  176. diffneusim/data/reference/x016run/x016run_v3p00_s2_l3.npz +0 -0
  177. diffneusim/data/reference/x016run/x016run_v3p00_s2_r0.npz +0 -0
  178. diffneusim/data/reference/x016run/x016run_v3p00_s2_r1.npz +0 -0
  179. diffneusim/data/reference/x016run/x016run_v3p00_s2_r2.npz +0 -0
  180. diffneusim/data/reference/x016run/x016run_v3p00_s2_r3.npz +0 -0
  181. diffneusim/data/reference/x016run/x016run_v3p00_s3_l0.npz +0 -0
  182. diffneusim/data/reference/x016run/x016run_v3p00_s3_l1.npz +0 -0
  183. diffneusim/data/reference/x016run/x016run_v3p00_s3_l2.npz +0 -0
  184. diffneusim/data/reference/x016run/x016run_v3p00_s3_l3.npz +0 -0
  185. diffneusim/data/reference/x016run/x016run_v3p00_s3_r0.npz +0 -0
  186. diffneusim/data/reference/x016run/x016run_v3p00_s3_r1.npz +0 -0
  187. diffneusim/data/reference/x016run/x016run_v3p00_s3_r2.npz +0 -0
  188. diffneusim/data/reference/x016run/x016run_v3p00_s3_r3.npz +0 -0
  189. diffneusim/data/reference/x016run/x016run_v3p00_s4_l0.npz +0 -0
  190. diffneusim/data/reference/x016run/x016run_v3p00_s4_l1.npz +0 -0
  191. diffneusim/data/reference/x016run/x016run_v3p00_s4_l2.npz +0 -0
  192. diffneusim/data/reference/x016run/x016run_v3p00_s4_l3.npz +0 -0
  193. diffneusim/data/reference/x016run/x016run_v3p00_s4_r0.npz +0 -0
  194. diffneusim/data/reference/x016run/x016run_v3p00_s4_r1.npz +0 -0
  195. diffneusim/data/reference/x016run/x016run_v3p00_s4_r2.npz +0 -0
  196. diffneusim/data/reference/x016run/x016run_v3p00_s4_r3.npz +0 -0
  197. diffneusim/data/reference/x016run/x016run_v3p00_s5_l0.npz +0 -0
  198. diffneusim/data/reference/x016run/x016run_v3p00_s5_l1.npz +0 -0
  199. diffneusim/data/reference/x016run/x016run_v3p00_s5_l2.npz +0 -0
  200. diffneusim/data/reference/x016run/x016run_v3p00_s5_l3.npz +0 -0
  201. diffneusim/data/reference/x016run/x016run_v3p00_s5_r0.npz +0 -0
  202. diffneusim/data/reference/x016run/x016run_v3p00_s5_r1.npz +0 -0
  203. diffneusim/data/reference/x016run/x016run_v3p00_s5_r2.npz +0 -0
  204. diffneusim/data/reference/x016run/x016run_v3p00_s5_r3.npz +0 -0
  205. diffneusim/data/reference/x016run/x016run_v3p00_s6_l0.npz +0 -0
  206. diffneusim/data/reference/x016run/x016run_v3p00_s6_l1.npz +0 -0
  207. diffneusim/data/reference/x016run/x016run_v3p00_s6_l2.npz +0 -0
  208. diffneusim/data/reference/x016run/x016run_v3p00_s6_l3.npz +0 -0
  209. diffneusim/data/reference/x016run/x016run_v3p00_s6_r0.npz +0 -0
  210. diffneusim/data/reference/x016run/x016run_v3p00_s6_r1.npz +0 -0
  211. diffneusim/data/reference/x016run/x016run_v3p00_s6_r2.npz +0 -0
  212. diffneusim/data/reference/x016run/x016run_v3p00_s6_r3.npz +0 -0
  213. diffneusim/data/reference/x016run/x016run_v3p00_s7_l0.npz +0 -0
  214. diffneusim/data/reference/x016run/x016run_v3p00_s7_l1.npz +0 -0
  215. diffneusim/data/reference/x016run/x016run_v3p00_s7_l2.npz +0 -0
  216. diffneusim/data/reference/x016run/x016run_v3p00_s7_l3.npz +0 -0
  217. diffneusim/data/reference/x016run/x016run_v3p00_s7_r0.npz +0 -0
  218. diffneusim/data/reference/x016run/x016run_v3p00_s7_r1.npz +0 -0
  219. diffneusim/data/reference/x016run/x016run_v3p00_s7_r2.npz +0 -0
  220. diffneusim/data/reference/x016run/x016run_v3p00_s7_r3.npz +0 -0
  221. diffneusim/data/reference/x016run/x016run_v3p25_s0_l0.npz +0 -0
  222. diffneusim/data/reference/x016run/x016run_v3p25_s0_l1.npz +0 -0
  223. diffneusim/data/reference/x016run/x016run_v3p25_s0_l2.npz +0 -0
  224. diffneusim/data/reference/x016run/x016run_v3p25_s0_l3.npz +0 -0
  225. diffneusim/data/reference/x016run/x016run_v3p25_s0_r0.npz +0 -0
  226. diffneusim/data/reference/x016run/x016run_v3p25_s0_r1.npz +0 -0
  227. diffneusim/data/reference/x016run/x016run_v3p25_s0_r2.npz +0 -0
  228. diffneusim/data/reference/x016run/x016run_v3p25_s0_r3.npz +0 -0
  229. diffneusim/data/reference/x016run/x016run_v3p25_s1_l0.npz +0 -0
  230. diffneusim/data/reference/x016run/x016run_v3p25_s1_l1.npz +0 -0
  231. diffneusim/data/reference/x016run/x016run_v3p25_s1_l2.npz +0 -0
  232. diffneusim/data/reference/x016run/x016run_v3p25_s1_l3.npz +0 -0
  233. diffneusim/data/reference/x016run/x016run_v3p25_s1_r0.npz +0 -0
  234. diffneusim/data/reference/x016run/x016run_v3p25_s1_r1.npz +0 -0
  235. diffneusim/data/reference/x016run/x016run_v3p25_s1_r2.npz +0 -0
  236. diffneusim/data/reference/x016run/x016run_v3p25_s1_r3.npz +0 -0
  237. diffneusim/data/reference/x016run/x016run_v3p25_s2_l0.npz +0 -0
  238. diffneusim/data/reference/x016run/x016run_v3p25_s2_l1.npz +0 -0
  239. diffneusim/data/reference/x016run/x016run_v3p25_s2_l2.npz +0 -0
  240. diffneusim/data/reference/x016run/x016run_v3p25_s2_l3.npz +0 -0
  241. diffneusim/data/reference/x016run/x016run_v3p25_s2_r0.npz +0 -0
  242. diffneusim/data/reference/x016run/x016run_v3p25_s2_r1.npz +0 -0
  243. diffneusim/data/reference/x016run/x016run_v3p25_s2_r2.npz +0 -0
  244. diffneusim/data/reference/x016run/x016run_v3p25_s2_r3.npz +0 -0
  245. diffneusim/data/reference/x016run/x016run_v3p25_s3_l0.npz +0 -0
  246. diffneusim/data/reference/x016run/x016run_v3p25_s3_l1.npz +0 -0
  247. diffneusim/data/reference/x016run/x016run_v3p25_s3_l2.npz +0 -0
  248. diffneusim/data/reference/x016run/x016run_v3p25_s3_l3.npz +0 -0
  249. diffneusim/data/reference/x016run/x016run_v3p25_s3_r0.npz +0 -0
  250. diffneusim/data/reference/x016run/x016run_v3p25_s3_r1.npz +0 -0
  251. diffneusim/data/reference/x016run/x016run_v3p25_s3_r2.npz +0 -0
  252. diffneusim/data/reference/x016run/x016run_v3p25_s3_r3.npz +0 -0
  253. diffneusim/data/reference/x016run/x016run_v3p25_s4_l0.npz +0 -0
  254. diffneusim/data/reference/x016run/x016run_v3p25_s4_l1.npz +0 -0
  255. diffneusim/data/reference/x016run/x016run_v3p25_s4_l2.npz +0 -0
  256. diffneusim/data/reference/x016run/x016run_v3p25_s4_l3.npz +0 -0
  257. diffneusim/data/reference/x016run/x016run_v3p25_s4_r0.npz +0 -0
  258. diffneusim/data/reference/x016run/x016run_v3p25_s4_r1.npz +0 -0
  259. diffneusim/data/reference/x016run/x016run_v3p25_s4_r2.npz +0 -0
  260. diffneusim/data/reference/x016run/x016run_v3p25_s4_r3.npz +0 -0
  261. diffneusim/data/reference/x016run/x016run_v3p25_s5_l0.npz +0 -0
  262. diffneusim/data/reference/x016run/x016run_v3p25_s5_l1.npz +0 -0
  263. diffneusim/data/reference/x016run/x016run_v3p25_s5_l2.npz +0 -0
  264. diffneusim/data/reference/x016run/x016run_v3p25_s5_l3.npz +0 -0
  265. diffneusim/data/reference/x016run/x016run_v3p25_s5_r0.npz +0 -0
  266. diffneusim/data/reference/x016run/x016run_v3p25_s5_r1.npz +0 -0
  267. diffneusim/data/reference/x016run/x016run_v3p25_s5_r2.npz +0 -0
  268. diffneusim/data/reference/x016run/x016run_v3p25_s5_r3.npz +0 -0
  269. diffneusim/data/reference/x016run/x016run_v3p25_s6_l0.npz +0 -0
  270. diffneusim/data/reference/x016run/x016run_v3p25_s6_l1.npz +0 -0
  271. diffneusim/data/reference/x016run/x016run_v3p25_s6_l2.npz +0 -0
  272. diffneusim/data/reference/x016run/x016run_v3p25_s6_l3.npz +0 -0
  273. diffneusim/data/reference/x016run/x016run_v3p25_s6_r0.npz +0 -0
  274. diffneusim/data/reference/x016run/x016run_v3p25_s6_r1.npz +0 -0
  275. diffneusim/data/reference/x016run/x016run_v3p25_s6_r2.npz +0 -0
  276. diffneusim/data/reference/x016run/x016run_v3p25_s6_r3.npz +0 -0
  277. diffneusim/data/reference/x016run/x016run_v3p25_s7_l0.npz +0 -0
  278. diffneusim/data/reference/x016run/x016run_v3p25_s7_l1.npz +0 -0
  279. diffneusim/data/reference/x016run/x016run_v3p25_s7_l2.npz +0 -0
  280. diffneusim/data/reference/x016run/x016run_v3p25_s7_l3.npz +0 -0
  281. diffneusim/data/reference/x016run/x016run_v3p25_s7_r0.npz +0 -0
  282. diffneusim/data/reference/x016run/x016run_v3p25_s7_r1.npz +0 -0
  283. diffneusim/data/reference/x016run/x016run_v3p25_s7_r2.npz +0 -0
  284. diffneusim/data/reference/x016run/x016run_v3p25_s7_r3.npz +0 -0
  285. diffneusim/data/reference/x016run/x016run_v3p50_s0_l0.npz +0 -0
  286. diffneusim/data/reference/x016run/x016run_v3p50_s0_l1.npz +0 -0
  287. diffneusim/data/reference/x016run/x016run_v3p50_s0_l2.npz +0 -0
  288. diffneusim/data/reference/x016run/x016run_v3p50_s0_l3.npz +0 -0
  289. diffneusim/data/reference/x016run/x016run_v3p50_s0_r0.npz +0 -0
  290. diffneusim/data/reference/x016run/x016run_v3p50_s0_r1.npz +0 -0
  291. diffneusim/data/reference/x016run/x016run_v3p50_s0_r2.npz +0 -0
  292. diffneusim/data/reference/x016run/x016run_v3p50_s0_r3.npz +0 -0
  293. diffneusim/data/reference/x016run/x016run_v3p50_s1_l0.npz +0 -0
  294. diffneusim/data/reference/x016run/x016run_v3p50_s1_l1.npz +0 -0
  295. diffneusim/data/reference/x016run/x016run_v3p50_s1_l2.npz +0 -0
  296. diffneusim/data/reference/x016run/x016run_v3p50_s1_l3.npz +0 -0
  297. diffneusim/data/reference/x016run/x016run_v3p50_s1_r0.npz +0 -0
  298. diffneusim/data/reference/x016run/x016run_v3p50_s1_r1.npz +0 -0
  299. diffneusim/data/reference/x016run/x016run_v3p50_s1_r2.npz +0 -0
  300. diffneusim/data/reference/x016run/x016run_v3p50_s1_r3.npz +0 -0
  301. diffneusim/data/reference/x016run/x016run_v3p50_s2_l0.npz +0 -0
  302. diffneusim/data/reference/x016run/x016run_v3p50_s2_l1.npz +0 -0
  303. diffneusim/data/reference/x016run/x016run_v3p50_s2_l2.npz +0 -0
  304. diffneusim/data/reference/x016run/x016run_v3p50_s2_l3.npz +0 -0
  305. diffneusim/data/reference/x016run/x016run_v3p50_s2_r0.npz +0 -0
  306. diffneusim/data/reference/x016run/x016run_v3p50_s2_r1.npz +0 -0
  307. diffneusim/data/reference/x016run/x016run_v3p50_s2_r2.npz +0 -0
  308. diffneusim/data/reference/x016run/x016run_v3p50_s2_r3.npz +0 -0
  309. diffneusim/data/reference/x016run/x016run_v3p50_s3_l0.npz +0 -0
  310. diffneusim/data/reference/x016run/x016run_v3p50_s3_l1.npz +0 -0
  311. diffneusim/data/reference/x016run/x016run_v3p50_s3_l2.npz +0 -0
  312. diffneusim/data/reference/x016run/x016run_v3p50_s3_l3.npz +0 -0
  313. diffneusim/data/reference/x016run/x016run_v3p50_s3_r0.npz +0 -0
  314. diffneusim/data/reference/x016run/x016run_v3p50_s3_r1.npz +0 -0
  315. diffneusim/data/reference/x016run/x016run_v3p50_s3_r2.npz +0 -0
  316. diffneusim/data/reference/x016run/x016run_v3p50_s3_r3.npz +0 -0
  317. diffneusim/data/reference/x016run/x016run_v3p50_s5_l0.npz +0 -0
  318. diffneusim/data/reference/x016run/x016run_v3p50_s5_l1.npz +0 -0
  319. diffneusim/data/reference/x016run/x016run_v3p50_s5_l2.npz +0 -0
  320. diffneusim/data/reference/x016run/x016run_v3p50_s5_l3.npz +0 -0
  321. diffneusim/data/reference/x016run/x016run_v3p50_s5_r0.npz +0 -0
  322. diffneusim/data/reference/x016run/x016run_v3p50_s5_r1.npz +0 -0
  323. diffneusim/data/reference/x016run/x016run_v3p50_s5_r2.npz +0 -0
  324. diffneusim/data/reference/x016run/x016run_v3p50_s5_r3.npz +0 -0
  325. diffneusim/data/reference/x016run/x016run_v3p50_s6_l0.npz +0 -0
  326. diffneusim/data/reference/x016run/x016run_v3p50_s6_l1.npz +0 -0
  327. diffneusim/data/reference/x016run/x016run_v3p50_s6_l2.npz +0 -0
  328. diffneusim/data/reference/x016run/x016run_v3p50_s6_l3.npz +0 -0
  329. diffneusim/data/reference/x016run/x016run_v3p50_s6_r0.npz +0 -0
  330. diffneusim/data/reference/x016run/x016run_v3p50_s6_r1.npz +0 -0
  331. diffneusim/data/reference/x016run/x016run_v3p50_s6_r2.npz +0 -0
  332. diffneusim/data/reference/x016run/x016run_v3p50_s6_r3.npz +0 -0
  333. diffneusim/data/reference/x016run/x016run_v3p50_s7_l0.npz +0 -0
  334. diffneusim/data/reference/x016run/x016run_v3p50_s7_l1.npz +0 -0
  335. diffneusim/data/reference/x016run/x016run_v3p50_s7_l2.npz +0 -0
  336. diffneusim/data/reference/x016run/x016run_v3p50_s7_l3.npz +0 -0
  337. diffneusim/data/reference/x016run/x016run_v3p50_s7_r0.npz +0 -0
  338. diffneusim/data/reference/x016run/x016run_v3p50_s7_r1.npz +0 -0
  339. diffneusim/data/reference/x016run/x016run_v3p50_s7_r2.npz +0 -0
  340. diffneusim/data/reference/x016run/x016run_v3p50_s7_r3.npz +0 -0
  341. diffneusim/data/reference/x016run/x016run_v3p75_s0_l0.npz +0 -0
  342. diffneusim/data/reference/x016run/x016run_v3p75_s0_l1.npz +0 -0
  343. diffneusim/data/reference/x016run/x016run_v3p75_s0_l2.npz +0 -0
  344. diffneusim/data/reference/x016run/x016run_v3p75_s0_l3.npz +0 -0
  345. diffneusim/data/reference/x016run/x016run_v3p75_s0_r0.npz +0 -0
  346. diffneusim/data/reference/x016run/x016run_v3p75_s0_r1.npz +0 -0
  347. diffneusim/data/reference/x016run/x016run_v3p75_s0_r2.npz +0 -0
  348. diffneusim/data/reference/x016run/x016run_v3p75_s0_r3.npz +0 -0
  349. diffneusim/data/reference/x016run/x016run_v3p75_s1_l0.npz +0 -0
  350. diffneusim/data/reference/x016run/x016run_v3p75_s1_l1.npz +0 -0
  351. diffneusim/data/reference/x016run/x016run_v3p75_s1_l2.npz +0 -0
  352. diffneusim/data/reference/x016run/x016run_v3p75_s1_l3.npz +0 -0
  353. diffneusim/data/reference/x016run/x016run_v3p75_s1_r0.npz +0 -0
  354. diffneusim/data/reference/x016run/x016run_v3p75_s1_r1.npz +0 -0
  355. diffneusim/data/reference/x016run/x016run_v3p75_s1_r2.npz +0 -0
  356. diffneusim/data/reference/x016run/x016run_v3p75_s1_r3.npz +0 -0
  357. diffneusim/data/reference/x016run/x016run_v3p75_s2_l0.npz +0 -0
  358. diffneusim/data/reference/x016run/x016run_v3p75_s2_l1.npz +0 -0
  359. diffneusim/data/reference/x016run/x016run_v3p75_s2_l2.npz +0 -0
  360. diffneusim/data/reference/x016run/x016run_v3p75_s2_l3.npz +0 -0
  361. diffneusim/data/reference/x016run/x016run_v3p75_s2_r0.npz +0 -0
  362. diffneusim/data/reference/x016run/x016run_v3p75_s2_r1.npz +0 -0
  363. diffneusim/data/reference/x016run/x016run_v3p75_s2_r2.npz +0 -0
  364. diffneusim/data/reference/x016run/x016run_v3p75_s2_r3.npz +0 -0
  365. diffneusim/data/reference/x016run/x016run_v3p75_s3_l0.npz +0 -0
  366. diffneusim/data/reference/x016run/x016run_v3p75_s3_l1.npz +0 -0
  367. diffneusim/data/reference/x016run/x016run_v3p75_s3_l2.npz +0 -0
  368. diffneusim/data/reference/x016run/x016run_v3p75_s3_l3.npz +0 -0
  369. diffneusim/data/reference/x016run/x016run_v3p75_s3_r0.npz +0 -0
  370. diffneusim/data/reference/x016run/x016run_v3p75_s3_r1.npz +0 -0
  371. diffneusim/data/reference/x016run/x016run_v3p75_s3_r2.npz +0 -0
  372. diffneusim/data/reference/x016run/x016run_v3p75_s3_r3.npz +0 -0
  373. diffneusim/data/reference/x016run/x016run_v3p75_s5_l0.npz +0 -0
  374. diffneusim/data/reference/x016run/x016run_v3p75_s5_l1.npz +0 -0
  375. diffneusim/data/reference/x016run/x016run_v3p75_s5_l2.npz +0 -0
  376. diffneusim/data/reference/x016run/x016run_v3p75_s5_l3.npz +0 -0
  377. diffneusim/data/reference/x016run/x016run_v3p75_s5_r0.npz +0 -0
  378. diffneusim/data/reference/x016run/x016run_v3p75_s5_r1.npz +0 -0
  379. diffneusim/data/reference/x016run/x016run_v3p75_s5_r2.npz +0 -0
  380. diffneusim/data/reference/x016run/x016run_v3p75_s5_r3.npz +0 -0
  381. diffneusim/data/reference/x016run/x016run_v3p75_s6_l0.npz +0 -0
  382. diffneusim/data/reference/x016run/x016run_v3p75_s6_l1.npz +0 -0
  383. diffneusim/data/reference/x016run/x016run_v3p75_s6_l2.npz +0 -0
  384. diffneusim/data/reference/x016run/x016run_v3p75_s6_l3.npz +0 -0
  385. diffneusim/data/reference/x016run/x016run_v3p75_s6_r0.npz +0 -0
  386. diffneusim/data/reference/x016run/x016run_v3p75_s6_r1.npz +0 -0
  387. diffneusim/data/reference/x016run/x016run_v3p75_s6_r2.npz +0 -0
  388. diffneusim/data/reference/x016run/x016run_v3p75_s6_r3.npz +0 -0
  389. diffneusim/data/reference/x016run/x016run_v3p75_s7_l0.npz +0 -0
  390. diffneusim/data/reference/x016run/x016run_v3p75_s7_l1.npz +0 -0
  391. diffneusim/data/reference/x016run/x016run_v3p75_s7_l2.npz +0 -0
  392. diffneusim/data/reference/x016run/x016run_v3p75_s7_l3.npz +0 -0
  393. diffneusim/data/reference/x016run/x016run_v3p75_s7_r0.npz +0 -0
  394. diffneusim/data/reference/x016run/x016run_v3p75_s7_r1.npz +0 -0
  395. diffneusim/data/reference/x016run/x016run_v3p75_s7_r2.npz +0 -0
  396. diffneusim/data/reference/x016run/x016run_v3p75_s7_r3.npz +0 -0
  397. diffneusim/data/state_prior/lumbar_poly_fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
  398. diffneusim/engine/__init__.py +0 -0
  399. diffneusim/engine/build_tag.py +52 -0
  400. diffneusim/engine/case_tables.py +46 -0
  401. diffneusim/engine/d16_body.py +80 -0
  402. diffneusim/engine/engine14.py +367 -0
  403. diffneusim/engine/gen_split.py +159 -0
  404. diffneusim/engine/hand_format.py +69 -0
  405. diffneusim/engine/live14.py +149 -0
  406. diffneusim/engine/phase_b_tree.py +137 -0
  407. diffneusim/engine/soft14.py +130 -0
  408. diffneusim/engine/soft_capi.py +373 -0
  409. diffneusim/engine/soft_engine.py +165 -0
  410. diffneusim/engine/step14.py +132 -0
  411. diffneusim/engine/tape_format.py +89 -0
  412. diffneusim/engine/x14cpu.py +163 -0
  413. diffneusim/env/__init__.py +0 -0
  414. diffneusim/env/absent.py +20 -0
  415. diffneusim/env/cpu14.py +105 -0
  416. diffneusim/env/e0loop14.py +224 -0
  417. diffneusim/env/env14.py +568 -0
  418. diffneusim/env/kin_contact14.py +193 -0
  419. diffneusim/env/mimic_sites_x14.json +366 -0
  420. diffneusim/env/old_count.py +78 -0
  421. diffneusim/env/rew14.py +114 -0
  422. diffneusim/env/rew14_hook.py +105 -0
  423. diffneusim/g1/__init__.py +1 -0
  424. diffneusim/g1/arm_a2.py +165 -0
  425. diffneusim/g1/arm_a3.py +576 -0
  426. diffneusim/g1/read_a3.py +79 -0
  427. diffneusim/g1/rg1_read.py +89 -0
  428. diffneusim/model/__init__.py +66 -0
  429. diffneusim/model/case.py +17 -0
  430. diffneusim/model/dnmodel.py +79 -0
  431. diffneusim/model/fuse_fixed.py +281 -0
  432. diffneusim/model/monitor.py +834 -0
  433. diffneusim/models/BODIES.toml +48 -0
  434. diffneusim/models/MANIFEST.toml +979 -0
  435. diffneusim/models/cases/G290/case.bin +0 -0
  436. diffneusim/models/cases/G290/case.json +1 -0
  437. diffneusim/models/cases/G356-SRC/case.bin +0 -0
  438. diffneusim/models/cases/G356-SRC/case.json +1 -0
  439. diffneusim/models/cases/G416/case.bin +0 -0
  440. diffneusim/models/cases/G416/case.json +1 -0
  441. diffneusim/models/cases/M290C-SRC/case.bin +0 -0
  442. diffneusim/models/cases/M290C-SRC/case.json +1 -0
  443. diffneusim/models/cases/M290R-SRC/case.bin +0 -0
  444. diffneusim/models/cases/M290R-SRC/case.json +1 -0
  445. diffneusim/models/cases/M356C-SRC/case.bin +0 -0
  446. diffneusim/models/cases/M356C-SRC/case.json +1 -0
  447. diffneusim/models/cases/M356R-SRC/case.bin +0 -0
  448. diffneusim/models/cases/M356R-SRC/case.json +1 -0
  449. diffneusim/models/cases/M416C-SRC/case.bin +0 -0
  450. diffneusim/models/cases/M416C-SRC/case.json +1 -0
  451. diffneusim/models/derived/d16_expanded_62f77a4bb16b1e67_mmfloor.xml +673 -0
  452. diffneusim/models/derived/d16_expanded_a1e8b196b2cd7b3c_mmfloor.xml +673 -0
  453. diffneusim/models/derived/d16_soft_law_019e20820f8633b9_mmfloor.json +7844 -0
  454. diffneusim/models/derived/d16_soft_law_62f77a4bb16b1e67_mmfloor.json +16855 -0
  455. diffneusim/models/derived/d16_soft_law_77dbb7213f26e821_mmfloor_rampsb3l_n6t12.json +7883 -0
  456. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rampsb3l_n6t12.json +7883 -0
  457. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsd05_n6t12.json +7868 -0
  458. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsdef_n6t12.json +7868 -0
  459. diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsmjd_n6t12.json +7868 -0
  460. diffneusim/models/derived/d16_soft_law_a1e8b196b2cd7b3c_mmfloor_rampsb3l_n6t12.json +16894 -0
  461. diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor.json +12655 -0
  462. diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor_rampsb3l_n6t12.json +12700 -0
  463. diffneusim/models/derived/unitree_g1_soft_law.json +15580 -0
  464. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +28913 -0
  465. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  466. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +29202 -0
  467. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
  468. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.dnmodel +1 -0
  469. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  470. diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  471. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +46970 -0
  472. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  473. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  474. diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  475. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +38570 -0
  476. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
  477. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +38923 -0
  478. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
  479. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
  480. diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
  481. diffneusim/models/fullbody_meshes/1mc.stl +0 -0
  482. diffneusim/models/fullbody_meshes/2distph.stl +0 -0
  483. diffneusim/models/fullbody_meshes/2mc.stl +0 -0
  484. diffneusim/models/fullbody_meshes/2midph.stl +0 -0
  485. diffneusim/models/fullbody_meshes/2proxph.stl +0 -0
  486. diffneusim/models/fullbody_meshes/3distph.stl +0 -0
  487. diffneusim/models/fullbody_meshes/3mc.stl +0 -0
  488. diffneusim/models/fullbody_meshes/3midph.stl +0 -0
  489. diffneusim/models/fullbody_meshes/3proxph.stl +0 -0
  490. diffneusim/models/fullbody_meshes/4distph.stl +0 -0
  491. diffneusim/models/fullbody_meshes/4mc.stl +0 -0
  492. diffneusim/models/fullbody_meshes/4midph.stl +0 -0
  493. diffneusim/models/fullbody_meshes/4proxph.stl +0 -0
  494. diffneusim/models/fullbody_meshes/5distph.stl +0 -0
  495. diffneusim/models/fullbody_meshes/5mc.stl +0 -0
  496. diffneusim/models/fullbody_meshes/5midph.stl +0 -0
  497. diffneusim/models/fullbody_meshes/5proxph.stl +0 -0
  498. diffneusim/models/fullbody_meshes/NOTICE +2 -0
  499. diffneusim/models/fullbody_meshes/capitate.stl +0 -0
  500. diffneusim/models/fullbody_meshes/clavicle.stl +0 -0
  501. diffneusim/models/fullbody_meshes/hamate.stl +0 -0
  502. diffneusim/models/fullbody_meshes/hat_cervical.stl +0 -0
  503. diffneusim/models/fullbody_meshes/hat_jaw.stl +0 -0
  504. diffneusim/models/fullbody_meshes/hat_skull.stl +0 -0
  505. diffneusim/models/fullbody_meshes/humerus.stl +0 -0
  506. diffneusim/models/fullbody_meshes/l_bofoot.stl +0 -0
  507. diffneusim/models/fullbody_meshes/l_femur.stl +0 -0
  508. diffneusim/models/fullbody_meshes/l_fibula.stl +0 -0
  509. diffneusim/models/fullbody_meshes/l_foot.stl +0 -0
  510. diffneusim/models/fullbody_meshes/l_patella.stl +0 -0
  511. diffneusim/models/fullbody_meshes/l_pelvis.stl +0 -0
  512. diffneusim/models/fullbody_meshes/l_talus.stl +0 -0
  513. diffneusim/models/fullbody_meshes/l_tibia.stl +0 -0
  514. diffneusim/models/fullbody_meshes/lumbar1.stl +0 -0
  515. diffneusim/models/fullbody_meshes/lumbar2.stl +0 -0
  516. diffneusim/models/fullbody_meshes/lumbar3.stl +0 -0
  517. diffneusim/models/fullbody_meshes/lumbar4.stl +0 -0
  518. diffneusim/models/fullbody_meshes/lumbar5.stl +0 -0
  519. diffneusim/models/fullbody_meshes/lunate.stl +0 -0
  520. diffneusim/models/fullbody_meshes/pisiform.stl +0 -0
  521. diffneusim/models/fullbody_meshes/r_bofoot.stl +0 -0
  522. diffneusim/models/fullbody_meshes/r_femur.stl +0 -0
  523. diffneusim/models/fullbody_meshes/r_fibula.stl +0 -0
  524. diffneusim/models/fullbody_meshes/r_foot.stl +0 -0
  525. diffneusim/models/fullbody_meshes/r_patella.stl +0 -0
  526. diffneusim/models/fullbody_meshes/r_pelvis.stl +0 -0
  527. diffneusim/models/fullbody_meshes/r_talus.stl +0 -0
  528. diffneusim/models/fullbody_meshes/r_tibia.stl +0 -0
  529. diffneusim/models/fullbody_meshes/radius.stl +0 -0
  530. diffneusim/models/fullbody_meshes/sacrum.stl +0 -0
  531. diffneusim/models/fullbody_meshes/scaphoid.stl +0 -0
  532. diffneusim/models/fullbody_meshes/scapula.stl +0 -0
  533. diffneusim/models/fullbody_meshes/thoracic10_s.stl +0 -0
  534. diffneusim/models/fullbody_meshes/thoracic11_s.stl +0 -0
  535. diffneusim/models/fullbody_meshes/thoracic12_s.stl +0 -0
  536. diffneusim/models/fullbody_meshes/thoracic1_s.stl +0 -0
  537. diffneusim/models/fullbody_meshes/thoracic2_s.stl +0 -0
  538. diffneusim/models/fullbody_meshes/thoracic3_s.stl +0 -0
  539. diffneusim/models/fullbody_meshes/thoracic4_s.stl +0 -0
  540. diffneusim/models/fullbody_meshes/thoracic5_s.stl +0 -0
  541. diffneusim/models/fullbody_meshes/thoracic6_s.stl +0 -0
  542. diffneusim/models/fullbody_meshes/thoracic7_s.stl +0 -0
  543. diffneusim/models/fullbody_meshes/thoracic8_s.stl +0 -0
  544. diffneusim/models/fullbody_meshes/thoracic9_s.stl +0 -0
  545. diffneusim/models/fullbody_meshes/thorax.stl +0 -0
  546. diffneusim/models/fullbody_meshes/thumbdist.stl +0 -0
  547. diffneusim/models/fullbody_meshes/thumbprox.stl +0 -0
  548. diffneusim/models/fullbody_meshes/trapezium.stl +0 -0
  549. diffneusim/models/fullbody_meshes/trapezoid.stl +0 -0
  550. diffneusim/models/fullbody_meshes/triquetrum.stl +0 -0
  551. diffneusim/models/fullbody_meshes/ulna.stl +0 -0
  552. diffneusim/models/source/myo_fullbody/UPSTREAM.md +91 -0
  553. diffneusim/models/source/myoleg/UPSTREAM.md +52 -0
  554. diffneusim/models/source/unitree_g1/LICENSE.mjlab +202 -0
  555. diffneusim/models/source/unitree_g1/UPSTREAM.md +38 -0
  556. diffneusim/models/source/unitree_g1/assets/head_link.STL +0 -0
  557. diffneusim/models/source/unitree_g1/assets/left_ankle_pitch_link.STL +0 -0
  558. diffneusim/models/source/unitree_g1/assets/left_ankle_roll_link.STL +0 -0
  559. diffneusim/models/source/unitree_g1/assets/left_elbow_link.STL +0 -0
  560. diffneusim/models/source/unitree_g1/assets/left_hip_pitch_link.STL +0 -0
  561. diffneusim/models/source/unitree_g1/assets/left_hip_roll_link.STL +0 -0
  562. diffneusim/models/source/unitree_g1/assets/left_hip_yaw_link.STL +0 -0
  563. diffneusim/models/source/unitree_g1/assets/left_knee_link.STL +0 -0
  564. diffneusim/models/source/unitree_g1/assets/left_rubber_hand.STL +0 -0
  565. diffneusim/models/source/unitree_g1/assets/left_shoulder_pitch_link.STL +0 -0
  566. diffneusim/models/source/unitree_g1/assets/left_shoulder_roll_link.STL +0 -0
  567. diffneusim/models/source/unitree_g1/assets/left_shoulder_yaw_link.STL +0 -0
  568. diffneusim/models/source/unitree_g1/assets/left_wrist_pitch_link.STL +0 -0
  569. diffneusim/models/source/unitree_g1/assets/left_wrist_roll_link.STL +0 -0
  570. diffneusim/models/source/unitree_g1/assets/left_wrist_yaw_link.STL +0 -0
  571. diffneusim/models/source/unitree_g1/assets/logo_link.STL +0 -0
  572. diffneusim/models/source/unitree_g1/assets/pelvis.STL +0 -0
  573. diffneusim/models/source/unitree_g1/assets/pelvis_contour_link.STL +0 -0
  574. diffneusim/models/source/unitree_g1/assets/right_ankle_pitch_link.STL +0 -0
  575. diffneusim/models/source/unitree_g1/assets/right_ankle_roll_link.STL +0 -0
  576. diffneusim/models/source/unitree_g1/assets/right_elbow_link.STL +0 -0
  577. diffneusim/models/source/unitree_g1/assets/right_hip_pitch_link.STL +0 -0
  578. diffneusim/models/source/unitree_g1/assets/right_hip_roll_link.STL +0 -0
  579. diffneusim/models/source/unitree_g1/assets/right_hip_yaw_link.STL +0 -0
  580. diffneusim/models/source/unitree_g1/assets/right_knee_link.STL +0 -0
  581. diffneusim/models/source/unitree_g1/assets/right_rubber_hand.STL +0 -0
  582. diffneusim/models/source/unitree_g1/assets/right_shoulder_pitch_link.STL +0 -0
  583. diffneusim/models/source/unitree_g1/assets/right_shoulder_roll_link.STL +0 -0
  584. diffneusim/models/source/unitree_g1/assets/right_shoulder_yaw_link.STL +0 -0
  585. diffneusim/models/source/unitree_g1/assets/right_wrist_pitch_link.STL +0 -0
  586. diffneusim/models/source/unitree_g1/assets/right_wrist_roll_link.STL +0 -0
  587. diffneusim/models/source/unitree_g1/assets/right_wrist_yaw_link.STL +0 -0
  588. diffneusim/models/source/unitree_g1/assets/torso_link_rev_1_0.STL +0 -0
  589. diffneusim/models/source/unitree_g1/assets/waist_roll_link_rev_1_0.STL +0 -0
  590. diffneusim/models/source/unitree_g1/assets/waist_yaw_link_rev_1_0.STL +0 -0
  591. diffneusim/models/source/unitree_g1/dump_mjlab_reference.py +30 -0
  592. diffneusim/models/source/unitree_g1/g1.xml +308 -0
  593. diffneusim/models/source/unitree_g1/g1_constants.py +298 -0
  594. diffneusim/models/source/unitree_g1/mjlab_compiled_reference.json +857 -0
  595. diffneusim/models/unitree_g1.dnmodel +4393 -0
  596. diffneusim/models/unitree_g1_selfcol.dnmodel +20824 -0
  597. diffneusim/rl/__init__.py +2 -0
  598. diffneusim/rl/dynsyn_layer.py +146 -0
  599. diffneusim/rl/footstep_plan.py +337 -0
  600. diffneusim/rl/g1_bm_env.py +572 -0
  601. diffneusim/rl/g1_bm_eval.py +168 -0
  602. diffneusim/rl/g1_bm_fused.py +275 -0
  603. diffneusim/rl/g1_bm_ppo.py +622 -0
  604. diffneusim/rl/g1_bm_sapo.py +551 -0
  605. diffneusim/rl/g1_ppo.py +395 -0
  606. diffneusim/rl/g1_sapo_soft.py +240 -0
  607. diffneusim/rl/g1_soft_env.py +452 -0
  608. diffneusim/rl/g1_soft_grad.py +145 -0
  609. diffneusim/rl/geyer_curves_torch.py +108 -0
  610. diffneusim/rl/gpu_fullbody_vec_env.py +1241 -0
  611. diffneusim/rl/imitation.py +2027 -0
  612. diffneusim/rl/imitation_reward_v2.py +248 -0
  613. diffneusim/rl/imitation_reward_v3.py +349 -0
  614. diffneusim/rl/latent_task.py +175 -0
  615. diffneusim/rl/llc_reward.py +316 -0
  616. diffneusim/rl/millard_curves_torch.py +154 -0
  617. diffneusim/rl/mirror_symmetry.py +212 -0
  618. diffneusim/rl/model_path.py +35 -0
  619. diffneusim/rl/mvae_recon.py +123 -0
  620. diffneusim/rl/nets_shac.py +599 -0
  621. diffneusim/rl/reset_pool.py +154 -0
  622. diffneusim/rl/sapo_capture.py +873 -0
  623. diffneusim/rl/sapo_vec.py +1051 -0
  624. diffneusim/rl/shac_vec.py +346 -0
  625. diffneusim/rl/state_prior.py +151 -0
  626. diffneusim/rl/step_library.py +105 -0
  627. diffneusim/rl/task_walk_env.py +1793 -0
  628. diffneusim/rl/task_walk_reward.py +3300 -0
  629. diffneusim/run.py +23 -0
  630. diffneusim/run_env.py +46 -0
  631. diffneusim/tasks/__init__.py +147 -0
  632. diffneusim/tasks/legacy_names.py +63 -0
  633. diffneusim/tasks/paths.py +79 -0
  634. diffneusim/tasks/settings.py +202 -0
  635. diffneusim/third_party/instantmimic_947430ee/LICENSE +202 -0
  636. diffneusim/third_party/instantmimic_947430ee/NOTICE +19 -0
  637. diffneusim/third_party/instantmimic_947430ee/README.md +31 -0
  638. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/benchmark_protocol.py +106 -0
  639. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/metrics.py +214 -0
  640. diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/reference.py +513 -0
  641. diffneusim/third_party/instantmimic_947430ee/instantmimic/motion/quaternion.py +193 -0
  642. diffneusim/train/__init__.py +0 -0
  643. diffneusim/train/eval_ckpt.py +239 -0
  644. diffneusim/train/eval_mimic.py +133 -0
  645. diffneusim/train/gait_report.py +203 -0
  646. diffneusim/train/gcot_chain.py +51 -0
  647. diffneusim/train/levers.py +135 -0
  648. diffneusim/train/masked_reset.py +314 -0
  649. diffneusim/train/rl_algorithm_suite.py +917 -0
  650. diffneusim/train/train14.py +240 -0
  651. diffneusim/train/train_tw14.py +674 -0
  652. diffneusim/viz/__init__.py +5 -0
  653. diffneusim/viz/__main__.py +41 -0
  654. diffneusim/viz/camera.py +115 -0
  655. diffneusim/viz/dnrec.py +118 -0
  656. diffneusim/viz/dnrec_io.py +686 -0
  657. diffneusim/viz/hud.py +565 -0
  658. diffneusim/viz/meshes.py +458 -0
  659. diffneusim/viz/play.py +237 -0
  660. diffneusim/viz/record.py +74 -0
  661. diffneusim/viz/render.py +1402 -0
  662. diffneusim/viz/renderer.py +268 -0
  663. diffneusim/viz/rl_env_render.py +635 -0
  664. diffneusim/viz/snapshot.py +54 -0
  665. diffneusim/viz/strobe.py +124 -0
  666. diffneusim/viz/to_mp4.py +58 -0
  667. diffneusim/viz/ui.py +481 -0
  668. diffneusim/viz/viewer.py +2086 -0
  669. diffneusim-1.0.0.dist-info/METADATA +226 -0
  670. diffneusim-1.0.0.dist-info/RECORD +682 -0
  671. diffneusim-1.0.0.dist-info/WHEEL +5 -0
  672. diffneusim-1.0.0.dist-info/licenses/LICENSE +201 -0
  673. diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-ARMS-hand-wrist-4.3.txt +20 -0
  674. diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-MoBL-ARMS.txt +25 -0
  675. diffneusim-1.0.0.dist-info/licenses/LICENSES/CC-BY-3.0-OpenSim-geometry.txt +25 -0
  676. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Christophy2012-lumbarspine.txt +10 -0
  677. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lai2017-model-high-flex.txt +10 -0
  678. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lee2015-hand_muscle.txt +11 -0
  679. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Rajagopal2016-full_body.txt +11 -0
  680. diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Uhlrich2022-fbmodpassivecal.txt +10 -0
  681. diffneusim-1.0.0.dist-info/licenses/NOTICE +274 -0
  682. diffneusim-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,47 @@
1
+ #pragma once
2
+ // The body a D16 binding compiles (2026-11-06; tools/d16_bodies/PORT_DESIGN.md section 5). A binding first includes either its
3
+ // generated x14 header, as it always has, or, in a build with -DD16_BODY_HEADER="soft/gpu/generated/body_<tag>.cuh", that body's header
4
+ // (tools/d16_bodies/gen_body.py), which includes its x14 header, defines D16_X14_NS and defines every value below. This file then gives
5
+ // the 14x's values, the literals these names replace, so a 14x build preprocesses to the same tokens as before
6
+ // (tools/d16_bodies/token_check.py). They are macros, not constexpr variables, for that reason: a new declaration is a new token.
7
+ // NQ, NV, NM the state's sizes
8
+ // NS, MKD, NSLOT k_mus' template sizes: site capacity, the staging stride (the case's g_ent holds lane * MKD + k), pose slots
9
+ // NPOSE the tape's POSE block: kernel P's bodies
10
+ // NBALL, BQ*, BD* the balls' qpos and dof addresses (X14Opts)
11
+ // NPR the law's contact pairs (the tape's pair field)
12
+ // NTRI, NTRI4 L_H's entries, and rounded up to 4 for rinv's place behind them in tree14's accumulators (adj14.cuh K14)
13
+ // TAPE_*, CTL_WORDS the tape record's values the bindings assert; a body header's come from the same layout rule (core/soft/tape.h)
14
+ #if !defined(D16_BODY_HEADER)
15
+ #include "x14_rowcf.h" // D16_X14_ROWCF (deck-only): the row's closed form on the 14x (PREREG_X14ROWCF.md)
16
+ #define D16_BODY_NQ 40
17
+ #define D16_BODY_NV 37
18
+ #define D16_BODY_NM 356
19
+ #define D16_BODY_NS 10
20
+ #define D16_BODY_MKD 6
21
+ #define D16_BODY_NSLOT 152
22
+ #define D16_BODY_NPOSE 66
23
+ #define D16_BODY_NBALL 2
24
+ #define D16_BODY_BQ0 24
25
+ #define D16_BODY_BQ1 32
26
+ #define D16_BODY_BD0 23
27
+ #define D16_BODY_BD1 30
28
+ #define D16_BODY_NPR 155
29
+ #define D16_BODY_NTRI 703
30
+ #define D16_BODY_NTRI4 704
31
+ #define D16_BODY_TAPE_WORDS 1792
32
+ #define D16_BODY_TAPE_LH 224
33
+ #define D16_BODY_TAPE_POSE 928
34
+ #define D16_BODY_TAPE_MUS 1408
35
+ #define D16_BODY_CTL_WORDS 736
36
+ #else
37
+ #if defined(D16_X14_ROWCF) // (PREREG_X14ROWCF.md) a body header sets D16_BODY_ROW_CF itself (gen_body.py --row-cf)
38
+ #error "D16_X14_ROWCF is the 14x's lever; a body build takes its header's D16_BODY_ROW_CF"
39
+ #endif
40
+ #if !defined(D16_BODY_NQ) || !defined(D16_BODY_NV) || !defined(D16_BODY_NM) || !defined(D16_BODY_NS) || !defined(D16_BODY_MKD) || \
41
+ !defined(D16_BODY_NSLOT) || !defined(D16_BODY_NPOSE) || !defined(D16_BODY_NBALL) || !defined(D16_BODY_BQ0) || !defined(D16_BODY_BQ1) || \
42
+ !defined(D16_BODY_BD0) || !defined(D16_BODY_BD1) || !defined(D16_BODY_NPR) || !defined(D16_BODY_NTRI) || !defined(D16_BODY_NTRI4) || \
43
+ !defined(D16_BODY_TAPE_WORDS) || !defined(D16_BODY_TAPE_LH) || !defined(D16_BODY_TAPE_POSE) || !defined(D16_BODY_TAPE_MUS) || \
44
+ !defined(D16_BODY_CTL_WORDS) || !defined(D16_X14_NS)
45
+ #error "a body header must define every D16_BODY_ value and D16_X14_NS (tools/d16_bodies/gen_body.py)"
46
+ #endif
47
+ #endif
@@ -0,0 +1,458 @@
1
+ #pragma once
2
+ // Portions of this file are derived from NablaEngine (https://github.com/OamIcs/NablaEngine at 70d0c8c,
3
+ // src/nablaengine/g1_engine/source.py: chol_solve_bcast's register-row factor with the transposed tail rows, the column
4
+ // broadcast, the pivot lookahead and the rsqrt + Newton reciprocal; chol_resolve / chol_back32's blocked triangular solve),
5
+ // Copyright 2026 The NablaEngine Authors, licensed under the Apache License, Version 2.0. Changed by this project: templated on
6
+ // the scalar (double keeps sqrt and division), a pivot under mindiag clamped to mindiag with a count and its column below zeroed
7
+ // (not MuJoCo's rule, see below), the factor separate from the solve with stored reciprocal pivots, a caller-provided
8
+ // double-buffered column. See core/soft/NOTICE.md.
9
+ // D16 shared Cholesky for one world per 32-thread block (engine C, 2026-11-02; for L3's Newton and implicitfast factors,
10
+ // kernel P's chol(M) and the adjoint's L_H / L_Q solves). A symmetric positive matrix of order NV, 32 < NV <= 37 (the G1's 35,
11
+ // the 14x's 37), as its
12
+ // packed lower triangle TRI(i, j) = i (i + 1) / 2 + j in shared memory. Templated on the scalar T.
13
+ //
14
+ // factor_regs the factor from row registers (pivot lookahead, rsqrt + Newton for float, a double-buffered column) (lane r: row r < 32; the tail rows 32.. transposed; their NT x NT block on
15
+ // every lane), so a caller that assembles the matrix in registers skips the shared round trip
16
+ // factor the same, loading the registers from L
17
+ // factor_fwd the factor with the forward solve fused in (v3g); solve_bwd the backward half after it (column by
18
+ // column, v3i); solve_fwd the forward half alone, column by column (v3j)
19
+ // set_rinv the reciprocal pivots of a factor computed elsewhere (e.g. kernel P's chol(M) in the hand)
20
+ // update a rank-1 update / downdate of a factor in place (mju_cholUpdate's operations)
21
+ // solve x = (L L')^-1 x, blocked by 8 rows (one shuffle round per block, the diagonal block solved redundantly on
22
+ // every lane), multiplying by the stored reciprocal pivots
23
+ //
24
+ // A pivot under mindiag (the engine's kernels pass 1e-15, mjMINVAL) becomes mindiag and is counted, as in mju_cholFactor, and its
25
+ // column below is then zeroed, which is NOT MuJoCo's rule: mju_cholFactor keeps that column, scaled by 1 / sqrt(mindiag), and so do
26
+ // its sparse and numeric factors (MuJoCo 3.10.0, engine_util_solve.c:33-62, :143-183, :294-366). newton.h's chol_factor, the host
27
+ // reference, zeroes it as this does. This factor and MuJoCo's differ only at a clamped pivot, which is why the count is returned.
28
+ // update below keeps the column, as mju_cholUpdate does. Right-looking:
29
+ // at step k, lane r holds row r shifted so that a[m] is entry (r, k + m) (every register index a compile-time constant); the
30
+ // column below the pivot goes through shared memory once (col, 16-byte aligned) and is read back four entries per load
31
+ // (NablaEngine's chol_solve_bcast scheme). The factor writes L (true diagonal) and rinv[k] = 1 / L[k][k]. Deterministic: fixed
32
+ // lanes, no atomics; the summation order differs from MuJoCo's left-looking dots (roundoff only).
33
+ #include <cuda_runtime.h>
34
+
35
+ namespace js::soft::gpu::chol {
36
+
37
+ constexpr unsigned kFull = 0xffffffffu;
38
+ __host__ __device__ constexpr int tri(int i, int j) { return i * (i + 1) / 2 + j; }
39
+
40
+ __device__ __forceinline__ void load4(const float* p, float* o) {
41
+ #if defined(D16_CPU_STANDIN) // (tools/d16_bodies/cpu_cuda: a device's vector access faults on a misaligned address, a CPU's does not)
42
+ cpu_cuda_align16(p, "chol::load4");
43
+ #endif
44
+ const float4 v = *reinterpret_cast<const float4*>(p);
45
+ o[0] = v.x; o[1] = v.y; o[2] = v.z; o[3] = v.w;
46
+ }
47
+ __device__ __forceinline__ void load4(const double* p, double* o) {
48
+ #if defined(D16_CPU_STANDIN)
49
+ cpu_cuda_align16(p, "chol::load4");
50
+ #endif
51
+ const double2 a = *reinterpret_cast<const double2*>(p), b = *reinterpret_cast<const double2*>(p + 2);
52
+ o[0] = a.x; o[1] = a.y; o[2] = b.x; o[3] = b.y;
53
+ }
54
+
55
+ __device__ __forceinline__ void store4(float* p, const float* v) {
56
+ #if defined(D16_CPU_STANDIN)
57
+ cpu_cuda_align16(p, "chol::store4");
58
+ #endif
59
+ *reinterpret_cast<float4*>(p) = make_float4(v[0], v[1], v[2], v[3]);
60
+ }
61
+ __device__ __forceinline__ void store4(double* p, const double* v) {
62
+ #if defined(D16_CPU_STANDIN)
63
+ cpu_cuda_align16(p, "chol::store4");
64
+ #endif
65
+ reinterpret_cast<double2*>(p)[0] = make_double2(v[0], v[1]);
66
+ reinterpret_cast<double2*>(p)[1] = make_double2(v[2], v[3]);
67
+ }
68
+
69
+ // a pivot's square root and its reciprocal: float rsqrt + one Newton step (the pivot chain's latency; ~1 ulp); double the
70
+ // correctly rounded sqrt and division (the f64 correctness gate)
71
+ __device__ __forceinline__ void pivot_inv(float piv, float& d, float& inv) {
72
+ float r = rsqrtf(piv);
73
+ r = r * fmaf(-0.5f * piv * r, r, 1.5f);
74
+ inv = r;
75
+ d = piv * r;
76
+ }
77
+ __device__ __forceinline__ void pivot_inv(double piv, double& d, double& inv) {
78
+ d = sqrt(piv);
79
+ inv = 1.0 / d;
80
+ }
81
+
82
+ #if defined(D16_NV_LE32) // a body with no tail rows (tools/d16_bodies/PORT_DESIGN.md section 6)
83
+ #include "chol_small.cuh"
84
+ #else
85
+ template <int NV> struct Dims {
86
+ static_assert(NV > 32 && NV <= 37, "rows 0..31 on the lanes, a tail of 1..5 rows (on every lane: NT + NT (NT + 1) / 2 registers)");
87
+ static constexpr int NT = NV - 32, NTB = NT * (NT + 1) / 2;
88
+ };
89
+
90
+ // Factor from registers; a, tt, tb are consumed. L (shared, packed) receives the factor, rinv (shared, NV) the reciprocal
91
+ // pivots, col0 / col1 (shared, 32 entries each, 16-byte aligned) the column broadcast's double buffer. Returns the number of
92
+ // pivots clamped to mindiag (uniform). The pivot chain does not wait for the broadcast: lane k + 1 forms its next pivot
93
+ // dn = a[1] - l l from its own entries as soon as it has its l (NablaEngine's chol_solve_bcast); the trailing update forms the
94
+ // same entry with the same fused operation, so both are the same bits.
95
+ // RHS (compile time, v3g): the forward solve fused in (NablaEngine's chol_solve_bcast form): lane k scales its y_k by the
96
+ // pivot's reciprocal and y_k is broadcast with the step; on return b (shared NV vector) holds L^-1 b, and solve_bwd finishes
97
+ // x = (L L')^-1 b. A compile-time flag, not a runtime test: v3c-b's `if (b)` made every shuffle of the Newton loop a WARPSYNC
98
+ // call stub (L3_RESULTS.md 16:58).
99
+ template <class T, int NV, bool RHS = false>
100
+ __device__ __forceinline__ int factor_regs(T (&a)[32], T (&tt)[Dims<NV>::NT], T (&tb)[Dims<NV>::NTB], T* L, T* rinv, T* col0,
101
+ T* col1, T mindiag, int lane, T* b = nullptr) {
102
+ constexpr int NT = Dims<NV>::NT;
103
+ const int r = lane;
104
+ int nlow = 0;
105
+ T dn = a[0]; // lane k's pivot at step k: its diagonal after the updates of columns < k
106
+ T y = T(0), yt[NT];
107
+ if constexpr (RHS) {
108
+ y = b[r];
109
+ #pragma unroll
110
+ for (int t = 0; t < NT; ++t) yt[t] = b[32 + t];
111
+ }
112
+ __syncwarp();
113
+ #pragma unroll
114
+ for (int k = 0; k < 32; ++k) {
115
+ T piv = __shfl_sync(kFull, dn, k);
116
+ const bool low = piv < mindiag; // the same on every lane
117
+ if (low) { piv = mindiag; ++nlow; }
118
+ T d, inv;
119
+ pivot_inv(piv, d, inv);
120
+ T l = r > k && !low ? a[0] * inv : T(0);
121
+ if (k + 1 < 32) dn = fma(-l, l, a[1]); // lane k + 1: entry (k + 1, k + 1) after column k
122
+ if (r == k) { L[tri(k, k)] = d; rinv[k] = inv; }
123
+ else if (r > k) L[tri(r, k)] = l;
124
+ T lt[NT];
125
+ #pragma unroll
126
+ for (int t = 0; t < NT; ++t) {
127
+ const T v = __shfl_sync(kFull, tt[t], k);
128
+ lt[t] = low ? T(0) : v * inv;
129
+ }
130
+ if (r == k) {
131
+ #pragma unroll
132
+ for (int t = 0; t < NT; ++t) L[tri(32 + t, k)] = lt[t];
133
+ }
134
+ if constexpr (RHS) { // forward: y_k = (b_k - ...) / L_kk on lane k, then every later row loses l_r y_k
135
+ if (r == k) y *= inv;
136
+ const T yk = __shfl_sync(kFull, y, k);
137
+ if (r > k) y = fma(-l, yk, y);
138
+ #pragma unroll
139
+ for (int t = 0; t < NT; ++t) yt[t] = fma(-lt[t], yk, yt[t]);
140
+ }
141
+ T* col = (k & 1) ? col1 : col0; // double buffer: this one is rewritten at step k + 2, after step k + 1's __syncwarp
142
+ col[r] = l; // column k below the diagonal (0 on lanes r <= k)
143
+ __syncwarp();
144
+ #pragma unroll
145
+ for (int g = 0; g < 32; g += 4) {
146
+ if (g + 4 <= k + 1) continue; // compile time: the group lies at or left of the pivot
147
+ T c[4];
148
+ load4(col + g, c);
149
+ #pragma unroll
150
+ for (int m = 0; m < 4; ++m) {
151
+ const int j = g + m;
152
+ if (j > k) a[j - k - 1] = fma(-l, c[m], a[j - k]); // entry (r, j) -= l_r l_j, shifted left by one
153
+ }
154
+ }
155
+ #pragma unroll
156
+ for (int t = 0; t < NT; ++t) tt[t] = r > k ? tt[t] - lt[t] * l : tt[t];
157
+ #pragma unroll
158
+ for (int t = 0; t < NT; ++t)
159
+ #pragma unroll
160
+ for (int u = 0; u <= t; ++u) tb[t * (t + 1) / 2 + u] -= lt[t] * lt[u];
161
+ }
162
+ #pragma unroll
163
+ for (int t = 0; t < NT; ++t) { // the tail block, the same on every lane
164
+ T piv = tb[t * (t + 1) / 2 + t];
165
+ const bool low = piv < mindiag;
166
+ if (low) { piv = mindiag; ++nlow; }
167
+ T d, inv;
168
+ pivot_inv(piv, d, inv);
169
+ tb[t * (t + 1) / 2 + t] = d;
170
+ if (lane == 0) rinv[32 + t] = inv;
171
+ if constexpr (RHS) { // the tail's forward: its row t of the tail block is final here
172
+ #pragma unroll
173
+ for (int u = 0; u < t; ++u) yt[t] = fma(-tb[t * (t + 1) / 2 + u], yt[u], yt[t]);
174
+ yt[t] *= inv;
175
+ }
176
+ #pragma unroll
177
+ for (int v = t + 1; v < NT; ++v) tb[v * (v + 1) / 2 + t] = low ? T(0) : tb[v * (v + 1) / 2 + t] * inv;
178
+ #pragma unroll
179
+ for (int v = t + 1; v < NT; ++v)
180
+ #pragma unroll
181
+ for (int u = t + 1; u <= v; ++u) tb[v * (v + 1) / 2 + u] -= tb[v * (v + 1) / 2 + t] * tb[u * (u + 1) / 2 + t];
182
+ }
183
+ if (lane == 0) {
184
+ #pragma unroll
185
+ for (int t = 0; t < NT; ++t)
186
+ #pragma unroll
187
+ for (int u = 0; u <= t; ++u) L[tri(32 + t, 32 + u)] = tb[t * (t + 1) / 2 + u];
188
+ }
189
+ if constexpr (RHS) {
190
+ b[r] = y;
191
+ if (lane == 0) {
192
+ #pragma unroll
193
+ for (int t = 0; t < NT; ++t) b[32 + t] = yt[t];
194
+ }
195
+ }
196
+ __syncwarp();
197
+ return nlow;
198
+ }
199
+
200
+ // Factor of the matrix held in L (in place)
201
+ template <class T, int NV> __device__ __noinline__ int factor(T* L, T* rinv, T* col0, T* col1, T mindiag, int lane) {
202
+ constexpr int NT = Dims<NV>::NT, NTB = Dims<NV>::NTB;
203
+ const int r = lane;
204
+ T a[32], tt[NT], tb[NTB];
205
+ #pragma unroll
206
+ for (int j = 0; j < 32; ++j) a[j] = j <= r ? L[tri(r, j)] : T(0);
207
+ #pragma unroll
208
+ for (int t = 0; t < NT; ++t) {
209
+ tt[t] = L[tri(32 + t, r)];
210
+ #pragma unroll
211
+ for (int u = 0; u <= t; ++u) tb[t * (t + 1) / 2 + u] = L[tri(32 + t, 32 + u)];
212
+ }
213
+ return factor_regs<T, NV>(a, tt, tb, L, rinv, col0, col1, mindiag, lane);
214
+ }
215
+
216
+ // The factor of the matrix held in L (in place) with the forward solve fused in: on return b = L^-1 b (v3g; solve_bwd finishes)
217
+ template <class T, int NV>
218
+ __device__ __noinline__ int factor_fwd(T* L, T* rinv, T* col0, T* col1, T mindiag, int lane, T* b) {
219
+ constexpr int NT = Dims<NV>::NT, NTB = Dims<NV>::NTB;
220
+ const int r = lane;
221
+ T a[32], tt[NT], tb[NTB];
222
+ #pragma unroll
223
+ for (int j = 0; j < 32; ++j) a[j] = j <= r ? L[tri(r, j)] : T(0);
224
+ #pragma unroll
225
+ for (int t = 0; t < NT; ++t) {
226
+ tt[t] = L[tri(32 + t, r)];
227
+ #pragma unroll
228
+ for (int u = 0; u <= t; ++u) tb[t * (t + 1) / 2 + u] = L[tri(32 + t, 32 + u)];
229
+ }
230
+ return factor_regs<T, NV, true>(a, tt, tb, L, rinv, col0, col1, mindiag, lane, b);
231
+ }
232
+
233
+ // rinv[k] = 1 / L[k][k] for a factor computed elsewhere
234
+ template <class T, int NV> __device__ __forceinline__ void set_rinv(const T* L, T* rinv, int lane) {
235
+ for (int k = lane; k < NV; k += 32) rinv[k] = T(1) / L[tri(k, k)];
236
+ __syncwarp();
237
+ }
238
+
239
+ // Rank-1 update or downdate of a factor in place, L L' +- x x' (mju_cholUpdate, engine_util_solve.c:104-144; MuJoCo's
240
+ // HessianIncremental calls it per row whose zone changed). x is held by row owner: lane r has x[r] in x0 and, for r < NV - 32,
241
+ // x[32 + r] in x1; both are consumed. Column k in order: skipped when x[k] is exactly 0 (a voted uniform branch: x[k] is
242
+ // broadcast); tmp = L_kk^2 +- x_k^2, clamped to mindiag with a count; r = sqrt(tmp); each row i > k: L_ik = (L_ik +- s x_i) / c,
243
+ // then x_i = c x_i - s L_ik, with c = r / L_kk and s = x_k / L_kk. MuJoCo's operations, with the stored reciprocal pivot in
244
+ // place of the divisions and pivot_inv on the chain. Returns the clamped count (uniform; MuJoCo's caller then refactors).
245
+ // v2 (no divergent regions: predicated stores and selects; an unrolled loop is priced by its instructions on the path,
246
+ // step 5b): every lane owns row A = lane; lanes 0..NT-1 also own a tail row B = 32 + lane through columns 0..NT-1, where their
247
+ // own rows finish, and then take it as row A, so columns NT..NV-1 update one row per lane. Row k's owner (lane k & 31, its row
248
+ // A) keeps L_kk and 1 / L_kk in registers and broadcasts them with x_k, so no lane reads a shared word another lane writes.
249
+ template <class T, int NV>
250
+ __device__ __noinline__ int update(T* L, T* rinv, T x0, T x1, bool plus, T mindiag, int lane) {
251
+ constexpr int NT = Dims<NV>::NT;
252
+ const bool hasB = lane < NT;
253
+ int rA = lane, bA = tri(lane, 0);
254
+ const int rB = hasB ? 32 + lane : 32, bB = tri(rB, 0);
255
+ T xA = x0, xB = hasB ? x1 : T(0);
256
+ T dA = L[tri(rA, rA)], iA = rinv[rA];
257
+ T dB = L[tri(rB, rB)], iB = rinv[rB];
258
+ T eA = L[bA], eB = L[bB]; // column 0's entries (row A's is its diagonal on lane 0: unused there)
259
+ const T sg = plus ? T(1) : T(-1);
260
+ int nlow = 0;
261
+ auto step = [&](int k, bool two) {
262
+ const T cA = eA, cB = eB;
263
+ eA = L[bA + (k + 1 < rA ? k + 1 : rA)]; // the next column's entry (a valid address of row A; column k never writes it)
264
+ if (two) eB = L[bB + k + 1];
265
+ const int src = k & 31;
266
+ const T xk = __shfl_sync(kFull, xA, src), Lkk = __shfl_sync(kFull, dA, src), rk = __shfl_sync(kFull, iA, src);
267
+ if (__all_sync(kFull, xk == T(0))) return;
268
+ T tmp = Lkk * Lkk + sg * (xk * xk);
269
+ const bool low = tmp < mindiag;
270
+ nlow += low;
271
+ tmp = low ? mindiag : tmp;
272
+ T rr, ri;
273
+ pivot_inv(tmp, rr, ri);
274
+ const T c = rr * rk, sv = xk * rk, cinv = Lkk * ri;
275
+ const bool below = rA > k, diag = rA == k;
276
+ const T lA = (cA + sg * (sv * xA)) * cinv;
277
+ if (below || diag) L[bA + k] = below ? lA : rr;
278
+ if (diag) rinv[k] = ri;
279
+ xA = below ? c * xA - sv * lA : xA;
280
+ dA = diag ? rr : dA;
281
+ iA = diag ? ri : iA;
282
+ if (two) { // the tail row B: always below column k < NT
283
+ const T lB = (cB + sg * (sv * xB)) * cinv;
284
+ if (hasB) L[bB + k] = lB;
285
+ xB = c * xB - sv * lB;
286
+ }
287
+ };
288
+ #pragma unroll
289
+ for (int k = 0; k < NT; ++k) step(k, true);
290
+ if (hasB) { rA = rB; bA = bB; xA = xB; dA = dB; iA = iB; eA = eB; } // row A finished: lanes 0..NT-1 take their tail row
291
+ #pragma unroll 1
292
+ for (int k = NT; k < NV; ++k) step(k, false);
293
+ __syncwarp();
294
+ return nlow;
295
+ }
296
+
297
+ // x = (L L')^-1 x in place; L and rinv in shared memory, x a shared NV vector
298
+ template <class T, int NV> __device__ __noinline__ void solve(const T* L, const T* rinv, T* x, int lane) {
299
+ constexpr int NT = Dims<NV>::NT;
300
+ const int r = lane;
301
+ T y = x[r], yt[NT];
302
+ #pragma unroll
303
+ for (int t = 0; t < NT; ++t) yt[t] = x[32 + t]; // the tail rows on every lane
304
+ __syncwarp();
305
+ // forward, L y = b: per block of 8 rows the block's own triangle on every lane, then each lane updates its row
306
+ #pragma unroll
307
+ for (int kb = 0; kb < 32; kb += 8) {
308
+ T yb[8];
309
+ #pragma unroll
310
+ for (int j = 0; j < 8; ++j) yb[j] = __shfl_sync(kFull, y, kb + j);
311
+ #pragma unroll
312
+ for (int j = 0; j < 8; ++j) {
313
+ T t = yb[j];
314
+ #pragma unroll
315
+ for (int i = 0; i < j; ++i) t -= L[tri(kb + j, kb + i)] * yb[i];
316
+ yb[j] = t * rinv[kb + j];
317
+ }
318
+ if (r >= kb + 8) {
319
+ const T* Lr = L + tri(r, kb);
320
+ #pragma unroll
321
+ for (int j = 0; j < 8; ++j) y -= Lr[j] * yb[j];
322
+ }
323
+ #pragma unroll
324
+ for (int j = 0; j < 8; ++j)
325
+ if (r == kb + j) y = yb[j];
326
+ #pragma unroll
327
+ for (int t = 0; t < NT; ++t) {
328
+ const T* Lt = L + tri(32 + t, kb);
329
+ #pragma unroll
330
+ for (int j = 0; j < 8; ++j) yt[t] -= Lt[j] * yb[j];
331
+ }
332
+ }
333
+ #pragma unroll
334
+ for (int t = 0; t < NT; ++t) { // the tail's own triangle
335
+ #pragma unroll
336
+ for (int u = 0; u < t; ++u) yt[t] -= L[tri(32 + t, 32 + u)] * yt[u];
337
+ yt[t] *= rinv[32 + t];
338
+ }
339
+ // backward, L' x = y: the tail first, then blocks of 8 from the bottom
340
+ #pragma unroll
341
+ for (int t = NT - 1; t >= 0; --t) {
342
+ #pragma unroll
343
+ for (int u = t + 1; u < NT; ++u) yt[t] -= L[tri(32 + u, 32 + t)] * yt[u];
344
+ yt[t] *= rinv[32 + t];
345
+ }
346
+ #pragma unroll
347
+ for (int t = 0; t < NT; ++t) y -= L[tri(32 + t, r)] * yt[t];
348
+ #pragma unroll
349
+ for (int kb = 24; kb >= 0; kb -= 8) {
350
+ T xb[8];
351
+ #pragma unroll
352
+ for (int j = 0; j < 8; ++j) xb[j] = __shfl_sync(kFull, y, kb + j);
353
+ #pragma unroll
354
+ for (int j = 7; j >= 0; --j) {
355
+ T t = xb[j];
356
+ #pragma unroll
357
+ for (int i = j + 1; i < 8; ++i) t -= L[tri(kb + i, kb + j)] * xb[i];
358
+ xb[j] = t * rinv[kb + j];
359
+ }
360
+ if (r < kb) {
361
+ #pragma unroll
362
+ for (int j = 0; j < 8; ++j) y -= L[tri(kb + j, r)] * xb[j];
363
+ }
364
+ #pragma unroll
365
+ for (int j = 0; j < 8; ++j)
366
+ if (r == kb + j) y = xb[j];
367
+ }
368
+ __syncwarp();
369
+ x[r] = y;
370
+ if (r == 0) {
371
+ #pragma unroll
372
+ for (int t = 0; t < NT; ++t) x[32 + t] = yt[t];
373
+ }
374
+ __syncwarp();
375
+ }
376
+
377
+ // the forward half: x = L^-1 x in place (v3j, for the iterations that reuse a factor). Rows 0..31 column by column: y_k / L_kk
378
+ // broadcast from lane k, rows r > k lose L_rk y_k (one shuffle and one row load per column); the tail rows then subtract their
379
+ // sums over rows 0..31 by warp reductions (3 row loads and 15 shuffles, against 96 broadcast loads column by column) and solve
380
+ // their own block. solve_fwd then solve_bwd replaces solve's 8-row blocks
381
+ // Tag (binding v10b, 2026-11-02): a caller outside k_post (the adjoint, Tag 1) gets its own instantiation. In the binding's
382
+ // one translation unit a noinline function shared by k_post (<= 128 registers) and the adjoint (168) is compiled once for
383
+ // both, and v10's shared solve_fwd / solve_bwd rescheduled k_post (SASS 1,884 lines different, +3% time, the same source).
384
+ template <class T, int NV, int Tag = 0> __device__ __noinline__ void solve_fwd(const T* L, const T* rinv, T* x, int lane) {
385
+ constexpr int NT = Dims<NV>::NT;
386
+ const int r = lane;
387
+ T y = x[r], yt[NT];
388
+ #pragma unroll
389
+ for (int t = 0; t < NT; ++t) yt[t] = x[32 + t];
390
+ const T myinv = rinv[r];
391
+ __syncwarp();
392
+ #pragma unroll 4
393
+ for (int k = 0; k < 32; ++k) {
394
+ const T yk = __shfl_sync(kFull, y * myinv, k);
395
+ const T lk = r > k ? L[tri(r, k)] : T(0);
396
+ y = r == k ? yk : fma(-lk, yk, y);
397
+ }
398
+ #pragma unroll
399
+ for (int t = 0; t < NT; ++t) {
400
+ T v = L[tri(32 + t, r)] * y;
401
+ #pragma unroll
402
+ for (int o = 16; o > 0; o >>= 1) v += __shfl_xor_sync(kFull, v, o);
403
+ yt[t] -= v;
404
+ }
405
+ #pragma unroll
406
+ for (int t = 0; t < NT; ++t) {
407
+ #pragma unroll
408
+ for (int u = 0; u < t; ++u) yt[t] -= L[tri(32 + t, 32 + u)] * yt[u];
409
+ yt[t] *= rinv[32 + t];
410
+ }
411
+ __syncwarp();
412
+ x[r] = y;
413
+ if (r == 0) {
414
+ #pragma unroll
415
+ for (int t = 0; t < NT; ++t) x[32 + t] = yt[t];
416
+ }
417
+ __syncwarp();
418
+ }
419
+
420
+ // the backward half: x = L'^-1 y in place (y = L^-1 b, from factor_fwd). The tail rows first (every lane), then rows 0..31
421
+ // column by column (v3i, NablaEngine's chol_solve_bcast backward): x_k = y_k / L_kk broadcast from lane k, rows r < k lose
422
+ // L_kr x_k; one shuffle and one row load per column (~70 MIO operations against the 8-row blocks' ~196)
423
+ template <class T, int NV, int Tag = 0> __device__ __noinline__ void solve_bwd(const T* L, const T* rinv, T* x, int lane) {
424
+ constexpr int NT = Dims<NV>::NT;
425
+ const int r = lane;
426
+ T y = x[r], yt[NT];
427
+ #pragma unroll
428
+ for (int t = 0; t < NT; ++t) yt[t] = x[32 + t];
429
+ const T myinv = rinv[r];
430
+ __syncwarp();
431
+ #pragma unroll
432
+ for (int t = NT - 1; t >= 0; --t) {
433
+ #pragma unroll
434
+ for (int u = t + 1; u < NT; ++u) yt[t] -= L[tri(32 + u, 32 + t)] * yt[u];
435
+ yt[t] *= rinv[32 + t];
436
+ }
437
+ #pragma unroll
438
+ for (int t = 0; t < NT; ++t) y -= L[tri(32 + t, r)] * yt[t];
439
+ #pragma unroll 4
440
+ for (int k = 31; k >= 0; --k) {
441
+ const T xk = __shfl_sync(kFull, y * myinv, k);
442
+ const T lk = r < k ? L[tri(k, r)] : T(0);
443
+ y = r == k ? xk : fma(-lk, xk, y);
444
+ }
445
+ __syncwarp();
446
+ x[r] = y;
447
+ if (r == 0) {
448
+ #pragma unroll
449
+ for (int t = 0; t < NT; ++t) x[32 + t] = yt[t];
450
+ }
451
+ __syncwarp();
452
+ }
453
+ #if defined(D16_NV_GT64) // a body with finger chains: the split factor over the dense core above (tools/d16_bodies/PHASE_B.md section 4)
454
+ #include "chol_split.cuh"
455
+ #endif
456
+ #endif // D16_NV_LE32
457
+
458
+ } // namespace js::soft::gpu::chol
@@ -0,0 +1,123 @@
1
+ // chol_rn.cuh's factor and solves for NV <= 32 (2026-11-05; tools/d16_bodies/PORT_DESIGN.md section 6). Included by chol_rn.cuh inside
2
+ // its namespace, in a build with -DD16_NV_LE32 only, in place of the 32 < NV <= 37 versions, so a build without it (the G1, the 14x)
3
+ // has the same tokens as before. The same algorithm with no tail rows: rows 0..NV-1 on lanes 0..NV-1, and the lanes >= NV own no row.
4
+ // Those lanes join every shuffle and sync, form l = 0 and write nothing: L, rinv and the second column buffer (the solver's Mv) hold
5
+ // exactly NV rows or entries, so a write from a lane >= NV would land past them. A column group's read past entry NV - 1 is ignored.
6
+ // solve and update are not here: no NV <= 32 path uses them, and a use fails at compile time.
7
+ template <int NV> struct Dims {
8
+ static_assert(NV >= 1 && NV <= 32, "chol_small.cuh is for NV <= 32 (-DD16_NV_LE32); NV 33..37 is chol_rn.cuh's");
9
+ static constexpr int NT = 1, NTB = 1; // the callers' tail arrays: length 1, unused here
10
+ };
11
+
12
+ template <class T, int NV, bool RHS = false>
13
+ __device__ __forceinline__ int factor_regs(T (&a)[32], T (&)[1], T (&)[1], T* L, T* rinv, T* col0, T* col1, T mindiag, int lane,
14
+ T* b = nullptr) {
15
+ const int r = lane;
16
+ const bool own = r < NV;
17
+ int nlow = 0;
18
+ T dn = a[0]; // lane k's pivot at step k: its diagonal after the updates of columns < k
19
+ T y = T(0);
20
+ if constexpr (RHS) {
21
+ if (own) y = b[r];
22
+ }
23
+ __syncwarp();
24
+ #pragma unroll
25
+ for (int k = 0; k < NV; ++k) {
26
+ T piv = __shfl_sync(kFull, dn, k);
27
+ const bool low = piv < mindiag; // the same on every lane
28
+ if (low) { piv = mindiag; ++nlow; }
29
+ T d, inv;
30
+ pivot_inv(piv, d, inv);
31
+ T l = own && r > k && !low ? a[0] * inv : T(0);
32
+ if (k + 1 < NV) dn = fma(-l, l, a[1]); // lane k + 1: entry (k + 1, k + 1) after column k
33
+ if (r == k) { L[tri(k, k)] = d; rinv[k] = inv; }
34
+ else if (own && r > k) L[tri(r, k)] = l;
35
+ if constexpr (RHS) { // forward: y_k = (b_k - ...) / L_kk on lane k, then every later row loses l_r y_k
36
+ if (r == k) y *= inv;
37
+ const T yk = __shfl_sync(kFull, y, k);
38
+ if (own && r > k) y = fma(-l, yk, y);
39
+ }
40
+ T* col = (k & 1) ? col1 : col0; // double buffer: this one is rewritten at step k + 2, after step k + 1's __syncwarp
41
+ if (own) col[r] = l; // column k below the diagonal (0 on lanes r <= k)
42
+ __syncwarp();
43
+ #pragma unroll
44
+ for (int g = 0; g < NV; g += 4) {
45
+ if (g + 4 <= k + 1) continue; // compile time: the group lies at or left of the pivot
46
+ T c[4];
47
+ load4(col + g, c);
48
+ #pragma unroll
49
+ for (int m = 0; m < 4; ++m) {
50
+ const int j = g + m;
51
+ if (j > k && j < NV) a[j - k - 1] = fma(-l, c[m], a[j - k]); // entry (r, j) -= l_r l_j, shifted left by one
52
+ }
53
+ }
54
+ }
55
+ if constexpr (RHS) {
56
+ if (own) b[r] = y;
57
+ }
58
+ __syncwarp();
59
+ return nlow;
60
+ }
61
+
62
+ // a lane's row of the matrix held in L, into the registers factor_regs takes (lanes >= NV: zeros)
63
+ template <class T, int NV> __device__ __forceinline__ void load_row(const T* L, T (&a)[32], int lane) {
64
+ #pragma unroll
65
+ for (int j = 0; j < 32; ++j) a[j] = lane < NV && j <= lane ? L[tri(lane, j)] : T(0);
66
+ }
67
+
68
+ // Factor of the matrix held in L (in place)
69
+ template <class T, int NV> __device__ __noinline__ int factor(T* L, T* rinv, T* col0, T* col1, T mindiag, int lane) {
70
+ T a[32], tt[1], tb[1];
71
+ load_row<T, NV>(L, a, lane);
72
+ return factor_regs<T, NV>(a, tt, tb, L, rinv, col0, col1, mindiag, lane);
73
+ }
74
+
75
+ // The factor of the matrix held in L (in place) with the forward solve fused in: on return b = L^-1 b
76
+ template <class T, int NV>
77
+ __device__ __noinline__ int factor_fwd(T* L, T* rinv, T* col0, T* col1, T mindiag, int lane, T* b) {
78
+ T a[32], tt[1], tb[1];
79
+ load_row<T, NV>(L, a, lane);
80
+ return factor_regs<T, NV, true>(a, tt, tb, L, rinv, col0, col1, mindiag, lane, b);
81
+ }
82
+
83
+ // rinv[k] = 1 / L[k][k] for a factor computed elsewhere
84
+ template <class T, int NV> __device__ __forceinline__ void set_rinv(const T* L, T* rinv, int lane) {
85
+ for (int k = lane; k < NV; k += 32) rinv[k] = T(1) / L[tri(k, k)];
86
+ __syncwarp();
87
+ }
88
+
89
+ // the forward half: x = L^-1 x in place, column by column (chol_rn.cuh's, rows 0..NV-1)
90
+ template <class T, int NV, int Tag = 0> __device__ __noinline__ void solve_fwd(const T* L, const T* rinv, T* x, int lane) {
91
+ const int r = lane;
92
+ const bool own = r < NV;
93
+ T y = own ? x[r] : T(0);
94
+ const T myinv = own ? rinv[r] : T(0);
95
+ __syncwarp();
96
+ #pragma unroll 4
97
+ for (int k = 0; k < NV; ++k) {
98
+ const T yk = __shfl_sync(kFull, y * myinv, k);
99
+ const T lk = own && r > k ? L[tri(r, k)] : T(0);
100
+ y = r == k ? yk : fma(-lk, yk, y);
101
+ }
102
+ __syncwarp();
103
+ if (own) x[r] = y;
104
+ __syncwarp();
105
+ }
106
+
107
+ // the backward half: x = L'^-1 y in place (y = L^-1 b, from factor_fwd), column by column
108
+ template <class T, int NV, int Tag = 0> __device__ __noinline__ void solve_bwd(const T* L, const T* rinv, T* x, int lane) {
109
+ const int r = lane;
110
+ const bool own = r < NV;
111
+ T y = own ? x[r] : T(0);
112
+ const T myinv = own ? rinv[r] : T(0);
113
+ __syncwarp();
114
+ #pragma unroll 4
115
+ for (int k = NV - 1; k >= 0; --k) {
116
+ const T xk = __shfl_sync(kFull, y * myinv, k);
117
+ const T lk = r < k ? L[tri(k, r)] : T(0);
118
+ y = r == k ? xk : fma(-lk, xk, y);
119
+ }
120
+ __syncwarp();
121
+ if (own) x[r] = y;
122
+ __syncwarp();
123
+ }