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.
- diffneusim/__init__.py +1 -0
- diffneusim/_cache.py +42 -0
- diffneusim/_paths.py +5 -0
- diffneusim/bindings/rew14_ext.cu +115 -0
- diffneusim/bindings/soft14_capi.cpp +443 -0
- diffneusim/bindings/soft14_engine_ext.cu +596 -0
- diffneusim/bindings/soft_capi.cpp +782 -0
- diffneusim/bindings/soft_engine_ext.cu +495 -0
- diffneusim/core/cpu_engine/build.sh +40 -0
- diffneusim/core/cpu_engine/fiber/cuda_runtime.h +445 -0
- diffneusim/core/cpu_engine/x14_cpu.cpp +283 -0
- diffneusim/core/diff/dual.h +126 -0
- diffneusim/core/include/diffneusim/macros.h +35 -0
- diffneusim/core/kin/kinematic_tree.h +273 -0
- diffneusim/core/math/so3.h +182 -0
- diffneusim/core/soft/adj/out_adj.h +102 -0
- diffneusim/core/soft/adj/rnea_adj.h +425 -0
- diffneusim/core/soft/adj/rows_adj.h +439 -0
- diffneusim/core/soft/adj/rows_functor.h +89 -0
- diffneusim/core/soft/adj/rows_lanes.h +443 -0
- diffneusim/core/soft/adj/shell_adj.h +243 -0
- diffneusim/core/soft/adj/tree_adj.h +356 -0
- diffneusim/core/soft/collide.h +183 -0
- diffneusim/core/soft/gpu/adj14.cuh +233 -0
- diffneusim/core/soft/gpu/adj14_mus.cuh +98 -0
- diffneusim/core/soft/gpu/adj_shell.cuh +50 -0
- diffneusim/core/soft/gpu/adj_tab.cuh +49 -0
- diffneusim/core/soft/gpu/body14.cuh +47 -0
- diffneusim/core/soft/gpu/chol_rn.cuh +458 -0
- diffneusim/core/soft/gpu/chol_small.cuh +123 -0
- diffneusim/core/soft/gpu/chol_split.cuh +193 -0
- diffneusim/core/soft/gpu/engine_launch.cuh +263 -0
- diffneusim/core/soft/gpu/fk_rn.cuh +109 -0
- diffneusim/core/soft/gpu/generated/body_019e20820f86_mmfloor.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_62f77a4bb16b_mmfloor.cuh +52 -0
- diffneusim/core/soft/gpu/generated/body_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +28 -0
- diffneusim/core/soft/gpu/generated/body_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +52 -0
- diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor.cuh +25 -0
- diffneusim/core/soft/gpu/generated/body_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +25 -0
- diffneusim/core/soft/gpu/generated/g1_soft_5db44fd45286.cuh +74 -0
- diffneusim/core/soft/gpu/generated/split_62f77a4bb16b_mmfloor.cuh +18 -0
- diffneusim/core/soft/gpu/generated/split_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +18 -0
- diffneusim/core/soft/gpu/generated/x14_soft_019e20820f86_mmfloor.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_62f77a4bb16b_mmfloor.cuh +129 -0
- diffneusim/core/soft/gpu/generated/x14_soft_77dbb7213f26_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsd05_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsdef_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_8989b60e4486_mmfloor_rhlsmjd_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a1e8b196b2cd_mmfloor_rampsb3l_n6t12.cuh +129 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor.cuh +123 -0
- diffneusim/core/soft/gpu/generated/x14_soft_a944653edd64_mmfloor_rampsb3l_n6t12.cuh +123 -0
- diffneusim/core/soft/gpu/k_mus.cuh +1038 -0
- diffneusim/core/soft/gpu/k_mus_host.cuh +377 -0
- diffneusim/core/soft/gpu/k_pre.cuh +52 -0
- diffneusim/core/soft/gpu/kernel_p.cuh +490 -0
- diffneusim/core/soft/gpu/kp14.cuh +465 -0
- diffneusim/core/soft/gpu/l2v2.cuh +367 -0
- diffneusim/core/soft/gpu/l2x14.cuh +319 -0
- diffneusim/core/soft/gpu/l3.cuh +1483 -0
- diffneusim/core/soft/gpu/model_view.cuh +48 -0
- diffneusim/core/soft/gpu/mus_case_fits.h +15 -0
- diffneusim/core/soft/gpu/mus_classes.h +182 -0
- diffneusim/core/soft/gpu/mus_row_cf.h +44 -0
- diffneusim/core/soft/gpu/rew14.cuh +177 -0
- diffneusim/core/soft/gpu/rows_ctab.cuh +44 -0
- diffneusim/core/soft/gpu/tree_m.cuh +247 -0
- diffneusim/core/soft/gpu/x14_engine_kernels.cuh +260 -0
- diffneusim/core/soft/gpu/x14_rowcf.h +14 -0
- diffneusim/core/soft/hand.h +124 -0
- diffneusim/core/soft/impedance.h +115 -0
- diffneusim/core/soft/jvp.h +202 -0
- diffneusim/core/soft/kin.h +250 -0
- diffneusim/core/soft/muscle.h +1208 -0
- diffneusim/core/soft/newton.h +371 -0
- diffneusim/core/soft/rows.h +176 -0
- diffneusim/core/soft/step.h +188 -0
- diffneusim/core/soft/tape.h +313 -0
- diffneusim/core/soft/x14/collide14.h +69 -0
- diffneusim/core/soft/x14/jvp14.h +182 -0
- diffneusim/core/soft/x14/law14.h +453 -0
- diffneusim/core/soft/x14adj/collide14_adj.h +134 -0
- diffneusim/core/soft/x14adj/passive14_adj.h +162 -0
- diffneusim/core/soft/x14adj/reward14.h +484 -0
- diffneusim/core/soft/x14adj/rows14_adj.h +400 -0
- diffneusim/core/soft/x14adj/scan14.h +349 -0
- diffneusim/core/soft/x14adj/shell14_adj.h +122 -0
- diffneusim/core/soft/x14adj/sweep14.h +255 -0
- diffneusim/core/soft/x14adj/tree14_adj.h +500 -0
- diffneusim/core/soft/x14adj/x14adj_common.h +96 -0
- diffneusim/data/mirror/H1622v2k_geyer_hfdeq.npz +0 -0
- diffneusim/data/mirror/H1622v2k_hfd.npz +0 -0
- diffneusim/data/mirror/H1622v2k_millard_hfdeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_p2str_rigid.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_calf2_pe.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfix.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01legs.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_jd01lumbar.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfix.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_lumbfixlegs01.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_hinge.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1a.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n2.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_rom23.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_fusedhand_lspine_girdle_osimeq.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_millard.npz +0 -0
- diffneusim/data/mirror/fullbody_contact_spinecoupled_lspine_girdle_osimeq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_compound_g14eq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_luispe.npz +0 -0
- diffneusim/data/mirror/myoleg26_3d_kneeexp_g14eq_trunkpose_spin_ank30_hip30_trunk0701.npz +0 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_axfix.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_axfixlegs01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01legs.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_jd01lumbar.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfix.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_lumbfixlegs01.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n1.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n1a.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_n2.json +91 -0
- diffneusim/data/muscle_fit/wang_mass_volume_14t_rom23.json +91 -0
- diffneusim/data/reference/musclemimic/myofullbody_mimic_sites.json +261 -0
- diffneusim/data/reference/pose3/pose3_scone.json +305 -0
- diffneusim/data/reference/pose3/pose3_scone.txt +3 -0
- diffneusim/data/reference/pose3/pose3_scone_gait.npz +0 -0
- diffneusim/data/reference/pose3/pose3_scone_mirror.npz +0 -0
- diffneusim/data/reference/pose3/pose3_scone_stand.npz +0 -0
- diffneusim/data/reference/x016run/MD5SUMS +241 -0
- diffneusim/data/reference/x016run/x016run_states.txt +240 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s4_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p00_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s4_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p25_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p50_s7_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s0_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s1_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s2_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s3_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s5_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s6_r3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_l3.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r0.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r1.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r2.npz +0 -0
- diffneusim/data/reference/x016run/x016run_v3p75_s7_r3.npz +0 -0
- diffneusim/data/state_prior/lumbar_poly_fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc.npz +0 -0
- diffneusim/engine/__init__.py +0 -0
- diffneusim/engine/build_tag.py +52 -0
- diffneusim/engine/case_tables.py +46 -0
- diffneusim/engine/d16_body.py +80 -0
- diffneusim/engine/engine14.py +367 -0
- diffneusim/engine/gen_split.py +159 -0
- diffneusim/engine/hand_format.py +69 -0
- diffneusim/engine/live14.py +149 -0
- diffneusim/engine/phase_b_tree.py +137 -0
- diffneusim/engine/soft14.py +130 -0
- diffneusim/engine/soft_capi.py +373 -0
- diffneusim/engine/soft_engine.py +165 -0
- diffneusim/engine/step14.py +132 -0
- diffneusim/engine/tape_format.py +89 -0
- diffneusim/engine/x14cpu.py +163 -0
- diffneusim/env/__init__.py +0 -0
- diffneusim/env/absent.py +20 -0
- diffneusim/env/cpu14.py +105 -0
- diffneusim/env/e0loop14.py +224 -0
- diffneusim/env/env14.py +568 -0
- diffneusim/env/kin_contact14.py +193 -0
- diffneusim/env/mimic_sites_x14.json +366 -0
- diffneusim/env/old_count.py +78 -0
- diffneusim/env/rew14.py +114 -0
- diffneusim/env/rew14_hook.py +105 -0
- diffneusim/g1/__init__.py +1 -0
- diffneusim/g1/arm_a2.py +165 -0
- diffneusim/g1/arm_a3.py +576 -0
- diffneusim/g1/read_a3.py +79 -0
- diffneusim/g1/rg1_read.py +89 -0
- diffneusim/model/__init__.py +66 -0
- diffneusim/model/case.py +17 -0
- diffneusim/model/dnmodel.py +79 -0
- diffneusim/model/fuse_fixed.py +281 -0
- diffneusim/model/monitor.py +834 -0
- diffneusim/models/BODIES.toml +48 -0
- diffneusim/models/MANIFEST.toml +979 -0
- diffneusim/models/cases/G290/case.bin +0 -0
- diffneusim/models/cases/G290/case.json +1 -0
- diffneusim/models/cases/G356-SRC/case.bin +0 -0
- diffneusim/models/cases/G356-SRC/case.json +1 -0
- diffneusim/models/cases/G416/case.bin +0 -0
- diffneusim/models/cases/G416/case.json +1 -0
- diffneusim/models/cases/M290C-SRC/case.bin +0 -0
- diffneusim/models/cases/M290C-SRC/case.json +1 -0
- diffneusim/models/cases/M290R-SRC/case.bin +0 -0
- diffneusim/models/cases/M290R-SRC/case.json +1 -0
- diffneusim/models/cases/M356C-SRC/case.bin +0 -0
- diffneusim/models/cases/M356C-SRC/case.json +1 -0
- diffneusim/models/cases/M356R-SRC/case.bin +0 -0
- diffneusim/models/cases/M356R-SRC/case.json +1 -0
- diffneusim/models/cases/M416C-SRC/case.bin +0 -0
- diffneusim/models/cases/M416C-SRC/case.json +1 -0
- diffneusim/models/derived/d16_expanded_62f77a4bb16b1e67_mmfloor.xml +673 -0
- diffneusim/models/derived/d16_expanded_a1e8b196b2cd7b3c_mmfloor.xml +673 -0
- diffneusim/models/derived/d16_soft_law_019e20820f8633b9_mmfloor.json +7844 -0
- diffneusim/models/derived/d16_soft_law_62f77a4bb16b1e67_mmfloor.json +16855 -0
- diffneusim/models/derived/d16_soft_law_77dbb7213f26e821_mmfloor_rampsb3l_n6t12.json +7883 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rampsb3l_n6t12.json +7883 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsd05_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsdef_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_8989b60e44860c5b_mmfloor_rhlsmjd_n6t12.json +7868 -0
- diffneusim/models/derived/d16_soft_law_a1e8b196b2cd7b3c_mmfloor_rampsb3l_n6t12.json +16894 -0
- diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor.json +12655 -0
- diffneusim/models/derived/d16_soft_law_a944653edd642082_mmfloor_rampsb3l_n6t12.json +12700 -0
- diffneusim/models/derived/unitree_g1_soft_law.json +15580 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +28913 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +29202 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_axfixlegs01.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_armless_ball_lspine_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +46970 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src.dnmodel +38570 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid.dnmodel +38923 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_millard_stickspin_wrapvia_mtp60k25_trunkfix_toepair_n1_src_rigid_qk.txt +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1.dnmodel +1 -0
- diffneusim/models/fullbody_contact_spinecoupled_fusedhand_ball_lspine_girdle_osimeq_stickspin_wrapvia_mtp60k25_trunkfix_calf2_pe_toepair_flsrc_n1_qk.txt +1 -0
- diffneusim/models/fullbody_meshes/1mc.stl +0 -0
- diffneusim/models/fullbody_meshes/2distph.stl +0 -0
- diffneusim/models/fullbody_meshes/2mc.stl +0 -0
- diffneusim/models/fullbody_meshes/2midph.stl +0 -0
- diffneusim/models/fullbody_meshes/2proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/3distph.stl +0 -0
- diffneusim/models/fullbody_meshes/3mc.stl +0 -0
- diffneusim/models/fullbody_meshes/3midph.stl +0 -0
- diffneusim/models/fullbody_meshes/3proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/4distph.stl +0 -0
- diffneusim/models/fullbody_meshes/4mc.stl +0 -0
- diffneusim/models/fullbody_meshes/4midph.stl +0 -0
- diffneusim/models/fullbody_meshes/4proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/5distph.stl +0 -0
- diffneusim/models/fullbody_meshes/5mc.stl +0 -0
- diffneusim/models/fullbody_meshes/5midph.stl +0 -0
- diffneusim/models/fullbody_meshes/5proxph.stl +0 -0
- diffneusim/models/fullbody_meshes/NOTICE +2 -0
- diffneusim/models/fullbody_meshes/capitate.stl +0 -0
- diffneusim/models/fullbody_meshes/clavicle.stl +0 -0
- diffneusim/models/fullbody_meshes/hamate.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_cervical.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_jaw.stl +0 -0
- diffneusim/models/fullbody_meshes/hat_skull.stl +0 -0
- diffneusim/models/fullbody_meshes/humerus.stl +0 -0
- diffneusim/models/fullbody_meshes/l_bofoot.stl +0 -0
- diffneusim/models/fullbody_meshes/l_femur.stl +0 -0
- diffneusim/models/fullbody_meshes/l_fibula.stl +0 -0
- diffneusim/models/fullbody_meshes/l_foot.stl +0 -0
- diffneusim/models/fullbody_meshes/l_patella.stl +0 -0
- diffneusim/models/fullbody_meshes/l_pelvis.stl +0 -0
- diffneusim/models/fullbody_meshes/l_talus.stl +0 -0
- diffneusim/models/fullbody_meshes/l_tibia.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar1.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar2.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar3.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar4.stl +0 -0
- diffneusim/models/fullbody_meshes/lumbar5.stl +0 -0
- diffneusim/models/fullbody_meshes/lunate.stl +0 -0
- diffneusim/models/fullbody_meshes/pisiform.stl +0 -0
- diffneusim/models/fullbody_meshes/r_bofoot.stl +0 -0
- diffneusim/models/fullbody_meshes/r_femur.stl +0 -0
- diffneusim/models/fullbody_meshes/r_fibula.stl +0 -0
- diffneusim/models/fullbody_meshes/r_foot.stl +0 -0
- diffneusim/models/fullbody_meshes/r_patella.stl +0 -0
- diffneusim/models/fullbody_meshes/r_pelvis.stl +0 -0
- diffneusim/models/fullbody_meshes/r_talus.stl +0 -0
- diffneusim/models/fullbody_meshes/r_tibia.stl +0 -0
- diffneusim/models/fullbody_meshes/radius.stl +0 -0
- diffneusim/models/fullbody_meshes/sacrum.stl +0 -0
- diffneusim/models/fullbody_meshes/scaphoid.stl +0 -0
- diffneusim/models/fullbody_meshes/scapula.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic10_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic11_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic12_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic1_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic2_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic3_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic4_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic5_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic6_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic7_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic8_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thoracic9_s.stl +0 -0
- diffneusim/models/fullbody_meshes/thorax.stl +0 -0
- diffneusim/models/fullbody_meshes/thumbdist.stl +0 -0
- diffneusim/models/fullbody_meshes/thumbprox.stl +0 -0
- diffneusim/models/fullbody_meshes/trapezium.stl +0 -0
- diffneusim/models/fullbody_meshes/trapezoid.stl +0 -0
- diffneusim/models/fullbody_meshes/triquetrum.stl +0 -0
- diffneusim/models/fullbody_meshes/ulna.stl +0 -0
- diffneusim/models/source/myo_fullbody/UPSTREAM.md +91 -0
- diffneusim/models/source/myoleg/UPSTREAM.md +52 -0
- diffneusim/models/source/unitree_g1/LICENSE.mjlab +202 -0
- diffneusim/models/source/unitree_g1/UPSTREAM.md +38 -0
- diffneusim/models/source/unitree_g1/assets/head_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_ankle_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_ankle_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_elbow_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_hip_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_knee_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_rubber_hand.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_shoulder_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/left_wrist_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/logo_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/pelvis.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/pelvis_contour_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_ankle_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_ankle_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_elbow_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_hip_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_knee_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_rubber_hand.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_shoulder_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_pitch_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_roll_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/right_wrist_yaw_link.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/torso_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/waist_roll_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/assets/waist_yaw_link_rev_1_0.STL +0 -0
- diffneusim/models/source/unitree_g1/dump_mjlab_reference.py +30 -0
- diffneusim/models/source/unitree_g1/g1.xml +308 -0
- diffneusim/models/source/unitree_g1/g1_constants.py +298 -0
- diffneusim/models/source/unitree_g1/mjlab_compiled_reference.json +857 -0
- diffneusim/models/unitree_g1.dnmodel +4393 -0
- diffneusim/models/unitree_g1_selfcol.dnmodel +20824 -0
- diffneusim/rl/__init__.py +2 -0
- diffneusim/rl/dynsyn_layer.py +146 -0
- diffneusim/rl/footstep_plan.py +337 -0
- diffneusim/rl/g1_bm_env.py +572 -0
- diffneusim/rl/g1_bm_eval.py +168 -0
- diffneusim/rl/g1_bm_fused.py +275 -0
- diffneusim/rl/g1_bm_ppo.py +622 -0
- diffneusim/rl/g1_bm_sapo.py +551 -0
- diffneusim/rl/g1_ppo.py +395 -0
- diffneusim/rl/g1_sapo_soft.py +240 -0
- diffneusim/rl/g1_soft_env.py +452 -0
- diffneusim/rl/g1_soft_grad.py +145 -0
- diffneusim/rl/geyer_curves_torch.py +108 -0
- diffneusim/rl/gpu_fullbody_vec_env.py +1241 -0
- diffneusim/rl/imitation.py +2027 -0
- diffneusim/rl/imitation_reward_v2.py +248 -0
- diffneusim/rl/imitation_reward_v3.py +349 -0
- diffneusim/rl/latent_task.py +175 -0
- diffneusim/rl/llc_reward.py +316 -0
- diffneusim/rl/millard_curves_torch.py +154 -0
- diffneusim/rl/mirror_symmetry.py +212 -0
- diffneusim/rl/model_path.py +35 -0
- diffneusim/rl/mvae_recon.py +123 -0
- diffneusim/rl/nets_shac.py +599 -0
- diffneusim/rl/reset_pool.py +154 -0
- diffneusim/rl/sapo_capture.py +873 -0
- diffneusim/rl/sapo_vec.py +1051 -0
- diffneusim/rl/shac_vec.py +346 -0
- diffneusim/rl/state_prior.py +151 -0
- diffneusim/rl/step_library.py +105 -0
- diffneusim/rl/task_walk_env.py +1793 -0
- diffneusim/rl/task_walk_reward.py +3300 -0
- diffneusim/run.py +23 -0
- diffneusim/run_env.py +46 -0
- diffneusim/tasks/__init__.py +147 -0
- diffneusim/tasks/legacy_names.py +63 -0
- diffneusim/tasks/paths.py +79 -0
- diffneusim/tasks/settings.py +202 -0
- diffneusim/third_party/instantmimic_947430ee/LICENSE +202 -0
- diffneusim/third_party/instantmimic_947430ee/NOTICE +19 -0
- diffneusim/third_party/instantmimic_947430ee/README.md +31 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/benchmark_protocol.py +106 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/metrics.py +214 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/envs/unitree_g1/tasks/beyondmimic_tracking/reference.py +513 -0
- diffneusim/third_party/instantmimic_947430ee/instantmimic/motion/quaternion.py +193 -0
- diffneusim/train/__init__.py +0 -0
- diffneusim/train/eval_ckpt.py +239 -0
- diffneusim/train/eval_mimic.py +133 -0
- diffneusim/train/gait_report.py +203 -0
- diffneusim/train/gcot_chain.py +51 -0
- diffneusim/train/levers.py +135 -0
- diffneusim/train/masked_reset.py +314 -0
- diffneusim/train/rl_algorithm_suite.py +917 -0
- diffneusim/train/train14.py +240 -0
- diffneusim/train/train_tw14.py +674 -0
- diffneusim/viz/__init__.py +5 -0
- diffneusim/viz/__main__.py +41 -0
- diffneusim/viz/camera.py +115 -0
- diffneusim/viz/dnrec.py +118 -0
- diffneusim/viz/dnrec_io.py +686 -0
- diffneusim/viz/hud.py +565 -0
- diffneusim/viz/meshes.py +458 -0
- diffneusim/viz/play.py +237 -0
- diffneusim/viz/record.py +74 -0
- diffneusim/viz/render.py +1402 -0
- diffneusim/viz/renderer.py +268 -0
- diffneusim/viz/rl_env_render.py +635 -0
- diffneusim/viz/snapshot.py +54 -0
- diffneusim/viz/strobe.py +124 -0
- diffneusim/viz/to_mp4.py +58 -0
- diffneusim/viz/ui.py +481 -0
- diffneusim/viz/viewer.py +2086 -0
- diffneusim-1.0.0.dist-info/METADATA +226 -0
- diffneusim-1.0.0.dist-info/RECORD +682 -0
- diffneusim-1.0.0.dist-info/WHEEL +5 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSE +201 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-ARMS-hand-wrist-4.3.txt +20 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/BSD-3-Clause-NC-MoBL-ARMS.txt +25 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/CC-BY-3.0-OpenSim-geometry.txt +25 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Christophy2012-lumbarspine.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lai2017-model-high-flex.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Lee2015-hand_muscle.txt +11 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Rajagopal2016-full_body.txt +11 -0
- diffneusim-1.0.0.dist-info/licenses/LICENSES/MIT-Uhlrich2022-fbmodpassivecal.txt +10 -0
- diffneusim-1.0.0.dist-info/licenses/NOTICE +274 -0
- diffneusim-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
// Portions of this file are translated from MuJoCo 3.16.0 (https://github.com/google-deepmind/mujoco), Copyright 2021
|
|
3
|
+
// DeepMind Technologies Limited, licensed under the Apache License, Version 2.0. Changed by this project: transcribed to
|
|
4
|
+
// templated C++ (double, Dual, float), restructured for the G1 soft law and the GPU path. See core/soft/NOTICE.md.
|
|
5
|
+
// D16 C1 (2026-11-02): MuJoCo 3.16.0's primitive colliders for the G1's geoms (plane, sphere, capsule) and
|
|
6
|
+
// mju_makeFrame, transcribed from engine_collision_primitive.c and engine_util_spatial.c at tag 3.16.0
|
|
7
|
+
// (docs-dev/engine-model/20261102_d16_engine_redesign/LAW_SPEC_MUJOCO316.md, "Primitive colliders"). Templated on the
|
|
8
|
+
// scalar S (double, or js::diff::Dual for C2's IFT JVP: the branches and clips dispatch on the value, as MuJoCo's).
|
|
9
|
+
// Conventions (MuJoCo's): dist < 0 is penetration; the normal points from geom 1 to geom 2; pos is the midpoint between the
|
|
10
|
+
// two surfaces along the normal; a geom's rotation is row-major R (world = R local), its local z axis (R[2], R[5], R[8]).
|
|
11
|
+
#include "diffneusim/macros.h"
|
|
12
|
+
#include "../math/so3.h"
|
|
13
|
+
#include "impedance.h"
|
|
14
|
+
|
|
15
|
+
namespace js::soft {
|
|
16
|
+
|
|
17
|
+
template <class S> using V3 = so3::Vec3<S>;
|
|
18
|
+
|
|
19
|
+
// a geom's world placement: position and row-major rotation
|
|
20
|
+
template <class S> struct GeomPose {
|
|
21
|
+
V3<S> p;
|
|
22
|
+
S R[9];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// one contact before its frame: MuJoCo's mjPreContact (dist, pos, normal, tangent), plus the collider's slot (which of the
|
|
26
|
+
// pair's contacts: plane-capsule end 0 / 1, the parallel capsule-capsule candidate 0-3)
|
|
27
|
+
template <class S> struct PreContact {
|
|
28
|
+
S dist;
|
|
29
|
+
V3<S> pos, normal, tangent;
|
|
30
|
+
int slot;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
template <class S> DN_HOST_DEVICE V3<S> zaxis(const S* R) { return V3<S>{R[2], R[5], R[8]}; }
|
|
34
|
+
template <class S, class P = double> DN_HOST_DEVICE S clip(S x, P lo, P hi) { return x < lo ? S(lo) : (x > hi ? S(hi) : x); }
|
|
35
|
+
|
|
36
|
+
// mju_normalize3 (engine_util_blas.c:113-128): v / |v|, or (1, 0, 0) when |v| < mjMINVAL; returns |v|
|
|
37
|
+
template <class S> DN_HOST_DEVICE S normalize3(V3<S>& v) {
|
|
38
|
+
using so3::js_sqrt;
|
|
39
|
+
const S n = js_sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
|
40
|
+
if (n < lit_t<S>(kMinVal)) {
|
|
41
|
+
v = V3<S>{S(1), S(0), S(0)};
|
|
42
|
+
} else {
|
|
43
|
+
const S inv = S(1) / n;
|
|
44
|
+
v = V3<S>{v.x * inv, v.y * inv, v.z * inv};
|
|
45
|
+
}
|
|
46
|
+
return n;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// mjraw_SphereSphere (:262-295)
|
|
50
|
+
template <class S, class P = double>
|
|
51
|
+
DN_HOST_DEVICE int sphere_sphere(PreContact<S>* con, P margin, V3<S> pos1, V3<S> z1, P r1, V3<S> pos2,
|
|
52
|
+
V3<S> z2, P r2, int slot) {
|
|
53
|
+
const V3<S> dif = so3::sub(pos1, pos2);
|
|
54
|
+
const S cdist_sqr = so3::dot(dif, dif);
|
|
55
|
+
const P min_dist = margin + r1 + r2;
|
|
56
|
+
if (cdist_sqr > min_dist * min_dist) return 0;
|
|
57
|
+
using so3::js_sqrt;
|
|
58
|
+
con->dist = js_sqrt(cdist_sqr) - S(r1) - S(r2);
|
|
59
|
+
V3<S> n = so3::sub(pos2, pos1);
|
|
60
|
+
const S len = normalize3(n);
|
|
61
|
+
if (len < P(kMinVal)) { // the same centres: the normal from the cross product of the z axes, (1, 0, 0) when parallel
|
|
62
|
+
n = so3::cross(z1, z2);
|
|
63
|
+
normalize3(n);
|
|
64
|
+
}
|
|
65
|
+
con->normal = n;
|
|
66
|
+
con->pos = so3::add(pos1, so3::scale(n, S(r1) + con->dist / S(2)));
|
|
67
|
+
con->tangent = V3<S>{S(0), S(0), S(0)};
|
|
68
|
+
con->slot = slot;
|
|
69
|
+
return 1;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// mjraw_PlaneSphere (:28-49): plane (pos1, z1), sphere (pos2, r)
|
|
73
|
+
template <class S, class P = double>
|
|
74
|
+
DN_HOST_DEVICE int plane_sphere(PreContact<S>* con, P margin, V3<S> pos1, V3<S> z1, V3<S> pos2, P r, int slot) {
|
|
75
|
+
const V3<S> n = z1;
|
|
76
|
+
const S cdist = so3::dot(so3::sub(pos2, pos1), n);
|
|
77
|
+
if (cdist > margin + r) return 0;
|
|
78
|
+
con->dist = cdist - S(r);
|
|
79
|
+
con->normal = n;
|
|
80
|
+
con->pos = so3::add(pos2, so3::scale(n, S(0) - con->dist / S(2) - S(r)));
|
|
81
|
+
con->tangent = V3<S>{S(0), S(0), S(0)};
|
|
82
|
+
con->slot = slot;
|
|
83
|
+
return 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// plane-capsule (:66-97): each end as plane-sphere, A = pos2 + L axis first, then B = pos2 - L axis; tangent = the axis
|
|
87
|
+
template <class S, class P = double>
|
|
88
|
+
DN_HOST_DEVICE int plane_capsule(PreContact<S>* con, P margin, V3<S> pos1, V3<S> z1, V3<S> pos2, V3<S> z2, P r,
|
|
89
|
+
P L) {
|
|
90
|
+
const V3<S> axis = z2;
|
|
91
|
+
int n = plane_sphere(con, margin, pos1, z1, so3::add(pos2, so3::scale(axis, S(L))), r, 0);
|
|
92
|
+
if (n) con[0].tangent = axis;
|
|
93
|
+
const int m = plane_sphere(con + n, margin, pos1, z1, so3::sub(pos2, so3::scale(axis, S(L))), r, 1);
|
|
94
|
+
if (m) con[n].tangent = axis;
|
|
95
|
+
return n + m;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// mjraw_SphereCapsule (:313-328): sphere (pos1, z1, r1), capsule (pos2, z2, r2, L2)
|
|
99
|
+
template <class S, class P = double>
|
|
100
|
+
DN_HOST_DEVICE int sphere_capsule(PreContact<S>* con, P margin, V3<S> pos1, V3<S> z1, P r1, V3<S> pos2, V3<S> z2,
|
|
101
|
+
P r2, P L2) {
|
|
102
|
+
const V3<S> axis = z2;
|
|
103
|
+
const S x = clip(so3::dot(axis, so3::sub(pos1, pos2)), -L2, L2);
|
|
104
|
+
return sphere_sphere(con, margin, pos1, z1, r1, so3::add(pos2, so3::scale(axis, x)), z2, r2, 0);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// mjraw_CapsuleCapsule (:425-514)
|
|
108
|
+
template <class S, class P = double>
|
|
109
|
+
DN_HOST_DEVICE int capsule_capsule(PreContact<S>* con, P margin, V3<S> pos1, V3<S> z1, P r1, P L1, V3<S> pos2,
|
|
110
|
+
V3<S> z2, P r2, P L2) {
|
|
111
|
+
const V3<S> a1 = so3::scale(z1, S(L1)), a2 = so3::scale(z2, S(L2));
|
|
112
|
+
const V3<S> dif = so3::sub(pos1, pos2);
|
|
113
|
+
const S ma = so3::dot(a1, a1), mb = S(0) - so3::dot(a1, a2), mc = so3::dot(a2, a2);
|
|
114
|
+
const S u = S(0) - so3::dot(a1, dif), v = so3::dot(a2, dif);
|
|
115
|
+
const V3<S> cr = so3::cross(a1, a2);
|
|
116
|
+
const S det = so3::dot(cr, cr);
|
|
117
|
+
if (det > S(1e-8) * ma * mc) { // general (sin^2 > 1e-8)
|
|
118
|
+
const V3<S> cross_dif = so3::cross(a2, dif);
|
|
119
|
+
S x1 = clip(so3::dot(cr, cross_dif) / det, P(-1), P(1));
|
|
120
|
+
S x2 = (v - mb * x1) / mc;
|
|
121
|
+
if (x2 > P(1) || x2 < P(-1)) {
|
|
122
|
+
x2 = clip(x2, P(-1), P(1));
|
|
123
|
+
x1 = clip((u - mb * x2) / ma, P(-1), P(1));
|
|
124
|
+
}
|
|
125
|
+
return sphere_sphere(con, margin, so3::add(pos1, so3::scale(a1, x1)), z1, r1, so3::add(pos2, so3::scale(a2, x2)), z2,
|
|
126
|
+
r2, 0);
|
|
127
|
+
}
|
|
128
|
+
// parallel axes: the four end candidates in MuJoCo's order, at most two contacts
|
|
129
|
+
int n1 = sphere_sphere(con, margin, so3::add(pos1, a1), z1, r1,
|
|
130
|
+
so3::add(pos2, so3::scale(a2, clip((v - mb) / mc, P(-1), P(1)))), z2, r2, 0);
|
|
131
|
+
int n2 = sphere_sphere(con + n1, margin, so3::sub(pos1, a1), z1, r1,
|
|
132
|
+
so3::add(pos2, so3::scale(a2, clip((v + mb) / mc, P(-1), P(1)))), z2, r2, 1);
|
|
133
|
+
if (n1 + n2 >= 2) return n1 + n2;
|
|
134
|
+
int n3 = sphere_sphere(con + n1 + n2, margin, so3::add(pos1, so3::scale(a1, clip((u - mb) / ma, P(-1), P(1)))), z1, r1,
|
|
135
|
+
so3::add(pos2, a2), z2, r2, 2);
|
|
136
|
+
if (n1 + n2 + n3 >= 2) return n1 + n2 + n3;
|
|
137
|
+
int n4 = sphere_sphere(con + n1 + n2 + n3, margin, so3::add(pos1, so3::scale(a1, clip((u + mb) / ma, P(-1), P(1)))), z1,
|
|
138
|
+
r1, so3::sub(pos2, a2), z2, r2, 3);
|
|
139
|
+
return n1 + n2 + n3 + n4;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// mju_makeFrame (engine_util_spatial.c:511-537): rows (normal, t1, t2) from the normal and an optional tangent hint
|
|
143
|
+
template <class S> DN_HOST_DEVICE void make_frame(V3<S> normal, V3<S> tangent, V3<S>* frame) {
|
|
144
|
+
using L = lit_t<S>;
|
|
145
|
+
V3<S> x = normal;
|
|
146
|
+
const S nx = normalize3(x);
|
|
147
|
+
JS_DEVICE_ASSERT(!(nx < L(0.5)) && "mju_makeFrame: the normal is not a unit-ish vector"); // data-dependent: gate builds
|
|
148
|
+
V3<S> y = tangent;
|
|
149
|
+
if (so3::dot(y, y) < L(0.25)) y = (x.y > L(-0.5) && x.y < L(0.5)) ? V3<S>{S(0), S(1), S(0)} : V3<S>{S(0), S(0), S(1)};
|
|
150
|
+
y = so3::sub(y, so3::scale(x, so3::dot(x, y)));
|
|
151
|
+
normalize3(y);
|
|
152
|
+
frame[0] = x;
|
|
153
|
+
frame[1] = y;
|
|
154
|
+
frame[2] = so3::cross(x, y);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// the collider for a pair of geom types (t1 <= t2 after pushGeomGeom): 0 plane, 2 sphere, 3 capsule. size = MuJoCo's
|
|
158
|
+
// geom_size (radius, half length). Returns the number of PreContacts written (at most 2). The G1 law's colliders read a
|
|
159
|
+
// geom's rotation only through its local z axis (the plane's normal, the capsule's axis, the coincident-centre fallback), so
|
|
160
|
+
// they take (position, z axis); a collider that needs the whole rotation (a box) changes this signature, and with it L2's
|
|
161
|
+
// shared geom poses (core/soft/gpu/l2v2.cuh keeps the z axis only: the k_pre residency step, 2026-11-02).
|
|
162
|
+
// the geom-type pairs collide() handles; the GPU table builders require it of every pair on the host (no device assert)
|
|
163
|
+
DN_HOST_DEVICE constexpr bool collide_handles(int t1, int t2) {
|
|
164
|
+
return (t1 == 0 && (t2 == 2 || t2 == 3)) || (t1 == 2 && (t2 == 2 || t2 == 3)) || (t1 == 3 && t2 == 3);
|
|
165
|
+
}
|
|
166
|
+
template <class S, class P = double>
|
|
167
|
+
DN_HOST_DEVICE int collide(PreContact<S>* con, P margin, int t1, V3<S> p1, V3<S> z1, const P* size1, int t2, V3<S> p2,
|
|
168
|
+
V3<S> z2, const P* size2) {
|
|
169
|
+
if (t1 == 0 && t2 == 2) return plane_sphere(con, margin, p1, z1, p2, size2[0], 0);
|
|
170
|
+
if (t1 == 0 && t2 == 3) return plane_capsule(con, margin, p1, z1, p2, z2, size2[0], size2[1]);
|
|
171
|
+
if (t1 == 2 && t2 == 2) return sphere_sphere(con, margin, p1, z1, size1[0], p2, z2, size2[0], 0);
|
|
172
|
+
if (t1 == 2 && t2 == 3) return sphere_capsule(con, margin, p1, z1, size1[0], p2, z2, size2[0], size2[1]);
|
|
173
|
+
if (t1 == 3 && t2 == 3) return capsule_capsule(con, margin, p1, z1, size1[0], size1[1], p2, z2, size2[0], size2[1]);
|
|
174
|
+
JS_DEVICE_ASSERT(false && "collide: a geom-type pair the G1 law does not handle"); // the host builders check collide_handles
|
|
175
|
+
return 0;
|
|
176
|
+
}
|
|
177
|
+
template <class S, class P = double>
|
|
178
|
+
DN_HOST_DEVICE int collide(PreContact<S>* con, P margin, int t1, const GeomPose<S>& g1, const P* size1, int t2,
|
|
179
|
+
const GeomPose<S>& g2, const P* size2) {
|
|
180
|
+
return collide(con, margin, t1, g1.p, zaxis(g1.R), size1, t2, g2.p, zaxis(g2.R), size2);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
} // namespace js::soft
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
// D16 14x adjoint (engine C, 2026-11-03; tools/d16_x14adj/PLAN.md): the megakernel and its header-only launcher for the engine14
|
|
3
|
+
// binding (included in the binding's translation unit after the generated model header and D16_X14_NS, as kp14.cuh is).
|
|
4
|
+
// One launch per control step: one warp per world reverses the nsub Euler substeps from the step's records (the tape_layout(40,
|
|
5
|
+
// 37, 64, 255, 66, 356, lq false), 1,792 words; the row cap 255 since 2026-11-04, was 192: q, v, a* (= a_adv), L_H, the zones,
|
|
6
|
+
// the contacts; the poses and the passive terms recomputed), chaining (q_bar, v_bar) from the cotangents of (q_{t+1}, v_{t+1})
|
|
7
|
+
// (tangent charts: the root's world translation and body-frame rotation, the balls' body-frame rotations, the hinges additive).
|
|
8
|
+
// The warm start carries no derivative. The muscles' reverse (the muscle_adj: a0, u, the MUS block; tau_bar_k = lam_k into it)
|
|
9
|
+
// is wired at step 4: until then the muscle arguments must be null and the result is the rigid gradient. Deterministic; no
|
|
10
|
+
// allocation (graph-capturable); flags [n] nonzero: a contact slot the collider no longer produces (1), a limit-row count
|
|
11
|
+
// different from the record's (2), a bad record (4) (the caller asserts: fail loud).
|
|
12
|
+
#include <cuda_runtime.h>
|
|
13
|
+
|
|
14
|
+
#include <cassert>
|
|
15
|
+
|
|
16
|
+
#include "../tape.h"
|
|
17
|
+
#include "body14.cuh"
|
|
18
|
+
#include "chol_rn.cuh"
|
|
19
|
+
#include "../x14adj/shell14_adj.h"
|
|
20
|
+
|
|
21
|
+
namespace d16::adj14 {
|
|
22
|
+
namespace A = d16::x14adj;
|
|
23
|
+
#if defined(D16_NV_GT64) // B3c: a phase B record names its limit count and the split words (tape.h)
|
|
24
|
+
constexpr js::soft::TapeLayout TL14 = js::soft::tape_layout(D16_BODY_NQ, D16_BODY_NV, 64, 255, D16_BODY_NPOSE, D16_BODY_NM, false, A::MD::NLIM,
|
|
25
|
+
::d16::split::WORDS); // the binding: field by field
|
|
26
|
+
#else
|
|
27
|
+
constexpr js::soft::TapeLayout TL14 = js::soft::tape_layout(D16_BODY_NQ, D16_BODY_NV, 64, 255, D16_BODY_NPOSE, D16_BODY_NM, false); // the binding: field by field
|
|
28
|
+
#endif
|
|
29
|
+
#if defined(D16_NV_GT64) // B3d: a phase B record (the 416: clamp 4 words, zone 8 at word 8, con at 16, q at 48; L_H the split storage's words)
|
|
30
|
+
static_assert(TL14.words == D16_BODY_TAPE_WORDS && TL14.LH == D16_BODY_TAPE_LH && TL14.pose == D16_BODY_TAPE_POSE && TL14.mus == D16_BODY_TAPE_MUS &&
|
|
31
|
+
TL14.n_zone == 8 && TL14.n_clamp * 32 >= A::MD::NLIM && TL14.ntri == ::d16::split::WORDS,
|
|
32
|
+
"a phase B record at 255 rows: 8 zone words, the limit mask in the clamp words, L_H in the split words");
|
|
33
|
+
#else
|
|
34
|
+
static_assert(TL14.words == D16_BODY_TAPE_WORDS && TL14.LH == D16_BODY_TAPE_LH && TL14.pose == D16_BODY_TAPE_POSE && TL14.mus == D16_BODY_TAPE_MUS &&
|
|
35
|
+
TL14.n_zone == 8 && TL14.con == 14,
|
|
36
|
+
"38's 14x record at 255 rows (zone 8 words; con, q, v, a 2 words later than at 192)");
|
|
37
|
+
#endif
|
|
38
|
+
#if defined(D16_BODY_HEADER) // PORT_DESIGN.md 7.4: a wrong count here reads a truncated or overlapping L_H, with no other error
|
|
39
|
+
static_assert(D16_BODY_NTRI == A::NV * (A::NV + 1) / 2 && D16_BODY_NTRI4 == (D16_BODY_NTRI + 3) / 4 * 4, "NTRI and rinv's place are the body's");
|
|
40
|
+
static_assert(D16_BODY_NQ == A::NQ && D16_BODY_NV == A::NV && D16_BODY_NPOSE == A::NB, "the body header's sizes are its law's");
|
|
41
|
+
#endif
|
|
42
|
+
#if defined(D16_NV_GT64) // a phase B body's L_H is the split factor (PHASE_B.md section 4): staged as the record holds it, solved by chol_split in the split order
|
|
43
|
+
constexpr int kAdjLW = ::d16::split::WORDS, kAdjLW4 = (kAdjLW + 3) / 4 * 4; // L_H's words, and rinv's place after them
|
|
44
|
+
static_assert(::d16::split::NV == A::NV, "the split header is this body's");
|
|
45
|
+
#endif
|
|
46
|
+
constexpr int kTagAdj14 = 24; // chol_rn's solves instantiated for this kernel alone (the codegen-coupling rule)
|
|
47
|
+
|
|
48
|
+
// lever 2: L_H's staging and rinv live in tree14's accumulators (LOCAL zeroes them after the solve; body 0's row is never used),
|
|
49
|
+
// q / v / a are staged into tree14's own arrays
|
|
50
|
+
template <class T> struct alignas(16) K14 {
|
|
51
|
+
A::Shell14<T> sh;
|
|
52
|
+
T qb[A::NV], vb[A::NV], ab[A::NV];
|
|
53
|
+
D16_IDX_T cp[64], cs[64];
|
|
54
|
+
#if defined(D16_NV_GT64) // the active-limit mask, one word per 32 limits (PHASE_B.md section 6.3)
|
|
55
|
+
unsigned zone[8], limm[(A::MD::NLIM + 31) / 32];
|
|
56
|
+
#else
|
|
57
|
+
unsigned zone[8], limm[2];
|
|
58
|
+
#endif
|
|
59
|
+
__device__ T* L() { return &sh.t.acc[0][0]; }
|
|
60
|
+
#if defined(D16_NV_GT64)
|
|
61
|
+
__device__ T* rinv() { return &sh.t.acc[0][0] + kAdjLW4; }
|
|
62
|
+
#else
|
|
63
|
+
__device__ T* rinv() { return &sh.t.acc[0][0] + D16_BODY_NTRI4; }
|
|
64
|
+
#endif
|
|
65
|
+
__device__ T* q() { return sh.t.q; }
|
|
66
|
+
__device__ T* v() { return sh.t.v; }
|
|
67
|
+
__device__ T* a() { return sh.t.a; }
|
|
68
|
+
};
|
|
69
|
+
#if defined(D16_T14_DEVLAYOUT) // stage A (ADJ_RESIDENCY.md): 3 worlds per SM on sm_89 need <= 32,768 B per block (101,376 B per SM, 1,024 B reserved per block)
|
|
70
|
+
static_assert(sizeof(K14<float>) <= 32768, "K14<float> over 3 worlds per SM's 32,768 B: ADJ_RESIDENCY.md stage A");
|
|
71
|
+
#endif
|
|
72
|
+
#if defined(D16_X14_ADJ5) // (11-08; up/PREREG_X14ADJ5.md, the check b) 5 worlds per SM on sm_89: round_up_128(sizeof) <= 19,456 (102,400 B per SM, 1,024 B per block)
|
|
73
|
+
static_assert((sizeof(K14<float>) + 127) / 128 * 128 <= 19456, "K14<float> over 5 worlds per SM's 19,456 B: up/PREREG_X14ADJ5.md");
|
|
74
|
+
static_assert(4 * 64 + 64 < 32767 && A::NV < 32767 && A::MD::NPR < 512, "the 16-bit row and contact indices hold every value");
|
|
75
|
+
#endif
|
|
76
|
+
#if defined(D16_NV_GT64)
|
|
77
|
+
static_assert(sizeof(A::Tree14<float>::acc) >= sizeof(float) * (kAdjLW4 + A::NV + 3), "L_H's split words and rinv fit tree14's accumulators");
|
|
78
|
+
#else
|
|
79
|
+
static_assert(sizeof(A::Tree14<float>::acc) >= sizeof(float) * (D16_BODY_NTRI4 + A::NV + 3), "L_H and rinv fit tree14's accumulators");
|
|
80
|
+
#endif
|
|
81
|
+
|
|
82
|
+
template <class T>
|
|
83
|
+
__global__ void __launch_bounds__(32, 1) k_adj14(const T* __restrict__ V, const T* __restrict__ rec, long long sstride,
|
|
84
|
+
long long wstride, int nsub, int n, T h, const T* __restrict__ wq,
|
|
85
|
+
const T* __restrict__ wv, T* qbar, T* vbar, T* taub, int* flags, long long* prof,
|
|
86
|
+
const T* __restrict__ wq_add = nullptr) {
|
|
87
|
+
extern __shared__ __align__(16) unsigned char smem[];
|
|
88
|
+
K14<T>& S = *reinterpret_cast<K14<T>*>(smem);
|
|
89
|
+
const int w = blockIdx.x, lane = threadIdx.x & 31;
|
|
90
|
+
if (w >= n) return;
|
|
91
|
+
for (int d = lane; d < A::NV; d += 32) {
|
|
92
|
+
S.qb[d] = wq[w * A::NV + d] + (wq_add ? wq_add[w * A::NV + d] : T(0)); // (the muscle path's q cotangent, step 4)
|
|
93
|
+
S.vb[d] = wv[w * A::NV + d];
|
|
94
|
+
}
|
|
95
|
+
int fl = 0;
|
|
96
|
+
long long pr[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // (X14ADJ_PROF: the phases 0..5, UP's stages 8..13)
|
|
97
|
+
#if defined(X14ADJ_PROF)
|
|
98
|
+
pr[7] = clock64();
|
|
99
|
+
#endif
|
|
100
|
+
__syncwarp();
|
|
101
|
+
for (int sub = nsub - 1; sub >= 0; --sub) {
|
|
102
|
+
const T* r = rec + sub * sstride + w * wstride;
|
|
103
|
+
T *Sq = S.q(), *Sv = S.v(), *Sa = S.a(), *SL = S.L(), *Sr = S.rinv();
|
|
104
|
+
for (int i = lane; i < A::NQ; i += 32) Sq[i] = r[TL14.qpos + i];
|
|
105
|
+
for (int i = lane; i < A::NV; i += 32) { Sv[i] = r[TL14.qvel + i]; Sa[i] = r[TL14.qacc + i]; }
|
|
106
|
+
const uint32_t hdr = js::soft::tape_get_u(r, TL14.hdr), rf = js::soft::tape_get_u(r, TL14.flags);
|
|
107
|
+
const int ncon = static_cast<int>(hdr & 255u), nlim = static_cast<int>((hdr >> 16) & 255u);
|
|
108
|
+
for (int c = lane; c < ncon; c += 32) {
|
|
109
|
+
const uint32_t wd = js::soft::tape_get_u(r, TL14.con + c / 2), e = (c & 1) ? wd >> 16 : wd & 0xFFFFu;
|
|
110
|
+
#if defined(D16_X14_ADJ5) && X14ADJ_PLANT == 82 // (plant 82, the gates' build only: a 16-bit index truncated, the pair modulo 128)
|
|
111
|
+
S.cp[c] = static_cast<int>(e & 127u); S.cs[c] = static_cast<int>(e >> 9);
|
|
112
|
+
#else
|
|
113
|
+
S.cp[c] = static_cast<int>(e & 511u); S.cs[c] = static_cast<int>(e >> 9);
|
|
114
|
+
#endif
|
|
115
|
+
}
|
|
116
|
+
if (lane < 8) S.zone[lane] = lane < TL14.n_zone ? js::soft::tape_get_u(r, TL14.zone + lane) : 0u;
|
|
117
|
+
#if defined(D16_NV_GT64)
|
|
118
|
+
static_assert(TL14.n_clamp * 32 >= A::MD::NLIM, "the record's clamp words hold the whole active-limit mask");
|
|
119
|
+
if (lane < (A::MD::NLIM + 31) / 32) S.limm[lane] = js::soft::tape_get_u(r, TL14.clamp + lane);
|
|
120
|
+
#else
|
|
121
|
+
if (lane < 2) S.limm[lane] = js::soft::tape_get_u(r, TL14.clamp + lane); // the active-limit mask (k_pre14)
|
|
122
|
+
#endif
|
|
123
|
+
#if defined(D16_NV_GT64)
|
|
124
|
+
for (int k = lane; k < kAdjLW; k += 32) SL[k] = r[TL14.LH + k];
|
|
125
|
+
#else
|
|
126
|
+
for (int k = lane; k < D16_BODY_NTRI; k += 32) SL[k] = r[TL14.LH + k];
|
|
127
|
+
#endif
|
|
128
|
+
// lever 1: the frames from the POSE block (k_pre14's, at the substep's input q); tree14 runs only the chains
|
|
129
|
+
#if defined(D16_T14_DEVLAYOUT) // stage A2 (ADJ_RESIDENCY.md): read in place in the record, not copied (tree14 and rows14 only read them)
|
|
130
|
+
if (lane == 0) { S.sh.t.xpos.p = r + TL14.pose; S.sh.t.xquat.p = r + TL14.pose + 3 * A::NB; }
|
|
131
|
+
#else
|
|
132
|
+
for (int k = lane; k < 3 * A::NB; k += 32) (&S.sh.t.xpos[0][0])[k] = r[TL14.pose + k];
|
|
133
|
+
for (int k = lane; k < 4 * A::NB; k += 32) (&S.sh.t.xquat[0][0])[k] = r[TL14.pose + 3 * A::NB + k];
|
|
134
|
+
#endif
|
|
135
|
+
if (lane == 0 && (rf & js::soft::kTapeOverflow)) fl |= 4;
|
|
136
|
+
if (lane == 0 && !(rf & js::soft::kTapePose)) fl |= 8; // a record without POSE: the frames are not the forward's
|
|
137
|
+
__syncwarp();
|
|
138
|
+
A::shell14_kinematics<T>(Sv, Sa, h, S.qb, S.vb, S.ab, nullptr, lane);
|
|
139
|
+
#if defined(D16_NV_GT64) // lam = H^-1 a*_bar with the split factor: a*_bar into the split order (sh.y: free until theta's taub), forward, backward, back
|
|
140
|
+
js::soft::gpu::chol::split_set_rinv<T>(SL, Sr, lane);
|
|
141
|
+
js::soft::gpu::chol::split_gather<T>(S.ab, S.sh.y, lane); // (its closing sync orders rinv before the solves)
|
|
142
|
+
js::soft::gpu::chol::split_solve_fwd<T, kTagAdj14>(SL, Sr, S.sh.y, lane);
|
|
143
|
+
js::soft::gpu::chol::split_solve_bwd<T, kTagAdj14>(SL, Sr, S.sh.y, lane);
|
|
144
|
+
js::soft::gpu::chol::split_scatter<T>(S.sh.y, S.sh.lam, lane);
|
|
145
|
+
#else
|
|
146
|
+
js::soft::gpu::chol::set_rinv<T, A::NV>(SL, Sr, lane);
|
|
147
|
+
for (int d = lane; d < A::NV; d += 32) S.sh.lam[d] = S.ab[d];
|
|
148
|
+
__syncwarp();
|
|
149
|
+
js::soft::gpu::chol::solve_fwd<T, A::NV, kTagAdj14>(SL, Sr, S.sh.lam, lane);
|
|
150
|
+
js::soft::gpu::chol::solve_bwd<T, A::NV, kTagAdj14>(SL, Sr, S.sh.lam, lane);
|
|
151
|
+
#endif
|
|
152
|
+
__syncwarp(); // (L_H's words are tree14's accumulators: LOCAL rewrites them next)
|
|
153
|
+
A::shell14_theta<T>(S.sh, V, Sq, Sv, Sa, ncon, S.cp, S.cs, nlim, S.zone, S.qb, S.vb,
|
|
154
|
+
taub ? taub + (static_cast<size_t>(w) * nsub + sub) * A::NV : S.sh.y, lane, pr, S.limm);
|
|
155
|
+
if (lane == 0) fl |= S.sh.flags;
|
|
156
|
+
__syncwarp();
|
|
157
|
+
}
|
|
158
|
+
for (int d = lane; d < A::NV; d += 32) { qbar[w * A::NV + d] = S.qb[d]; vbar[w * A::NV + d] = S.vb[d]; }
|
|
159
|
+
if (lane == 0) flags[w] = fl;
|
|
160
|
+
#if defined(X14ADJ_PROF)
|
|
161
|
+
if (lane == 0 && prof) for (int k = 0; k < 16; ++k) prof[w * 16 + k] = k == 7 ? 0 : pr[k];
|
|
162
|
+
#endif
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
#if !defined(D16_CPU_STANDIN) // (tools/d16_bodies/cpu_cuda's builds run the kernel above on CPU threads: a host compiler cannot parse the launches below)
|
|
167
|
+
// one control step's VJP (see the file's head). rec [nsub][n][1792]; a0, u [n][356] (step 4); wq, wv [n][37]; wlce, wact [n][356]
|
|
168
|
+
// (step 4); outputs qbar, vbar [n][37], ubar, lcebar, actbar [n][356] (step 4), flags [n]; taub [n][nsub][37] (optional: the
|
|
169
|
+
// per-substep tau_bar for a standalone muscle chain); prof [n][8] (an X14ADJ_PROF build only)
|
|
170
|
+
template <class T>
|
|
171
|
+
void adj14_control_step(int n, cudaStream_t st, const T* V, const T* rec, const T* a0, const T* u, const T* wq, const T* wv,
|
|
172
|
+
const T* wlce, const T* wact, T* qbar, T* vbar, T* ubar, T* lcebar, T* actbar, int* flags,
|
|
173
|
+
T* taub = nullptr, long long* prof = nullptr) {
|
|
174
|
+
(void)a0; (void)u;
|
|
175
|
+
assert(!wlce && !wact && !ubar && !lcebar && !actbar && "adj14: the muscles' reverse is not wired yet (step 4)");
|
|
176
|
+
static bool attr = false;
|
|
177
|
+
if (!attr) {
|
|
178
|
+
const cudaError_t e = cudaFuncSetAttribute(k_adj14<T>, cudaFuncAttributeMaxDynamicSharedMemorySize, static_cast<int>(sizeof(K14<T>)));
|
|
179
|
+
assert(e == cudaSuccess && "adj14: the dynamic shared memory size");
|
|
180
|
+
#if defined(D16_NV_GT64) // the scan's tables at 4 slots and the descendant words (scan14.h; its checks hold under -DNDEBUG)
|
|
181
|
+
A::t14_upload_tables();
|
|
182
|
+
(void)e;
|
|
183
|
+
#else
|
|
184
|
+
int tab[A::kNR * X14_NSD * 32]; // lever 1's per-lane ancestor table
|
|
185
|
+
A::t14_anc_table(tab);
|
|
186
|
+
const cudaError_t e2 = cudaMemcpyToSymbol(A::gAnc14, tab, sizeof(tab));
|
|
187
|
+
assert(e2 == cudaSuccess && "adj14: the ancestor table");
|
|
188
|
+
int dtab[A::kNR * X14_NSD * 32], kids[4]; // stage 2's descendants and the root's children
|
|
189
|
+
A::t14_desc_table(dtab, kids);
|
|
190
|
+
const cudaError_t e3 = cudaMemcpyToSymbol(A::gDesc14, dtab, sizeof(dtab)), e4 = cudaMemcpyToSymbol(A::gKid14, kids, sizeof(kids));
|
|
191
|
+
assert(e3 == cudaSuccess && e4 == cudaSuccess && "adj14: the descendant tables");
|
|
192
|
+
(void)e; (void)e2; (void)e3; (void)e4;
|
|
193
|
+
#endif
|
|
194
|
+
attr = true;
|
|
195
|
+
}
|
|
196
|
+
k_adj14<T><<<n, 32, sizeof(K14<T>), st>>>(V, rec, static_cast<long long>(n) * TL14.words, TL14.words, D16_X14_NS::NSUB, n,
|
|
197
|
+
static_cast<T>(D16_X14_NS::TIMESTEP), wq, wv, qbar, vbar, taub, flags, prof);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// one substep's VJP (step 4's composition with the muscle_adj, substep k = nsub - 1 .. 0):
|
|
201
|
+
// rec_k: substep k's records [n][1792] (= rec + k n 1792); wq, wv: the cotangents of (q_{k+1}, v_{k+1}) from the rigid path
|
|
202
|
+
// (substep k + 1's qbar, vbar, or the control step's), wq_add: the muscle path's cotangent of q_{k+1} (the muscle_adj of
|
|
203
|
+
// substep k + 1; null at k = nsub - 1 unless the loss has one); out: qbar, vbar (rigid path, of (q_k, v_k)), taub [n][37]
|
|
204
|
+
// (tau_bar_k = lam_k, muscle_adj's input), flags [n]
|
|
205
|
+
template <class T>
|
|
206
|
+
void adj14_substep(int n, cudaStream_t st, const T* V, const T* rec_k, const T* wq, const T* wq_add, const T* wv, T* qbar, T* vbar,
|
|
207
|
+
T* taub, int* flags, long long* prof = nullptr) {
|
|
208
|
+
static bool attr = false;
|
|
209
|
+
if (!attr) {
|
|
210
|
+
const cudaError_t e = cudaFuncSetAttribute(k_adj14<T>, cudaFuncAttributeMaxDynamicSharedMemorySize, static_cast<int>(sizeof(K14<T>)));
|
|
211
|
+
assert(e == cudaSuccess && "adj14: the dynamic shared memory size");
|
|
212
|
+
#if defined(D16_NV_GT64) // the scan's tables at 4 slots and the descendant words (scan14.h; its checks hold under -DNDEBUG)
|
|
213
|
+
A::t14_upload_tables();
|
|
214
|
+
(void)e;
|
|
215
|
+
#else
|
|
216
|
+
int tab[A::kNR * X14_NSD * 32]; // lever 1's per-lane ancestor table
|
|
217
|
+
A::t14_anc_table(tab);
|
|
218
|
+
const cudaError_t e2 = cudaMemcpyToSymbol(A::gAnc14, tab, sizeof(tab));
|
|
219
|
+
assert(e2 == cudaSuccess && "adj14: the ancestor table");
|
|
220
|
+
int dtab[A::kNR * X14_NSD * 32], kids[4]; // stage 2's descendants and the root's children
|
|
221
|
+
A::t14_desc_table(dtab, kids);
|
|
222
|
+
const cudaError_t e3 = cudaMemcpyToSymbol(A::gDesc14, dtab, sizeof(dtab)), e4 = cudaMemcpyToSymbol(A::gKid14, kids, sizeof(kids));
|
|
223
|
+
assert(e3 == cudaSuccess && e4 == cudaSuccess && "adj14: the descendant tables");
|
|
224
|
+
(void)e; (void)e2; (void)e3; (void)e4;
|
|
225
|
+
#endif
|
|
226
|
+
attr = true;
|
|
227
|
+
}
|
|
228
|
+
k_adj14<T><<<n, 32, sizeof(K14<T>), st>>>(V, rec_k, 0, TL14.words, 1, n, static_cast<T>(D16_X14_NS::TIMESTEP), wq, wv, qbar, vbar,
|
|
229
|
+
taub, flags, prof, wq_add);
|
|
230
|
+
}
|
|
231
|
+
#endif
|
|
232
|
+
|
|
233
|
+
} // namespace d16::adj14
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
// D16 14x adjoint, step 4 (engine C, 2026-11-03; tools/d16_x14adj/PLAN.md "Step 4"): one control step's VJP with the muscles,
|
|
3
|
+
// the launcher the engine binding and gate 4 share. Per substep k = nsub - 1 .. 0:
|
|
4
|
+
// rigid_k adj14_substep: (q_{k+1}, v_{k+1})_bar (rigid path) + qmus_{k+1} (the muscle path's q_{k+1}_bar) -> (q_k, v_k)_bar
|
|
5
|
+
// (rigid path), tau_bar_k = lam_k
|
|
6
|
+
// muscle_k the muscle_adj_taped (k_mus_host.cuh): (tau_bar_k, lce_{k+1}_bar, a_{k+1}_bar) -> qmus_k, lce_k_bar, a_k_bar,
|
|
7
|
+
// u_bar += (zeroed before k = nsub - 1)
|
|
8
|
+
// and (q_0)_bar = rigid_0's q_bar + qmus_0. The records carry q_k (TL14.qpos: word 46 at the 255-row cap, 44 at 192) and lce_k
|
|
9
|
+
// (the MUS block, TL14.mus = 1408); a_k is the recompute from (a_0, u). The scratch is the caller's (no allocation per call);
|
|
10
|
+
// every launch is on the stream st.
|
|
11
|
+
#include <cuda_runtime.h>
|
|
12
|
+
|
|
13
|
+
#include <cassert>
|
|
14
|
+
#include <cstddef>
|
|
15
|
+
|
|
16
|
+
#include "adj14.cuh"
|
|
17
|
+
#include "k_mus_host.cuh"
|
|
18
|
+
|
|
19
|
+
namespace d16::adj14 {
|
|
20
|
+
|
|
21
|
+
// the record's offsets from TL14 itself (2026-11-04: the literal q offset 44 survived the row cap's zone growth and read q two
|
|
22
|
+
// words early; nrgate.sh's A3 caught it as NaN gradients)
|
|
23
|
+
constexpr int kAdj14NM = D16_BODY_NM, kAdj14MusOff = TL14.mus, kAdj14QOff = TL14.qpos;
|
|
24
|
+
#if defined(D16_NV_GT64) // a phase B record: q follows the contact words (the 416: word 48, its 4 clamp words two more than the 14x's)
|
|
25
|
+
static_assert(TL14.nmus == kAdj14NM && kAdj14MusOff == D16_BODY_TAPE_MUS && kAdj14QOff == TL14.con + TL14.n_con, "adj14_mus: a phase B record's q and MUS blocks");
|
|
26
|
+
#else
|
|
27
|
+
static_assert(TL14.nmus == kAdj14NM && kAdj14MusOff == D16_BODY_TAPE_MUS && kAdj14QOff == 46, "adj14_mus: the 14x record's q and MUS blocks");
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
// the scratch, carved from one caller buffer of adj14_mus_scratch_elems(n) elements of T
|
|
31
|
+
template <class T> struct Adj14MusScratch {
|
|
32
|
+
T* qb[2]; T* vb[2]; T* qm[2]; T* lb[2]; T* ab[2]; T* taub; T* zq;
|
|
33
|
+
};
|
|
34
|
+
inline size_t adj14_mus_scratch_elems(int n) {
|
|
35
|
+
return static_cast<size_t>(n) * (8 * static_cast<size_t>(D16_X14_NS::NV) + 4 * static_cast<size_t>(kAdj14NM)); // qb, vb, qm x 2, taub, zq
|
|
36
|
+
}
|
|
37
|
+
template <class T> Adj14MusScratch<T> adj14_mus_scratch(T* base, int n) {
|
|
38
|
+
const size_t a = static_cast<size_t>(n) * D16_X14_NS::NV, b = static_cast<size_t>(n) * kAdj14NM;
|
|
39
|
+
Adj14MusScratch<T> s;
|
|
40
|
+
T* p = base;
|
|
41
|
+
for (int i = 0; i < 2; ++i) { s.qb[i] = p; p += a; s.vb[i] = p; p += a; s.qm[i] = p; p += a; }
|
|
42
|
+
s.taub = p; p += a; s.zq = p; p += a;
|
|
43
|
+
for (int i = 0; i < 2; ++i) { s.lb[i] = p; p += b; s.ab[i] = p; p += b; }
|
|
44
|
+
assert(static_cast<size_t>(p - base) == adj14_mus_scratch_elems(n) && "adj14_mus: the scratch carve");
|
|
45
|
+
return s;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
template <class T> __global__ void k_adj14_add(const T* x, const T* y, T* o, int m) {
|
|
49
|
+
const int i = blockIdx.x * blockDim.x + threadIdx.x;
|
|
50
|
+
if (i < m) o[i] = x[i] + y[i];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// rec [nsub][n][1792]; a0, u, lce_out (the step's output lce, lce_nsub) [n][356]; wq, wv [n][37], wlce, wact [n][356]: the cotangents
|
|
54
|
+
// of the step's outputs (q_nsub in its tangent chart, v_nsub, lce_nsub, a_nsub). Out: qbar, vbar [n][37] (of q_0's tangent, v_0),
|
|
55
|
+
// lcebar, actbar, ubar [n][356] (of lce_0, a_0, u), flags [nsub][n] (substep k's at k n). t / sl: mus_upload_tables' (the case's
|
|
56
|
+
// tables); bl: the ball term's lists (mus_upload_tables' / the engine binding's MusBall); s: adj14_mus_scratch over
|
|
57
|
+
// adj14_mus_scratch_elems(n) elements.
|
|
58
|
+
template <class T>
|
|
59
|
+
void adj14_control_step_mus(int n, cudaStream_t st, const T* V, const js::soft::MuscleTables<T>& t, const js::soft::gpu::MusSlots<T>& sl,
|
|
60
|
+
const js::soft::gpu::MusBall& bl,
|
|
61
|
+
#if defined(D16_BODY_MUS_SPLIT) // R5: a muscle-split body's class tables (k_mus_host.cuh mus_class_upload); its muscle stage runs on them
|
|
62
|
+
const js::soft::gpu::MusClasses<T>& mc,
|
|
63
|
+
#endif
|
|
64
|
+
const T* rec, const T* a0, const T* u, const T* lce_out, const T* wq, const T* wv, const T* wlce,
|
|
65
|
+
const T* wact, T* qbar, T* vbar, T* lcebar, T* actbar, T* ubar, int* flags, const Adj14MusScratch<T>& s) {
|
|
66
|
+
constexpr int NSUB = D16_X14_NS::NSUB, W = TL14.words;
|
|
67
|
+
static_assert(TL14.words == D16_BODY_TAPE_WORDS, "adj14_mus: the 14x record");
|
|
68
|
+
const size_t nv = static_cast<size_t>(n) * D16_X14_NS::NV;
|
|
69
|
+
cudaMemsetAsync(s.zq, 0, sizeof(T) * nv, st);
|
|
70
|
+
cudaMemsetAsync(ubar, 0, sizeof(T) * static_cast<size_t>(n) * kAdj14NM, st);
|
|
71
|
+
const T *wq_k = wq, *wv_k = wv, *wadd = s.zq, *lnb = wlce, *anb = wact;
|
|
72
|
+
for (int k = NSUB - 1; k >= 0; --k) {
|
|
73
|
+
const int o = k & 1;
|
|
74
|
+
const T* rec_k = rec + static_cast<size_t>(k) * n * W;
|
|
75
|
+
T* vb_out = k == 0 ? vbar : s.vb[o];
|
|
76
|
+
T* lb_out = k == 0 ? lcebar : s.lb[o];
|
|
77
|
+
T* ab_out = k == 0 ? actbar : s.ab[o];
|
|
78
|
+
adj14_substep<T>(n, st, V, rec_k, wq_k, wadd, wv_k, s.qb[o], vb_out, s.taub, flags + static_cast<size_t>(k) * n);
|
|
79
|
+
const js::soft::gpu::AdjTape<T> tp{rec_k, W, kAdj14QOff, kAdj14MusOff,
|
|
80
|
+
k < NSUB - 1 ? rec + static_cast<size_t>(k + 1) * n * W + kAdj14MusOff : lce_out,
|
|
81
|
+
k < NSUB - 1 ? static_cast<long long>(W) : static_cast<long long>(kAdj14NM), a0, kAdj14NM, u,
|
|
82
|
+
kAdj14NM, k, ubar, kAdj14NM};
|
|
83
|
+
#if defined(D16_BODY_MUS_SPLIT) // narrow writes qmus, wide continues it (R3)
|
|
84
|
+
js::soft::gpu::launch_muscle_adj_taped_cls<T, D16_X14_NS::NQ, D16_X14_NS::NV, kAdj14NM>(mc, bl, tp, static_cast<T>(D16_X14_NS::TIMESTEP), n,
|
|
85
|
+
s.taub, lnb, anb, s.qm[o], lb_out, ab_out, st);
|
|
86
|
+
(void)t; (void)sl; // the full tables: the reset's k_mus_equil only
|
|
87
|
+
#else
|
|
88
|
+
js::soft::gpu::launch_muscle_adj_taped<T, D16_BODY_NS, D16_BODY_MKD, D16_BODY_NSLOT, D16_X14_NS::NQ, D16_X14_NS::NV, kAdj14NM>(
|
|
89
|
+
t, sl, bl, tp, static_cast<T>(D16_X14_NS::TIMESTEP), n, s.taub, lnb, anb, s.qm[o], lb_out, ab_out, st);
|
|
90
|
+
#endif
|
|
91
|
+
wadd = X14ADJ_PLANT == 51 ? s.zq : s.qm[o]; // (51: planted, gate 4: the muscle path's q cotangent dropped)
|
|
92
|
+
wq_k = s.qb[o]; wv_k = vb_out; lnb = lb_out; anb = ab_out;
|
|
93
|
+
}
|
|
94
|
+
const int m = static_cast<int>(nv);
|
|
95
|
+
k_adj14_add<T><<<(m + 255) / 256, 256, 0, st>>>(s.qb[0], s.qm[0], qbar, m);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
} // namespace d16::adj14
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
// D16 adjoint megakernel: the CUDA shell (d5, 2026-11-02; tools/d16_adj_shell/PREREG.md). One launch per control step, one warp per
|
|
3
|
+
// world, <<<nw, 32, adj_shell_smem<S>()>>>: every buffer is the caller's, nothing is allocated or read back, the record's counts and
|
|
4
|
+
// bits are read on the device, and a world's failures go to flags[w] (CUDA-graph capturable). The per-world body is
|
|
5
|
+
// core/soft/adj/shell_adj.h; B's rows / PD reverse enters as the Rows functor (RowsStub until it lands).
|
|
6
|
+
#include "../adj/shell_adj.h"
|
|
7
|
+
#include "adj_tab.cuh"
|
|
8
|
+
|
|
9
|
+
namespace js::soft::adj {
|
|
10
|
+
|
|
11
|
+
template <class S> constexpr size_t adj_shell_smem() { return sizeof(S) * kShellWords; }
|
|
12
|
+
|
|
13
|
+
// recs: [nw][nsub][L.words]; q_out [nw][36], v_out / wq / wv [nw][35]; out_*: [nw][kNB][3] or nullptr; q_bar / v_bar [nw][35],
|
|
14
|
+
// u_bar [nw][29], flags [nw] (written); dbg: [nw][nsub][3][kNV] or nullptr; kd_dof [35] (device); vals: the generated model values
|
|
15
|
+
template <class S, class Rows>
|
|
16
|
+
__global__ void __launch_bounds__(32, 12) k_adjoint_step(const S* vals, const S* kd_dof, const S* recs, TapeLayout L, int nsub, S h,
|
|
17
|
+
int nw, const S* q_out, const S* v_out, const S* wq, const S* wv,
|
|
18
|
+
const S* out_xpos_bar, const S* out_xrot_bar, const S* out_vb_bar,
|
|
19
|
+
const S* out_wb_bar, Rows rows, S* q_bar, S* v_bar, S* u_bar, uint32_t* flags,
|
|
20
|
+
#ifdef D16_G1_COMDR
|
|
21
|
+
S* dbg, long long* cyc, const S* ipo, int ipo_body) { // COMDR: kpre_kernel's
|
|
22
|
+
#else
|
|
23
|
+
S* dbg, long long* cyc) {
|
|
24
|
+
#endif
|
|
25
|
+
extern __shared__ __align__(16) unsigned char smem_raw[];
|
|
26
|
+
S* scratch = reinterpret_cast<S*>(smem_raw);
|
|
27
|
+
const int w = blockIdx.x;
|
|
28
|
+
if (w >= nw) return;
|
|
29
|
+
const size_t o3 = static_cast<size_t>(w) * 3 * kNB;
|
|
30
|
+
uint32_t* fl = flags + w;
|
|
31
|
+
if (threadIdx.x == 0) *fl = 0u;
|
|
32
|
+
__syncwarp();
|
|
33
|
+
const S* recs_w = recs + static_cast<size_t>(w) * nsub * L.words;
|
|
34
|
+
const auto rw = rows.bind(w, recs_w, scratch, fl); // the world's own functor (B's RowsB: records, foot friction, scratch, flag)
|
|
35
|
+
const long long t0 = clock64();
|
|
36
|
+
#ifdef D16_G1_COMDR
|
|
37
|
+
GenTab<S> tab{vals};
|
|
38
|
+
tab.set_anchor(ipo_body, ipo + static_cast<size_t>(w) * 3); // the forward's ipos for this world (adj_tree's replay)
|
|
39
|
+
adj_control_step<S>(tab, recs_w, L, nsub, h, kd_dof, q_out + w * 36, v_out + w * kNV,
|
|
40
|
+
#else
|
|
41
|
+
adj_control_step<S>(GenTab<S>{vals}, recs_w, L, nsub, h, kd_dof, q_out + w * 36, v_out + w * kNV,
|
|
42
|
+
#endif
|
|
43
|
+
wq + w * kNV, wv + w * kNV, out_xpos_bar ? out_xpos_bar + o3 : nullptr, out_xrot_bar ? out_xrot_bar + o3 : nullptr,
|
|
44
|
+
out_vb_bar ? out_vb_bar + o3 : nullptr, out_wb_bar ? out_wb_bar + o3 : nullptr, rw, q_bar + w * kNV,
|
|
45
|
+
v_bar + w * kNV, u_bar + w * 29, fl, scratch, dbg ? dbg + static_cast<size_t>(w) * nsub * 3 * kNV : nullptr);
|
|
46
|
+
__syncwarp();
|
|
47
|
+
if (cyc && threadIdx.x == 0) cyc[w] = clock64() - t0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
} // namespace js::soft::adj
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
// The device accessor of adj_rnea / adj_fk_pullback (core/soft/adj/rnea_adj.h) over the generated model header:
|
|
3
|
+
// integer structure from its __device__ tables (read with __ldg), values from the uploaded flat array (kValues for float,
|
|
4
|
+
// kValuesD for double, the same offsets). One accessor, so the adjoint reads exactly kernel P's model.
|
|
5
|
+
#include "generated/g1_soft_5db44fd45286.cuh"
|
|
6
|
+
#include "../adj/tree_adj.h"
|
|
7
|
+
|
|
8
|
+
namespace js::soft::adj {
|
|
9
|
+
|
|
10
|
+
namespace G = d16::g1_soft_5db44fd45286;
|
|
11
|
+
// the generated child table holds 3 children per body, which adj_tree's registers (kMaxKids) must cover
|
|
12
|
+
static_assert(sizeof(G::kChild) / sizeof(G::kChild[0]) == 3 * G::NB, "child table stride is not 3");
|
|
13
|
+
|
|
14
|
+
static_assert(3 <= kMaxKids, "adj_tree keeps fewer children per body than the generated table allows");
|
|
15
|
+
|
|
16
|
+
template <class S> struct GenTab {
|
|
17
|
+
const S* v; // device copy of G::kValues (float) or G::kValuesD (double), G::NVALS entries
|
|
18
|
+
__device__ int nb() const { return G::NB; }
|
|
19
|
+
__device__ int maxdepth() const { return G::MAXD; }
|
|
20
|
+
__device__ int parent(int b) const { return __ldg(G::dParent + b); }
|
|
21
|
+
__device__ int jnt(int b) const { return __ldg(G::dJtype + b); }
|
|
22
|
+
__device__ int qadr(int b) const { return __ldg(G::dQadr + b); }
|
|
23
|
+
__device__ int dadr(int b) const { return __ldg(G::dDadr + b); }
|
|
24
|
+
__device__ int depth(int b) const { return __ldg(G::dDepth + b); }
|
|
25
|
+
__device__ int nchild(int b) const { return __ldg(G::dNChild + b); }
|
|
26
|
+
__device__ int child(int b, int i) const { return __ldg(G::dChild + 3 * b + i); }
|
|
27
|
+
__device__ const S* pos(int b) const { return v + G::OFF_POS + 3 * b; }
|
|
28
|
+
__device__ const S* quat(int b) const { return v + G::OFF_QUAT + 4 * b; }
|
|
29
|
+
__device__ const S* axis(int b) const { return v + G::OFF_AXIS + 3 * b; }
|
|
30
|
+
#ifdef D16_G1_COMDR
|
|
31
|
+
// COMDR (deck-only): one body's ipos for THIS world (set_anchor: the table's value + the world's offset), so the adjoint's replay
|
|
32
|
+
// (adj_tree) reads the ipos the forward's kernel P used; every other body, and the default anc_body -1, read the table
|
|
33
|
+
int anc_body = -1;
|
|
34
|
+
S anc_ipos[3] = {S(0), S(0), S(0)};
|
|
35
|
+
__device__ void set_anchor(int b, const S* off) {
|
|
36
|
+
for (int k = 0; k < 3; ++k) anc_ipos[k] = v[G::OFF_IPOS + 3 * b + k] + off[k];
|
|
37
|
+
anc_body = b;
|
|
38
|
+
}
|
|
39
|
+
__device__ const S* ipos(int b) const { return b == anc_body ? anc_ipos : v + G::OFF_IPOS + 3 * b; }
|
|
40
|
+
#else
|
|
41
|
+
__device__ const S* ipos(int b) const { return v + G::OFF_IPOS + 3 * b; }
|
|
42
|
+
#endif
|
|
43
|
+
__device__ const S* iquat(int b) const { return v + G::OFF_IQUAT + 4 * b; }
|
|
44
|
+
__device__ const S* inertia(int b) const { return v + G::OFF_INERT + 3 * b; }
|
|
45
|
+
__device__ S mass(int b) const { return v[G::OFF_MASS + b]; }
|
|
46
|
+
__device__ S gravity(int k) const { return v[G::OFF_GRAV + k]; }
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace js::soft::adj
|