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,283 @@
|
|
|
1
|
+
// The CPU engine's prototype for the 14x (ENGINE_UNIFY_PLAN.md section 2.3 (a), phase 2; C, 2026-11-09): one control step of the composed
|
|
2
|
+
// 14x, world by world, from the GPU engine's OWN device code compiled for the host through the fiber shim (fiber/cuda_runtime.h). Per
|
|
3
|
+
// substep, as bindings/soft14_engine_ext.cu's step_t runs it: k_mus (core/soft/gpu/k_mus.cuh, the kernel itself), kernel P + L2
|
|
4
|
+
// (kp14.cuh p14_world, l2x14.cuh l2x14_world: kpre14's body), k_post (l3.cuh world_hand at X14Opts: kpost14's body, the fast path at
|
|
5
|
+
// NR 128 rows unless the world's nefc exceeds it, else the big path at NRK), then the ping-pong.
|
|
6
|
+
// Single-sourced with the GPU binding since 11-09 (the design rule: GPU code may move if the GPU behaves exactly as before):
|
|
7
|
+
// - X14Opts, the tape layouts and the kernels kpre14, k_order14 (the fast / big world order), kpost14 (both paths) and tail14: the
|
|
8
|
+
// binding's own block, core/soft/gpu/x14_engine_kernels.cuh, which the binding includes at the same place (token_check EQUAL);
|
|
9
|
+
// - the muscle tables: k_mus_host.cuh's own host builders, extracted verbatim by build.sh (the header's launchers use <<<>>>);
|
|
10
|
+
// - adj14.cuh's tape layout, which the shared block's static_assert reads: extracted verbatim by build.sh.
|
|
11
|
+
// - the substep sequence (x14_control_step: the launch order, k_post's arguments, the ping-pong), which the binding's step_t calls with its
|
|
12
|
+
// CUDA launcher and this driver with CpuLaunch14 below (step (c)).
|
|
13
|
+
// Still mirrored, pinned by mirror_pins.py: the binding's build() (the CPU builds the same tables with mus_upload_tables) in make() below.
|
|
14
|
+
// build: tools/d16_unify/cpu_engine/build.sh [mm|e0] (f32 and f64 in one library)
|
|
15
|
+
#include <cuda_runtime.h> // the fiber shim: -I tools/d16_unify/cpu_engine/fiber first
|
|
16
|
+
|
|
17
|
+
#include <chrono>
|
|
18
|
+
#include <cstdint>
|
|
19
|
+
#include <cstdio>
|
|
20
|
+
#include <cstdlib>
|
|
21
|
+
#include <cstring>
|
|
22
|
+
#include <memory>
|
|
23
|
+
#include <vector>
|
|
24
|
+
|
|
25
|
+
#if defined(D16_BODY_HEADER) // another body of the family (core/soft/gpu/body14.cuh), as the binding selects it
|
|
26
|
+
#include D16_BODY_HEADER
|
|
27
|
+
#elif defined(D16_X14_MMFLOOR)
|
|
28
|
+
#include "soft/gpu/generated/x14_soft_f1c2243ae6be_mmfloor.cuh"
|
|
29
|
+
#define D16_X14_NS d16::x14_soft_f1c2243ae6be_mmfloor
|
|
30
|
+
#else
|
|
31
|
+
#include "soft/gpu/generated/x14_soft_f1c2243ae6be.cuh"
|
|
32
|
+
#define D16_X14_NS d16::x14_soft_f1c2243ae6be
|
|
33
|
+
#endif
|
|
34
|
+
#include "soft/gpu/body14.cuh"
|
|
35
|
+
#include "soft/gpu/kp14.cuh"
|
|
36
|
+
#include "soft/gpu/l2x14.cuh"
|
|
37
|
+
#include "soft/gpu/l3.cuh"
|
|
38
|
+
#include "soft/gpu/k_mus.cuh"
|
|
39
|
+
#include "soft/x14adj/shell14_adj.h" // d16::x14adj, which adj14's layout names
|
|
40
|
+
#include "adj14_tl14.inc" // generated by build.sh: adj14.cuh's tape layout, verbatim
|
|
41
|
+
#include "k_mus_host_tables.inc" // generated by build.sh: k_mus_host.cuh's host part, verbatim
|
|
42
|
+
|
|
43
|
+
namespace {
|
|
44
|
+
#include "soft/gpu/x14_engine_kernels.cuh" // THE binding's kernels and layout (one source)
|
|
45
|
+
namespace sg = js::soft::gpu;
|
|
46
|
+
|
|
47
|
+
template <class T> struct Model {
|
|
48
|
+
sg::MusPool P;
|
|
49
|
+
js::soft::MuscleTables<T> mt{};
|
|
50
|
+
sg::MusSlots<T> ms{};
|
|
51
|
+
sg::MusBall mb{};
|
|
52
|
+
std::vector<T> V, kd;
|
|
53
|
+
std::vector<int> hq;
|
|
54
|
+
std::vector<T> hand = std::vector<T>(HL.words); // the hand record kpre14 writes and k_post reads (the kernels' __shared__ is the shim's)
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
template <class T> Model<T>* make(const int* dims, void* const* tabs) {
|
|
58
|
+
auto* M = new Model<T>;
|
|
59
|
+
{ // mus_case_fits, as the binding's build() checks it
|
|
60
|
+
if (dims[sg::kMusNQ] != NQ || dims[sg::kMusNV] != NV || dims[sg::kMusNM] != NM || dims[sg::kMusNSLOT] != D16_BODY_NSLOT) std::abort();
|
|
61
|
+
if (!sg::mus_case_fits(dims[sg::kMusNM], dims[sg::kMusNSLOT], dims[sg::kMusKD], static_cast<const int*>(tabs[16]),
|
|
62
|
+
static_cast<const int*>(tabs[17]), NM, D16_BODY_NSLOT, D16_BODY_NS, D16_BODY_MKD))
|
|
63
|
+
std::abort();
|
|
64
|
+
}
|
|
65
|
+
#ifdef D16_X14_MILLARD // a Millard build (11-17, M0): the law's eleven arrays follow the perm, tabs[44 ..], at mus_upload_tables' a[52 ..]
|
|
66
|
+
void* a[63] = {};
|
|
67
|
+
for (int i = 0; i < 11; ++i) a[52 + i] = tabs[44 + i];
|
|
68
|
+
#else
|
|
69
|
+
void* a[52] = {};
|
|
70
|
+
#endif
|
|
71
|
+
for (int i = 0; i < 43; ++i) a[i] = tabs[i];
|
|
72
|
+
a[51] = tabs[43]; // the perm (the binding's tabs[43])
|
|
73
|
+
sg::mus_upload_tables<T, NQ, NV>(M->P, dims, a, M->mt, M->ms, M->mb);
|
|
74
|
+
#if defined(X14CPU_PLANT) && X14CPU_PLANT == 1 // D3's positive control (d3_gate.py): muscle 0's F_max x 1.001, a table drift the gate must see
|
|
75
|
+
const_cast<T*>(M->mt.fmax)[0] *= T(1.001);
|
|
76
|
+
#endif
|
|
77
|
+
M->V.resize(MD::NVALS);
|
|
78
|
+
for (int i = 0; i < MD::NVALS; ++i) M->V[i] = static_cast<T>(MD::kValues[i]);
|
|
79
|
+
M->kd.assign(NV, T(0));
|
|
80
|
+
M->hq.assign(NV, -1);
|
|
81
|
+
for (int b = 1; b < MD::NB; ++b)
|
|
82
|
+
if (MD::kJtype[b] == 3 && MD::kQadr[b] >= 0 && MD::kDadr[b] >= 0) M->hq[MD::kDadr[b]] = MD::kQadr[b]; // own hinges only
|
|
83
|
+
return M;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// one world, nsub substeps: in (q, v, warm, lce, a, u) -> out; st[nsub][4] = (nefc, niter, kflags, big path)
|
|
87
|
+
// the CPU engine's launcher for x14_control_step (the shared substep sequence): each launch runs the binding's kernel over the binding's
|
|
88
|
+
// grid, block by block, through the fiber shim (blockIdx set per block). Untaped only: the CPU engine runs the forward.
|
|
89
|
+
template <class T> struct CpuLaunch14 {
|
|
90
|
+
Model<T>& M;
|
|
91
|
+
int n;
|
|
92
|
+
const T* u;
|
|
93
|
+
T dt;
|
|
94
|
+
int dt_iters;
|
|
95
|
+
T *tau, *hand;
|
|
96
|
+
int *nefc, *niter, *kflags;
|
|
97
|
+
uint32_t* flags;
|
|
98
|
+
int* stats;
|
|
99
|
+
void mus(const T* iq, const T* il, const T* ia, T* l1, T* a1, T* rk) const {
|
|
100
|
+
if (rk) std::abort();
|
|
101
|
+
for (int b = 0; b < n; ++b) {
|
|
102
|
+
blockIdx = {unsigned(b), 0, 0};
|
|
103
|
+
cpu_cuda::run_warp([&](int) { KMUS14(T)(M.mt, M.ms, iq, il, ia, u, dt, dt_iters, tau, l1, a1, nullptr); });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
void pre(const T* iq, const T* iv, T* rk) const {
|
|
107
|
+
if (rk) std::abort();
|
|
108
|
+
for (int b = 0; b < n; ++b) {
|
|
109
|
+
blockIdx = {unsigned(b), 0, 0};
|
|
110
|
+
cpu_cuda::run_warp([&](int) { kpre14<T>(M.V.data(), iq, iv, tau, hand, nefc, n); });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
void order(const int* ne, int thr, int* ord, int* nb) const {
|
|
114
|
+
blockIdx = {0, 0, 0};
|
|
115
|
+
cpu_cuda::run_block(1024, [&](int) { k_order14(n, ne, thr, ord, nb); });
|
|
116
|
+
}
|
|
117
|
+
void post(const l3::Args<T>& a, const int* ord, const int* nb) const {
|
|
118
|
+
for (int pass = 0; pass < 2; ++pass) // the binding's two launches: the big path's grid, then the fast path's
|
|
119
|
+
for (int b = 0; b < n; ++b) {
|
|
120
|
+
blockIdx = {unsigned(b), 0, 0};
|
|
121
|
+
if constexpr (sizeof(T) == 4) {
|
|
122
|
+
if (pass == 0) cpu_cuda::run_warp([&](int) { kpost14_big_f32(a, ord, nb); });
|
|
123
|
+
else cpu_cuda::run_warp([&](int) { kpost14_f32(a, ord, nb); });
|
|
124
|
+
} else {
|
|
125
|
+
if (pass == 0) cpu_cuda::run_warp([&](int) { kpost14_big_f64(a, ord, nb); });
|
|
126
|
+
else cpu_cuda::run_warp([&](int) { kpost14_f64(a, ord, nb); });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
void tail(int k, int nsub) const {
|
|
131
|
+
for (int b = 0; b < (n + 127) / 128; ++b) {
|
|
132
|
+
blockIdx = {unsigned(b), 0, 0};
|
|
133
|
+
cpu_cuda::run_block(128, [&](int) { tail14<T>(n, hand, niter, kflags, flags, stats, k, nsub); });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
T* rec_a = nullptr; // [nsub][n][NM]: the substeps' activations (k_mus's a1), when asked
|
|
137
|
+
void record(int k, const T*, const T* a1) const {
|
|
138
|
+
if (rec_a) std::memcpy(rec_a + static_cast<size_t>(k) * n * NM, a1, sizeof(T) * static_cast<size_t>(n) * NM);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// n worlds, `steps` control steps of nsub substeps, u held, through the shared substep sequence; st [n][steps][nsub][kStatW] (tail14's rows:
|
|
143
|
+
// ncon, nefc, niter, warm kept, nlim, cap) or null; flags_o [n] or null: every world's engine flag word (tail14's, the binding's
|
|
144
|
+
// flags: kFlagOverflow, kFlagCap, kFlagRankLoss, kFlagHandOrder, kFlagHandOverflow) OR-ed over the steps into the caller's array.
|
|
145
|
+
// Returns the wall seconds of the loop.
|
|
146
|
+
template <class T> double run(void* h, int n, const void* q, const void* v, const void* w, const void* l, const void* a, const void* u, int nsub,
|
|
147
|
+
int dt_iters, int steps, void* qo, void* vo, void* wo, void* lo, void* ao, int* st, void* rec_a = nullptr,
|
|
148
|
+
void* hand_o = nullptr, uint32_t* flags_o = nullptr) {
|
|
149
|
+
Model<T>& M = *static_cast<Model<T>*>(h);
|
|
150
|
+
const size_t N = size_t(n);
|
|
151
|
+
auto C = [](const void* p) { return static_cast<const T*>(p); };
|
|
152
|
+
std::vector<T> in_q(C(q), C(q) + N * NQ), in_v(C(v), C(v) + N * NV), in_w(C(w), C(w) + N * NV), in_l(C(l), C(l) + N * NM), in_a(C(a), C(a) + N * NM);
|
|
153
|
+
std::vector<T> bq[2] = {std::vector<T>(N * NQ), std::vector<T>(N * NQ)}, bv[2] = {std::vector<T>(N * NV), std::vector<T>(N * NV)},
|
|
154
|
+
bw[2] = {std::vector<T>(N * NV), std::vector<T>(N * NV)}, bl[2] = {std::vector<T>(N * NM), std::vector<T>(N * NM)},
|
|
155
|
+
ba[2] = {std::vector<T>(N * NM), std::vector<T>(N * NM)};
|
|
156
|
+
std::vector<T> tau(N * NV), hand(N * HL.words), aadv(N * NV);
|
|
157
|
+
std::vector<int> nefc(N), order(N), nbig(1), niter(N), kflags(N), nls(N), nfact(N), stats(N * size_t(nsub) * kStatW);
|
|
158
|
+
std::vector<uint32_t> flags(N);
|
|
159
|
+
std::vector<long long> cycles(N);
|
|
160
|
+
CpuLaunch14<T> L{M, n, C(u), T(MD::TIMESTEP), dt_iters, tau.data(), hand.data(), nefc.data(), niter.data(), kflags.data(), flags.data(), stats.data()};
|
|
161
|
+
if (rec_a) { if (steps != 1) std::abort(); L.rec_a = static_cast<T*>(rec_a); } // one control step's substeps
|
|
162
|
+
X14Bufs<T> B{};
|
|
163
|
+
B.n = n; B.q = in_q.data(); B.v = in_v.data(); B.w = in_w.data(); B.lce = in_l.data(); B.a = in_a.data();
|
|
164
|
+
for (int i = 0; i < 2; ++i) { B.bq[i] = bq[i].data(); B.bv[i] = bv[i].data(); B.bw[i] = bw[i].data(); B.bl[i] = bl[i].data(); B.ba[i] = ba[i].data(); }
|
|
165
|
+
B.tau = tau.data(); B.hand = hand.data(); B.aadv = aadv.data(); B.tape = nullptr;
|
|
166
|
+
B.nefc = nefc.data(); B.order = order.data(); B.nbig = nbig.data(); B.niter = niter.data(); B.kflags = kflags.data(); B.nls = nls.data();
|
|
167
|
+
B.nfact = nfact.data(); B.cycles = cycles.data(); B.kd = M.kd.data(); B.hinge_qadr = M.hq.data();
|
|
168
|
+
const auto t0 = std::chrono::steady_clock::now();
|
|
169
|
+
for (int s = 0; s < steps; ++s) {
|
|
170
|
+
std::fill(flags.begin(), flags.end(), 0u);
|
|
171
|
+
x14_control_step<T>(L, B, nsub, 15);
|
|
172
|
+
if (st)
|
|
173
|
+
for (size_t i = 0; i < N; ++i)
|
|
174
|
+
std::memcpy(st + (i * steps + s) * size_t(nsub) * kStatW, stats.data() + i * size_t(nsub) * kStatW, sizeof(int) * nsub * kStatW);
|
|
175
|
+
if (flags_o) // this control step's word (zeroed above, OR-ed over its substeps by tail14), into the caller's OR
|
|
176
|
+
for (size_t i = 0; i < N; ++i) flags_o[i] |= flags[i];
|
|
177
|
+
// the next control step's inputs: this one's outputs (buffer 0), copied, as the binding's caller hands in fresh tensors
|
|
178
|
+
in_q = bq[0]; in_v = bv[0]; in_w = bw[0]; in_l = bl[0]; in_a = ba[0];
|
|
179
|
+
}
|
|
180
|
+
const double secs = std::chrono::duration<double>(std::chrono::steady_clock::now() - t0).count();
|
|
181
|
+
if (hand_o) { if (steps != 1) std::abort(); std::memcpy(hand_o, hand.data(), sizeof(T) * N * HL.words); } // the last substep's hand
|
|
182
|
+
std::memcpy(qo, in_q.data(), sizeof(T) * N * NQ); std::memcpy(vo, in_v.data(), sizeof(T) * N * NV); std::memcpy(wo, in_w.data(), sizeof(T) * N * NV);
|
|
183
|
+
std::memcpy(lo, in_l.data(), sizeof(T) * N * NM); std::memcpy(ao, in_a.data(), sizeof(T) * N * NM);
|
|
184
|
+
return secs;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// the engine's activation alone (k_act14) and its VJP (k_act14_vjp), over the binding's grid (blocks of 128)
|
|
188
|
+
template <class T> void act(void* h, int n, const void* u, const void* a_prev, double dt, void* a_new) {
|
|
189
|
+
Model<T>& M = *static_cast<Model<T>*>(h);
|
|
190
|
+
const long tot = static_cast<long>(n) * NM;
|
|
191
|
+
for (long b = 0; b < (tot + 127) / 128; ++b) {
|
|
192
|
+
blockIdx = {unsigned(b), 0, 0};
|
|
193
|
+
cpu_cuda::run_block(128, [&](int) { k_act14<T>(n, M.mt, static_cast<const T*>(u), static_cast<const T*>(a_prev), T(dt), static_cast<T*>(a_new)); });
|
|
194
|
+
}
|
|
195
|
+
blockIdx = {0, 0, 0};
|
|
196
|
+
}
|
|
197
|
+
template <class T> void act_vjp(void* h, int n, const void* u, const void* a_prev, double dt, const void* a_bar, void* u_bar, void* a_prev_bar) {
|
|
198
|
+
Model<T>& M = *static_cast<Model<T>*>(h);
|
|
199
|
+
const long tot = static_cast<long>(n) * NM;
|
|
200
|
+
for (long b = 0; b < (tot + 127) / 128; ++b) {
|
|
201
|
+
blockIdx = {unsigned(b), 0, 0};
|
|
202
|
+
cpu_cuda::run_block(128, [&](int) {
|
|
203
|
+
k_act14_vjp<T>(n, M.mt, static_cast<const T*>(u), static_cast<const T*>(a_prev), T(dt), static_cast<const T*>(a_bar), static_cast<T*>(u_bar),
|
|
204
|
+
static_cast<T*>(a_prev_bar));
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
blockIdx = {0, 0, 0};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// the reset's fibre equilibrium (k_mus_equil itself, as the binding's equil_lce runs it: one world per block, every world masked in)
|
|
211
|
+
template <class T> void equil(void* h, int n, const void* q, const void* lce, const void* a0, int niter, int outer, double dt, void* out) {
|
|
212
|
+
Model<T>& M = *static_cast<Model<T>*>(h);
|
|
213
|
+
std::vector<unsigned char> mask(size_t(n), 1);
|
|
214
|
+
for (int w = 0; w < n; ++w) {
|
|
215
|
+
blockIdx = {unsigned(w), 0, 0};
|
|
216
|
+
cpu_cuda::run_warp([&](int) {
|
|
217
|
+
sg::k_mus_equil<T, D16_BODY_NS, D16_BODY_NSLOT, NQ, NM>(M.mt, M.ms, static_cast<const T*>(q), static_cast<const T*>(lce),
|
|
218
|
+
static_cast<const T*>(a0), mask.data(), T(dt), niter, outer, static_cast<T*>(out));
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
blockIdx = {0, 0, 0};
|
|
222
|
+
}
|
|
223
|
+
} // namespace
|
|
224
|
+
|
|
225
|
+
extern "C" {
|
|
226
|
+
void x14cpu_act(int prec, void* h, int n, const void* u, const void* a_prev, double dt, void* a_new) {
|
|
227
|
+
if (prec == 0) act<float>(h, n, u, a_prev, dt, a_new);
|
|
228
|
+
else act<double>(h, n, u, a_prev, dt, a_new);
|
|
229
|
+
}
|
|
230
|
+
void x14cpu_act_vjp(int prec, void* h, int n, const void* u, const void* a_prev, double dt, const void* a_bar, void* u_bar, void* a_prev_bar) {
|
|
231
|
+
if (prec == 0) act_vjp<float>(h, n, u, a_prev, dt, a_bar, u_bar, a_prev_bar);
|
|
232
|
+
else act_vjp<double>(h, n, u, a_prev, dt, a_bar, u_bar, a_prev_bar);
|
|
233
|
+
}
|
|
234
|
+
// one control step with the substeps' activations recorded: rec_a [nsub][n][NM]
|
|
235
|
+
double x14cpu_step_rec(int prec, void* h, int n, const void* q, const void* v, const void* w, const void* l, const void* a, const void* u, int nsub,
|
|
236
|
+
int dt_iters, void* qo, void* vo, void* wo, void* lo, void* ao, void* rec_a) {
|
|
237
|
+
return prec == 0 ? run<float>(h, n, q, v, w, l, a, u, nsub, dt_iters, 1, qo, vo, wo, lo, ao, nullptr, rec_a)
|
|
238
|
+
: run<double>(h, n, q, v, w, l, a, u, nsub, dt_iters, 1, qo, vo, wo, lo, ao, nullptr, rec_a);
|
|
239
|
+
}
|
|
240
|
+
// n worlds' fibre equilibrium at fixed q and a0: outer rounds of niter Newton steps at dt; out [n][nm] (may not alias lce)
|
|
241
|
+
void x14cpu_equil(int prec, void* h, int n, const void* q, const void* lce, const void* a0, int niter, int outer, double dt, void* out) {
|
|
242
|
+
if (prec == 0) equil<float>(h, n, q, lce, a0, niter, outer, dt, out);
|
|
243
|
+
else equil<double>(h, n, q, lce, a0, niter, outer, dt, out);
|
|
244
|
+
}
|
|
245
|
+
// one control step of nsub substeps and the last substep's hand record [n][HL.words] (k_pre's rows at that substep's start state: the contact
|
|
246
|
+
// frames' Jacobians, aref, efc_D, the metadata) beside the solved warm start wo (its qacc): the host decodes the contact forces from them
|
|
247
|
+
// (feat/d16-taskwalk's W reading: the D16 law's own ground reaction at a recorded state, muscles and coupling included)
|
|
248
|
+
double x14cpu_step_hand(int prec, void* h, int n, const void* q, const void* v, const void* w, const void* l, const void* a, const void* u, int nsub,
|
|
249
|
+
int dt_iters, void* qo, void* vo, void* wo, void* lo, void* ao, void* hand_o) {
|
|
250
|
+
return prec == 0 ? run<float>(h, n, q, v, w, l, a, u, nsub, dt_iters, 1, qo, vo, wo, lo, ao, nullptr, nullptr, hand_o)
|
|
251
|
+
: run<double>(h, n, q, v, w, l, a, u, nsub, dt_iters, 1, qo, vo, wo, lo, ao, nullptr, nullptr, hand_o);
|
|
252
|
+
}
|
|
253
|
+
// the hand record's layout (core/soft/hand.h): words, nc, nr, kdof, qacc, counts, conJ, condof, conmeta, conmu, aref, efcD, rowmeta
|
|
254
|
+
void x14cpu_hand_layout(int* o) {
|
|
255
|
+
const int v[13] = {HL.words, HL.nc, HL.nr, HL.kdof, HL.qacc, HL.counts, HL.conJ, HL.condof, HL.conmeta, HL.conmu, HL.aref, HL.efcD, HL.rowmeta};
|
|
256
|
+
for (int i = 0; i < 13; ++i) o[i] = v[i];
|
|
257
|
+
}
|
|
258
|
+
// sizes: nq, nv, nm, hand words, nr fast, nrk big
|
|
259
|
+
void x14cpu_sizes(int* o) { o[0] = NQ; o[1] = NV; o[2] = NM; o[3] = HL.words; o[4] = NR; o[5] = NRK; }
|
|
260
|
+
#ifdef D16_X14_MILLARD
|
|
261
|
+
// present only in a Millard build (build.sh TAG OUT -DD16_X14_MILLARD): x14cpu.py runs a Millard case only on a library that has it, and a
|
|
262
|
+
// Geyer case only on one that does not (the Geyer build's symbols are unchanged)
|
|
263
|
+
int x14cpu_millard() { return 1; }
|
|
264
|
+
#endif
|
|
265
|
+
// prec 0 f32, 1 f64; dims: kmus_gate.bind_dims (13 ints); tabs: kmus_gate.TABLE (43 arrays) + perm, each in the precision's float type or int32
|
|
266
|
+
void* x14cpu_new(int prec, const int* dims, void* const* tabs) {
|
|
267
|
+
return prec == 0 ? static_cast<void*>(make<float>(dims, tabs)) : static_cast<void*>(make<double>(dims, tabs));
|
|
268
|
+
}
|
|
269
|
+
// n worlds, `steps` control steps of nsub substeps each, u held; the arrays in the handle's precision; st [n][steps][nsub][4] or null.
|
|
270
|
+
// Returns the wall seconds of the loop.
|
|
271
|
+
double x14cpu_run(int prec, void* h, int n, const void* q, const void* v, const void* w, const void* l, const void* a, const void* u, int nsub,
|
|
272
|
+
int dt_iters, int steps, void* qo, void* vo, void* wo, void* lo, void* ao, int* st) {
|
|
273
|
+
return prec == 0 ? run<float>(h, n, q, v, w, l, a, u, nsub, dt_iters, steps, qo, vo, wo, lo, ao, st)
|
|
274
|
+
: run<double>(h, n, q, v, w, l, a, u, nsub, dt_iters, steps, qo, vo, wo, lo, ao, st);
|
|
275
|
+
}
|
|
276
|
+
// x14cpu_run plus the engine's flag words: flags_o [n] uint32, OR-ed over the steps into the caller's array (the binding's flags; the
|
|
277
|
+
// caller zeroes it, as the binding's zero_flags)
|
|
278
|
+
double x14cpu_run_flags(int prec, void* h, int n, const void* q, const void* v, const void* w, const void* l, const void* a, const void* u,
|
|
279
|
+
int nsub, int dt_iters, int steps, void* qo, void* vo, void* wo, void* lo, void* ao, int* st, uint32_t* flags_o) {
|
|
280
|
+
return prec == 0 ? run<float>(h, n, q, v, w, l, a, u, nsub, dt_iters, steps, qo, vo, wo, lo, ao, st, nullptr, nullptr, flags_o)
|
|
281
|
+
: run<double>(h, n, q, v, w, l, a, u, nsub, dt_iters, steps, qo, vo, wo, lo, ao, st, nullptr, nullptr, flags_o);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
// Forward-mode AD dual number: value + N partials. Correctness-first oracle for
|
|
3
|
+
// the contact adjoint (codex discuss_20260621_1328): differentiate the templated
|
|
4
|
+
// engine by instantiating S = Dual<double,N>; J^T seed gives the VJP. Also an
|
|
5
|
+
// independent cross-check for the reverse-mode adjoints (vs central-FD).
|
|
6
|
+
// NOTE: production train path stays reverse-mode VJP (Dual register pressure
|
|
7
|
+
// ~x(N+1); fine for tiny nv, prohibitive at torso_leg scale) -- now REALIZED for
|
|
8
|
+
// the contact WRENCH VJP in core/diff/contact_vjp_reverse.h (REG 255->119); this Dual = f64
|
|
9
|
+
// oracle + A/B (the q-only contact-point helpers stay production for the IMEX/stick path).
|
|
10
|
+
// Branch comparisons dispatch on the VALUE (valid where the function is smooth).
|
|
11
|
+
//
|
|
12
|
+
// js_* math overloads live in js::diff and are found by ADL for Dual args
|
|
13
|
+
// (alongside js::so3's float/double overloads called by the templated engine).
|
|
14
|
+
#include "diffneusim/macros.h"
|
|
15
|
+
#include "../math/so3.h"
|
|
16
|
+
|
|
17
|
+
namespace js::diff {
|
|
18
|
+
|
|
19
|
+
template <class S, int N> struct Dual {
|
|
20
|
+
S v;
|
|
21
|
+
S d[N];
|
|
22
|
+
// DELIBERATELY UNINITIALIZED. Every operator below fully overwrites `v` and all N slots of `d`, so
|
|
23
|
+
// zeroing here would be pure waste in the hot device path (this is instantiated at N up to nv and runs
|
|
24
|
+
// per element). It does mean `Dual<...> x;` and `std::vector<Dual<...>> v(n)` hold GARBAGE, not zeros:
|
|
25
|
+
// use `Dual(S(0))` when you want a zero. Reading the garbage is invisible on a fresh zero page and only
|
|
26
|
+
// shows up under a sanitizer -- which is exactly how test_mtu_hvp came to depend on it.
|
|
27
|
+
DN_HOST_DEVICE Dual() {}
|
|
28
|
+
DN_HOST_DEVICE Dual(S c) : v(c) { for (int i = 0; i < N; ++i) d[i] = S(0); } // constant (zeroes d)
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> dual_seed(S v, int k) {
|
|
32
|
+
Dual<S, N> r; r.v = v; for (int i = 0; i < N; ++i) r.d[i] = (i == k) ? S(1) : S(0); return r;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// --- arithmetic (Dual-Dual) ---
|
|
36
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator+(Dual<S, N> a, Dual<S, N> b) {
|
|
37
|
+
Dual<S, N> r; r.v = a.v + b.v; for (int i = 0; i < N; ++i) r.d[i] = a.d[i] + b.d[i]; return r;
|
|
38
|
+
}
|
|
39
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator-(Dual<S, N> a, Dual<S, N> b) {
|
|
40
|
+
Dual<S, N> r; r.v = a.v - b.v; for (int i = 0; i < N; ++i) r.d[i] = a.d[i] - b.d[i]; return r;
|
|
41
|
+
}
|
|
42
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator*(Dual<S, N> a, Dual<S, N> b) {
|
|
43
|
+
Dual<S, N> r; r.v = a.v * b.v;
|
|
44
|
+
for (int i = 0; i < N; ++i) r.d[i] = a.d[i] * b.v + a.v * b.d[i];
|
|
45
|
+
return r;
|
|
46
|
+
}
|
|
47
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator/(Dual<S, N> a, Dual<S, N> b) {
|
|
48
|
+
Dual<S, N> r; S inv = S(1) / b.v; r.v = a.v * inv;
|
|
49
|
+
for (int i = 0; i < N; ++i) r.d[i] = (a.d[i] - r.v * b.d[i]) * inv;
|
|
50
|
+
return r;
|
|
51
|
+
}
|
|
52
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator-(Dual<S, N> a) {
|
|
53
|
+
Dual<S, N> r; r.v = -a.v; for (int i = 0; i < N; ++i) r.d[i] = -a.d[i]; return r;
|
|
54
|
+
}
|
|
55
|
+
// --- arithmetic (Dual-scalar, both sides) ---
|
|
56
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator+(Dual<S, N> a, S b) { a.v = a.v + b; return a; }
|
|
57
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator+(S b, Dual<S, N> a) { a.v = a.v + b; return a; }
|
|
58
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator-(Dual<S, N> a, S b) { a.v = a.v - b; return a; }
|
|
59
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator-(S b, Dual<S, N> a) { return (-a) + b; }
|
|
60
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator*(Dual<S, N> a, S b) {
|
|
61
|
+
for (int i = 0; i < N; ++i) a.d[i] = a.d[i] * b; a.v = a.v * b; return a;
|
|
62
|
+
}
|
|
63
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator*(S b, Dual<S, N> a) { return a * b; }
|
|
64
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator/(Dual<S, N> a, S b) { return a * (S(1) / b); }
|
|
65
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator/(S b, Dual<S, N> a) { return Dual<S, N>(b) / a; }
|
|
66
|
+
// int-literal mixed arithmetic (engine uses bare int literals, e.g. quat_to_mat's 2*(...)).
|
|
67
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator*(int b, Dual<S, N> a) { return a * S(b); }
|
|
68
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator*(Dual<S, N> a, int b) { return a * S(b); }
|
|
69
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator+(int b, Dual<S, N> a) { return a + S(b); }
|
|
70
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator+(Dual<S, N> a, int b) { return a + S(b); }
|
|
71
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator-(Dual<S, N> a, int b) { return a - S(b); }
|
|
72
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator-(int b, Dual<S, N> a) { return S(b) - a; }
|
|
73
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator/(Dual<S, N> a, int b) { return a / S(b); }
|
|
74
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> operator/(int b, Dual<S, N> a) { return S(b) / a; }
|
|
75
|
+
|
|
76
|
+
// --- comparisons (dispatch on value) ---
|
|
77
|
+
template <class S, int N> DN_HOST_DEVICE bool operator<(Dual<S, N> a, Dual<S, N> b) { return a.v < b.v; }
|
|
78
|
+
template <class S, int N> DN_HOST_DEVICE bool operator<(Dual<S, N> a, S b) { return a.v < b; }
|
|
79
|
+
template <class S, int N> DN_HOST_DEVICE bool operator>(Dual<S, N> a, Dual<S, N> b) { return a.v > b.v; }
|
|
80
|
+
template <class S, int N> DN_HOST_DEVICE bool operator>(Dual<S, N> a, S b) { return a.v > b; }
|
|
81
|
+
template <class S, int N> DN_HOST_DEVICE bool operator>=(Dual<S, N> a, Dual<S, N> b) { return a.v >= b.v; }
|
|
82
|
+
template <class S, int N> DN_HOST_DEVICE bool operator>=(Dual<S, N> a, S b) { return a.v >= b; }
|
|
83
|
+
template <class S, int N> DN_HOST_DEVICE bool operator<=(Dual<S, N> a, S b) { return a.v <= b; }
|
|
84
|
+
|
|
85
|
+
// --- math (chain rule). In js::diff so ADL on a Dual arg finds them; the engine
|
|
86
|
+
// calls these unqualified (so3.h is inside js::so3; force.h via `using namespace
|
|
87
|
+
// js::so3`) -> ADL adds these for Dual args. The inner value math is called
|
|
88
|
+
// UNQUALIFIED (with using-declarations of the so3 scalar overloads) so that nested
|
|
89
|
+
// Dual<Dual<S,1>,N> resolves the inner scalar=Dual<S,1> via these templates (the
|
|
90
|
+
// Dual-of-Dual Hvp oracle); a qualified so3::js_* would bypass ADL and break nesting.
|
|
91
|
+
using so3::js_sqrt; using so3::js_exp; using so3::js_log;
|
|
92
|
+
using so3::js_sin; using so3::js_cos; using so3::js_atan2; using so3::js_acos;
|
|
93
|
+
// sqrt's slope 0.5 / sqrt(x) is infinite at x = 0, so a tangent through it there was 0 x inf = NaN (tools/d16_bodies/RESULTS.md, B3e's finding: so3::exp_map's
|
|
94
|
+
// theta = sqrt(phi . phi) at a hinge exactly at 0). At exactly 0 the slope is taken as 0, a valid subgradient of the norm there, which makes exp_map's tangent its exact
|
|
95
|
+
// limit at 0. Every x > 0 is unchanged; only the derivative channel at exactly 0 changes (the review GO 11-08, fix/js-sqrt-dual).
|
|
96
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> js_sqrt(Dual<S, N> a) {
|
|
97
|
+
S s = js_sqrt(a.v); S c = s > S(0) ? S(0.5) / s : S(0); Dual<S, N> r; r.v = s;
|
|
98
|
+
for (int i = 0; i < N; ++i) r.d[i] = a.d[i] * c; return r;
|
|
99
|
+
}
|
|
100
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> js_exp(Dual<S, N> a) {
|
|
101
|
+
S e = js_exp(a.v); Dual<S, N> r; r.v = e;
|
|
102
|
+
for (int i = 0; i < N; ++i) r.d[i] = a.d[i] * e; return r;
|
|
103
|
+
}
|
|
104
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> js_log(Dual<S, N> a) {
|
|
105
|
+
S inv = S(1) / a.v; Dual<S, N> r; r.v = js_log(a.v);
|
|
106
|
+
for (int i = 0; i < N; ++i) r.d[i] = a.d[i] * inv; return r;
|
|
107
|
+
}
|
|
108
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> js_sin(Dual<S, N> a) {
|
|
109
|
+
S c = js_cos(a.v); Dual<S, N> r; r.v = js_sin(a.v);
|
|
110
|
+
for (int i = 0; i < N; ++i) r.d[i] = a.d[i] * c; return r;
|
|
111
|
+
}
|
|
112
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> js_cos(Dual<S, N> a) {
|
|
113
|
+
S s = S(0) - js_sin(a.v); Dual<S, N> r; r.v = js_cos(a.v);
|
|
114
|
+
for (int i = 0; i < N; ++i) r.d[i] = a.d[i] * s; return r;
|
|
115
|
+
}
|
|
116
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> js_atan2(Dual<S, N> y, Dual<S, N> x) {
|
|
117
|
+
S den = S(1) / (x.v * x.v + y.v * y.v); Dual<S, N> r; r.v = js_atan2(y.v, x.v);
|
|
118
|
+
for (int i = 0; i < N; ++i) r.d[i] = (x.v * y.d[i] - y.v * x.d[i]) * den; return r;
|
|
119
|
+
}
|
|
120
|
+
template <class S, int N> DN_HOST_DEVICE Dual<S, N> js_acos(Dual<S, N> a) {
|
|
121
|
+
S g = (S(0) - S(1)) / js_sqrt(S(1) - a.v * a.v); // d/dx acos = -1/sqrt(1-x^2)
|
|
122
|
+
Dual<S, N> r; r.v = js_acos(a.v);
|
|
123
|
+
for (int i = 0; i < N; ++i) r.d[i] = a.d[i] * g; return r;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
} // namespace js::diff
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
// Host/device decoration. Same source compiles for the CPU f64 oracle build
|
|
3
|
+
// and the CUDA build (dev-rules §1: forward and adjoint share one code path).
|
|
4
|
+
#if defined(__CUDACC__)
|
|
5
|
+
#define DN_HOST_DEVICE __host__ __device__
|
|
6
|
+
#define DN_DEVICE __device__
|
|
7
|
+
#define DN_NOINLINE __noinline__
|
|
8
|
+
#else
|
|
9
|
+
#define DN_HOST_DEVICE
|
|
10
|
+
#define DN_DEVICE
|
|
11
|
+
#define DN_NOINLINE __attribute__((noinline))
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
// Break the mega-inline of the analytic contact adjoint on the FULL-BODY ext only. At full-body scale
|
|
15
|
+
// (NV padded to 130) the whole analytic contact adjoint (wrench VJP + friction/stick IMEX adjoint + the
|
|
16
|
+
// chain q/qd-VJP sweeps) inlines into one imex_contact_adj_kernel that hits REG:224 + ~65KB register
|
|
17
|
+
// spill -> CUDA reserves ~14GB of local memory (the throughput/memory wall, issue #31). Forcing a
|
|
18
|
+
// __noinline__ boundary on the heavy per-contact VJP functions keeps the kernel's live register set small
|
|
19
|
+
// (only one callee frame live at a time) -> far less spill/reservation. myoLeg (no MTU_FULLBODY) keeps
|
|
20
|
+
// full inlining: its NV is small, it does not spill, and inlining is faster there.
|
|
21
|
+
#ifdef MTU_FULLBODY
|
|
22
|
+
#define DN_FULLBODY_NOINLINE DN_NOINLINE
|
|
23
|
+
#else
|
|
24
|
+
#define DN_FULLBODY_NOINLINE
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
// JS_DEVICE_ASSERT(c): assert(c) on the host always; in device code only in gate builds (-DJS_DEVICE_ASSERTS). Each device
|
|
28
|
+
// assert is an __assertfail call (its message and ABI set-up) that grows a hot kernel: k_post with 3 asserts was 8.7% slower
|
|
29
|
+
// at equal clocks (C and d5, the 2026-11-02 rule). Structural conditions are checked on the host where the tables are built
|
|
30
|
+
// or the kernel launched; data-dependent ones stay in the gate builds, which compute the same values.
|
|
31
|
+
#if defined(__CUDA_ARCH__) && !defined(JS_DEVICE_ASSERTS)
|
|
32
|
+
#define JS_DEVICE_ASSERT(c) ((void)0)
|
|
33
|
+
#else
|
|
34
|
+
#define JS_DEVICE_ASSERT(c) assert(c)
|
|
35
|
+
#endif
|