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,48 @@
1
+ #pragma once
2
+ // D16 extension hook 2 (2026-11-02; core/soft/EXTENSION_HOOKS.md): every read of a model value in device code goes
3
+ // through one accessor that takes the world, mv.at(field, p), so per-world model values (digital twins, populations,
4
+ // domain randomization) can be switched on at compile time without touching the call sites.
5
+ // The default policy, MVShared, ignores the world and the field and reads __ldg(p): the same load as before the hook,
6
+ // so a default build's SASS is unchanged (the hook's acceptance gate, tools/d16/sass_same.py). MVScaled and MVPerWorld are
7
+ // declared for the call sites' sake and refuse to compile until they are implemented (fail fast, no half-built path).
8
+ #include "diffneusim/macros.h"
9
+
10
+ namespace js::soft::gpu {
11
+
12
+ // the fields a policy can make per-world (a field id is only an index for the non-shared policies' descriptor tables)
13
+ enum ModelField : int {
14
+ kFieldGeomPose = 0, kFieldGeomSize, kFieldPairThr, kFieldPairReach, kFieldPairMargin, kFieldPairMu0, kFieldPairK,
15
+ kFieldPairB, kFieldPairImp, kFieldPairTran, kFieldJointRange, kFieldJointMargin, kFieldJointK, kFieldJointB,
16
+ kFieldJointImp, kFieldJointInvw,
17
+ // the muscles (the request, 2026-11-02; appended, so the ids above keep their values)
18
+ kFieldMuscleFmax, kFieldMuscleLopt, kFieldMuscleLslack, kFieldMuscleVmax, kFieldMuscleCurve, kFieldMuscleAct, kFieldMuscleSite,
19
+ kFieldCount
20
+ };
21
+
22
+ struct MVShared {}; // one table for every world (the default)
23
+ struct MVScaled {}; // a shared base times a per-world scale table (not implemented yet)
24
+ struct MVPerWorld {}; // a whole table per world (not implemented yet)
25
+
26
+ template <class Policy> struct ModelView;
27
+
28
+ // host and device (the CPU reference shares the templates): on the device the load is __ldg, exactly the pre-hook load (the SASS
29
+ // gate), on the host a plain read
30
+ template <> struct ModelView<MVShared> {
31
+ DN_HOST_DEVICE explicit ModelView(int /*world*/) {}
32
+ // at(field, p): the value at p, a pointer into the field's table written exactly as the pre-hook load was (the same
33
+ // pointer arithmetic keeps the same SASS); a per-world policy recovers the entry's index as p - the field's base
34
+ template <class T> DN_HOST_DEVICE T at(int /*field*/, const T* p) const {
35
+ #ifdef __CUDA_ARCH__
36
+ return __ldg(p);
37
+ #else
38
+ return *p;
39
+ #endif
40
+ }
41
+ // a run of values a law function reads through a pointer (e.g. impedance's solimp [5]): the same pointer
42
+ template <class T> DN_HOST_DEVICE const T* row(int /*field*/, const T* base) const { return base; }
43
+ };
44
+
45
+ // ModelView<MVScaled> and ModelView<MVPerWorld> are left undefined on purpose: selecting either is a compile error (an
46
+ // incomplete type) until it is implemented (EXTENSION_HOOKS.md hook 2).
47
+
48
+ } // namespace js::soft::gpu
@@ -0,0 +1,15 @@
1
+ #pragma once
2
+ // Does a muscle case fit the kernels it is about to run on? (PORT_DESIGN.md 7.1; C, 2026-11-06) A case from another body, or wider than its
3
+ // build, gives wrong physics with no error: -DNDEBUG drops the device asserts, the guarded loops skip the excess sites, and the upload takes
4
+ // nm and nslot from the case's own dims. Every binding that uploads tables calls this on the host, in every build, so all three share one
5
+ // check. nm, nslot and KD must equal the build's (g_ent holds lane * KD + k). The export's NS is only a capacity (myoLeg26's build runs NS 8 on
6
+ // a case that records 10), so sites and row entries are read from the tables themselves. No device or CUDA dependency:
7
+ // tools/d16_bodies/case_fits_plant.cpp plants each failure on the host.
8
+ namespace js::soft::gpu {
9
+ inline bool mus_case_fits(int case_nm, int case_nslot, int case_kd, const int* site_off, const int* row_off, int NM, int NSLOT, int NS, int KD) {
10
+ if (case_nm != NM || case_nslot != NSLOT || case_kd != KD) return false;
11
+ for (int m = 0; m < case_nm; ++m)
12
+ if (site_off[m + 1] - site_off[m] > NS || row_off[m + 1] - row_off[m] > KD) return false;
13
+ return true;
14
+ }
15
+ } // namespace js::soft::gpu
@@ -0,0 +1,182 @@
1
+ #pragma once
2
+ // The muscle stage by class, on the host (2026-11-08; tools/d16_bodies/MUSCLE_SPLIT.md, the review R1-R5): a case's two muscle classes and
3
+ // each class's tables, derived from the case's own arrays (mus_upload_tables' layout: the tables a[0..42], the perm a[51]). No device or CUDA
4
+ // dependency, so tools/d16_bodies/split/mus_classes_check.cpp runs it on the CPU against split/mus_classes.py; k_mus_host.cuh mus_class_upload
5
+ // uploads its output.
6
+ // class 0, narrow: the muscles with at most ns0 sites and kd0 row entries; class 1, wide: the rest
7
+ // a class's slot table: its muscles' site and joint-entry slots with their ancestors (slot_parent), plus the identity, in global order (so
8
+ // by level); its levels are the global levels it touches
9
+ // R2: every value array stays global; a class has its own copies only of the slot-indexed arrays, of site_body, jent_body and the entry
10
+ // records' int part (full length, indexed by the global site / entry, holding class slots; the other class's entries hold -1), and of its
11
+ // rounds' perm (global muscle ids, in the case perm's relative order) and gather (at the class's KD)
12
+ #include <cstdio>
13
+ #include <cstdlib>
14
+ #include <vector>
15
+ #if defined(D16_BODY_ROW_CF)
16
+ #include "mus_row_cf.h"
17
+ #endif
18
+
19
+ namespace js::soft::gpu {
20
+
21
+ // the export's tau / q_bar gather (muscle_ref_gate.cpp export_gpu_case) for the muscle order perm [nm] at the staging stride kd: per round r and
22
+ // dof d, the round's lanes in order, each lane's row entries on d as lane * kd + (k - row_off[m]); g_off [nround nv + 1]
23
+ inline void mus_gather(int nv, int nm, const int* perm, const int* row_off, const int* row_dof, int kd, std::vector<int>& g_off,
24
+ std::vector<int>& g_ent) {
25
+ g_off.assign(1, 0);
26
+ g_ent.clear();
27
+ for (int r = 0; r * 32 < nm; ++r)
28
+ for (int d = 0; d < nv; ++d) {
29
+ for (int ln = 0; ln < 32 && 32 * r + ln < nm; ++ln) {
30
+ const int m = perm[32 * r + ln];
31
+ for (int k = row_off[m]; k < row_off[m + 1]; ++k)
32
+ if (row_dof[k] == d) g_ent.push_back(ln * kd + (k - row_off[m]));
33
+ }
34
+ g_off.push_back(static_cast<int>(g_ent.size()));
35
+ }
36
+ }
37
+ // a muscle's class: 1 (wide) when its sites or row entries exceed the narrow class's widths
38
+ inline int mus_class_of(const int* site_off, const int* row_off, int m, int ns0, int kd0) {
39
+ return site_off[m + 1] - site_off[m] > ns0 || row_off[m + 1] - row_off[m] > kd0 ? 1 : 0;
40
+ }
41
+ // every muscle's class. fill (gen_body --mus-fill; PREREG_MW2.md, the 12-round partition): the narrow muscles past the narrow class's whole rounds of 32,
42
+ // the last ones in perm order, join the wide class when the wide round has the lanes for them, so the narrow class runs whole rounds only
43
+ inline void mus_class_vec(int nm, const int* perm, const int* site_off, const int* row_off, int ns0, int kd0, bool fill, std::vector<int>& cls) {
44
+ cls.assign(nm, 0);
45
+ int n0 = 0;
46
+ for (int m = 0; m < nm; ++m) n0 += (cls[m] = mus_class_of(site_off, row_off, m, ns0, kd0)) == 0 ? 1 : 0;
47
+ const int rem = n0 % 32, n1 = nm - n0;
48
+ if (!fill || rem == 0 || n1 + rem > 32 || n0 == rem) return;
49
+ for (int i = nm - 1, moved = 0; i >= 0 && moved < rem; --i)
50
+ if (cls[perm[i]] == 0) { cls[perm[i]] = 1; ++moved; }
51
+ }
52
+ // the class order (the Q2): perm with the class 1 muscles moved last, each class in perm's relative order. The split's sums equal the single
53
+ // kernel's on this order with its gather rebuilt for it: the bitwise control.
54
+ inline void mus_perm_prime(int nm, const int* perm, const std::vector<int>& cls, std::vector<int>& pp) {
55
+ pp.clear();
56
+ for (int c = 0; c < 2; ++c)
57
+ for (int i = 0; i < nm; ++i)
58
+ if (cls[perm[i]] == c) pp.push_back(perm[i]);
59
+ }
60
+
61
+ [[noreturn]] inline void mus_class_fail(const char* what, int c, int i) {
62
+ std::fprintf(stderr, "mus_classes: %s (class %d, index %d)\n", what, c, i);
63
+ std::abort();
64
+ }
65
+
66
+ // the case's dims, in kmus_gate.py bind_dims' order (k_mus_host.cuh MusDim)
67
+ enum MusClsDim { kMcNQ, kMcNV, kMcNM, kMcNSITE, kMcNSLOT, kMcNLEV, kMcNROUND, kMcNNZ, kMcNJE, kMcNSEED, kMcNGENT, kMcNW, kMcKD };
68
+
69
+ // R4's premise: mus_gather rebuilds the case's own gather from its perm at its KD
70
+ inline void mus_gather_check(const int* dm, void* const* a) {
71
+ std::vector<int> go, ge;
72
+ mus_gather(dm[kMcNV], dm[kMcNM], static_cast<const int*>(a[51]), static_cast<const int*>(a[17]), static_cast<const int*>(a[18]), dm[kMcKD], go, ge);
73
+ const int* g_off = static_cast<const int*>(a[40]);
74
+ const int* g_ent = static_cast<const int*>(a[41]);
75
+ bool same = static_cast<int>(go.size()) == dm[kMcNROUND] * dm[kMcNV] + 1 && static_cast<int>(ge.size()) == dm[kMcNGENT];
76
+ for (size_t i = 0; same && i < go.size(); ++i) same = go[i] == g_off[i];
77
+ for (size_t i = 0; same && i < ge.size(); ++i) same = ge[i] == g_ent[i];
78
+ if (!same) mus_class_fail("the gather rule does not rebuild the case's g_off / g_ent", -1, -1);
79
+ }
80
+
81
+ template <class T> struct MusClassHost {
82
+ int nm = 0, nslot = 0, nlev = 0, nround = 0;
83
+ std::vector<int> perm, lev_off, parent, kjt, qadr, vadr, jtype, cpl_qadr, site_body, jent_body, erec_i, g_off, g_ent;
84
+ std::vector<T> pos, quat, axis, cpl_coef;
85
+ };
86
+
87
+ // Both classes' tables, with R4's checks (each aborts with its reason): the class perms are disjoint and cover every muscle; each class's
88
+ // muscles fit its widths (sites 2 .. ns_c, row entries <= kd_c); each class slot holds its global slot's fields, its parent is its global
89
+ // slot's parent, on an earlier level of the class's table; the gather rule rebuilds the case's own gather.
90
+ // What two of them can catch (the review of the diff): the class is a function of the muscle, so "in two classes or in none" checks that the case
91
+ // perm is a permutation; the field compare reads back the arrays this function just copied, so only a NaN can fail it. The evidence for the
92
+ // derivation is the CPU check against mus_classes.py (split/mus_classes_check.py) and the device's bitwise gate (split/split_gate.py).
93
+ template <class T>
94
+ void mus_classes_host(const int* dm, void* const* a, const int ns[2], const int kd[2], bool fill, MusClassHost<T> out[2]) {
95
+ const int nm = dm[kMcNM], nsite = dm[kMcNSITE], ns_ = dm[kMcNSLOT], nje = dm[kMcNJE], nlev = dm[kMcNLEV], nv = dm[kMcNV];
96
+ const auto I = [&](int k) { return static_cast<const int*>(a[k]); };
97
+ const auto F = [&](int k) { return static_cast<const T*>(a[k]); };
98
+ const int *site_off = I(16), *row_off = I(17), *row_dof = I(18), *jent_off = I(19), *jent_body = I(20), *jent_mask = I(21), *jent_slot = I(22);
99
+ const int *site_body = I(23), *bj = I(29), *bcq = I(31), *lev_off = I(33), *parent = I(34), *kjt = I(35), *qadr = I(36), *vadr = I(37);
100
+ const T *bax = F(30), *bcc = F(32), *pos = F(38), *quat = F(39);
101
+ const int* perm = I(51);
102
+ #if defined(D16_BODY_ROW_CF) // the class records carry the entries' codes (mus_row_cf.h), as the full records do
103
+ std::vector<int> rcode;
104
+ mus_row_codes(nm, site_off, jent_off, jent_mask, rcode);
105
+ jent_mask = rcode.data();
106
+ #endif
107
+ mus_gather_check(dm, a);
108
+ std::vector<int> glev(ns_, -1); // each global slot's level (slot 0, the identity, is in none)
109
+ if (lev_off[0] != 1 || lev_off[nlev] != ns_) mus_class_fail("the global levels do not cover slots 1 ..", -1, nlev);
110
+ for (int lv = 0; lv < nlev; ++lv)
111
+ for (int s = lev_off[lv]; s < lev_off[lv + 1]; ++s) glev[s] = lv;
112
+ std::vector<int> seen(nm, 0), cls;
113
+ mus_class_vec(nm, perm, site_off, row_off, ns[0], kd[0], fill, cls);
114
+ for (int c = 0; c < 2; ++c) {
115
+ MusClassHost<T>& o = out[c];
116
+ o = MusClassHost<T>{};
117
+ for (int i = 0; i < nm; ++i)
118
+ if (cls[perm[i]] == c) o.perm.push_back(perm[i]);
119
+ o.nm = static_cast<int>(o.perm.size());
120
+ o.nround = (o.nm + 31) / 32;
121
+ std::vector<char> in(ns_, 0);
122
+ in[0] = 1;
123
+ const auto add = [&](int s) { while (s > 0 && !in[s]) { in[s] = 1; s = parent[s]; } };
124
+ for (const int m : o.perm) {
125
+ if (++seen[m] != 1) mus_class_fail("a muscle in two classes", c, m);
126
+ const int nsm = site_off[m + 1] - site_off[m], ndm = row_off[m + 1] - row_off[m];
127
+ if (nsm < 2 || nsm > ns[c] || ndm > kd[c]) mus_class_fail("a muscle wider than its class's build (sites, row entries)", c, m);
128
+ for (int s = site_off[m]; s < site_off[m + 1]; ++s) add(site_body[s]);
129
+ for (int e = jent_off[m]; e < jent_off[m + 1]; ++e) add(jent_body[e]);
130
+ }
131
+ std::vector<int> gsl, cmap(ns_, -1); // class slot -> global slot (ascending, so by level); global -> class
132
+ for (int s = 0; s < ns_; ++s)
133
+ if (in[s]) { cmap[s] = static_cast<int>(gsl.size()); gsl.push_back(s); }
134
+ const int cn = static_cast<int>(gsl.size());
135
+ o.nslot = cn;
136
+ o.lev_off = {1}; // a new class level where the global level changes
137
+ for (int i = 2; i < cn; ++i)
138
+ if (glev[gsl[i]] != glev[gsl[i - 1]]) o.lev_off.push_back(i);
139
+ o.lev_off.push_back(cn);
140
+ o.nlev = static_cast<int>(o.lev_off.size()) - 1;
141
+ std::vector<int> clv(cn, -1);
142
+ for (int lv = 0; lv < o.nlev; ++lv)
143
+ for (int i = o.lev_off[lv]; i < o.lev_off[lv + 1]; ++i) clv[i] = lv;
144
+ o.parent.resize(cn); o.kjt.resize(cn); o.qadr.resize(cn); o.vadr.resize(cn); o.jtype.resize(cn); o.cpl_qadr.resize(cn);
145
+ o.pos.resize(3 * static_cast<size_t>(cn)); o.quat.resize(4 * static_cast<size_t>(cn)); o.axis.resize(3 * static_cast<size_t>(cn));
146
+ o.cpl_coef.resize(5 * static_cast<size_t>(cn));
147
+ for (int i = 0; i < cn; ++i) {
148
+ const int g = gsl[i];
149
+ o.parent[i] = i == 0 ? parent[0] : cmap[parent[g]];
150
+ o.kjt[i] = kjt[g]; o.qadr[i] = qadr[g]; o.vadr[i] = vadr[g]; o.jtype[i] = bj[g]; o.cpl_qadr[i] = bcq[g];
151
+ for (int k = 0; k < 3; ++k) { o.pos[3 * i + k] = pos[3 * g + k]; o.axis[3 * i + k] = bax[3 * g + k]; }
152
+ for (int k = 0; k < 4; ++k) o.quat[4 * i + k] = quat[4 * g + k];
153
+ for (int k = 0; k < 5; ++k) o.cpl_coef[5 * i + k] = bcc[5 * g + k];
154
+ }
155
+ for (int i = 1; i < cn; ++i) { // R4: fields, parent, level
156
+ const int g = gsl[i];
157
+ if (glev[g] < 0) mus_class_fail("a class slot outside the global levels", c, i);
158
+ if (o.parent[i] < 0 || gsl[o.parent[i]] != parent[g]) mus_class_fail("a class slot's parent is not its global slot's parent", c, i);
159
+ if (o.parent[i] != 0 && clv[o.parent[i]] >= clv[i]) mus_class_fail("a class slot's parent is not on an earlier level", c, i);
160
+ bool same = o.kjt[i] == kjt[g] && o.qadr[i] == qadr[g] && o.vadr[i] == vadr[g] && o.jtype[i] == bj[g] && o.cpl_qadr[i] == bcq[g];
161
+ for (int k = 0; k < 3; ++k) same = same && o.pos[3 * i + k] == pos[3 * g + k] && o.axis[3 * i + k] == bax[3 * g + k];
162
+ for (int k = 0; k < 4; ++k) same = same && o.quat[4 * i + k] == quat[4 * g + k];
163
+ for (int k = 0; k < 5; ++k) same = same && o.cpl_coef[5 * i + k] == bcc[5 * g + k];
164
+ if (!same) mus_class_fail("a class slot's fields differ from its global slot's", c, i);
165
+ }
166
+ // site_body, jent_body and the entry records (body, mask, row slot, jtype | (cpl_qadr + 1) << 8) at full length
167
+ o.site_body.assign(nsite, -1); o.jent_body.assign(nje, -1); o.erec_i.assign(4 * static_cast<size_t>(nje), -1);
168
+ for (const int m : o.perm) {
169
+ for (int s = site_off[m]; s < site_off[m + 1]; ++s) o.site_body[s] = cmap[site_body[s]];
170
+ for (int e = jent_off[m]; e < jent_off[m + 1]; ++e) {
171
+ const int b = jent_body[e];
172
+ o.jent_body[e] = cmap[b];
173
+ o.erec_i[4 * e] = cmap[b]; o.erec_i[4 * e + 1] = jent_mask[e]; o.erec_i[4 * e + 2] = jent_slot[e]; o.erec_i[4 * e + 3] = bj[b] | ((bcq[b] + 1) << 8);
174
+ }
175
+ }
176
+ mus_gather(nv, o.nm, o.perm.data(), row_off, row_dof, kd[c], o.g_off, o.g_ent);
177
+ }
178
+ for (int m = 0; m < nm; ++m)
179
+ if (seen[m] != 1) mus_class_fail("a muscle in no class", -1, m);
180
+ }
181
+
182
+ } // namespace js::soft::gpu
@@ -0,0 +1,44 @@
1
+ #pragma once
2
+ // The moment-arm row's closed-form group sums, on the host (2026-11-08; tools/d16_bodies/rowcf/PREREG_ROWCF.md, the review of ROW_PHASE.md). A body
3
+ // built with D16_BODY_ROW_CF stores in each joint entry's record (erec_i.y) the code of its site mask instead of the mask: a mask is a contiguous,
4
+ // non-empty, non-full prefix or suffix of the muscle's sites, so its group sums telescope to the one segment k that crosses the joint, with a sign:
5
+ // suffix [a, n): k = a - 1, sigma +1; prefix [0, b): k = b - 1, sigma -1; code = k << 1 | (sigma < 0)
6
+ // Equal masks give equal codes, so row_ms_rec_cf's change test is today's. Any other mask aborts here: the closed form does not cover it.
7
+ // No device or CUDA dependency (every builder calls it: mus_upload_tables, the engine binding's build(), mus_classes.h's class records).
8
+ // KMUS_ROWCF_PLANT 1 (gate builds only): every prefix code gets sigma +1, which kmus_gate's G1 must catch.
9
+ #include <cstdio>
10
+ #include <cstdlib>
11
+ #include <vector>
12
+
13
+ #ifndef KMUS_ROWCF_PLANT
14
+ #define KMUS_ROWCF_PLANT 0
15
+ #endif
16
+
17
+ namespace js::soft::gpu {
18
+
19
+ inline int mus_row_code(int mask, int n, int m, int e) {
20
+ const unsigned u = static_cast<unsigned>(mask);
21
+ const unsigned all = n >= 32 ? 0xffffffffu : ((1u << n) - 1u);
22
+ if (n < 2 || (u & ~all) != 0 || u == 0 || u == all) {
23
+ std::fprintf(stderr, "mus_row_code: muscle %d entry %d: mask 0x%x over %d sites is empty, full or out of range\n", m, e, u, n);
24
+ std::abort();
25
+ }
26
+ int a = 0;
27
+ while (!((u >> a) & 1u)) ++a;
28
+ int b = a;
29
+ while (b < n && ((u >> b) & 1u)) ++b;
30
+ if ((u >> b) != 0u) { std::fprintf(stderr, "mus_row_code: muscle %d entry %d: mask 0x%x is not contiguous\n", m, e, u); std::abort(); }
31
+ if (b == n) return (a - 1) << 1; // suffix: sigma +1
32
+ if (a == 0) return ((b - 1) << 1) | (KMUS_ROWCF_PLANT == 1 ? 0 : 1); // prefix: sigma -1
33
+ std::fprintf(stderr, "mus_row_code: muscle %d entry %d: mask 0x%x over %d sites is neither a prefix nor a suffix\n", m, e, u, n);
34
+ std::abort();
35
+ }
36
+
37
+ // every entry's code: code[e] for the entries of muscle m (jent_off), over its site count (site_off)
38
+ inline void mus_row_codes(int nm, const int* site_off, const int* jent_off, const int* jent_mask, std::vector<int>& code) {
39
+ code.assign(static_cast<size_t>(jent_off[nm]), 0);
40
+ for (int m = 0; m < nm; ++m)
41
+ for (int e = jent_off[m]; e < jent_off[m + 1]; ++e) code[e] = mus_row_code(jent_mask[e], site_off[m + 1] - site_off[m], m, e);
42
+ }
43
+
44
+ } // namespace js::soft::gpu
@@ -0,0 +1,177 @@
1
+ #pragma once
2
+ // D16 fused env side, Fwd14r / Bwd14r on the device (engine C, 2026-11-03; tools/d16_fused_env/DESIGN.md). One warp per world;
3
+ // the frames by levels on lanes (tree14_pose), the w / vo chains (tree14_chains), the reward's core and the sites' reverse on
4
+ // lane 0 (reward14_core / reward14_reverse, the host build's code), the obs, the lce finiteness, the accumulators' zeroing and the
5
+ // cotangents' writes on lanes, tree14_up as in k_adj14. Graph-capturable: no host syncs, the outputs into the caller's buffers,
6
+ // the caller's stream; the launchers' one-time setup (the shared-memory attribute, the scan tables) runs before any capture.
7
+ // Inputs per world (world-major, Step14's layout): q1 [40], v1 [37] (the law chart), lce1 [356]; the clip (start, T, loop) and
8
+ // the phase. Outputs: Fwd: r, term [8] (height, upright, max |qd| old chart, finite, mimic's three deviation measures, 0), obs [708];
9
+ // Bwd: given r_bar and obs_bar [708], q1_bar [40] RAW (Step14.backward projects it), v1_bar [37], lce1_bar [356].
10
+ #include <cuda_runtime.h>
11
+
12
+ #include <cassert>
13
+
14
+ #include "../x14adj/reward14.h"
15
+
16
+ namespace d16::rew14 {
17
+ namespace A = d16::x14adj;
18
+ #if defined(D16_NV_GT64) // rew14_setup's scan tables are the 14x's 2 slots of fan-in 2 (B3d ported the adjoint's to scan14's t14_upload_tables, not these)
19
+ static_assert(A::NV <= 64, "rew14: port rew14_setup to t14_upload_tables before a phase B body runs the reward");
20
+ #endif
21
+
22
+ template <class T> struct alignas(16) KR {
23
+ A::Tree14<T> t;
24
+ A::Rew14Out<T> o;
25
+ T vb[3], qg[A::NQ], vg[A::NV], tq[A::NV], tv[A::NV], troot[3];
26
+ };
27
+ constexpr int kTerm = 8;
28
+
29
+ template <class T>
30
+ __device__ __forceinline__ void kr_load(KR<T>& S, const T* q1, const T* v1, int w, int lane) {
31
+ for (int i = lane; i < A::NQ; i += 32) S.t.q[i] = q1[static_cast<size_t>(w) * A::NQ + i];
32
+ for (int i = lane; i < A::NV; i += 32) { S.t.v[i] = v1[static_cast<size_t>(w) * A::NV + i]; S.t.a[i] = T(0); S.t.lam[i] = T(0); }
33
+ __syncwarp();
34
+ }
35
+
36
+ template <class T>
37
+ __global__ void __launch_bounds__(32) k_rew14_fwd(const T* __restrict__ V, A::Rew14Model<T> M, A::Rew14Ref<T> R,
38
+ const long* __restrict__ start, const long* __restrict__ clipT,
39
+ const unsigned char* __restrict__ loop, const T* __restrict__ phase,
40
+ const T* __restrict__ q1, const T* __restrict__ v1, const T* __restrict__ lce1, int n,
41
+ T* __restrict__ r, T* __restrict__ term, T* __restrict__ obs,
42
+ long long* prof = nullptr) {
43
+ extern __shared__ __align__(16) unsigned char smem[];
44
+ KR<T>& S = *reinterpret_cast<KR<T>*>(smem);
45
+ const int w = blockIdx.x, lane = threadIdx.x & 31;
46
+ if (w >= n) return;
47
+ const T* lce = lce1 + static_cast<size_t>(w) * A::kNM14;
48
+ long long pr[16] = {};
49
+ (void)pr;
50
+ #if defined(X14ADJ_PROF)
51
+ pr[7] = clock64();
52
+ #endif
53
+ kr_load(S, q1, v1, w, lane);
54
+ X14_MARK(pr, 0);
55
+ A::tree14_pose(S.t, V, lane);
56
+ X14_MARK(pr, 1);
57
+ A::tree14_chains(S.t, V, lane);
58
+ X14_MARK(pr, 2);
59
+ const A::Rew14World<T> wd{start[w], clipT[w], loop[w] != 0, phase[w]};
60
+ bool fin = true;
61
+ for (int m = lane; m < A::kNM14; m += 32) fin = fin && isfinite(lce[m]);
62
+ fin = __all_sync(0xffffffffu, fin);
63
+ if (lane == 0) {
64
+ A::reward14_core(S.t, M, R, wd, S.t.q, S.t.v, static_cast<const T*>(nullptr), S.o);
65
+ T Rr[9];
66
+ A::qmat(S.t.xquat[M.root_b], Rr);
67
+ A::mtv(Rr, S.t.v, S.vb);
68
+ }
69
+ // lane 0's S.vb before the other lanes read it in reward14_obs (obs[41:44]). The CUDA memory model gives no ordering without this
70
+ // barrier; until 2026-11-08 the shipped binaries relied on the compiler's BSSY / BSYNC reconvergence (docs-dev/d16/20261108_rew14_race_sass)
71
+ #if X14ADJ_PLANT != 31 // (plant 31, standin_gate.py's positive control only: the barrier dropped, so the CPU stand-in must see obs[41:44] race)
72
+ __syncwarp();
73
+ #endif
74
+ X14_MARK(pr, 3);
75
+ A::reward14_obs(R, wd, S.t.q, S.t.v, lce, S.vb, obs + static_cast<size_t>(w) * A::kObs, lane);
76
+ X14_MARK(pr, 4);
77
+ if (lane == 0) {
78
+ r[w] = S.o.r;
79
+ T* tt = term + static_cast<size_t>(w) * kTerm;
80
+ tt[0] = S.o.height; tt[1] = S.o.upright; tt[2] = S.o.maxqd; tt[3] = (S.o.finite && fin) ? T(1) : T(0);
81
+ tt[4] = S.o.dev[0]; tt[5] = S.o.dev[1]; tt[6] = S.o.dev[2]; tt[7] = T(0);
82
+ }
83
+ #if defined(X14ADJ_PROF)
84
+ if (lane == 0 && prof) for (int k = 0; k < 16; ++k) prof[static_cast<size_t>(w) * 16 + k] = k == 7 ? 0 : pr[k];
85
+ #endif
86
+ }
87
+
88
+ template <class T>
89
+ __global__ void __launch_bounds__(32) k_rew14_bwd(const T* __restrict__ V, A::Rew14Model<T> M, A::Rew14Ref<T> R,
90
+ const long* __restrict__ start, const long* __restrict__ clipT,
91
+ const unsigned char* __restrict__ loop, const T* __restrict__ phase,
92
+ const T* __restrict__ q1, const T* __restrict__ v1, const T* __restrict__ rb,
93
+ const T* __restrict__ ob, int n, T* __restrict__ qg, T* __restrict__ vg,
94
+ T* __restrict__ lg, long long* prof = nullptr) {
95
+ extern __shared__ __align__(16) unsigned char smem[];
96
+ KR<T>& S = *reinterpret_cast<KR<T>*>(smem);
97
+ const int w = blockIdx.x, lane = threadIdx.x & 31;
98
+ if (w >= n) return;
99
+ const T* obw = ob + static_cast<size_t>(w) * A::kObs;
100
+ long long pr[16] = {};
101
+ (void)pr;
102
+ #if defined(X14ADJ_PROF)
103
+ pr[7] = clock64();
104
+ #endif
105
+ kr_load(S, q1, v1, w, lane);
106
+ A::tree14_pose(S.t, V, lane);
107
+ X14_MARK(pr, 1);
108
+ A::tree14_chains(S.t, V, lane);
109
+ X14_MARK(pr, 2);
110
+ for (int i = lane; i < A::NB * A::kMsg; i += 32) (&S.t.acc[0][0])[i] = T(0);
111
+ for (int i = lane; i < A::NQ; i += 32) S.qg[i] = T(0);
112
+ for (int i = lane; i < A::NV; i += 32) { S.vg[i] = T(0); S.tq[i] = T(0); S.tv[i] = T(0); }
113
+ for (int m = lane; m < A::kNM14; m += 32) lg[static_cast<size_t>(w) * A::kNM14 + m] = obw[75 + m]; // the lce slice
114
+ __syncwarp();
115
+ const A::Rew14World<T> wd{start[w], clipT[w], loop[w] != 0, phase[w]};
116
+ if (lane == 0) {
117
+ A::reward14_core(S.t, M, R, wd, S.t.q, S.t.v, static_cast<const T*>(nullptr), S.o);
118
+ A::reward14_reverse(S.t, M, R, S.o, S.t.q, S.t.v, rb[w], obw, S.qg, S.vg, static_cast<T*>(nullptr), S.troot);
119
+ }
120
+ // lane 0's acc words (the reverse's) before tree14_up's gathers read them: until 2026-11-08 the first gather read only kMAO, which the
121
+ // reverse never writes, and its own sync ordered the rest; the barrier makes that explicit
122
+ __syncwarp();
123
+ X14_MARK(pr, 3);
124
+ A::tree14_up(S.t, V, S.tq, S.tv, lane);
125
+ X14_MARK(pr, 4);
126
+ if (lane == 0) {
127
+ for (int i = 0; i < A::NV; ++i) S.vg[i] += S.tv[i];
128
+ A::reward14_raw(S.t.q, S.tq, S.troot, S.qg);
129
+ }
130
+ __syncwarp();
131
+ for (int i = lane; i < A::NQ; i += 32) qg[static_cast<size_t>(w) * A::NQ + i] = S.qg[i];
132
+ for (int i = lane; i < A::NV; i += 32) vg[static_cast<size_t>(w) * A::NV + i] = S.vg[i];
133
+ X14_MARK(pr, 5);
134
+ #if defined(X14ADJ_PROF)
135
+ if (lane == 0 && prof) for (int k = 0; k < 16; ++k) prof[static_cast<size_t>(w) * 16 + k] = k == 7 ? 0 : pr[k];
136
+ #endif
137
+ }
138
+
139
+ #if !defined(D16_CPU_STANDIN) // (the CPU stand-in, tools/d16_fused_env/rew14_cpu.cpp, runs the kernels per world and fills the tables itself)
140
+ // one-time setup (before any capture): the dynamic shared size, the scan tables (this translation unit's copies)
141
+ template <class T> void rew14_setup() {
142
+ static bool done = false;
143
+ if (done) return;
144
+ const int sz = static_cast<int>(sizeof(KR<T>));
145
+ cudaError_t e = cudaFuncSetAttribute(k_rew14_fwd<T>, cudaFuncAttributeMaxDynamicSharedMemorySize, sz);
146
+ assert(e == cudaSuccess && "rew14: the forward's shared size");
147
+ e = cudaFuncSetAttribute(k_rew14_bwd<T>, cudaFuncAttributeMaxDynamicSharedMemorySize, sz);
148
+ assert(e == cudaSuccess && "rew14: the backward's shared size");
149
+ int tab[A::kNR * 2 * 32], dtab[A::kNR * 2 * 32], kids[4];
150
+ A::t14_anc_table(tab);
151
+ A::t14_desc_table(dtab, kids);
152
+ e = cudaMemcpyToSymbol(A::gAnc14, tab, sizeof(tab));
153
+ assert(e == cudaSuccess);
154
+ e = cudaMemcpyToSymbol(A::gDesc14, dtab, sizeof(dtab));
155
+ assert(e == cudaSuccess);
156
+ e = cudaMemcpyToSymbol(A::gKid14, kids, sizeof(kids));
157
+ assert(e == cudaSuccess && "rew14: the scan tables");
158
+ (void)e;
159
+ done = true;
160
+ }
161
+ template <class T>
162
+ void rew14_fwd(int n, cudaStream_t st, const T* V, const A::Rew14Model<T>& M, const A::Rew14Ref<T>& R, const long* start,
163
+ const long* clipT, const unsigned char* loop, const T* phase, const T* q1, const T* v1, const T* lce1, T* r, T* term,
164
+ T* obs, long long* prof = nullptr) {
165
+ rew14_setup<T>();
166
+ k_rew14_fwd<T><<<n, 32, sizeof(KR<T>), st>>>(V, M, R, start, clipT, loop, phase, q1, v1, lce1, n, r, term, obs, prof);
167
+ }
168
+ template <class T>
169
+ void rew14_bwd(int n, cudaStream_t st, const T* V, const A::Rew14Model<T>& M, const A::Rew14Ref<T>& R, const long* start,
170
+ const long* clipT, const unsigned char* loop, const T* phase, const T* q1, const T* v1, const T* rb, const T* ob, T* qg,
171
+ T* vg, T* lg, long long* prof = nullptr) {
172
+ rew14_setup<T>();
173
+ k_rew14_bwd<T><<<n, 32, sizeof(KR<T>), st>>>(V, M, R, start, clipT, loop, phase, q1, v1, rb, ob, n, qg, vg, lg, prof);
174
+ }
175
+ #endif
176
+
177
+ } // namespace d16::rew14
@@ -0,0 +1,44 @@
1
+ #pragma once
2
+ // D16 adjoint (engine B, 2026-11-02): the contact / joint / actuator tables B's row reverse reads on the device (the CTab interface of
3
+ // core/soft/adj/rows_lanes.h), as plain device arrays of the law structs (SoftGeom / SoftPair / SoftJoint / SoftActuator, FP64
4
+ // parameters as in L2 v2; their f32 form is an L5 item shared with L2).
5
+ #include <vector>
6
+
7
+ #include "../adj/rows_lanes.h"
8
+
9
+ namespace js::soft::adj {
10
+
11
+
12
+
13
+ // L5 (i): the precomputed views of type P in device memory (P = float for the f32 kernel: no FP64; P = double for the f64 gate build,
14
+ // whose values equal the host's bit for bit, the same law calls). Hook 2 (EXTENSION_HOOKS.md): the scalable fields (K, B, imp, margin,
15
+ // mu0) go through the accessor here when it lands; tran / diw are Shared per model (MuJoCo's compile-time invweight0).
16
+ template <class Pp> struct DevCTabV {
17
+ using P = Pp;
18
+ const PairV<P>* pv; const GeomV<P>* gv; const JointV<P>* jv; const ActV<P>* av;
19
+ int nj, na, nv_; P ir;
20
+ DN_HOST_DEVICE const PairV<P>& pair(int i) const { return pv[i]; }
21
+ DN_HOST_DEVICE const GeomV<P>& geom(int g) const { return gv[g]; }
22
+ DN_HOST_DEVICE const JointV<P>& joint(int j) const { return jv[j]; }
23
+ DN_HOST_DEVICE int njoint() const { return nj; }
24
+ DN_HOST_DEVICE int nact() const { return na; }
25
+ DN_HOST_DEVICE const ActV<P>& act(int a) const { return av[a]; }
26
+ DN_HOST_DEVICE P impratio() const { return ir; }
27
+ DN_HOST_DEVICE int nv() const { return nv_; }
28
+ };
29
+ template <class P> struct CTabViews { // host-built tables, uploaded by the caller
30
+ std::vector<PairV<P>> pv; std::vector<GeomV<P>> gv; std::vector<JointV<P>> jv; std::vector<ActV<P>> av;
31
+ };
32
+ template <class P>
33
+ inline CTabViews<P> build_ctab_views(const std::vector<SoftGeom>& G, const std::vector<SoftPair>& Pp, const std::vector<SoftJoint>& J,
34
+ const std::vector<SoftActuator>& A, const std::vector<double>& dof_iw,
35
+ const std::vector<double>& body_iw, double timestep) {
36
+ CTabViews<P> t;
37
+ for (const SoftPair& pr : Pp) t.pv.push_back(pair_view<P>(pr, G.data(), body_iw.data(), timestep));
38
+ for (const SoftGeom& g : G) t.gv.push_back(geom_view<P>(g));
39
+ for (const SoftJoint& j : J) t.jv.push_back(joint_view<P>(j, dof_iw.data(), timestep));
40
+ for (const SoftActuator& a : A) t.av.push_back(act_view<P>(a));
41
+ return t;
42
+ }
43
+
44
+ } // namespace js::soft::adj