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,247 @@
1
+ #pragma once
2
+ // D16 (2026-11-02): the tree-sparse factor and solve of a matrix with M's sparsity (tools/d16/TREE_M_PREDICTION.md).
3
+ // A shared header: kernel P's qacc_smooth; k_post's lazy chol(M) and L_Q = M + h kd (diagonal kd: the same sparsity); d5's
4
+ // adjoint shell; the sparse L_Q tape item. (the chol_rn.cuh solves the DENSE H = M + J' D J.)
5
+ //
6
+ // Storage: packed sparse rows. Row i holds its ancestor-or-self dofs ascending (the generated header's kAnc / kNAnc), the
7
+ // diagonal last, at kRowOff[i] (NNZ words in all). A dof's ancestors form one chain, so the ancestor at position p has depth p
8
+ // and entry (x, y), y an ancestor-or-self of x, sits at kRowOff[x] + depth(y).
9
+ // The factor (in place): M = L' D L, MuJoCo's mj_factorM, leaves first, so there is no fill-in. Afterwards the diagonal holds
10
+ // D and an off-diagonal entry holds L[k][i] (L unit lower; i an ancestor of k); invD holds 1 / D. The eliminations of one
11
+ // height level (kHLev / kHOff: <= 4 dofs, independent branches) run together:
12
+ // A the updates M[x][y] -= sum_k M[k][x] M[k][y] / D_k over the level's eliminated k (x, y proper ancestors of k), from
13
+ // the generated items (kItems / kItemOff / kItemRows: u32 = slot (k, x) | slot (k, y) << 9 | k's index in the level
14
+ // << 18 | flush << 20 | valid << 21 | target slot << 22). Each target is owned by one lane, which sums its contributors
15
+ // in increasing k: a fixed order, no atomics.
16
+ // B the level's multipliers M[k][i] *= 1 / D_k; and the next level's reciprocal pivots
17
+ // The solve x = M^-1 b (in place in x): L' z = b leaves first (the same ordered sums into the ancestors), z / D, then
18
+ // L x = w root first (by depth).
19
+ //
20
+ // Step 5b (TREE_M_PREDICTION.md): specialized at compile time. Every level loop is unrolled through templates and every
21
+ // table entry on the chain is a constexpr (an immediate), so no index table is read at run time on the chain; only the
22
+ // per-lane update items (one u32 per item row) and the lane's own row offset / ancestor mask are loaded, off the chain.
23
+ // The rounded operations, their operands and their order are step 5's (16010b84), so the results are bit-identical.
24
+ // factor pivots: every lane computes the level's <= 4 reciprocals itself; A reads all its sources before its first write
25
+ // (sources: rows of the level's dofs; targets: rows of their strict ancestors); one __syncwarp per level
26
+ // solve forward by height and back by depth with the values moved by __shfl_sync (no shared memory on the chain)
27
+ // Lane-parallel inside one warp (one world); every write has one owner. The model header must be included first and its
28
+ // namespace named by D16_MODEL_NS; fk_rn.cuh provides the rn_* helpers.
29
+ #include <cstdint>
30
+ #include <type_traits>
31
+
32
+ #include "fk_rn.cuh"
33
+
34
+ #ifndef D16_MODEL_NS
35
+ #error "include the generated model header and define D16_MODEL_NS before tree_m.cuh"
36
+ #endif
37
+
38
+ // 0 (variant A): every update item loaded at the factor's entry (64 registers for the G1); 1 (variant B): each level's items
39
+ // one level ahead (fewer registers)
40
+ #ifndef D16_TREE_ITEMS_AHEAD
41
+ #define D16_TREE_ITEMS_AHEAD 0
42
+ #endif
43
+
44
+ namespace d16 {
45
+ namespace tree {
46
+ namespace TM = D16_MODEL_NS;
47
+
48
+ // ---- compile-time views of the generated tables ----
49
+ // nvcc: an element of a namespace-scope constexpr array may be used in device code inside a constexpr __host__ __device__
50
+ // function whose call is a constant expression. Every call below initializes a constexpr variable (or a static_assert).
51
+ namespace ct {
52
+ __host__ __device__ constexpr int hoff(int h) { return TM::kHOff[h]; }
53
+ __host__ __device__ constexpr int hlev(int i) { return TM::kHLev[i]; }
54
+ __host__ __device__ constexpr int nk(int h) { return TM::kHOff[h + 1] - TM::kHOff[h]; }
55
+ __host__ __device__ constexpr int nanc(int k) { return TM::kNAnc[k]; }
56
+ __host__ __device__ constexpr int rowoff(int k) { return TM::kRowOff[k]; }
57
+ __host__ __device__ constexpr int diag(int k) { return TM::kRowOff[k] + TM::kNAnc[k] - 1; }
58
+ __host__ __device__ constexpr unsigned long long panc(int k) { return TM::kAncMask[k] & ~(1ull << k); } // proper ancestors
59
+ __host__ __device__ constexpr int itemrows(int h) { return TM::kItemRows[h]; }
60
+ __host__ __device__ constexpr int rowsum(int h) { // item rows before level h
61
+ int s = 0;
62
+ for (int i = 0; i < h; ++i) s += TM::kItemRows[i];
63
+ return s;
64
+ }
65
+ // the tree facts the unrolled code relies on
66
+ __host__ __device__ constexpr bool rows_are_chains() {
67
+ for (int k = 0; k < TM::NV; ++k) {
68
+ if (TM::kDofDepth[k] != TM::kNAnc[k] - 1 || TM::kAnc[TM::MAXA * k + TM::kNAnc[k] - 1] != k) return false;
69
+ for (int p = 0; p < TM::kNAnc[k]; ++p) {
70
+ const int a = TM::kAnc[TM::MAXA * k + p];
71
+ if (a < 0 || TM::kDofDepth[a] != p || !((TM::kAncMask[k] >> a) & 1ull)) return false;
72
+ if (p > 0 && a <= TM::kAnc[TM::MAXA * k + p - 1]) return false;
73
+ }
74
+ }
75
+ return true;
76
+ }
77
+ __host__ __device__ constexpr bool levels_fit() {
78
+ for (int h = 0; h < TM::NH; ++h) {
79
+ if (nk(h) < 1 || nk(h) > 4 || TM::kItemOff[h] != 32 * rowsum(h)) return false;
80
+ for (int i = TM::kHOff[h]; i < TM::kHOff[h + 1]; ++i) // a level's dofs: no one an ancestor of another
81
+ for (int i2 = TM::kHOff[h]; i2 < TM::kHOff[h + 1]; ++i2)
82
+ if (i != i2 && ((TM::kAncMask[TM::kHLev[i]] >> TM::kHLev[i2]) & 1ull)) return false;
83
+ }
84
+ return TM::kHOff[TM::NH] == TM::NV;
85
+ }
86
+ } // namespace ct
87
+ static_assert(32 < TM::NV && TM::NV <= 64, "tree_m: every lane owns dof lane, lanes < NV - 32 also dof lane + 32");
88
+ static_assert(ct::rows_are_chains(), "tree_m: a row must list its ancestor chain ascending, position p at depth p");
89
+ static_assert(ct::levels_fit(), "tree_m: <= 4 independent dofs per height level, items contiguous by level");
90
+ static_assert(TM::NNZ < 512, "tree_m: 9-bit slots");
91
+
92
+ constexpr int NIR = ct::rowsum(TM::NH); // item rows in all (64 for the G1)
93
+
94
+ // a compile-time loop: f(std::integral_constant<int, I>) for I = B .. E - 1
95
+ template <int I, int E, class F> __device__ __forceinline__ void sfor(F&& f) {
96
+ if constexpr (I < E) {
97
+ f(std::integral_constant<int, I>{});
98
+ sfor<I + 1, E>(f);
99
+ }
100
+ }
101
+
102
+ // level H's items into wi (rows rowsum(H) .. + itemrows(H) - 1)
103
+ template <int H> __device__ __forceinline__ void load_items(uint32_t (&wi)[NIR > 0 ? NIR : 1], int lane) {
104
+ constexpr int r0 = ct::rowsum(H), nr = ct::itemrows(H);
105
+ #pragma unroll
106
+ for (int m = 0; m < nr; ++m) wi[r0 + m] = __ldg(&TM::dItems[32 * (r0 + m) + lane]);
107
+ }
108
+
109
+ // 1 / D_k for level H's dofs, in every lane (il[kk], kk the dof's index in the level); lane kk also stores it in invD
110
+ template <class T, int H> __device__ __forceinline__ void pivots(const T* Msp, T* invD, int lane, T (&il)[4]) {
111
+ constexpr int h0 = ct::hoff(H), n = ct::nk(H);
112
+ sfor<0, 4>([&](auto kc) {
113
+ constexpr int kk = decltype(kc)::value;
114
+ if constexpr (kk < n) {
115
+ constexpr int k = ct::hlev(h0 + kk), dg = ct::diag(k);
116
+ il[kk] = rn_div(T(1), Msp[dg]);
117
+ if (lane == kk) invD[k] = il[kk];
118
+ } else {
119
+ il[kk] = T(0);
120
+ }
121
+ });
122
+ }
123
+
124
+ // the factor, in place on Msp [NNZ]; invD [NV]: the reciprocal pivots (for the solve). invL: the scratch step 5 used, no
125
+ // longer touched (kept so the signature is stable). The caller has synced Msp; the factor ends with a __syncwarp.
126
+ template <class T> __device__ __forceinline__ void factor(T* Msp, T* invD, T* invL, int lane) {
127
+ (void)invL;
128
+ uint32_t wi[NIR > 0 ? NIR : 1];
129
+ #if D16_TREE_ITEMS_AHEAD
130
+ load_items<0>(wi, lane);
131
+ #else
132
+ sfor<0, TM::NH>([&](auto hc) { load_items<decltype(hc)::value>(wi, lane); });
133
+ #endif
134
+ T il[4];
135
+ pivots<T, 0>(Msp, invD, lane, il);
136
+ sfor<0, TM::NH>([&](auto hc) {
137
+ constexpr int H = decltype(hc)::value, h0 = ct::hoff(H), n = ct::nk(H), r0 = ct::rowsum(H), nr = ct::itemrows(H);
138
+ #if D16_TREE_ITEMS_AHEAD
139
+ if constexpr (H + 1 < TM::NH) load_items<H + 1>(wi, lane);
140
+ #endif
141
+ // A: the level's updates. All reads first: the sources are rows of level H's dofs and each target is read only by its
142
+ // owner lane before its one flush, so nothing read here is written in this level.
143
+ if constexpr (nr > 0) {
144
+ T p[nr], pt[nr];
145
+ #pragma unroll
146
+ for (int m = 0; m < nr; ++m) {
147
+ const uint32_t w = wi[r0 + m];
148
+ p[m] = RMUL(Msp[w & 511u], Msp[(w >> 9) & 511u]);
149
+ pt[m] = Msp[w >> 22]; // the target (every item carries its slot; an empty item reads slot 0, unused)
150
+ }
151
+ T acc = T(0);
152
+ #pragma unroll
153
+ for (int m = 0; m < nr; ++m) {
154
+ const uint32_t w = wi[r0 + m];
155
+ if (w & (1u << 21)) {
156
+ const uint32_t kk = (w >> 18) & 3u;
157
+ const T ik = kk == 0u ? il[0] : kk == 1u ? il[1] : kk == 2u ? il[2] : il[3];
158
+ acc = RFMA(p[m], ik, acc);
159
+ if (w & (1u << 20)) {
160
+ Msp[w >> 22] = RSUB(pt[m], acc);
161
+ acc = T(0);
162
+ }
163
+ }
164
+ }
165
+ }
166
+ __syncwarp();
167
+ // B: the level's multipliers (rows of level H: no reader until the solve), and the next level's pivots (their diagonals
168
+ // are final after A and the sync; level H + 1's A writes neither)
169
+ sfor<0, n>([&](auto kc) {
170
+ constexpr int kk = decltype(kc)::value, k = ct::hlev(h0 + kk), na = ct::nanc(k) - 1, ro = ct::rowoff(k);
171
+ if (lane < na) Msp[ro + lane] = RMUL(Msp[ro + lane], il[kk]);
172
+ });
173
+ if constexpr (H + 1 < TM::NH) pivots<T, H + 1>(Msp, invD, lane, il);
174
+ });
175
+ __syncwarp();
176
+ }
177
+
178
+ // x = M^-1 x for the factored Lsp (factor() above); lane l owns x[l] and x[l + 32]
179
+ template <class T> __device__ __forceinline__ void solve(const T* Lsp, const T* invD, T* x, int lane) {
180
+ constexpr unsigned FULL = 0xffffffffu;
181
+ const int j0 = lane, j1 = lane + 32;
182
+ const bool has1 = j1 < TM::NV;
183
+ const int j1c = has1 ? j1 : j0;
184
+ // the lane's own rows, for the back sweep: issued now, first used after the forward sweep
185
+ const unsigned long long am0 = __ldg(&TM::dAncMask[j0]) & ~(1ull << j0);
186
+ const unsigned long long am1 = has1 ? __ldg(&TM::dAncMask[j1c]) & ~(1ull << j1c) : 0ull;
187
+ const int ro0 = __ldg(&TM::dRowOff[j0]), ro1 = __ldg(&TM::dRowOff[j1c]);
188
+ T x0 = x[j0], x1 = has1 ? x[j1] : T(0);
189
+ // L' z = b, leaves first: z_j -= sum over the level's k (j a proper ancestor of k) of L[k][j] z_k, k increasing. z_k is
190
+ // final at its level (all its descendants are lower) and comes from its owner lane by shuffle.
191
+ sfor<0, TM::NH>([&](auto hc) {
192
+ constexpr int H = decltype(hc)::value, h0 = ct::hoff(H), n = ct::nk(H);
193
+ T a0 = T(0), a1 = T(0);
194
+ bool any0 = false, any1 = false;
195
+ sfor<0, n>([&](auto kc) {
196
+ constexpr int k = ct::hlev(h0 + decltype(kc)::value), ro = ct::rowoff(k);
197
+ constexpr unsigned long long pm = ct::panc(k);
198
+ const T zk = __shfl_sync(FULL, k < 32 ? x0 : x1, k & 31);
199
+ if ((pm >> j0) & 1ull) {
200
+ a0 = RFMA(Lsp[ro + __popcll(pm & ((1ull << j0) - 1ull))], zk, a0);
201
+ any0 = true;
202
+ }
203
+ if (has1 && ((pm >> j1) & 1ull)) {
204
+ a1 = RFMA(Lsp[ro + __popcll(pm & ((1ull << j1) - 1ull))], zk, a1);
205
+ any1 = true;
206
+ }
207
+ });
208
+ if (any0) x0 = RSUB(x0, a0);
209
+ if (any1) x1 = RSUB(x1, a1);
210
+ });
211
+ // w = z / D
212
+ x0 = RMUL(x0, invD[j0]);
213
+ if (has1) x1 = RMUL(x1, invD[j1]);
214
+ // L x = w, root first: x_k -= sum over k's proper ancestors a (increasing = by depth) of L[k][a] x_a. At depth d the dofs
215
+ // of depth d finish, then every deeper lane adds its depth-d ancestor's term (that ancestor's x by shuffle; L[k][a] at
216
+ // the row's position d).
217
+ const int d0 = __popcll(am0), d1 = has1 ? __popcll(am1) : -1;
218
+ unsigned long long m0 = am0, m1 = am1;
219
+ T b0 = T(0), b1 = T(0);
220
+ sfor<0, TM::MAXDEP + 1>([&](auto dc) {
221
+ constexpr int d = decltype(dc)::value;
222
+ if constexpr (d > 0) {
223
+ if (d0 == d) x0 = RSUB(x0, b0);
224
+ if (d1 == d) x1 = RSUB(x1, b1);
225
+ }
226
+ if constexpr (d < TM::MAXDEP) {
227
+ const int a0 = __ffsll(static_cast<long long>(m0)) - 1, a1 = __ffsll(static_cast<long long>(m1)) - 1;
228
+ const int s0 = (d0 > d ? a0 : 0) & 31, s1 = (d1 > d ? a1 : 0) & 31;
229
+ const T v00 = __shfl_sync(FULL, x0, s0), v01 = __shfl_sync(FULL, x1, s0);
230
+ const T v10 = __shfl_sync(FULL, x0, s1), v11 = __shfl_sync(FULL, x1, s1);
231
+ if (d0 > d) {
232
+ b0 = RFMA(Lsp[ro0 + d], a0 < 32 ? v00 : v01, b0);
233
+ m0 &= m0 - 1ull;
234
+ }
235
+ if (d1 > d) {
236
+ b1 = RFMA(Lsp[ro1 + d], a1 < 32 ? v10 : v11, b1);
237
+ m1 &= m1 - 1ull;
238
+ }
239
+ }
240
+ });
241
+ x[j0] = x0;
242
+ if (has1) x[j1] = x1;
243
+ __syncwarp();
244
+ }
245
+
246
+ } // namespace tree
247
+ } // namespace d16
@@ -0,0 +1,260 @@
1
+ // The 14x engine's kernels and their compile-time layout (2026-11-09; ENGINE_UNIFY_PLAN.md, the design rule of 11-09: GPU code may move
2
+ // if the GPU behaves exactly as before). This is bindings/soft14_engine_ext.cu's torch-free block, moved here VERBATIM so the CPU engine
3
+ // (tools/d16_unify/cpu_engine) compiles the very same kernels: the binding includes it at the same place, inside its anonymous namespace,
4
+ // so the preprocessed tokens of every pass are what they were (tools/d16_unify/token_eq.sh). A FRAGMENT, not a standalone header:
5
+ // include it once, inside an anonymous namespace, after the model header (D16_X14_NS), body14.cuh, kp14.cuh, l2x14.cuh, l3.cuh and k_mus.cuh.
6
+ // (The guard below is directive-only: it adds no token.)
7
+ #ifdef D16_X14_ENGINE_KERNELS_CUH
8
+ #error "x14_engine_kernels.cuh is a fragment: include it once"
9
+ #endif
10
+ #define D16_X14_ENGINE_KERNELS_CUH
11
+ namespace MD = D16_X14_NS;
12
+ namespace K = d16::kp14;
13
+ namespace L2 = d16::l2x14;
14
+ namespace l3 = js::soft::gpu::l3;
15
+ namespace sg = js::soft::gpu;
16
+ // NRH: the hand's rows and the row cap (L2::NR, 255; was 192). NRK: the big path's rows in shared memory, NRH rounded up to the
17
+ // solve's 32-row words (l3.cuh: RT = NR / 32 words per lane)
18
+ constexpr int NQ = MD::NQ, NV = MD::NV, NM = D16_BODY_NM, NR = 128, NRH = L2::NR, NRK = (NRH + 31) / 32 * 32, NC = L2::NC, KD = L2::KD;
19
+ constexpr int kStatW = 6;
20
+ constexpr js::soft::HandLayout HL = L2::HL;
21
+ static_assert(HL.nc == NC && HL.nr == NRH && HL.kdof == KD, "the hand k_pre14 writes is the one k_post reads");
22
+ #if defined(D16_NV_GT64) // B3c: k_post's layout (l3.cuh's six sites) is L2's, the split M block included, field by field
23
+ static_assert(js::soft::hand_layout_same(D16_L3_HAND_LAYOUT(NV, NC, NRH, KD), HL) && HL.ntri == ::d16::split::WORDS,
24
+ "k_post reads the hand at the layout L2 writes (l2x14::HL)");
25
+ #endif
26
+ static_assert(NRH == 255 && NRK == 256, "the 14x row cap (C, 2026-11-04)");
27
+ // the 14x options (bindings/soft_l3_test.cu X14Opts at f5a1368f): Euler, the limit guard, the two balls, the tape's nq / POSE
28
+ struct X14Opts {
29
+ static constexpr bool kEuler = true, kLimGuard = true;
30
+ static constexpr int kNball = D16_BODY_NBALL, kNq = D16_BODY_NQ, kNpose = D16_BODY_NPOSE;
31
+ static constexpr int kNmus = D16_BODY_NM; // the tape's MUS block (the request, 2026-11-03)
32
+ static constexpr bool kLq = false; // Euler: the 14x record has no L_Q block (tape.h tape_layout's lq)
33
+ static constexpr bool kLimitMask = true; // the record's clamp words hold k_pre14's active-limit mask: k_post leaves them
34
+ #if defined(D16_NV_GT64)
35
+ static constexpr int kNlim = MD::NLIM; // B3c: the mask's width, and the record's clamp words with it (l3.cuh OptNlim)
36
+ #endif
37
+ __host__ __device__ static constexpr int ball_q(int b) { return b == 0 ? D16_BODY_BQ0 : D16_BODY_BQ1; }
38
+ __host__ __device__ static constexpr int ball_d(int b) { return b == 0 ? D16_BODY_BD0 : D16_BODY_BD1; }
39
+ };
40
+ static_assert(MD::NROM == D16_BODY_NBALL && MD::kRomQadr[0] == D16_BODY_BQ0 && MD::kRomQadr[1] == D16_BODY_BQ1 && MD::kRomDadr[0] == D16_BODY_BD0 &&
41
+ MD::kRomDadr[1] == D16_BODY_BD1,
42
+ "X14Opts' ball addresses are the generated model's");
43
+ // the 14x instantiation of k_mus (sites 10, staging 6, slots 152); its taped form (k_mus_taped, the 4c1b09de) with a policy
44
+ #define KMUS14(T) sg::k_mus<T, D16_BODY_NS, D16_BODY_MKD, D16_BODY_NSLOT, NQ, NV, NM>
45
+ #define KMUS14T(T, P) sg::k_mus_taped<T, D16_BODY_NS, D16_BODY_MKD, D16_BODY_NSLOT, NQ, NV, NM, P>
46
+ // the 14x tape (the layout, 2026-11-03; core/soft/tape.h): the substep record and the per-control-step muscle record
47
+ #if defined(D16_NV_GT64) // B3c: a phase B record names its limit count and the split words (tape.h)
48
+ constexpr js::soft::TapeLayout TL14 = js::soft::tape_layout(NQ, NV, NC, NRH, X14Opts::kNpose, X14Opts::kNmus, X14Opts::kLq, MD::NLIM,
49
+ ::d16::split::WORDS);
50
+ #else
51
+ constexpr js::soft::TapeLayout TL14 = js::soft::tape_layout(NQ, NV, NC, NRH, X14Opts::kNpose, X14Opts::kNmus, X14Opts::kLq);
52
+ #endif
53
+ constexpr js::soft::TapeCtlLayout CL14 = js::soft::tape_ctl_layout(X14Opts::kNmus);
54
+ // three readers build the 14x record's layout: this binding (the writer's side), k_post's HandRows (l3.cuh, at the hand's NRH and
55
+ // X14Opts) and the adjoint (adj14.cuh). They must agree field by field (2026-11-04: they had drifted to separate literals).
56
+ constexpr bool tape_same(const js::soft::TapeLayout& a, const js::soft::TapeLayout& b) {
57
+ return a.words == b.words && a.hdr == b.hdr && a.flags == b.flags && a.clamp == b.clamp && a.zone == b.zone && a.con == b.con &&
58
+ a.qpos == b.qpos && a.qvel == b.qvel && a.qacc == b.qacc && a.qadv == b.qadv && a.LH == b.LH && a.LQ == b.LQ &&
59
+ a.pose == b.pose && a.mus == b.mus && a.n_clamp == b.n_clamp && a.n_zone == b.n_zone && a.n_con == b.n_con &&
60
+ a.maxcon == b.maxcon && a.maxrows == b.maxrows;
61
+ }
62
+ static_assert(tape_same(TL14, d16::adj14::TL14), "the adjoint reads the record the binding writes");
63
+ #if defined(D16_NV_GT64) // B3c: a phase B record names its limit count and the split words (tape.h)
64
+ static_assert(tape_same(TL14, js::soft::tape_layout(X14Opts::kNq, NV, NC, NRH, X14Opts::kNpose, X14Opts::kNmus, X14Opts::kLq, X14Opts::kNlim,
65
+ ::d16::split::WORDS)),
66
+ "k_post's HandRows writes the record at (X14Opts, NRH)");
67
+ #else
68
+ static_assert(tape_same(TL14, js::soft::tape_layout(X14Opts::kNq, NV, NC, NRH, X14Opts::kNpose, X14Opts::kNmus, X14Opts::kLq)),
69
+ "k_post's HandRows writes the record at (X14Opts, NRH)");
70
+ #endif
71
+ static_assert(js::soft::tape_layout_ok(TL14, MD::NPR) && TL14.n_zone * 32 >= NRH, "the record's u8 counts and zone words cover NRH");
72
+ static_assert(X14Opts::kLq == !X14Opts::kEuler, "l3.cuh derives the L_Q block from kEuler (C's d8002e2b)");
73
+ static_assert(TL14.n_clamp * 32 >= MD::NLIM, "the active-limit mask fits the record's clamp words");
74
+ static_assert(NM == X14Opts::kNmus && TL14.words == D16_BODY_TAPE_WORDS && TL14.pose == D16_BODY_TAPE_POSE && TL14.mus == D16_BODY_TAPE_MUS &&
75
+ TL14.LQ == -1 && CL14.words == D16_BODY_CTL_WORDS,
76
+ "the 14x tape layout sent to C and F (2026-11-03)");
77
+
78
+ // ---- kernels ----
79
+ // TP (compile time): the taped form writes this world's POSE block (kernel P's frames at the substep's input q, the ones L2
80
+ // used: xpos [66][3] then xquat [66][4], and the padding up to MUS) into the substep record rec [nw][TL14.words]
81
+ template <class T, bool TP = false>
82
+ __global__ void __launch_bounds__(32) kpre14(const T* __restrict__ V, const T* __restrict__ qpos, const T* __restrict__ qvel,
83
+ const T* __restrict__ tau, T* hand, int* nefc, int nw, T* rec = nullptr) {
84
+ __shared__ K::Shared14<T> s;
85
+ const int w = blockIdx.x, lane = threadIdx.x;
86
+ if (w >= nw) return;
87
+ K::p14_world<T>(s, V, qpos + static_cast<size_t>(w) * NQ, qvel + static_cast<size_t>(w) * NV, tau + static_cast<size_t>(w) * NV, lane);
88
+ __syncwarp();
89
+ if constexpr (TP) {
90
+ constexpr js::soft::TapeLayout tl0 = TL14; // a local copy for device code
91
+ L2::l2x14_world<T, false, true>(s, V, hand + static_cast<size_t>(w) * HL.words, nefc + w, lane, nullptr,
92
+ rec + static_cast<size_t>(w) * tl0.words + tl0.clamp);
93
+ } else {
94
+ L2::l2x14_world<T>(s, V, hand + static_cast<size_t>(w) * HL.words, nefc + w, lane);
95
+ }
96
+ if constexpr (TP) {
97
+ static_assert(X14Opts::kNpose == MD::NB, "the POSE block holds kernel P's bodies");
98
+ js::soft::TapeIn<T> in;
99
+ in.xpos = &s.xpos[0][0]; in.xquat = &s.xquat[0][0];
100
+ constexpr js::soft::TapeLayout tl = TL14; // a local copy: the host constexpr object is not addressable in device code
101
+ js::soft::tape_pack_range(rec + static_cast<size_t>(w) * tl.words, tl, in, tl.pose, tl.mus, lane, 32);
102
+ }
103
+ }
104
+
105
+ __device__ __forceinline__ int fast_world(const int* order, const int* nbig, int nw) {
106
+ const int b = static_cast<int>(blockIdx.x), slot = *nbig + b;
107
+ return slot < nw ? order[slot] : -1;
108
+ }
109
+ __device__ __forceinline__ int big_world(const int* order, const int* nbig) {
110
+ const int b = static_cast<int>(blockIdx.x);
111
+ return b < *nbig ? order[b] : -1;
112
+ }
113
+ #if defined(D16_B416_KPOST9) // (11-09; kpost9/PREREG_KPOST9.md) 9 worlds per SM on sm_89: 9 x roundup_128(S + 1,024) <= 102,400, so S <= 10,240 B (l3.cuh's reordered Shared)
114
+ static_assert(sizeof(l3::Shared<float, NV, NR>) <= 10240, "D16_B416_KPOST9: kpost14_f32's shared memory must fit 9 worlds per SM");
115
+ #endif
116
+ __global__ void __launch_bounds__(32, 15) kpost14_f32(l3::Args<float> a, const int* order, const int* nbig) {
117
+ __shared__ l3::Shared<float, NV, NR> s;
118
+ const int w = fast_world(order, nbig, a.nw);
119
+ if (w >= 0) l3::world_hand<float, NV, NR, NC, NRH, KD, X14Opts>(a, s, w, threadIdx.x & 31);
120
+ }
121
+ __global__ void __launch_bounds__(32) kpost14_big_f32(l3::Args<float> a, const int* order, const int* nbig) {
122
+ __shared__ l3::Shared<float, NV, NRK> s;
123
+ const int w = big_world(order, nbig);
124
+ if (w >= 0) l3::world_hand<float, NV, NRK, NC, NRH, KD, X14Opts>(a, s, w, threadIdx.x & 31);
125
+ }
126
+ __global__ void kpost14_f64(l3::Args<double> a, const int* order, const int* nbig) {
127
+ __shared__ l3::Shared<double, NV, NR> s;
128
+ const int w = fast_world(order, nbig, a.nw);
129
+ if (w >= 0) l3::world_hand<double, NV, NR, NC, NRH, KD, X14Opts>(a, s, w, threadIdx.x & 31);
130
+ }
131
+ __global__ void kpost14_big_f64(l3::Args<double> a, const int* order, const int* nbig) {
132
+ __shared__ l3::Shared<double, NV, NRK> s;
133
+ const int w = big_world(order, nbig);
134
+ if (w >= 0) l3::world_hand<double, NV, NRK, NC, NRH, KD, X14Opts>(a, s, w, threadIdx.x & 31);
135
+ }
136
+
137
+ // the row-count order (engine_launch.cuh's k_order, at the 14x's NRH 255): a stable counting sort, most rows first, one block of
138
+ // 1024 threads; nbig = the worlds over thr rows. Deterministic (no atomics on the positions).
139
+ constexpr int kOrdBins = NRH + 1;
140
+ __device__ __forceinline__ int ord_bin(int ne) { return NRH - min(max(ne, 0), NRH); }
141
+ __global__ void __launch_bounds__(1024) k_order14(int nw, const int* __restrict__ nefc, int thr, int* order, int* nbig) {
142
+ __shared__ int start[kOrdBins];
143
+ __shared__ int cnt[32][kOrdBins];
144
+ const int tid = static_cast<int>(threadIdx.x), lane = tid & 31, warp = tid >> 5;
145
+ for (int i = tid; i < kOrdBins; i += 1024) start[i] = 0;
146
+ __syncthreads();
147
+ for (int w = tid; w < nw; w += 1024) atomicAdd(&start[ord_bin(nefc[w])], 1);
148
+ __syncthreads();
149
+ if (warp == 0) {
150
+ constexpr int PER = (kOrdBins + 31) / 32;
151
+ int loc[PER], s = 0;
152
+ #pragma unroll
153
+ for (int k = 0; k < PER; ++k) { const int i = lane * PER + k; loc[k] = i < kOrdBins ? start[i] : 0; s += loc[k]; }
154
+ int inc = s;
155
+ #pragma unroll
156
+ for (int o = 1; o < 32; o <<= 1) { const int y = __shfl_up_sync(0xffffffffu, inc, o); if (lane >= o) inc += y; }
157
+ int run = inc - s;
158
+ #pragma unroll
159
+ for (int k = 0; k < PER; ++k) { const int i = lane * PER + k; if (i < kOrdBins) start[i] = run; run += loc[k]; }
160
+ }
161
+ __syncthreads();
162
+ if (tid == 0) { const int dcut = min(max(NRH - thr, 0), kOrdBins); *nbig = dcut < kOrdBins ? start[dcut] : nw; }
163
+ for (int c0 = 0; c0 < nw; c0 += 1024) {
164
+ for (int i = tid; i < 32 * kOrdBins; i += 1024) (&cnt[0][0])[i] = 0;
165
+ __syncthreads();
166
+ const int w = c0 + tid;
167
+ const bool valid = w < nw;
168
+ const int d = valid ? ord_bin(nefc[w]) : -1;
169
+ const unsigned peers = __match_any_sync(0xffffffffu, d);
170
+ const int rank = __popc(peers & ((1u << lane) - 1u));
171
+ if (valid && rank == 0) cnt[warp][d] = __popc(peers);
172
+ __syncthreads();
173
+ if (valid) { int pos = start[d] + rank; for (int v = 0; v < warp; ++v) pos += cnt[v][d]; order[pos] = w; }
174
+ __syncthreads();
175
+ for (int i = tid; i < kOrdBins; i += 1024) { int s = 0; for (int v = 0; v < 32; ++v) s += cnt[v][i]; start[i] += s; }
176
+ __syncthreads();
177
+ }
178
+ }
179
+
180
+ constexpr uint32_t kFlagHandOverflow = 1u << 8;
181
+ template <class T>
182
+ __global__ void tail14(int nw, const T* hand, const int* niter, const int* kflags, uint32_t* flags, int* stats, int s, int nsub) {
183
+ const int w = blockIdx.x * blockDim.x + threadIdx.x;
184
+ if (w >= nw) return;
185
+ const T* rec = hand + static_cast<size_t>(w) * HL.words;
186
+ const uint32_t ncon = js::soft::tape_get_u(rec, HL.counts), nefc = js::soft::tape_get_u(rec, HL.counts + 1);
187
+ const uint32_t nlim = js::soft::tape_get_u(rec, HL.counts + 2), hov = js::soft::tape_get_u(rec, HL.counts + 3);
188
+ const int kf = kflags[w];
189
+ flags[w] = flags[w] | static_cast<uint32_t>(kf & (l3::kFlagOverflow | l3::kFlagCap | l3::kFlagRankLoss | l3::kFlagHandOrder)) |
190
+ (hov ? kFlagHandOverflow : 0u);
191
+ int* st = stats + (static_cast<size_t>(w) * nsub + s) * kStatW;
192
+ st[0] = static_cast<int>(ncon); st[1] = static_cast<int>(nefc); st[2] = niter[w]; st[3] = (kf & l3::kFlagWarm) ? 1 : 0;
193
+ st[4] = static_cast<int>(nlim); st[5] = (kf & l3::kFlagCap) ? 1 : 0;
194
+ }
195
+
196
+
197
+ // ---- one control step (11-09; ENGINE_UNIFY_PLAN.md step (c)): the substep sequence the binding's step_t runs on the device and the CPU
198
+ // engine runs on the host, through a launcher L with the binding's launches (the binding: <<<>>> on its stream; the CPU engine: the fiber
199
+ // shim's blocks). Per substep k: k_mus, k_pre14, then k_post's arguments, the row order and k_post (its big path, then its fast path),
200
+ // tail14, the launcher's per-substep records; the ping-pong ends in buffer 0 for any nsub (substep k writes buffer (nsub - 1 - k) & 1). ----
201
+ template <class T> struct X14Bufs {
202
+ int n;
203
+ const T *q, *v, *w, *lce, *a; // the control step's inputs (not aliased with the buffers below)
204
+ T *bq[2], *bv[2], *bw[2], *bl[2], *ba[2]; // [0] = the outputs, [1] = scratch
205
+ T *tau, *hand, *aadv, *tape; // tape: [nsub][n][TL14.words] (the taped forward), or null
206
+ int *nefc, *order, *nbig, *niter, *kflags, *nls, *nfact;
207
+ long long* cycles;
208
+ const T* kd;
209
+ const int* hinge_qadr;
210
+ };
211
+ template <class T, class L> void x14_control_step(L& launch, const X14Bufs<T>& B, int nsub, int parts) {
212
+ const T *iq = B.q, *iv = B.v, *iw = B.w, *il = B.lce, *ia = B.a;
213
+ for (int k = 0; k < nsub; ++k) {
214
+ const int o = (nsub - 1 - k) & 1;
215
+ T *q1 = B.bq[o], *v1 = B.bv[o], *w1 = B.bw[o], *l1 = B.bl[o], *a1 = B.ba[o];
216
+ T* rk = B.tape ? B.tape + static_cast<size_t>(k) * B.n * TL14.words : nullptr; // substep k's records
217
+ if (parts & 1) launch.mus(iq, il, ia, l1, a1, rk);
218
+ if (parts & 2) launch.pre(iq, iv, rk);
219
+ if (parts & 4) {
220
+ l3::Args<T> a{};
221
+ a.nw = B.n; a.nq = NQ; a.hand = B.hand; a.nefc = B.nefc;
222
+ a.qpos = iq; a.qvel = iv; a.warm = iw; a.kd = B.kd; a.hinge_qadr = B.hinge_qadr;
223
+ a.h = T(MD::TIMESTEP); a.tol = T(MD::TOLERANCE); a.iterations = MD::ITERATIONS; a.order = nullptr;
224
+ a.a_star = w1; a.a_adv = B.aadv; a.qvel1 = v1; a.qpos1 = q1; a.qfrc_c = nullptr; a.LH = nullptr; a.LQ = nullptr; a.zone = nullptr;
225
+ a.zone_words = TL14.n_zone; a.niter = B.niter; a.flags = B.kflags; a.nls = B.nls;
226
+ a.nfact = B.nfact; a.cycles = B.cycles; a.prof = nullptr;
227
+ a.tape = rk; a.tape_stride = B.tape ? TL14.words : 0; // null untaped
228
+ launch.order(B.nefc, NR, B.order, B.nbig);
229
+ launch.post(a, B.order, B.nbig);
230
+ }
231
+ if (parts & 8) launch.tail(k, nsub);
232
+ launch.record(k, l1, a1);
233
+ iq = q1; iv = v1; iw = w1; il = l1; ia = a1;
234
+ }
235
+ }
236
+
237
+ // ---- the engine's activation alone (11-09; feat/d16-taskwalk step 2): k_mus's first stage, muscle_activation (soft/muscle.h) with the
238
+ // same tables, the same model view and the same (world, muscle) indexing as k_mus (im = w * NM + m), one thread per (world, muscle); and its
239
+ // VJP, muscle_activation_vjp, as muscle_adj uses it. A reward that reads the substeps' activations reads the engine's own through these. ----
240
+ template <class T>
241
+ __global__ void __launch_bounds__(128) k_act14(int n, js::soft::MuscleTables<T> t, const T* __restrict__ u, const T* __restrict__ a_prev, T dt,
242
+ T* __restrict__ a_new) {
243
+ const long i = static_cast<long>(blockIdx.x) * blockDim.x + threadIdx.x;
244
+ if (i >= static_cast<long>(n) * NM) return;
245
+ const int w = static_cast<int>(i / NM), m = static_cast<int>(i % NM);
246
+ sg::ModelView<sg::MVShared> mv(w);
247
+ a_new[i] = js::soft::muscle_activation<T>(t, mv, m, u[i], a_prev[i], dt);
248
+ }
249
+ template <class T>
250
+ __global__ void __launch_bounds__(128) k_act14_vjp(int n, js::soft::MuscleTables<T> t, const T* __restrict__ u, const T* __restrict__ a_prev, T dt,
251
+ const T* __restrict__ a_bar, T* __restrict__ u_bar, T* __restrict__ a_prev_bar) {
252
+ const long i = static_cast<long>(blockIdx.x) * blockDim.x + threadIdx.x;
253
+ if (i >= static_cast<long>(n) * NM) return;
254
+ const int w = static_cast<int>(i / NM), m = static_cast<int>(i % NM);
255
+ sg::ModelView<sg::MVShared> mv(w);
256
+ T ub = T(0), ab = T(0); // muscle_activation_vjp ACCUMULATES into both (as k_mus's muscle_adj zeroes them first)
257
+ js::soft::muscle_activation_vjp<T>(t, mv, m, u[i], a_prev[i], dt, a_bar[i], ub, ab);
258
+ u_bar[i] = ub;
259
+ a_prev_bar[i] = ab;
260
+ }
@@ -0,0 +1,14 @@
1
+ #pragma once
2
+ // D16_X14_ROWCF (2026-11-08; tools/d16_bodies/rowcf/PREREG_X14ROWCF.md, the review): the moment-arm row's closed form on the 14x, deck-only. The 416's
3
+ // header sets D16_BODY_ROW_CF itself (gen_body.py --row-cf); the 14x has no body header, so a 14x build with -DD16_X14_ROWCF maps it here. Every 14x
4
+ // binding includes this file before k_mus.cuh: body14.cuh's 14x branch, and muscle_gpu_test.cu (kmus_gate's library) directly. Preprocessor lines only,
5
+ // so a default build's tokens are unchanged.
6
+ #if defined(D16_X14_ROWCF)
7
+ #if defined(D16_BODY_HEADER)
8
+ #error "D16_X14_ROWCF is the 14x's lever; a body header sets D16_BODY_ROW_CF itself (gen_body.py --row-cf)"
9
+ #endif
10
+ #if defined(D16_KMUS_INCLUDED)
11
+ #error "x14_rowcf.h after k_mus.cuh: the muscle code was compiled before D16_BODY_ROW_CF was set (include it first)"
12
+ #endif
13
+ #define D16_BODY_ROW_CF 1
14
+ #endif
@@ -0,0 +1,124 @@
1
+ #pragma once
2
+ // D16 hand (2026-11-02; the confirmation in review): what kernel k_pre (P + L2) hands to k_post (N: Newton,
3
+ // implicitfast, the tape) per world and substep, in global memory. NablaEngine's split (step.py struct Hand) in its compact
4
+ // contact-frame form. One record per world, words of T (float in production, double for the f64 build); integer fields are
5
+ // stored bitwise (a u32 in a float word, the same u32 zero-extended in a double word: tape.h's tape_put_u / tape_get_u).
6
+ // Blocks start on 32-word boundaries.
7
+ //
8
+ // M ntri qM with armature, packed TRI(i, j) = i (i + 1) / 2 + j (chol(M) is not handed: k_post factors M
9
+ // only where it needs it, the nefc = 0 worlds' tape L_H and the zero-iteration gap test)
10
+ // SMALL 2 nv + 7 qfrc_smooth [nv], qacc_smooth [nv], clamp [2] (u32: bit d = dof d's actuator force at or past its
11
+ // range, inclusive), counts [4] (u32: ncon, nefc, nlim, overflow), min_nu [1] (T, at counts + 4, in the
12
+ // block's padding so no offset moved: the smallest core distance dist + both radii over the contacts of
13
+ // two non-plane geoms, +inf without one; the tape's min_nu word and its kTapeSingular flag come from it,
14
+ // both written by k_post, the decision 2026-11-02)
15
+ // CONJ nc 3 kdof con_J[c][k][s]: row k of the contact frame (0 normal, 1 tangent 1, 2 tangent 2) dotted with J2 - J1
16
+ // at support slot s, the sign in the value (J2 - J1 = +lin on b2's chain, -lin on b1's; the shared
17
+ // ancestors' terms are equal and are left out); slots past nd are 0
18
+ // CONDOF nc kdof / 4 u8 dof of each support slot, 4 per u32 word (0xFF past nd)
19
+ // CONMETA nc u32 per contact: pair (bits 0-8) | slot (9-11) | condim (12-13) | row0 (16-23) | nd (24-28)
20
+ // CONMU nc the contact's friction (the foot override applied)
21
+ // AREF nr efc_aref
22
+ // EFCD nr efc_D = 1 / R
23
+ // ROWMETA nr u32 per row: type (bits 0-1: 1 limit, 2 frictionless, 3 pyramidal) | index (2-9: the dof of a limit,
24
+ // the contact of a contact row) | k (10-11: pyramid row) | sign (12: a limit's J is -e_dof when set)
25
+ // Rows are the CPU law's order: the limits by joint (lower, upper), then the contacts in contact order, 1 row (condim 1) or 4
26
+ // (condim 3: J = Jn + s_k mu Jt(k), s = (+, -, +, -), t = (1, 1, 2, 2)).
27
+ // The per-world nefc is also written to a dense array beside the records (k_post's row-count dispatch reads 4 B per world).
28
+ #include <cstdint>
29
+
30
+ #include "diffneusim/macros.h"
31
+ #include "tape.h"
32
+
33
+ namespace js::soft {
34
+
35
+ constexpr int kHandKdof = 16; // the G1's largest support set (root 6 + waist 3 + arm 7; between limbs also 16)
36
+
37
+ struct HandLayout {
38
+ int nv, ntri, nc, nr, kdof;
39
+ int M, qfrc, qacc, clamp, counts, min_nu, conJ, condof, conmeta, conmu, aref, efcD, rowmeta, words;
40
+ #if defined(D16_NV_GT64)
41
+ int n_clamp; // the clamp block's words: 2, one per 32 dofs past 64
42
+ #endif
43
+ };
44
+
45
+ DN_HOST_DEVICE constexpr int hand_align(int o) { return tape_ceil(o, kTapeAlign) * kTapeAlign; }
46
+
47
+ #if defined(D16_NV_GT64)
48
+ // a phase B body (tools/d16_bodies/PHASE_B.md): M's block is the split storage of mwords words (::d16::split::WORDS), required: left at -1 the layout is
49
+ // invalid and hand_layout_ok false, so a reader that forgets it fails where the layout is checked; the clamp block takes one word per 32 dofs
50
+ DN_HOST_DEVICE constexpr HandLayout hand_layout(int nv, int nc, int nr, int kdof = kHandKdof, int mwords = -1) {
51
+ HandLayout h{};
52
+ h.nv = nv; h.ntri = mwords; h.nc = nc; h.nr = nr; h.kdof = kdof; h.n_clamp = nv <= 64 ? 2 : tape_ceil(nv, 32);
53
+ int o = 0;
54
+ h.M = o; o = hand_align(o + (mwords > 0 ? mwords : 0));
55
+ h.qfrc = o; h.qacc = o + nv; h.clamp = o + 2 * nv; h.counts = h.clamp + h.n_clamp; h.min_nu = h.counts + 4; o = hand_align(h.min_nu + 1);
56
+ #else
57
+ DN_HOST_DEVICE constexpr HandLayout hand_layout(int nv, int nc, int nr, int kdof = kHandKdof) {
58
+ HandLayout h{};
59
+ h.nv = nv; h.ntri = nv * (nv + 1) / 2; h.nc = nc; h.nr = nr; h.kdof = kdof;
60
+ int o = 0;
61
+ h.M = o; o = hand_align(o + h.ntri);
62
+ h.qfrc = o; h.qacc = o + nv; h.clamp = o + 2 * nv; h.counts = h.clamp + 2; h.min_nu = h.counts + 4; o = hand_align(h.min_nu + 1);
63
+ #endif
64
+ h.conJ = o; o = hand_align(o + nc * 3 * kdof);
65
+ h.condof = o; o = hand_align(o + tape_ceil(nc * kdof, 4));
66
+ h.conmeta = o; o = hand_align(o + nc);
67
+ h.conmu = o; o = hand_align(o + nc);
68
+ h.aref = o; o = hand_align(o + nr);
69
+ h.efcD = o; o = hand_align(o + nr);
70
+ h.rowmeta = o; o = hand_align(o + nr);
71
+ h.words = o;
72
+ return h;
73
+ }
74
+
75
+ constexpr uint32_t kHandRowLimit = 1, kHandRowFrictionless = 2, kHandRowPyramidal = 3;
76
+
77
+ DN_HOST_DEVICE constexpr uint32_t hand_conmeta(int pair, int slot, int condim, int row0, int nd) {
78
+ return static_cast<uint32_t>(pair) | static_cast<uint32_t>(slot) << 9 | static_cast<uint32_t>(condim) << 12 |
79
+ static_cast<uint32_t>(row0) << 16 | static_cast<uint32_t>(nd) << 24;
80
+ }
81
+ DN_HOST_DEVICE constexpr int hand_con_pair(uint32_t m) { return static_cast<int>(m & 511u); }
82
+ DN_HOST_DEVICE constexpr int hand_con_slot(uint32_t m) { return static_cast<int>((m >> 9) & 7u); }
83
+ DN_HOST_DEVICE constexpr int hand_con_condim(uint32_t m) { return static_cast<int>((m >> 12) & 3u); }
84
+ DN_HOST_DEVICE constexpr int hand_con_row0(uint32_t m) { return static_cast<int>((m >> 16) & 255u); }
85
+ DN_HOST_DEVICE constexpr int hand_con_nd(uint32_t m) { return static_cast<int>((m >> 24) & 31u); }
86
+
87
+ DN_HOST_DEVICE constexpr uint32_t hand_rowmeta(uint32_t type, int index, int k, bool neg) {
88
+ return type | static_cast<uint32_t>(index) << 2 | static_cast<uint32_t>(k) << 10 | (neg ? 1u << 12 : 0u);
89
+ }
90
+ DN_HOST_DEVICE constexpr uint32_t hand_row_type(uint32_t m) { return m & 3u; }
91
+ DN_HOST_DEVICE constexpr int hand_row_index(uint32_t m) { return static_cast<int>((m >> 2) & 255u); }
92
+ DN_HOST_DEVICE constexpr int hand_row_k(uint32_t m) { return static_cast<int>((m >> 10) & 3u); }
93
+ DN_HOST_DEVICE constexpr bool hand_row_neg(uint32_t m) { return ((m >> 12) & 1u) != 0; }
94
+
95
+ #if defined(D16_NV_GT64)
96
+ // two readers' layouts of one hand, field by field (B3c: k_post's at l3.cuh's sites against L2's l2x14::HL, which writes the record)
97
+ DN_HOST_DEVICE constexpr bool hand_layout_same(const HandLayout& a, const HandLayout& b) {
98
+ return a.nv == b.nv && a.ntri == b.ntri && a.nc == b.nc && a.nr == b.nr && a.kdof == b.kdof && a.M == b.M && a.qfrc == b.qfrc &&
99
+ a.qacc == b.qacc && a.clamp == b.clamp && a.counts == b.counts && a.min_nu == b.min_nu && a.conJ == b.conJ &&
100
+ a.condof == b.condof && a.conmeta == b.conmeta && a.conmu == b.conmu && a.aref == b.aref && a.efcD == b.efcD &&
101
+ a.rowmeta == b.rowmeta && a.words == b.words && a.n_clamp == b.n_clamp;
102
+ }
103
+ #endif
104
+
105
+ // the field widths the packing assumes
106
+ DN_HOST_DEVICE constexpr bool hand_layout_ok(const HandLayout& h, int npair) {
107
+ #if defined(D16_NV_GT64) // the dof fields are u8 (condof, rowmeta's index); M's split block given
108
+ return npair <= 512 && h.nc <= 255 && h.nr <= 256 && h.kdof <= 31 && h.nv <= 255 && h.ntri > 0;
109
+ #else
110
+ return npair <= 512 && h.nc <= 255 && h.nr <= 256 && h.kdof <= 31 && h.nv <= 64;
111
+ #endif
112
+ }
113
+
114
+ // a support slot's dof (u8, 4 per word) in a record; the writer packs 4 slots per word (hand_put_dof4)
115
+ template <class T> DN_HOST_DEVICE inline int hand_con_dof(const T* rec, const HandLayout& h, int c, int s) {
116
+ const int e = c * h.kdof + s;
117
+ return static_cast<int>((tape_get_u(rec, h.condof + e / 4) >> (8 * (e % 4))) & 255u);
118
+ }
119
+
120
+ // pyramid row k's coefficients on the contact frame rows: J_row = Jn + s mu Jt(t)
121
+ DN_HOST_DEVICE constexpr int hand_pyr_t(int k) { return k < 2 ? 1 : 2; }
122
+ DN_HOST_DEVICE constexpr int hand_pyr_s(int k) { return (k % 2 == 0) ? 1 : -1; }
123
+
124
+ } // namespace js::soft