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,465 @@
1
+ #pragma once
2
+ // D16 14x kernel P (2026-11-02; tools/d16_14x/KPRE14_PREREG.md): the 14x soft law's smooth dynamics for one world
3
+ // per 32-thread block, lane-parallel, gated against core/soft/x14/law14.h (P1). The first build is the plain one, correct first
4
+ // (the cost levers follow the measured phases): the generated tree (tools/d16_14x/gen14.py) with 66 bodies in 34 levels of at
5
+ // most 4, coupled hinges (angle coef q_m), 2 balls and the free root, in MuJoCo's conventions.
6
+ // DOWN level by level (lanes over the level's bodies): pose, the expanded dofs' world axes, the angular velocity w, and at
7
+ // qacc = 0 (gravity as the root's base acceleration) the angular acceleration al and the origin's acceleration ao
8
+ // JFN every body at once: its Newton-Euler force (f, n about O = the root origin) and its composite inertia about O
9
+ // UP subtree sums, deepest level first, a level's bodies in table order (fixed order; lanes = the 16 numbers)
10
+ // S, F per expanded dof its motion about O (w, v) and F = Ic(subtree) S
11
+ // M per packed lower entry of M_r (lanes over entries) the fixed-order sum of its expanded pair products w S_j . F_i,
12
+ // plus the armature on the diagonal
13
+ // BIAS per reduced dof the fixed-order sum over its expanded dofs of coef S_e . F_sub(body_e)
14
+ // PAS -D qvel; then lane 0: the toe springs and the hips' ball_rom (law14.h's order)
15
+ // SOLVE qfrc_smooth = passive + tau_ext - bias; chol_rn's dense right-looking Cholesky of M (newton.h's chol_factor rule, mindiag)
16
+ // and the two triangular solves for qacc_smooth
17
+ // Determinism: fixed lane ownership, every sum in a fixed order, no atomics. The model header (namespace D16_X14_NS) must be
18
+ // included first.
19
+ #include <cstdint>
20
+
21
+ #include "../hand.h"
22
+ #include "chol_rn.cuh" // the dense broadcast factor (NV <= 37 since a433aca8); its solves instantiated with k_pre's own Tag
23
+
24
+ #ifndef D16_X14_NS
25
+ #error "include the generated 14x model header and define D16_X14_NS before kp14.cuh"
26
+ #endif
27
+
28
+ namespace d16 {
29
+ namespace kp14 {
30
+ namespace MD = D16_X14_NS;
31
+ using MD::NB; using MD::NQ; using MD::NV; using MD::NE; using MD::NLEV; using MD::NTRI;
32
+ constexpr unsigned kFull = 0xffffffffu;
33
+ __host__ __device__ constexpr int TRI(int i, int j) { return i * (i + 1) / 2 + j; }
34
+ #if defined(D16_NV_GT64) // phase B (tools/d16_bodies/PHASE_B.md section 4): M in the body's split storage, each dense entry written through gSplitWord
35
+ #define KP14_MWORDS ::d16::split::WORDS
36
+ #define KP14_MW(t) __ldg(&::d16::split::gSplitWord[t])
37
+ #else // the 14x: M dense, and these expand to the tokens they replace
38
+ #define KP14_MWORDS NTRI
39
+ #define KP14_MW(t) t
40
+ #endif
41
+
42
+ // Shared memory by lifetime (the residency pass, KPRE14_PREREG.md): f32 11,680 B, so 8 worlds per SM on the 4090.
43
+ // Body 0 (the world) has no ci / fs and no DOWN block: only the free root has it as parent (gen14.py asserts it) and the root's
44
+ // branch reads no parent, so those arrays hold bodies 1..NB-1 behind the accessors CI / FS / W / AL / AO / QREL / SL (b >= 1).
45
+ #if defined(D16_NV_LE32)
46
+ // L2's scratch (l2x14.cuh L2S) overlays regions A and U. It scales with the geoms and the 64 contacts, not with NV, so on a small body it is
47
+ // larger than kernel P's own regions: at NV 23, 7,824 B against 4,016 B in f32 (the 14x's regions are 8,320 B). Region U grows to hold it. In
48
+ // words of T: geoms 12 each, contacts 10 each, then the 4 int arrays and 3 counts; l2s_fits is the exact byte check.
49
+ constexpr int kL2ScratchWords = MD::NG * 12 + 64 * 10 + 3 * 64 + 65 + 3 + 4;
50
+ #endif
51
+ template <class T> struct alignas(16) Shared14 {
52
+ // live for L2: the state, the poses, the expanded dofs' world axes
53
+ T qpos[NQ], qvel[NV];
54
+ T xpos[NB][3], xquat[NB][4];
55
+ T eax[NE][3];
56
+ // region A: DOWN's stash (the local phase -> the level chain), then ci / fs (JFN -> UP -> SF), then M (M -> the factor's
57
+ // register load and L2's hand copy)
58
+ union alignas(16) A {
59
+ // the level chain's per-body inputs, gathered in the local phase so the chain makes no global load (at 8 blocks per SM the
60
+ // shared memory leaves L1 too small for the model's values, and each level's dependent loads went to L2)
61
+ struct { T pos[NB][3]; int par[NB], jt[NB], lev[NB]; } dn;
62
+ // per body one 16-number row: ci (10: composite inertia about O, I_O (xx yy zz xy xz yz), h = m (com - O), m) then fs (6:
63
+ // spatial force about O (f, n)); then subtree sums. One row lets UP add a child into its parent on lanes 0..15 with no branch.
64
+ T cf[NB - 1][16];
65
+ T M[KP14_MWORDS];
66
+ } a;
67
+ // region U: DOWN's block (read by the expanded axes and JFN), then S / F and BIAS's terms (SF -> M, BIAS, PAS), then the
68
+ // factor (L, rinv, the column buffers). L2's scratch overlays A and U once it has copied M into the hand.
69
+ union alignas(16) U {
70
+ struct {
71
+ T w[NB - 1][3], al[NB - 1][3], ao[NB - 1][3];
72
+ T qrel[NB - 1][4]; // the body's rotation in its parent's frame: quat_b (x) the joint's local rotation (hinge, ball)
73
+ T sl[NB - 1][3]; // the joint's angular velocity in the body's own frame
74
+ } d; // (no stored xmat: its readers recompute qmat(xquat), bitwise the value once stored)
75
+ struct {
76
+ T S[NE][6]; T F[NE][6]; // motion about O (w, v); Ic(subtree) S as (f, n)
77
+ T bt[NE]; // BIAS's per expanded dof term S_e . F_sub(body_e), formed in SF while fs is live
78
+ T bias[NV], pas[NV];
79
+ } m;
80
+ struct {
81
+ T L[KP14_MWORDS];
82
+ alignas(16) T rinv[NV + 3];
83
+ alignas(16) T col0[32];
84
+ alignas(16) T col1[32];
85
+ #if defined(D16_NV_GT64)
86
+ alignas(16) T xs[NV + 3]; // the right-hand side in the split order
87
+ #endif
88
+ } f;
89
+ #if defined(D16_NV_LE32)
90
+ T l2[kL2ScratchWords - static_cast<int>(sizeof(A) / sizeof(T))];
91
+ #endif
92
+ } u;
93
+ T qf[NV], qa[NV];
94
+ __device__ __forceinline__ T* CI(int b) { return a.cf[b - 1]; }
95
+ __device__ __forceinline__ T* FS(int b) { return a.cf[b - 1] + 10; }
96
+ __device__ __forceinline__ T* W(int b) { return u.d.w[b - 1]; }
97
+ __device__ __forceinline__ T* AL(int b) { return u.d.al[b - 1]; }
98
+ __device__ __forceinline__ T* AO(int b) { return u.d.ao[b - 1]; }
99
+ __device__ __forceinline__ T* QREL(int b) { return u.d.qrel[b - 1]; }
100
+ __device__ __forceinline__ T* SL(int b) { return u.d.sl[b - 1]; }
101
+ };
102
+ #if !defined(D16_NV_GT64)
103
+ static_assert(sizeof(Shared14<float>) <= 11776, "8 worlds per SM on sm_89: 8 x (shared + 1 KB reserved) <= 100 KB (residency)");
104
+ #else // the 416 measured 19,040 B in f32 (kp_split_cpu.cpp, B3b): 5 worlds per SM, where PHASE_B.md section 3 estimated 4; a growth past this drops one
105
+ static_assert(sizeof(Shared14<float>) <= 19456, "5 worlds per SM on sm_89: 5 x (shared + 1 KB reserved) <= 100 KB (residency)");
106
+ static_assert(sizeof(Shared14<double>) <= 49152, "the f64 gate build's static shared memory: 48 KB");
107
+ #endif
108
+ constexpr int kTagKpre14 = 14; // chol_rn's solve instantiation for this kernel only (the codegen-coupling rule)
109
+
110
+ template <class T> __device__ __forceinline__ void qmul(const T* a, const T* b, T* o) { // mju_mulQuat
111
+ const T w = a[0] * b[0] - a[1] * b[1] - a[2] * b[2] - a[3] * b[3];
112
+ const T x = a[0] * b[1] + a[1] * b[0] + a[2] * b[3] - a[3] * b[2];
113
+ const T y = a[0] * b[2] - a[1] * b[3] + a[2] * b[0] + a[3] * b[1];
114
+ const T z = a[0] * b[3] + a[1] * b[2] - a[2] * b[1] + a[3] * b[0];
115
+ o[0] = w; o[1] = x; o[2] = y; o[3] = z;
116
+ }
117
+ template <class T> __device__ __forceinline__ void qnorm(T* q) { // mju_normalize4
118
+ const T n = sqrt(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3]);
119
+ if (n < T(1e-15)) { q[0] = T(1); q[1] = q[2] = q[3] = T(0); return; }
120
+ const T d = n - T(1);
121
+ if (d > T(1e-15) || d < -T(1e-15)) { const T inv = T(1) / n; for (int k = 0; k < 4; ++k) q[k] = q[k] * inv; }
122
+ }
123
+ template <class T> __device__ __forceinline__ void qmat(const T* q, T* R) { // mju_quat2Mat, row-major
124
+ const T q00 = q[0] * q[0], q01 = q[0] * q[1], q02 = q[0] * q[2], q03 = q[0] * q[3];
125
+ const T q11 = q[1] * q[1], q12 = q[1] * q[2], q13 = q[1] * q[3], q22 = q[2] * q[2], q23 = q[2] * q[3], q33 = q[3] * q[3];
126
+ R[0] = q00 + q11 - q22 - q33; R[4] = q00 - q11 + q22 - q33; R[8] = q00 - q11 - q22 + q33;
127
+ R[1] = T(2) * (q12 - q03); R[2] = T(2) * (q13 + q02);
128
+ R[3] = T(2) * (q12 + q03); R[5] = T(2) * (q23 - q01);
129
+ R[6] = T(2) * (q13 - q02); R[7] = T(2) * (q23 + q01);
130
+ }
131
+ template <class T> __device__ __forceinline__ void mv(const T* R, const T* v, T* o) {
132
+ for (int i = 0; i < 3; ++i) o[i] = R[3 * i] * v[0] + R[3 * i + 1] * v[1] + R[3 * i + 2] * v[2];
133
+ }
134
+ template <class T> __device__ __forceinline__ void crs(const T* a, const T* b, T* o) {
135
+ const T x = a[1] * b[2] - a[2] * b[1], y = a[2] * b[0] - a[0] * b[2], z = a[0] * b[1] - a[1] * b[0];
136
+ o[0] = x; o[1] = y; o[2] = z;
137
+ }
138
+ // symmetric packed (xx yy zz xy xz yz) times v
139
+ template <class T> __device__ __forceinline__ void symv(const T* I, const T* v, T* o) {
140
+ o[0] = I[0] * v[0] + I[3] * v[1] + I[4] * v[2];
141
+ o[1] = I[3] * v[0] + I[1] * v[1] + I[5] * v[2];
142
+ o[2] = I[4] * v[0] + I[5] * v[1] + I[2] * v[2];
143
+ }
144
+ template <class T> __device__ __forceinline__ T warp_sum(T x) {
145
+ for (int o = 16; o > 0; o >>= 1) x += __shfl_xor_sync(kFull, x, o);
146
+ return x;
147
+ }
148
+ template <class T> __device__ __forceinline__ T ldv(const T* V, int i) { return __ldg(V + i); }
149
+ // the model's index tables at a lane-varying index: the global copy through the read-only path (gen14.py's g<name>); reads at
150
+ // one index across the warp keep the __constant__ copy (a broadcast)
151
+ #define KG(name, i) __ldg(&MD::g##name[i])
152
+
153
+ // phase A (every body at once, independent of the tree): the joint's local rotation composed with the body's fixed rotation,
154
+ // and the joint's angular velocity in the body's frame
155
+ template <class T> __device__ __forceinline__ void local_body(Shared14<T>& s, const T* V, int b) {
156
+ const int jt = KG(Jtype, b);
157
+ const T* bv = V + MD::O_BODY + 21 * b;
158
+ s.a.dn.jt[b] = jt; s.a.dn.par[b] = KG(Parent, b); // the chain's stash (down_body reads it)
159
+ for (int k = 0; k < 3; ++k) s.a.dn.pos[b][k] = ldv(bv, k);
160
+ if (jt == 0) { // the free root: its frame from qpos (phase B); its local angular velocity
161
+ const int da = KG(Dadr, b);
162
+ for (int k = 0; k < 3; ++k) s.SL(b)[k] = s.qvel[da + 3 + k];
163
+ return;
164
+ }
165
+ const T bq[4] = {ldv(bv, 3), ldv(bv, 4), ldv(bv, 5), ldv(bv, 6)};
166
+ T ql[4];
167
+ if (jt == 3) {
168
+ const int e0 = KG(J0, b);
169
+ const T c = ldv(V, MD::O_ECOEF + e0), half = c * s.qpos[KG(Qsrc, b)] * T(0.5);
170
+ const T sh = sin(half), ch = cos(half), ax[3] = {ldv(bv, 7), ldv(bv, 8), ldv(bv, 9)};
171
+ ql[0] = ch; ql[1] = ax[0] * sh; ql[2] = ax[1] * sh; ql[3] = ax[2] * sh;
172
+ const T rate = c * s.qvel[KG(Rsrc, b)];
173
+ for (int k = 0; k < 3; ++k) s.SL(b)[k] = ax[k] * rate;
174
+ } else {
175
+ const int qa = KG(Qadr, b), da = KG(Dadr, b);
176
+ for (int k = 0; k < 4; ++k) ql[k] = s.qpos[qa + k];
177
+ qnorm(ql);
178
+ for (int k = 0; k < 3; ++k) s.SL(b)[k] = s.qvel[da + k];
179
+ }
180
+ qmul(bq, ql, s.QREL(b));
181
+ }
182
+
183
+ // phase B (the level chain): the pose from the parent's, then w, al, ao (qacc = 0, gravity as the root's base acceleration)
184
+ template <class T> __device__ __forceinline__ void down_body(Shared14<T>& s, const T* V, int b) {
185
+ const int jt = s.a.dn.jt[b], p = s.a.dn.par[b];
186
+ T q[4], R[9], sw[3];
187
+ if (jt == 0) {
188
+ const int qa = KG(Qadr, b);
189
+ for (int k = 0; k < 3; ++k) s.xpos[b][k] = s.qpos[qa + k];
190
+ for (int k = 0; k < 4; ++k) q[k] = s.qpos[qa + 3 + k];
191
+ qnorm(q);
192
+ qmat(q, R);
193
+ mv(R, s.SL(b), sw);
194
+ for (int k = 0; k < 3; ++k) { s.W(b)[k] = sw[k]; s.AL(b)[k] = T(0); s.AO(b)[k] = -ldv(V, MD::O_GRAVITY + k); }
195
+ } else {
196
+ const T pos[3] = {s.a.dn.pos[b][0], s.a.dn.pos[b][1], s.a.dn.pos[b][2]};
197
+ T r[3];
198
+ T Rp[9];
199
+ qmat(s.xquat[p], Rp);
200
+ mv(Rp, pos, r); // r = x_b - x_p
201
+ qmul(s.xquat[p], s.QREL(b), q);
202
+ qnorm(q);
203
+ qmat(q, R);
204
+ mv(R, s.SL(b), sw);
205
+ T ws[3], wr[3], wwr[3], alr[3];
206
+ const T *wp = s.W(p), *alp = s.AL(p), *aop = s.AO(p); // p >= 1: only the root has the world as parent
207
+ crs(wp, sw, ws); crs(wp, r, wr); crs(wp, wr, wwr); crs(alp, r, alr);
208
+ T *wb = s.W(b), *alb = s.AL(b), *aob = s.AO(b);
209
+ for (int k = 0; k < 3; ++k) {
210
+ s.xpos[b][k] = s.xpos[p][k] + r[k];
211
+ wb[k] = wp[k] + sw[k]; alb[k] = alp[k] + ws[k]; aob[k] = aop[k] + alr[k] + wwr[k];
212
+ }
213
+ }
214
+ for (int k = 0; k < 4; ++k) s.xquat[b][k] = q[k];
215
+ }
216
+
217
+ // one body's own Newton-Euler force about O and its inertia about O
218
+ template <class T> __device__ __forceinline__ void jfn_body(Shared14<T>& s, const T* V, int b) {
219
+ const T* bv = V + MD::O_BODY + 21 * b;
220
+ const T m = ldv(bv, 20);
221
+ T Ri[9], iq[4] = {ldv(bv, 13), ldv(bv, 14), ldv(bv, 15), ldv(bv, 16)}, qq[4], ip[3] = {ldv(bv, 10), ldv(bv, 11), ldv(bv, 12)};
222
+ T R[9];
223
+ qmat(s.xquat[b], R);
224
+ qmul(s.xquat[b], iq, qq);
225
+ qmat(qq, Ri);
226
+ T rc[3];
227
+ mv(R, ip, rc);
228
+ const T d3[3] = {ldv(bv, 17), ldv(bv, 18), ldv(bv, 19)};
229
+ T I[6]; // Ri diag(d3) Ri'
230
+ I[0] = Ri[0] * Ri[0] * d3[0] + Ri[1] * Ri[1] * d3[1] + Ri[2] * Ri[2] * d3[2];
231
+ I[1] = Ri[3] * Ri[3] * d3[0] + Ri[4] * Ri[4] * d3[1] + Ri[5] * Ri[5] * d3[2];
232
+ I[2] = Ri[6] * Ri[6] * d3[0] + Ri[7] * Ri[7] * d3[1] + Ri[8] * Ri[8] * d3[2];
233
+ I[3] = Ri[0] * Ri[3] * d3[0] + Ri[1] * Ri[4] * d3[1] + Ri[2] * Ri[5] * d3[2];
234
+ I[4] = Ri[0] * Ri[6] * d3[0] + Ri[1] * Ri[7] * d3[1] + Ri[2] * Ri[8] * d3[2];
235
+ I[5] = Ri[3] * Ri[6] * d3[0] + Ri[4] * Ri[7] * d3[1] + Ri[5] * Ri[8] * d3[2];
236
+ T wr[3], wwr[3], alr[3], a[3], f[3], Iw[3], Ia[3], wIw[3], c[3], cf[3];
237
+ const T *wb = s.W(b), *alb = s.AL(b), *aob = s.AO(b);
238
+ crs(wb, rc, wr); crs(wb, wr, wwr); crs(alb, rc, alr);
239
+ for (int k = 0; k < 3; ++k) { a[k] = aob[k] + alr[k] + wwr[k]; f[k] = m * a[k]; }
240
+ symv(I, wb, Iw); symv(I, alb, Ia); crs(wb, Iw, wIw);
241
+ for (int k = 0; k < 3; ++k) c[k] = s.xpos[b][k] + rc[k] - s.xpos[1][k];
242
+ crs(c, f, cf);
243
+ T* fb = s.FS(b);
244
+ T* cb = s.CI(b);
245
+ for (int k = 0; k < 3; ++k) { fb[k] = f[k]; fb[3 + k] = Ia[k] + wIw[k] + cf[k]; }
246
+ const T cc = c[0] * c[0] + c[1] * c[1] + c[2] * c[2];
247
+ cb[0] = I[0] + m * (cc - c[0] * c[0]); cb[1] = I[1] + m * (cc - c[1] * c[1]); cb[2] = I[2] + m * (cc - c[2] * c[2]);
248
+ cb[3] = I[3] - m * c[0] * c[1]; cb[4] = I[4] - m * c[0] * c[2]; cb[5] = I[5] - m * c[1] * c[2];
249
+ for (int k = 0; k < 3; ++k) cb[6 + k] = m * c[k];
250
+ cb[9] = m;
251
+ }
252
+
253
+ // the hips' ball_rom (law14.h ball_rom_force, the old engine's core/dyn/ball_limit.h)
254
+ template <class T> __device__ __forceinline__ T limexp(T x, T a, T w) {
255
+ const T u = x / w;
256
+ if (u <= T(12)) return a * exp(u);
257
+ return a * exp(T(12)) * (T(1) + (u - T(12)));
258
+ }
259
+ template <class T> __device__ __forceinline__ T srelu_d(T x, T b) { return T(0.5) * (T(1) + x / sqrt(x * x + b * b)); }
260
+ template <class T> __device__ void ball_rom(const Shared14<T>& s, const T* V, int r, T* tau) {
261
+ const T* rv = V + MD::O_ROM + 12 * r;
262
+ const int qa = MD::cRomQadr[r], da = MD::cRomDadr[r];
263
+ T q[4] = {s.qpos[qa], s.qpos[qa + 1], s.qpos[qa + 2], s.qpos[qa + 3]};
264
+ qnorm(q);
265
+ const T w = q[0], x = q[1], y = q[2], z = q[3];
266
+ const T R01 = T(2) * (x * y - w * z), R11 = T(1) - T(2) * (x * x + z * z), R20 = T(2) * (x * z - w * y);
267
+ const T R21 = T(2) * (y * z + w * x), R22 = T(1) - T(2) * (x * x + y * y);
268
+ const T th[3] = {atan2(-R01, R11), atan2(R21, sqrt(R01 * R01 + R11 * R11)), atan2(-R20, R22)};
269
+ const T sa = sin(th[1]), ca = cos(th[1]), sr = sin(th[2]), cr = cos(th[2]);
270
+ const T E[9] = {-sr / ca, T(0), cr / ca, cr, T(0), sr, sa * sr / ca, T(1), -sa * cr / ca};
271
+ const T om[3] = {s.qvel[da], s.qvel[da + 1], s.qvel[da + 2]};
272
+ T sk[3];
273
+ for (int k = 0; k < 3; ++k) {
274
+ const T thd = E[3 * k] * om[0] + E[3 * k + 1] * om[1] + E[3 * k + 2] * om[2];
275
+ const T dlo = ldv(rv, k) - th[k], dhi = th[k] - ldv(rv, 3 + k);
276
+ const T spring = limexp(dlo, ldv(rv, 9), ldv(rv, 10)) - limexp(dhi, ldv(rv, 9), ldv(rv, 10));
277
+ const T eng = srelu_d(dlo, ldv(rv, 11)) + srelu_d(dhi, ldv(rv, 11));
278
+ sk[k] = spring - ldv(rv, 6 + k) * thd * eng;
279
+ }
280
+ for (int i = 0; i < 3; ++i) tau[da + i] = tau[da + i] + E[i] * sk[0] + E[3 + i] * sk[1] + E[6 + i] * sk[2];
281
+ }
282
+
283
+ // the smooth dynamics of one world. tau_ext: this world's [NV] or null (a compile-time choice in the production build; the
284
+ // gate build passes a pointer or null). Leaves the live block and s.a.M / s.qf / s.qa in shared memory.
285
+ // TM (compile time): phase clock marks into tm[0..9] (DOWN, JFN, UP, SF, M, BIAS + damping, the springs / ball_rom, the factor,
286
+ // the solves; tm[0] the start) and DOWN's split tm[10..11] (after the local phase, after the level chain): tm [12], lane 0, for
287
+ // the cost model; off in every gated or production build.
288
+ // BP (compile time, gate P1 only): bias and the passive force out to bias_out / pas_out before the factor overwrites them.
289
+ template <class T, bool TM = false, bool BP = false>
290
+ __device__ void p14_world(Shared14<T>& s, const T* __restrict__ V, const T* __restrict__ qpos, const T* __restrict__ qvel,
291
+ const T* __restrict__ tau_ext, int lane, long long* tm = nullptr, T* bias_out = nullptr, T* pas_out = nullptr) {
292
+ #define KP14_MARK(i) do { if constexpr (TM) { __syncwarp(); if (lane == 0) tm[i] = clock64(); } } while (0)
293
+ KP14_MARK(0);
294
+ for (int i = lane; i < NQ; i += 32) s.qpos[i] = qpos[i];
295
+ for (int i = lane; i < NV; i += 32) s.qvel[i] = qvel[i];
296
+ if (lane < 3) s.xpos[0][lane] = T(0); // the world (its DOWN block is not stored: no body but the root reads it)
297
+ if (lane < 4) s.xquat[0][lane] = T(lane == 0 ? 1 : 0);
298
+ __syncwarp();
299
+ // DOWN: phase A on every body, the level chain, then the expanded dofs' world axes
300
+ for (int b = 1 + lane; b < NB; b += 32) local_body(s, V, b);
301
+ for (int i = lane; i < NB - 1; i += 32) s.a.dn.lev[i] = KG(LevBody, i); // the level table (65 bodies, levels in order)
302
+ __syncwarp();
303
+ KP14_MARK(10); // DOWN's split (the cost model): tm[10] after the local phase, tm[11] after the level chain
304
+ for (int l = 0; l < NLEV; ++l) {
305
+ const int o0 = MD::cLevOff[l], o1 = MD::cLevOff[l + 1];
306
+ if (lane < o1 - o0) down_body(s, V, s.a.dn.lev[o0 + lane]);
307
+ __syncwarp();
308
+ }
309
+ KP14_MARK(11);
310
+ for (int e = lane; e < NE; e += 32) {
311
+ const int b = KG(EBody, e), kind = KG(EKind, e), k = KG(EK, e);
312
+ T R[9];
313
+ if (kind != 0) qmat(s.xquat[b], R);
314
+ if (kind == 0) { for (int i = 0; i < 3; ++i) s.eax[e][i] = T(i == k ? 1 : 0); }
315
+ else if (kind == 1) { for (int i = 0; i < 3; ++i) s.eax[e][i] = R[3 * i + k]; }
316
+ else {
317
+ const T* bv = V + MD::O_BODY + 21 * b;
318
+ const T ax[3] = {ldv(bv, 7), ldv(bv, 8), ldv(bv, 9)};
319
+ mv(R, ax, s.eax[e]);
320
+ }
321
+ }
322
+ __syncwarp();
323
+ KP14_MARK(1);
324
+ // JFN
325
+ for (int b = 1 + lane; b < NB; b += 32) jfn_body(s, V, b);
326
+ __syncwarp();
327
+ KP14_MARK(2);
328
+ // UP: deepest level first; a level's bodies in table order into their parents (lanes 0..15: the 16 numbers)
329
+ for (int l = NLEV - 1; l >= 1; --l) {
330
+ const int o0 = MD::cLevOff[l], o1 = MD::cLevOff[l + 1];
331
+ if (lane < 16)
332
+ for (int k = o0; k < o1; ++k) {
333
+ const int b = MD::cLevBody[k], p = MD::cParent[b];
334
+ s.CI(p)[lane] += s.CI(b)[lane]; // ci then fs in one row; p >= 1 at levels >= 1
335
+ }
336
+ __syncwarp();
337
+ }
338
+ KP14_MARK(3);
339
+ // S and F per expanded dof
340
+ for (int e = lane; e < NE; e += 32) {
341
+ const int b = KG(EBody, e);
342
+ T ww[3], vv[3];
343
+ if (KG(EKind, e) == 0) {
344
+ for (int k = 0; k < 3; ++k) { ww[k] = T(0); vv[k] = s.eax[e][k]; }
345
+ } else {
346
+ T r[3];
347
+ for (int k = 0; k < 3; ++k) { ww[k] = s.eax[e][k]; r[k] = s.xpos[1][k] - s.xpos[b][k]; }
348
+ crs(ww, r, vv);
349
+ }
350
+ for (int k = 0; k < 3; ++k) { s.u.m.S[e][k] = ww[k]; s.u.m.S[e][3 + k] = vv[k]; }
351
+ const T* c = s.CI(b);
352
+ T wh[3], hv[3], Iw[3];
353
+ crs(ww, c + 6, wh); crs(c + 6, vv, hv); symv(c, ww, Iw);
354
+ for (int k = 0; k < 3; ++k) { s.u.m.F[e][k] = c[9] * vv[k] + wh[k]; s.u.m.F[e][3 + k] = Iw[k] + hv[k]; }
355
+ const T* f = s.FS(b); // BIAS's term, the expression BIAS formed from S_e in shared (ci / fs are dead after SF)
356
+ s.u.m.bt[e] = ww[0] * f[3] + ww[1] * f[4] + ww[2] * f[5] + vv[0] * f[0] + vv[1] * f[1] + vv[2] * f[2];
357
+ }
358
+ __syncwarp();
359
+ KP14_MARK(4);
360
+ // M: zero, then each lane its own entries from its contiguous records (gPairRec: i, j, entry, weight index), an entry's records
361
+ // in table order; then the armature on the diagonal
362
+ for (int t = lane; t < KP14_MWORDS; t += 32) s.a.M[t] = T(0); // over ci / fs, dead after SF
363
+ __syncwarp();
364
+ {
365
+ const int k0 = KG(PairOff, lane), k1 = KG(PairOff, lane + 1);
366
+ T sum = T(0);
367
+ int cur = -1;
368
+ // software-pipelined, records two ahead and weights one ahead (the heaviest lane holds 66 records of one entry): a warp
369
+ // issues in order, so a weight's load must not wait on a record loaded in the same iteration. The indices are clamped to
370
+ // the table, so every load is unconditional (no branch splits the loop body); the same products summed in the same order
371
+ constexpr int kLast = MD::NPAIR - 1;
372
+ int4 r0 = __ldg(&MD::gPairRec[k0 < kLast ? k0 : kLast]), r1 = __ldg(&MD::gPairRec[k0 + 1 < kLast ? k0 + 1 : kLast]);
373
+ T w0 = ldv(V, MD::O_PAIRW + r0.w);
374
+ for (int k = k0; k < k1; ++k) {
375
+ const int4 r = r0;
376
+ const T wgt = w0;
377
+ r0 = r1;
378
+ r1 = __ldg(&MD::gPairRec[k + 2 < kLast ? k + 2 : kLast]);
379
+ w0 = ldv(V, MD::O_PAIRW + r0.w); // record k + 1, loaded an iteration ago
380
+ if (r.z != cur) { if (cur >= 0) s.a.M[KP14_MW(cur)] = sum; cur = r.z; sum = T(0); }
381
+ const T* Sj = s.u.m.S[r.y];
382
+ const T* Fi = s.u.m.F[r.x];
383
+ const T d = Sj[0] * Fi[3] + Sj[1] * Fi[4] + Sj[2] * Fi[5] + Sj[3] * Fi[0] + Sj[4] * Fi[1] + Sj[5] * Fi[2];
384
+ sum += wgt * d;
385
+ }
386
+ if (cur >= 0) s.a.M[KP14_MW(cur)] = sum;
387
+ }
388
+ __syncwarp();
389
+ for (int d = lane; d < NV; d += 32) s.a.M[KP14_MW(TRI(d, d))] += ldv(V, MD::O_ARM + d);
390
+ KP14_MARK(5);
391
+ // BIAS and the damping
392
+ for (int d = lane; d < NV; d += 32) {
393
+ T sum = T(0);
394
+ for (int k = KG(BiasOff, d); k < KG(BiasOff, d + 1); ++k) {
395
+ const int e = KG(BiasE, k);
396
+ sum += ldv(V, MD::O_ECOEF + e) * s.u.m.bt[e];
397
+ }
398
+ s.u.m.bias[d] = sum;
399
+ s.u.m.pas[d] = -ldv(V, MD::O_DAMP + d) * s.qvel[d];
400
+ }
401
+ __syncwarp();
402
+ KP14_MARK(6);
403
+ // the springs (lane 0) and the ball_roms (lane 1 + r): disjoint dofs, so concurrent is law14.h's sequential result
404
+ if (lane == 0) {
405
+ for (int k = 0; k < MD::NSPRING; ++k)
406
+ s.u.m.pas[MD::cSpDof[k]] = s.u.m.pas[MD::cSpDof[k]] - ldv(V, MD::O_SPRING + 2 * k) * (s.qpos[MD::cSpQadr[k]] - ldv(V, MD::O_SPRING + 2 * k + 1));
407
+ } else if (lane <= MD::NROM) {
408
+ ball_rom(s, V, lane - 1, s.u.m.pas);
409
+ }
410
+ __syncwarp();
411
+ if constexpr (BP) {
412
+ for (int d = lane; d < NV; d += 32) { bias_out[d] = s.u.m.bias[d]; pas_out[d] = s.u.m.pas[d]; }
413
+ }
414
+ for (int d = lane; d < NV; d += 32) {
415
+ s.qf[d] = s.u.m.pas[d] + (tau_ext ? tau_ext[d] : T(0)) - s.u.m.bias[d];
416
+ s.qa[d] = s.qf[d];
417
+ }
418
+ __syncwarp();
419
+ KP14_MARK(7);
420
+ #if defined(D16_NV_GT64)
421
+ // SOLVE on the split storage (chol_split.cuh): M copied into the factor's region (L2 copies the unfactored M into the hand), the right-hand
422
+ // side gathered into the split order, the factor with the forward solve fused, the backward solve (k_pre's own Tag), scattered back
423
+ {
424
+ namespace CH = js::soft::gpu::chol;
425
+ for (int t = lane; t < KP14_MWORDS; t += 32) s.u.f.L[t] = s.a.M[t]; // L / rinv / xs overlay S / F, bias and pas (dead: qf is formed)
426
+ CH::split_gather<T>(s.qa, s.u.f.xs, lane);
427
+ CH::split_factor_fwd<T>(s.u.f.L, s.u.f.rinv, s.u.f.col0, s.u.f.col1, T(1e-15), lane, s.u.f.xs);
428
+ KP14_MARK(8);
429
+ CH::split_solve_bwd<T, kTagKpre14>(s.u.f.L, s.u.f.rinv, s.u.f.xs, lane);
430
+ CH::split_scatter<T>(s.u.f.xs, s.qa, lane);
431
+ }
432
+ #else
433
+ // SOLVE: the dense broadcast factor from row registers with the forward solve fused (chol_rn factor_regs, RHS), then the
434
+ // backward solve (solve_bwd, k_pre's own Tag). newton.h's mindiag rule (MuJoCo's threshold; the column below a clamped pivot
435
+ // zeroed, which MuJoCo does not do: chol_rn.cuh's header); the clamped count is not read here. The result is newton.h's chol up
436
+ // to roundoff.
437
+ {
438
+ namespace CH = js::soft::gpu::chol;
439
+ constexpr int NT = CH::Dims<NV>::NT, NTB = CH::Dims<NV>::NTB;
440
+ T a[32], tt[NT], tb[NTB];
441
+ #if defined(D16_NV_LE32) // no tail rows, and a lane >= NV owns no row (chol_small.cuh)
442
+ CH::load_row<T, NV>(s.a.M, a, lane);
443
+ #else
444
+ #pragma unroll
445
+ for (int j = 0; j < 32; ++j) a[j] = j <= lane ? s.a.M[TRI(lane, j)] : T(0);
446
+ #pragma unroll
447
+ for (int t = 0; t < NT; ++t) {
448
+ tt[t] = s.a.M[TRI(32 + t, lane)];
449
+ #pragma unroll
450
+ for (int u = 0; u <= t; ++u) tb[t * (t + 1) / 2 + u] = s.a.M[TRI(32 + t, 32 + u)];
451
+ }
452
+ #endif
453
+ __syncwarp(); // L / rinv / the columns overlay S / F, bias and pas (dead: qf is formed)
454
+ CH::factor_regs<T, NV, true>(a, tt, tb, s.u.f.L, s.u.f.rinv, s.u.f.col0, s.u.f.col1, T(1e-15), lane, s.qa);
455
+ KP14_MARK(8);
456
+ CH::solve_bwd<T, NV, kTagKpre14>(s.u.f.L, s.u.f.rinv, s.qa, lane);
457
+ __syncwarp();
458
+ }
459
+ #endif
460
+ KP14_MARK(9);
461
+ #undef KP14_MARK
462
+ }
463
+
464
+ } // namespace kp14
465
+ } // namespace d16