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,596 @@
|
|
|
1
|
+
// D16 14x engine binding (2026-11-02): the composed forward of the 14x on the new engine, one control step of nsub
|
|
2
|
+
// substeps, every kernel one world per 32-thread block:
|
|
3
|
+
// k_mus the muscle stage (core/soft/gpu/k_mus.cuh at feat/d16-muscle 981c61f9): (q_k, lce_k, a_k, u) -> tau_mus,
|
|
4
|
+
// lce_k+1, a_k+1 (lce / a ping-pong; u held for the control step)
|
|
5
|
+
// k_pre14 the kernel P + L2 (kp14.cuh, l2x14.cuh): the smooth terms with tau_ext = tau_mus, collision and rows, into the hand
|
|
6
|
+
// k_order14 the row-count order (engine_launch.cuh's k_order at the 14x's NRH 255, copied): the big worlds first
|
|
7
|
+
// k_post14 the world_hand<..., X14Opts> (l3.cuh at feat/d16-l3 f5a1368f): Newton (cap 4), Euler with explicit damping,
|
|
8
|
+
// the root and the hip balls by quat_integrate; the fast path (NR 128 shared) and the big path (NRK 256 shared for the
|
|
9
|
+
// hand's 255 rows: the solve works in 32-row words)
|
|
10
|
+
// tail14 per world the flag word and the stats row (ncon, nefc, niter, warm kept, nlim, 0)
|
|
11
|
+
// q / v / warm and lce / a are ping-pong buffers that end in the output buffers for any nsub (substep k writes buffer
|
|
12
|
+
// (nsub - 1 - k) & 1: 0 = out, 1 = scratch). Optional per-substep records for the composed gates C1-C4: tau, lce, a [nsub][n][.].
|
|
13
|
+
#define JS_TAPE_STREAM 1 // the 14x tape's stores are evict-first (core/soft/tape.h tape_st); the G1's builds leave it undefined
|
|
14
|
+
#include <ATen/cuda/CUDAContext.h>
|
|
15
|
+
#include <torch/extension.h>
|
|
16
|
+
|
|
17
|
+
#include <vector>
|
|
18
|
+
|
|
19
|
+
// the model, chosen at build time: -DD16_X14_MMFLOOR, the floor-contact set x14_soft_f1c2243ae6be_mmfloor (FLOOR_CONTACT_TABLE.md;
|
|
20
|
+
// the tools' default, X14_VARIANT=mm), or without it the 14x with its 10 foot spheres (X14_VARIANT=e0)
|
|
21
|
+
// or, with -DD16_BODY_HEADER, another body of the family (core/soft/gpu/body14.cuh)
|
|
22
|
+
#if defined(D16_BODY_HEADER)
|
|
23
|
+
#include D16_BODY_HEADER
|
|
24
|
+
#elif defined(D16_X14_MMFLOOR)
|
|
25
|
+
#include "soft/gpu/generated/x14_soft_f1c2243ae6be_mmfloor.cuh"
|
|
26
|
+
#define D16_X14_NS d16::x14_soft_f1c2243ae6be_mmfloor
|
|
27
|
+
#else
|
|
28
|
+
#include "soft/gpu/generated/x14_soft_f1c2243ae6be.cuh"
|
|
29
|
+
#define D16_X14_NS d16::x14_soft_f1c2243ae6be
|
|
30
|
+
#endif
|
|
31
|
+
#include "soft/gpu/body14.cuh"
|
|
32
|
+
#include "soft/gpu/kp14.cuh"
|
|
33
|
+
#include "soft/gpu/l2x14.cuh"
|
|
34
|
+
#include "soft/gpu/l3.cuh"
|
|
35
|
+
#include "soft/gpu/k_mus.cuh"
|
|
36
|
+
#include "soft/gpu/adj14.cuh" // the 14x adjoint megakernel and its launcher (the backward of engine14's training path)
|
|
37
|
+
#include "soft/gpu/adj14_mus.cuh" // the step 4: the control step's VJP with the muscle_adj (the composed backward)
|
|
38
|
+
|
|
39
|
+
#define CKE(x) do { cudaError_t e_ = (x); TORCH_CHECK(e_ == cudaSuccess, #x, ": ", cudaGetErrorString(e_)); } while (0)
|
|
40
|
+
|
|
41
|
+
namespace {
|
|
42
|
+
#include "soft/gpu/x14_engine_kernels.cuh" // the kernels and their layout, shared with the CPU engine (moved verbatim)
|
|
43
|
+
|
|
44
|
+
// ---- the model on the device ----
|
|
45
|
+
template <class T> struct Dev {
|
|
46
|
+
T* V = nullptr;
|
|
47
|
+
T* kd = nullptr;
|
|
48
|
+
int* hinge_qadr = nullptr;
|
|
49
|
+
js::soft::MuscleTables<T> mt{};
|
|
50
|
+
sg::MusSlots<T> ms{};
|
|
51
|
+
sg::MusBall mb{}; // the ball term's lists (k_mus_host.cuh mus_ball_list)
|
|
52
|
+
#if defined(D16_BODY_MUS_SPLIT) // the muscle split's class tables (k_mus_host.cuh mus_class_upload); mt / ms stay for k_mus_equil (the Q3)
|
|
53
|
+
sg::MusPool cpool;
|
|
54
|
+
sg::MusClasses<T> mc{};
|
|
55
|
+
#endif
|
|
56
|
+
bool ready = false;
|
|
57
|
+
};
|
|
58
|
+
Dev<float> d32;
|
|
59
|
+
Dev<double> d64;
|
|
60
|
+
std::vector<void*> g_alloc;
|
|
61
|
+
template <class X> X* up(const X* h, size_t n) {
|
|
62
|
+
X* d = nullptr;
|
|
63
|
+
CKE(cudaMalloc(&d, n * sizeof(X) + 64));
|
|
64
|
+
g_alloc.push_back(d);
|
|
65
|
+
if (h && n) CKE(cudaMemcpy(d, h, n * sizeof(X), cudaMemcpyHostToDevice));
|
|
66
|
+
return d;
|
|
67
|
+
}
|
|
68
|
+
template <class X> X* up_t(const torch::Tensor& t) { // a CPU tensor of the right dtype
|
|
69
|
+
TORCH_CHECK(t.device().is_cpu() && t.is_contiguous(), "muscle tables: contiguous CPU tensors");
|
|
70
|
+
return up<X>(static_cast<const X*>(t.data_ptr()), static_cast<size_t>(t.numel()));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// tabs: the 43 TABLE arrays of tools/d16/muscle_ref/kmus_gate.py in its order (float arrays in T, int arrays int32), then perm;
|
|
74
|
+
// a Millard build (-DD16_X14_MILLARD, engine14 compiles a Millard case's extension with it) then the law's eleven (kmus_gate.py MILLARD);
|
|
75
|
+
// dims: k_mus_host.cuh MusDim, kmus_gate.py bind_dims: nq, nv, nm, nsite, nslot, nlev, nround, nnz, nje, nseed, ngent, nw (unused here), kd
|
|
76
|
+
#ifdef D16_X14_MILLARD
|
|
77
|
+
constexpr size_t kTabs = 55;
|
|
78
|
+
#else
|
|
79
|
+
constexpr size_t kTabs = 44;
|
|
80
|
+
#endif
|
|
81
|
+
template <class T> void build(Dev<T>& D, const std::vector<torch::Tensor>& tabs, const std::vector<int64_t>& dims) {
|
|
82
|
+
TORCH_CHECK(tabs.size() == kTabs, "muscle tables: 43 arrays + perm (+ the Millard law's 11 in a D16_X14_MILLARD build): got ", tabs.size());
|
|
83
|
+
TORCH_CHECK(dims.size() == sg::kMusKD + 1, "muscle tables: dims is kmus_gate.py bind_dims' list: got ", dims.size());
|
|
84
|
+
TORCH_CHECK(dims[0] == NQ && dims[1] == NV && dims[2] == NM && dims[4] == D16_BODY_NSLOT, "the muscle case is not this build's body");
|
|
85
|
+
TORCH_CHECK(sg::mus_case_fits(static_cast<int>(dims[2]), static_cast<int>(dims[4]), static_cast<int>(dims[sg::kMusKD]), tabs[16].data_ptr<int>(),
|
|
86
|
+
tabs[17].data_ptr<int>(), NM, D16_BODY_NSLOT, D16_BODY_NS, D16_BODY_MKD),
|
|
87
|
+
"the muscle case does not fit this build (nm, nslot or KD differ, or sites > NS, or row entries > MKD): a body needs its own case and build");
|
|
88
|
+
std::vector<T> V(MD::NVALS);
|
|
89
|
+
for (int i = 0; i < MD::NVALS; ++i) V[i] = static_cast<T>(MD::kValues[i]);
|
|
90
|
+
D.V = up<T>(V.data(), V.size());
|
|
91
|
+
std::vector<T> kd(NV, T(0));
|
|
92
|
+
std::vector<int> hq(NV, -1);
|
|
93
|
+
for (int b = 1; b < MD::NB; ++b)
|
|
94
|
+
if (MD::kJtype[b] == 3 && MD::kQadr[b] >= 0 && MD::kDadr[b] >= 0) hq[MD::kDadr[b]] = MD::kQadr[b]; // own hinges only
|
|
95
|
+
D.kd = up<T>(kd.data(), kd.size());
|
|
96
|
+
D.hinge_qadr = up<int>(hq.data(), hq.size());
|
|
97
|
+
js::soft::MuscleTables<T>& t = D.mt;
|
|
98
|
+
const int nm = static_cast<int>(dims[2]), nsite = static_cast<int>(dims[3]), ns = static_cast<int>(dims[4]);
|
|
99
|
+
t.nm = nm; t.nsite = nsite; t.nv = NV; t.nq = NQ; t.nbody = ns;
|
|
100
|
+
const T** vals[15] = {&t.fmax, &t.lopt, &t.lslack, &t.vmax, &t.W, &t.C, &t.N, &t.K, &t.eref, &t.pe_rest, &t.pe_eps, &t.beta,
|
|
101
|
+
&t.tau_act, &t.tau_deact, &t.tausmooth};
|
|
102
|
+
for (int i = 0; i < 15; ++i) *vals[i] = up_t<T>(tabs[i]);
|
|
103
|
+
t.rigid = up_t<int>(tabs[15]); t.site_off = up_t<int>(tabs[16]); t.row_off = up_t<int>(tabs[17]); t.row_dof = up_t<int>(tabs[18]);
|
|
104
|
+
t.jent_off = up_t<int>(tabs[19]); t.jent_body = up_t<int>(tabs[20]); t.jent_mask = up_t<int>(tabs[21]); t.jent_slot = up_t<int>(tabs[22]);
|
|
105
|
+
t.site_body = up_t<int>(tabs[23]); t.site_off3 = up_t<T>(tabs[24]); t.site_moving = up_t<int>(tabs[25]); t.site_cdof_q = up_t<int>(tabs[26]);
|
|
106
|
+
t.site_slot = up_t<int>(tabs[27]); t.site_coef = up_t<T>(tabs[28]); t.body_jtype = up_t<int>(tabs[29]); t.body_jaxis = up_t<T>(tabs[30]);
|
|
107
|
+
t.body_cpl_qadr = up_t<int>(tabs[31]); t.body_cpl_coef = up_t<T>(tabs[32]);
|
|
108
|
+
sg::MusSlots<T>& sl = D.ms;
|
|
109
|
+
sl.nslot = ns; sl.nlev = static_cast<int>(dims[5]); sl.nround = static_cast<int>(dims[6]); sl.nseed = static_cast<int>(dims[9]);
|
|
110
|
+
sl.lev_off = up_t<int>(tabs[33]); sl.parent = up_t<int>(tabs[34]); sl.kjt = up_t<int>(tabs[35]); sl.qadr = up_t<int>(tabs[36]);
|
|
111
|
+
sl.vadr = up_t<int>(tabs[37]); sl.pos = up_t<T>(tabs[38]); sl.quat = up_t<T>(tabs[39]);
|
|
112
|
+
sl.cpl_qadr = t.body_cpl_qadr; sl.cpl_coef = t.body_cpl_coef; sl.axis = t.body_jaxis;
|
|
113
|
+
sl.g_off = up_t<int>(tabs[40]); sl.g_ent = up_t<int>(tabs[41]); sl.seed = up_t<int>(tabs[42]);
|
|
114
|
+
sl.perm = up_t<int>(tabs[43]);
|
|
115
|
+
{ // the per-entry records (bindings/muscle_gpu_test.cu run_model at 981c61f9, the fix 5 (i)), built on the host
|
|
116
|
+
const int nje = static_cast<int>(dims[8]);
|
|
117
|
+
const int* jb = tabs[20].data_ptr<int>(); const int* jm = tabs[21].data_ptr<int>(); const int* js_ = tabs[22].data_ptr<int>();
|
|
118
|
+
const int* bj = tabs[29].data_ptr<int>(); const T* bax = static_cast<const T*>(tabs[30].data_ptr());
|
|
119
|
+
const int* bcq = tabs[31].data_ptr<int>(); const T* bcc = static_cast<const T*>(tabs[32].data_ptr());
|
|
120
|
+
#if defined(D16_BODY_ROW_CF) // the records carry the entries' codes (mus_row_cf.h), not their masks
|
|
121
|
+
std::vector<int> rcode;
|
|
122
|
+
sg::mus_row_codes(nm, tabs[16].data_ptr<int>(), tabs[19].data_ptr<int>(), jm, rcode);
|
|
123
|
+
jm = rcode.data();
|
|
124
|
+
#endif
|
|
125
|
+
std::vector<int> ri(4 * static_cast<size_t>(nje)); std::vector<T> rf(8 * static_cast<size_t>(nje), T(0));
|
|
126
|
+
for (int e = 0; e < nje; ++e) {
|
|
127
|
+
const int b = jb[e];
|
|
128
|
+
ri[4 * e] = b; ri[4 * e + 1] = jm[e]; ri[4 * e + 2] = js_[e]; ri[4 * e + 3] = bj[b] | ((bcq[b] + 1) << 8);
|
|
129
|
+
for (int k = 0; k < 4; ++k) rf[8 * e + k] = bcc[5 * b + 1 + k];
|
|
130
|
+
for (int k = 0; k < 3; ++k) rf[8 * e + 4 + k] = bax[3 * b + k];
|
|
131
|
+
}
|
|
132
|
+
sl.erec_i = reinterpret_cast<const int4*>(up<int>(ri.data(), ri.size())); sl.erec_f = up<T>(rf.data(), rf.size());
|
|
133
|
+
std::vector<int> boff, bsv; // the ball term's lists (MusBall), the same builder as mus_upload_tables
|
|
134
|
+
sg::mus_ball_list(nm, tabs[19].data_ptr<int>(), jb, js_, bj, tabs[37].data_ptr<int>(), boff, bsv);
|
|
135
|
+
D.mb.off = up<int>(boff.data(), boff.size()); D.mb.sv = up<int>(bsv.data(), bsv.size());
|
|
136
|
+
}
|
|
137
|
+
#ifdef D16_X14_MILLARD
|
|
138
|
+
{ // the Millard law's tables (k_mus_host.cuh mus_millard_check: the same checks as the test bindings' upload)
|
|
139
|
+
for (size_t i = 44; i < kTabs; ++i) TORCH_CHECK(tabs[i].device().is_cpu() && tabs[i].is_contiguous(), "Millard tables: contiguous CPU tensors");
|
|
140
|
+
TORCH_CHECK(tabs[44].numel() == 3 && tabs[45].numel() == nm && tabs[46].numel() == nm && tabs[47].numel() == nm && tabs[48].numel() == nm &&
|
|
141
|
+
tabs[49].numel() == nm && tabs[54].numel() == nm, "Millard tables: law [3], then per-muscle [nm] arrays");
|
|
142
|
+
int K = 0, NC = 0, nk = 0;
|
|
143
|
+
sg::mus_millard_check(nm, tabs[44].data_ptr<int>(), tabs[45].data_ptr<int>(), tabs[50].data_ptr<int>(), tabs[54].data_ptr<int>(), K, NC, nk);
|
|
144
|
+
TORCH_CHECK(tabs[50].numel() == 2 * NC && tabs[51].numel() == 8 * NC && tabs[52].numel() >= 3 * nk && tabs[53].numel() == K,
|
|
145
|
+
"Millard tables: the curve headers, knots and sin(phi_max) for ", K, " sets and ", NC, " curves");
|
|
146
|
+
t.law = js::soft::kLawMillard; t.nmset = K; t.ncurve = NC; t.pfl_curve = up_t<int>(tabs[54]);
|
|
147
|
+
t.mset = up_t<int>(tabs[45]); t.pen_h = up_t<T>(tabs[46]); t.lce_min = up_t<T>(tabs[47]); t.pfl_a = up_t<T>(tabs[48]); t.pfl_b = up_t<T>(tabs[49]);
|
|
148
|
+
t.mc_i = up_t<int>(tabs[50]); t.mc_f = up_t<T>(tabs[51]); t.mc_knot = up_t<T>(tabs[52]); t.mc_sinmax = up_t<T>(tabs[53]);
|
|
149
|
+
}
|
|
150
|
+
#endif
|
|
151
|
+
#if defined(D16_BODY_MUS_SPLIT)
|
|
152
|
+
{ // the classes from the same arrays, in mus_upload_tables' layout (the tables a[0..42], the perm a[51]); R4's checks abort on a failure
|
|
153
|
+
int dm[sg::kMusKD + 1];
|
|
154
|
+
for (int i = 0; i <= sg::kMusKD; ++i) dm[i] = static_cast<int>(dims[i]);
|
|
155
|
+
void* a[52] = {};
|
|
156
|
+
for (int i = 0; i < 43; ++i) a[i] = tabs[i].data_ptr();
|
|
157
|
+
a[51] = tabs[43].data_ptr();
|
|
158
|
+
sg::mus_class_upload<T, NV>(D.cpool, dm, a, D.mt, D.ms, D.mc);
|
|
159
|
+
}
|
|
160
|
+
#endif
|
|
161
|
+
D.ready = true;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
void init(std::vector<torch::Tensor> tabs32, std::vector<torch::Tensor> tabs64, std::vector<int64_t> dims) {
|
|
165
|
+
build(d32, tabs32, dims);
|
|
166
|
+
build(d64, tabs64, dims);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
void chk(const torch::Tensor& t, at::ScalarType st, std::vector<int64_t> shape, const char* name) {
|
|
170
|
+
TORCH_CHECK(t.is_cuda() && t.scalar_type() == st && t.is_contiguous(), name, ": a contiguous CUDA tensor of the right dtype");
|
|
171
|
+
TORCH_CHECK(t.sizes().vec() == shape, name, ": shape ", t.sizes(), " expected ", c10::IntArrayRef(shape));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// one control step. bufs (CUDA, T): qpos [n,40], qvel / warm [n,37], lce / a / u [n,356] (inputs); oq / ov / ow / olce / oa (outputs);
|
|
175
|
+
// sq / sv / sw / slce / sa (scratch); tau [n,37]; hand [n,words]. ints: nefc, order, niter, kflags, nls, nfact, flags [n]; nbig [1];
|
|
176
|
+
// cycles [n] i64; stats [n, nsub, 6]. rec_tau / rec_lce / rec_a: [nsub, n, .] or empty (no record). parts: 1 k_mus, 2 k_pre, 4 k_post.
|
|
177
|
+
// tape_rec [nsub, n, TL14.words] (this control step's slice of engine14.alloc_tape), or empty (untaped: the record-off
|
|
178
|
+
// kernels): k_mus writes MUS, k_pre14 writes POSE, k_post (the l3.cuh, d8002e2b) writes [0, POSE): the header, zones, contacts,
|
|
179
|
+
// q, v, a*, a_adv and L_H. No control record: the adjoint reads the step's own a_0 and u (the autograd Function saves them;
|
|
180
|
+
// F and C agreed 2026-11-03), so substep 0 runs the same MusTapeSub as the others.
|
|
181
|
+
// (with the order), 8 tail (15 = everything; subsets for timing only).
|
|
182
|
+
// the binding's launcher for x14_control_step: every launch as step_t made it before 11-09 (the same kernels, grids, arguments and stream)
|
|
183
|
+
template <class T> struct CudaLaunch14 {
|
|
184
|
+
const Dev<T>& D;
|
|
185
|
+
cudaStream_t s;
|
|
186
|
+
unsigned nw;
|
|
187
|
+
int n;
|
|
188
|
+
bool taped, rec;
|
|
189
|
+
const T* u;
|
|
190
|
+
T dt;
|
|
191
|
+
int dt_iters;
|
|
192
|
+
T *tau, *hand;
|
|
193
|
+
int *nefc, *niter, *kflags;
|
|
194
|
+
uint32_t* flags;
|
|
195
|
+
int* stats;
|
|
196
|
+
T *rtau, *rlce, *ra;
|
|
197
|
+
void mus(const T* iq, const T* il, const T* ia, T* l1, T* a1, T* rk) const {
|
|
198
|
+
#if defined(D16_BODY_MUS_SPLIT) // R5: the two class kernels, narrow then wide continuing tau (k_mus_host.cuh mus_fwd_cls)
|
|
199
|
+
if (!taped)
|
|
200
|
+
sg::mus_fwd_cls<T, NQ, NV, NM>(D.mc, nw, s, iq, il, ia, u, dt, dt_iters, tau, l1, a1, nullptr, sg::NoMusTape{});
|
|
201
|
+
else
|
|
202
|
+
sg::mus_fwd_cls<T, NQ, NV, NM>(D.mc, nw, s, iq, il, ia, u, dt, dt_iters, tau, l1, a1, nullptr, sg::MusTapeSub<T>{rk, TL14.words, TL14});
|
|
203
|
+
#else
|
|
204
|
+
if (!taped)
|
|
205
|
+
KMUS14(T)<<<nw, 32, 0, s>>>(D.mt, D.ms, iq, il, ia, u, dt, dt_iters, tau, l1, a1, nullptr);
|
|
206
|
+
else
|
|
207
|
+
KMUS14T(T, sg::MusTapeSub<T>)<<<nw, 32, 0, s>>>(D.mt, D.ms, iq, il, ia, u, dt, dt_iters, tau, l1, a1, nullptr,
|
|
208
|
+
sg::MusTapeSub<T>{rk, TL14.words, TL14});
|
|
209
|
+
#endif
|
|
210
|
+
}
|
|
211
|
+
void pre(const T* iq, const T* iv, T* rk) const {
|
|
212
|
+
if (!taped) kpre14<T><<<nw, 32, 0, s>>>(D.V, iq, iv, tau, hand, nefc, n);
|
|
213
|
+
else kpre14<T, true><<<nw, 32, 0, s>>>(D.V, iq, iv, tau, hand, nefc, n, rk);
|
|
214
|
+
}
|
|
215
|
+
void order(const int* ne, int thr, int* ord, int* nb) const { k_order14<<<1, 1024, 0, s>>>(n, ne, thr, ord, nb); }
|
|
216
|
+
void post(const l3::Args<T>& a, const int* ord, const int* nb) const {
|
|
217
|
+
if constexpr (sizeof(T) == 4) {
|
|
218
|
+
kpost14_big_f32<<<nw, 32, 0, s>>>(a, ord, nb);
|
|
219
|
+
kpost14_f32<<<nw, 32, 0, s>>>(a, ord, nb);
|
|
220
|
+
} else {
|
|
221
|
+
kpost14_big_f64<<<nw, 32, 0, s>>>(a, ord, nb);
|
|
222
|
+
kpost14_f64<<<nw, 32, 0, s>>>(a, ord, nb);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
void tail(int k, int nsub) const { tail14<T><<<(nw + 127) / 128, 128, 0, s>>>(n, hand, niter, kflags, flags, stats, k, nsub); }
|
|
226
|
+
void record(int k, const T* l1, const T* a1) const {
|
|
227
|
+
if (!rec) return;
|
|
228
|
+
CKE(cudaMemcpyAsync(rtau + static_cast<size_t>(k) * n * NV, tau, sizeof(T) * n * NV, cudaMemcpyDeviceToDevice, s));
|
|
229
|
+
CKE(cudaMemcpyAsync(rlce + static_cast<size_t>(k) * n * NM, l1, sizeof(T) * n * NM, cudaMemcpyDeviceToDevice, s));
|
|
230
|
+
CKE(cudaMemcpyAsync(ra + static_cast<size_t>(k) * n * NM, a1, sizeof(T) * n * NM, cudaMemcpyDeviceToDevice, s));
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
template <class T>
|
|
235
|
+
void step_t(const Dev<T>& D, std::vector<torch::Tensor> b, int nsub, int dt_iters, double dt, int parts) {
|
|
236
|
+
TORCH_CHECK(D.ready, "init() first");
|
|
237
|
+
TORCH_CHECK(dt == MD::TIMESTEP, "the muscle stage's dt is the law's timestep");
|
|
238
|
+
torch::Tensor &qpos = b[0], &qvel = b[1], &warm = b[2], &lce = b[3], &act = b[4], &u = b[5];
|
|
239
|
+
torch::Tensor &oq = b[6], &ov = b[7], &ow = b[8], &olce = b[9], &oa = b[10];
|
|
240
|
+
torch::Tensor &sq = b[11], &sv = b[12], &sw = b[13], &slce = b[14], &sa = b[15];
|
|
241
|
+
torch::Tensor &tau = b[16], &hand = b[17], &nefc = b[18], &order = b[19], &nbig = b[20], &niter = b[21], &kflags = b[22];
|
|
242
|
+
torch::Tensor &nls = b[23], &nfact = b[24], &cycles = b[25], &flags = b[26], &stats = b[27];
|
|
243
|
+
torch::Tensor &rtau = b[28], &rlce = b[29], &ra = b[30];
|
|
244
|
+
torch::Tensor &aadv = b[31]; // k_post writes a_adv (= a* in the Euler form) unconditionally (l3.cuh): a scratch [n, 37]
|
|
245
|
+
torch::Tensor &trec = b[32];
|
|
246
|
+
const int64_t n = qpos.size(0);
|
|
247
|
+
const auto st = sizeof(T) == 4 ? torch::kFloat32 : torch::kFloat64;
|
|
248
|
+
for (torch::Tensor* t : {&qpos, &oq, &sq}) chk(*t, st, {n, NQ}, "qpos");
|
|
249
|
+
for (torch::Tensor* t : {&qvel, &warm, &ov, &ow, &sv, &sw, &tau, &aadv}) chk(*t, st, {n, NV}, "nv-sized");
|
|
250
|
+
for (torch::Tensor* t : {&lce, &act, &u, &olce, &oa, &slce, &sa}) chk(*t, st, {n, NM}, "nm-sized");
|
|
251
|
+
chk(hand, st, {n, HL.words}, "hand");
|
|
252
|
+
for (torch::Tensor* t : {&nefc, &order, &niter, &kflags, &nls, &nfact, &flags}) chk(*t, torch::kInt32, {n}, "int [n]");
|
|
253
|
+
chk(stats, torch::kInt32, {n, nsub, kStatW}, "stats");
|
|
254
|
+
const bool rec = rtau.numel() > 0;
|
|
255
|
+
if (rec) { chk(rtau, st, {nsub, n, NV}, "rec_tau"); chk(rlce, st, {nsub, n, NM}, "rec_lce"); chk(ra, st, {nsub, n, NM}, "rec_a"); }
|
|
256
|
+
const bool taped = trec.numel() > 0;
|
|
257
|
+
if (taped) {
|
|
258
|
+
chk(trec, st, {nsub, n, TL14.words}, "tape_rec");
|
|
259
|
+
#if defined(D16_NV_GT64) // B3c: the record's layout with the limit count and the split words
|
|
260
|
+
TORCH_CHECK(l3::kpost_tape_ok(trec.data_ptr<T>(), TL14.words, NV, NC, NRH, NQ, X14Opts::kNpose, X14Opts::kNmus, X14Opts::kLq,
|
|
261
|
+
X14Opts::kNlim, ::d16::split::WORDS),
|
|
262
|
+
"k_post's tape stride is below its record");
|
|
263
|
+
#else
|
|
264
|
+
TORCH_CHECK(l3::kpost_tape_ok(trec.data_ptr<T>(), TL14.words, NV, NC, NRH, NQ, X14Opts::kNpose, X14Opts::kNmus, X14Opts::kLq),
|
|
265
|
+
"k_post's tape stride is below its record");
|
|
266
|
+
#endif
|
|
267
|
+
}
|
|
268
|
+
cudaStream_t s = at::cuda::getCurrentCUDAStream();
|
|
269
|
+
CudaLaunch14<T> L{D, s, static_cast<unsigned>(n), static_cast<int>(n), taped, rec, u.data_ptr<T>(), T(dt), dt_iters, tau.data_ptr<T>(),
|
|
270
|
+
hand.data_ptr<T>(), nefc.data_ptr<int>(), niter.data_ptr<int>(), kflags.data_ptr<int>(),
|
|
271
|
+
reinterpret_cast<uint32_t*>(flags.data_ptr<int>()), stats.data_ptr<int>(), rec ? rtau.data_ptr<T>() : nullptr,
|
|
272
|
+
rec ? rlce.data_ptr<T>() : nullptr, rec ? ra.data_ptr<T>() : nullptr}; // the records' tensors only when recording
|
|
273
|
+
X14Bufs<T> B{};
|
|
274
|
+
B.n = static_cast<int>(n);
|
|
275
|
+
B.q = qpos.data_ptr<T>(); B.v = qvel.data_ptr<T>(); B.w = warm.data_ptr<T>(); B.lce = lce.data_ptr<T>(); B.a = act.data_ptr<T>();
|
|
276
|
+
B.bq[0] = oq.data_ptr<T>(); B.bq[1] = sq.data_ptr<T>(); B.bv[0] = ov.data_ptr<T>(); B.bv[1] = sv.data_ptr<T>();
|
|
277
|
+
B.bw[0] = ow.data_ptr<T>(); B.bw[1] = sw.data_ptr<T>(); B.bl[0] = olce.data_ptr<T>(); B.bl[1] = slce.data_ptr<T>();
|
|
278
|
+
B.ba[0] = oa.data_ptr<T>(); B.ba[1] = sa.data_ptr<T>();
|
|
279
|
+
B.tau = tau.data_ptr<T>(); B.hand = hand.data_ptr<T>(); B.aadv = aadv.data_ptr<T>(); B.tape = taped ? trec.data_ptr<T>() : nullptr;
|
|
280
|
+
B.nefc = nefc.data_ptr<int>(); B.order = order.data_ptr<int>(); B.nbig = nbig.data_ptr<int>(); B.niter = niter.data_ptr<int>();
|
|
281
|
+
B.kflags = kflags.data_ptr<int>(); B.nls = nls.data_ptr<int>(); B.nfact = nfact.data_ptr<int>();
|
|
282
|
+
B.cycles = reinterpret_cast<long long*>(cycles.data_ptr<int64_t>()); B.kd = D.kd; B.hinge_qadr = D.hinge_qadr;
|
|
283
|
+
x14_control_step<T>(L, B, nsub, parts); // the substep sequence, shared with the CPU engine (x14_engine_kernels.cuh)
|
|
284
|
+
CKE(cudaGetLastError());
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// P1 (tools/e0speed/CAPTURE_PLAN.md): the reset's fibre equilibrium on this law, k_mus_equil on the tables init() uploaded
|
|
288
|
+
// (D.mt / D.ms; nothing new is uploaded). b: q [n, NQ] (the law chart), lce, a0 [n, NM], mask [n] uint8 (nonzero: equilibrate
|
|
289
|
+
// this world; the others copy lce through), lce_out [n, NM] (may alias lce). outer rounds of the fibre solve at niter Newton
|
|
290
|
+
// steps each, at A = a0 with l_ce_prev <- l_ce (v_ce -> 0). On the current stream.
|
|
291
|
+
template <class T>
|
|
292
|
+
void equil_t(const Dev<T>& D, std::vector<torch::Tensor> b, int niter, int outer, double dt) {
|
|
293
|
+
TORCH_CHECK(D.ready, "init() first");
|
|
294
|
+
#ifdef D16_X14_MILLARD
|
|
295
|
+
// Millard's reset runs its rounds at a large dt (engine14.EQUIL_DT_MILLARD, the review's decision (a), 11-05): the static residual's Newton
|
|
296
|
+
TORCH_CHECK(dt >= MD::TIMESTEP, "the equilibration's dt is the law's timestep or larger (Millard's static reset)");
|
|
297
|
+
#else
|
|
298
|
+
// The Geyer-root arm (engine14's X14_EQUIL_SCHEDULE, the review 11-06): the same relaxation for the reset only. k_mus_equil passes dt at run
|
|
299
|
+
// time to muscle_fiber_h; the step's own check (step_t) is unchanged, and the default reset's dt (TIMESTEP) passes as before.
|
|
300
|
+
TORCH_CHECK(dt >= MD::TIMESTEP, "the equilibration's dt is the law's timestep or larger (a static reset)");
|
|
301
|
+
#endif
|
|
302
|
+
TORCH_CHECK(b.size() == 5, "equil_lce: [q, lce, a0, mask, lce_out]");
|
|
303
|
+
TORCH_CHECK(niter >= 1 && outer >= 1, "equil_lce: niter and outer >= 1");
|
|
304
|
+
torch::Tensor &q = b[0], &lce = b[1], &a0 = b[2], &mask = b[3], &out = b[4];
|
|
305
|
+
const int64_t n = q.size(0);
|
|
306
|
+
const auto st = sizeof(T) == 4 ? torch::kFloat32 : torch::kFloat64;
|
|
307
|
+
chk(q, st, {n, NQ}, "q (law chart)");
|
|
308
|
+
for (torch::Tensor* t : {&lce, &a0, &out}) chk(*t, st, {n, NM}, "nm-sized");
|
|
309
|
+
chk(mask, torch::kUInt8, {n}, "mask");
|
|
310
|
+
{ // out is lce itself (in place) or disjoint from it: a partial overlap would race across worlds (the review)
|
|
311
|
+
const char *l0 = static_cast<const char*>(lce.data_ptr()), *o0 = static_cast<const char*>(out.data_ptr());
|
|
312
|
+
const size_t nb = static_cast<size_t>(lce.numel()) * lce.element_size();
|
|
313
|
+
TORCH_CHECK(o0 == l0 || o0 + nb <= l0 || l0 + nb <= o0, "equil_lce: lce_out must be lce itself or not overlap it");
|
|
314
|
+
}
|
|
315
|
+
if (n == 0) return;
|
|
316
|
+
sg::k_mus_equil<T, D16_BODY_NS, D16_BODY_NSLOT, NQ, NM><<<static_cast<unsigned>(n), 32, 0, at::cuda::getCurrentCUDAStream()>>>(
|
|
317
|
+
D.mt, D.ms, q.data_ptr<T>(), lce.data_ptr<T>(), a0.data_ptr<T>(), mask.data_ptr<uint8_t>(), T(dt), niter, outer,
|
|
318
|
+
out.data_ptr<T>());
|
|
319
|
+
CKE(cudaGetLastError());
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// the engine's activation alone (feat/d16-taskwalk step 2; k_act14 in x14_engine_kernels.cuh): b = u, a_prev, a_new [n, NM]
|
|
323
|
+
template <class T> void act_t(const Dev<T>& D, std::vector<torch::Tensor> b, double dt) {
|
|
324
|
+
TORCH_CHECK(D.ready, "init() first");
|
|
325
|
+
const int64_t n = b[0].size(0);
|
|
326
|
+
const auto st = sizeof(T) == 4 ? torch::kFloat32 : torch::kFloat64;
|
|
327
|
+
for (torch::Tensor* t : {&b[0], &b[1], &b[2]}) chk(*t, st, {n, NM}, "act [n, NM]");
|
|
328
|
+
const long tot = static_cast<long>(n) * NM;
|
|
329
|
+
if (tot == 0) return;
|
|
330
|
+
k_act14<T><<<static_cast<unsigned>((tot + 127) / 128), 128, 0, at::cuda::getCurrentCUDAStream()>>>(static_cast<int>(n), D.mt, b[0].data_ptr<T>(),
|
|
331
|
+
b[1].data_ptr<T>(), T(dt), b[2].data_ptr<T>());
|
|
332
|
+
CKE(cudaGetLastError());
|
|
333
|
+
}
|
|
334
|
+
void act(std::vector<torch::Tensor> b, double dt) {
|
|
335
|
+
if (b[0].scalar_type() == torch::kFloat32) act_t<float>(d32, b, dt);
|
|
336
|
+
else act_t<double>(d64, b, dt);
|
|
337
|
+
}
|
|
338
|
+
// its VJP: b = u, a_prev, a_bar, u_bar, a_prev_bar [n, NM]
|
|
339
|
+
template <class T> void act_vjp_t(const Dev<T>& D, std::vector<torch::Tensor> b, double dt) {
|
|
340
|
+
TORCH_CHECK(D.ready, "init() first");
|
|
341
|
+
const int64_t n = b[0].size(0);
|
|
342
|
+
const auto st = sizeof(T) == 4 ? torch::kFloat32 : torch::kFloat64;
|
|
343
|
+
for (torch::Tensor* t : {&b[0], &b[1], &b[2], &b[3], &b[4]}) chk(*t, st, {n, NM}, "act_vjp [n, NM]");
|
|
344
|
+
const long tot = static_cast<long>(n) * NM;
|
|
345
|
+
if (tot == 0) return;
|
|
346
|
+
k_act14_vjp<T><<<static_cast<unsigned>((tot + 127) / 128), 128, 0, at::cuda::getCurrentCUDAStream()>>>(
|
|
347
|
+
static_cast<int>(n), D.mt, b[0].data_ptr<T>(), b[1].data_ptr<T>(), T(dt), b[2].data_ptr<T>(), b[3].data_ptr<T>(), b[4].data_ptr<T>());
|
|
348
|
+
CKE(cudaGetLastError());
|
|
349
|
+
}
|
|
350
|
+
void act_vjp(std::vector<torch::Tensor> b, double dt) {
|
|
351
|
+
if (b[0].scalar_type() == torch::kFloat32) act_vjp_t<float>(d32, b, dt);
|
|
352
|
+
else act_vjp_t<double>(d64, b, dt);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
void equil_lce(std::vector<torch::Tensor> b, int64_t niter, int64_t outer, double dt) {
|
|
356
|
+
if (b[0].scalar_type() == torch::kFloat32) equil_t<float>(d32, b, static_cast<int>(niter), static_cast<int>(outer), dt);
|
|
357
|
+
else equil_t<double>(d64, b, static_cast<int>(niter), static_cast<int>(outer), dt);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
void control_step(std::vector<torch::Tensor> b, int64_t nsub, int64_t niter_fibre, double dt, int64_t parts) {
|
|
361
|
+
if (b[0].scalar_type() == torch::kFloat32) step_t<float>(d32, b, static_cast<int>(nsub), static_cast<int>(niter_fibre), dt, static_cast<int>(parts));
|
|
362
|
+
else step_t<double>(d64, b, static_cast<int>(nsub), static_cast<int>(niter_fibre), dt, static_cast<int>(parts));
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// The backward of one control step (the adj14_control_step, rigid until the muscle_adj is wired at the step 4):
|
|
366
|
+
// rec [nsub, n, words] (the step's records), a0 / u [n, NM] (the step's saved inputs: no control record), wq / wv [n, NV]
|
|
367
|
+
// (the cotangents of q_{t+1} in its tangent chart and of v_{t+1}) -> qbar / vbar [n, NV] (of q_t, v_t, same charts), flags [n]
|
|
368
|
+
// (nonzero: a record the adjoint could not reproduce; the caller asserts). The launcher's null checks are host asserts, which
|
|
369
|
+
// -DNDEBUG compiles out: they are enforced here.
|
|
370
|
+
template <class T>
|
|
371
|
+
void adjoint_t(const Dev<T>& D, std::vector<torch::Tensor> b) {
|
|
372
|
+
torch::Tensor &rec = b[0], &a0 = b[1], &u = b[2], &wq = b[3], &wv = b[4], &qbar = b[5], &vbar = b[6], &flags = b[7];
|
|
373
|
+
const int64_t n = wq.size(0);
|
|
374
|
+
const auto st = rec.scalar_type();
|
|
375
|
+
chk(rec, st, {MD::NSUB, n, TL14.words}, "rec");
|
|
376
|
+
for (torch::Tensor* t : {&a0, &u}) chk(*t, st, {n, NM}, "a0 / u");
|
|
377
|
+
for (torch::Tensor* t : {&wq, &wv, &qbar, &vbar}) chk(*t, st, {n, NV}, "wq / wv / qbar / vbar");
|
|
378
|
+
chk(flags, torch::kInt32, {n}, "flags");
|
|
379
|
+
TORCH_CHECK(D.V != nullptr, "adjoint: init() first");
|
|
380
|
+
d16::adj14::adj14_control_step<T>(static_cast<int>(n), at::cuda::getCurrentCUDAStream(), D.V, rec.data_ptr<T>(), a0.data_ptr<T>(),
|
|
381
|
+
u.data_ptr<T>(), wq.data_ptr<T>(), wv.data_ptr<T>(), nullptr, nullptr, qbar.data_ptr<T>(),
|
|
382
|
+
vbar.data_ptr<T>(), nullptr, nullptr, nullptr, flags.data_ptr<int>());
|
|
383
|
+
CKE(cudaGetLastError());
|
|
384
|
+
}
|
|
385
|
+
void adjoint(std::vector<torch::Tensor> b) {
|
|
386
|
+
if (b[0].scalar_type() == torch::kFloat32) adjoint_t<float>(d32, b);
|
|
387
|
+
else adjoint_t<double>(d64, b);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// ---- the training path's boundary charts in one kernel each side (train14.py's q_cot_to_tangent / tangent_cot_to_q, the same
|
|
391
|
+
// formulas; one thread per world, the bodies at a warp-uniform index): q1's raw cotangent -> its tangent chart, the adjoint, then
|
|
392
|
+
// q's tangent cotangent -> raw through the engine's normalization. Coupled hinges have no coordinate (qadr -1).
|
|
393
|
+
template <class T> __device__ __forceinline__ void qmul4(const T* a, const T* b, T* o) { // train14._qmul's expression order
|
|
394
|
+
o[0] = a[0] * b[0] - a[1] * b[1] - a[2] * b[2] - a[3] * b[3];
|
|
395
|
+
o[1] = a[0] * b[1] + a[1] * b[0] + a[2] * b[3] - a[3] * b[2];
|
|
396
|
+
o[2] = a[0] * b[2] - a[1] * b[3] + a[2] * b[0] + a[3] * b[1];
|
|
397
|
+
o[3] = a[0] * b[3] + a[1] * b[2] - a[2] * b[1] + a[3] * b[0];
|
|
398
|
+
}
|
|
399
|
+
template <class T>
|
|
400
|
+
__global__ void k_cot_out(int n, const T* __restrict__ q1, const T* __restrict__ g, T* __restrict__ wq) {
|
|
401
|
+
const int w = blockIdx.x * blockDim.x + threadIdx.x;
|
|
402
|
+
if (w >= n) return;
|
|
403
|
+
const T* qq = q1 + static_cast<size_t>(w) * NQ;
|
|
404
|
+
const T* gg = g + static_cast<size_t>(w) * NQ;
|
|
405
|
+
T* o = wq + static_cast<size_t>(w) * NV;
|
|
406
|
+
for (int b = 1; b < MD::NB; ++b) {
|
|
407
|
+
const int jt = MD::cJtype[b], qa = MD::cQadr[b], da = MD::cDadr[b];
|
|
408
|
+
if (jt == 0 || jt == 1) {
|
|
409
|
+
const int qo = jt == 0 ? qa + 3 : qa, vo = jt == 0 ? da + 3 : da;
|
|
410
|
+
if (jt == 0) for (int k = 0; k < 3; ++k) o[da + k] = gg[qa + k];
|
|
411
|
+
const T c[4] = {qq[qo], -qq[qo + 1], -qq[qo + 2], -qq[qo + 3]}, gq[4] = {gg[qo], gg[qo + 1], gg[qo + 2], gg[qo + 3]};
|
|
412
|
+
T r[4];
|
|
413
|
+
qmul4(c, gq, r);
|
|
414
|
+
for (int k = 0; k < 3; ++k) o[vo + k] = T(0.5) * r[1 + k];
|
|
415
|
+
} else if (qa >= 0) {
|
|
416
|
+
o[da] = gg[qa];
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
template <class T>
|
|
421
|
+
__global__ void k_cot_in(int n, const T* __restrict__ q, const T* __restrict__ gt, T* __restrict__ gq) {
|
|
422
|
+
const int w = blockIdx.x * blockDim.x + threadIdx.x;
|
|
423
|
+
if (w >= n) return;
|
|
424
|
+
const T* qq = q + static_cast<size_t>(w) * NQ;
|
|
425
|
+
const T* tt = gt + static_cast<size_t>(w) * NV;
|
|
426
|
+
T* o = gq + static_cast<size_t>(w) * NQ;
|
|
427
|
+
for (int b = 1; b < MD::NB; ++b) {
|
|
428
|
+
const int jt = MD::cJtype[b], qa = MD::cQadr[b], da = MD::cDadr[b];
|
|
429
|
+
if (jt == 0 || jt == 1) {
|
|
430
|
+
const int qo = jt == 0 ? qa + 3 : qa, vo = jt == 0 ? da + 3 : da;
|
|
431
|
+
if (jt == 0) for (int k = 0; k < 3; ++k) o[qa + k] = tt[da + k];
|
|
432
|
+
const T r = sqrt(qq[qo] * qq[qo] + qq[qo + 1] * qq[qo + 1] + qq[qo + 2] * qq[qo + 2] + qq[qo + 3] * qq[qo + 3]);
|
|
433
|
+
const T qh[4] = {qq[qo] / r, qq[qo + 1] / r, qq[qo + 2] / r, qq[qo + 3] / r}, pure[4] = {T(0), tt[vo], tt[vo + 1], tt[vo + 2]};
|
|
434
|
+
T m[4];
|
|
435
|
+
qmul4(qh, pure, m);
|
|
436
|
+
const T s = T(2) / r;
|
|
437
|
+
for (int k = 0; k < 4; ++k) o[qo + k] = s * m[k];
|
|
438
|
+
} else if (qa >= 0) {
|
|
439
|
+
o[qa] = tt[da];
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
// The backward of one control step in raw coordinates (Step14's call): rec [nsub, n, words], a0 / u [n, NM], q / q1 [n, NQ] (the
|
|
444
|
+
// step's input and output), gq1 [n, NQ] / gv1 [n, NV] (the loss's cotangents of q1, v1) -> gq [n, NQ], vbar [n, NV], flags [n]
|
|
445
|
+
template <class T>
|
|
446
|
+
void adjoint_raw_t(const Dev<T>& D, std::vector<torch::Tensor> b) {
|
|
447
|
+
torch::Tensor &rec = b[0], &a0 = b[1], &u = b[2], &q = b[3], &q1 = b[4], &gq1 = b[5], &gv1 = b[6], &gq = b[7], &vbar = b[8], &flags = b[9];
|
|
448
|
+
const int64_t n = q.size(0);
|
|
449
|
+
const auto st = rec.scalar_type();
|
|
450
|
+
chk(rec, st, {MD::NSUB, n, TL14.words}, "rec");
|
|
451
|
+
for (torch::Tensor* t : {&a0, &u}) chk(*t, st, {n, NM}, "a0 / u");
|
|
452
|
+
for (torch::Tensor* t : {&q, &q1, &gq1, &gq}) chk(*t, st, {n, NQ}, "q / q1 / gq1 / gq");
|
|
453
|
+
for (torch::Tensor* t : {&gv1, &vbar}) chk(*t, st, {n, NV}, "gv1 / vbar");
|
|
454
|
+
chk(flags, torch::kInt32, {n}, "flags");
|
|
455
|
+
TORCH_CHECK(D.V != nullptr, "adjoint_raw: init() first");
|
|
456
|
+
cudaStream_t s = at::cuda::getCurrentCUDAStream();
|
|
457
|
+
torch::Tensor wq = torch::empty({n, NV}, gv1.options()), qbar = torch::empty({n, NV}, gv1.options());
|
|
458
|
+
const unsigned nb = static_cast<unsigned>((n + 127) / 128);
|
|
459
|
+
k_cot_out<T><<<nb, 128, 0, s>>>(static_cast<int>(n), q1.data_ptr<T>(), gq1.data_ptr<T>(), wq.data_ptr<T>());
|
|
460
|
+
d16::adj14::adj14_control_step<T>(static_cast<int>(n), s, D.V, rec.data_ptr<T>(), a0.data_ptr<T>(), u.data_ptr<T>(), wq.data_ptr<T>(),
|
|
461
|
+
gv1.data_ptr<T>(), nullptr, nullptr, qbar.data_ptr<T>(), vbar.data_ptr<T>(), nullptr, nullptr, nullptr,
|
|
462
|
+
flags.data_ptr<int>());
|
|
463
|
+
k_cot_in<T><<<nb, 128, 0, s>>>(static_cast<int>(n), q.data_ptr<T>(), qbar.data_ptr<T>(), gq.data_ptr<T>());
|
|
464
|
+
CKE(cudaGetLastError());
|
|
465
|
+
}
|
|
466
|
+
void adjoint_raw(std::vector<torch::Tensor> b) {
|
|
467
|
+
if (b[0].scalar_type() == torch::kFloat32) adjoint_raw_t<float>(d32, b);
|
|
468
|
+
else adjoint_raw_t<double>(d64, b);
|
|
469
|
+
}
|
|
470
|
+
// The composed backward (the step 4, adj14_control_step_mus) in raw coordinates: rec [nsub, n, words], a0 / u / lce_out [n, NM]
|
|
471
|
+
// (the step's a, u and output lce), q / q1 [n, NQ], the loss's cotangents gq1 [n, NQ], gv1 [n, NV], glce1 / ga1 [n, NM] (zeros
|
|
472
|
+
// when the loss has none) -> gq [n, NQ], vbar [n, NV], lcebar / actbar / ubar [n, NM], flags [nsub, n]; scratch
|
|
473
|
+
// [adj14_mus_scratch_elems(n)] from the caller (the launcher's size assert is a host assert: enforced here)
|
|
474
|
+
template <class T>
|
|
475
|
+
void adjoint_mus_raw_t(const Dev<T>& D, std::vector<torch::Tensor> b) {
|
|
476
|
+
torch::Tensor &rec = b[0], &a0 = b[1], &u = b[2], &lce1 = b[3], &q = b[4], &q1 = b[5], &gq1 = b[6], &gv1 = b[7], &gl1 = b[8], &ga1 = b[9];
|
|
477
|
+
torch::Tensor &gq = b[10], &vbar = b[11], &lbar = b[12], &abar = b[13], &ubar = b[14], &flags = b[15], &scr = b[16];
|
|
478
|
+
const int64_t n = q.size(0);
|
|
479
|
+
const auto st = rec.scalar_type();
|
|
480
|
+
chk(rec, st, {MD::NSUB, n, TL14.words}, "rec");
|
|
481
|
+
for (torch::Tensor* t : {&a0, &u, &lce1, &gl1, &ga1, &lbar, &abar, &ubar}) chk(*t, st, {n, NM}, "muscle-sized");
|
|
482
|
+
for (torch::Tensor* t : {&q, &q1, &gq1, &gq}) chk(*t, st, {n, NQ}, "q-sized");
|
|
483
|
+
for (torch::Tensor* t : {&gv1, &vbar}) chk(*t, st, {n, NV}, "v-sized");
|
|
484
|
+
chk(flags, torch::kInt32, {MD::NSUB, n}, "flags");
|
|
485
|
+
chk(scr, st, {static_cast<int64_t>(d16::adj14::adj14_mus_scratch_elems(static_cast<int>(n)))}, "scratch");
|
|
486
|
+
TORCH_CHECK(D.V != nullptr && D.ready, "adjoint_mus_raw: init() first");
|
|
487
|
+
cudaStream_t s = at::cuda::getCurrentCUDAStream();
|
|
488
|
+
torch::Tensor wq = torch::empty({n, NV}, gv1.options()), qbar = torch::empty({n, NV}, gv1.options());
|
|
489
|
+
const unsigned nb = static_cast<unsigned>((n + 127) / 128);
|
|
490
|
+
k_cot_out<T><<<nb, 128, 0, s>>>(static_cast<int>(n), q1.data_ptr<T>(), gq1.data_ptr<T>(), wq.data_ptr<T>());
|
|
491
|
+
const auto sc = d16::adj14::adj14_mus_scratch<T>(scr.data_ptr<T>(), static_cast<int>(n));
|
|
492
|
+
#if defined(D16_BODY_MUS_SPLIT)
|
|
493
|
+
d16::adj14::adj14_control_step_mus<T>(static_cast<int>(n), s, D.V, D.mt, D.ms, D.mb, D.mc, rec.data_ptr<T>(), a0.data_ptr<T>(), u.data_ptr<T>(),
|
|
494
|
+
lce1.data_ptr<T>(), wq.data_ptr<T>(), gv1.data_ptr<T>(), gl1.data_ptr<T>(), ga1.data_ptr<T>(),
|
|
495
|
+
qbar.data_ptr<T>(), vbar.data_ptr<T>(), lbar.data_ptr<T>(), abar.data_ptr<T>(), ubar.data_ptr<T>(),
|
|
496
|
+
flags.data_ptr<int>(), sc);
|
|
497
|
+
#else
|
|
498
|
+
d16::adj14::adj14_control_step_mus<T>(static_cast<int>(n), s, D.V, D.mt, D.ms, D.mb, rec.data_ptr<T>(), a0.data_ptr<T>(), u.data_ptr<T>(),
|
|
499
|
+
lce1.data_ptr<T>(), wq.data_ptr<T>(), gv1.data_ptr<T>(), gl1.data_ptr<T>(), ga1.data_ptr<T>(),
|
|
500
|
+
qbar.data_ptr<T>(), vbar.data_ptr<T>(), lbar.data_ptr<T>(), abar.data_ptr<T>(), ubar.data_ptr<T>(),
|
|
501
|
+
flags.data_ptr<int>(), sc);
|
|
502
|
+
#endif
|
|
503
|
+
k_cot_in<T><<<nb, 128, 0, s>>>(static_cast<int>(n), q.data_ptr<T>(), qbar.data_ptr<T>(), gq.data_ptr<T>());
|
|
504
|
+
CKE(cudaGetLastError());
|
|
505
|
+
}
|
|
506
|
+
void adjoint_mus_raw(std::vector<torch::Tensor> b) {
|
|
507
|
+
if (b[0].scalar_type() == torch::kFloat32) adjoint_mus_raw_t<float>(d32, b);
|
|
508
|
+
else adjoint_mus_raw_t<double>(d64, b);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// the two chart kernels alone (the gate's check against train14.py's torch formulas)
|
|
512
|
+
void charts(torch::Tensor q1, torch::Tensor g, torch::Tensor wq, torch::Tensor q, torch::Tensor gt, torch::Tensor gq) {
|
|
513
|
+
const int n = static_cast<int>(q1.size(0));
|
|
514
|
+
cudaStream_t s = at::cuda::getCurrentCUDAStream();
|
|
515
|
+
const unsigned nb = static_cast<unsigned>((n + 127) / 128);
|
|
516
|
+
if (q1.scalar_type() == torch::kFloat32) {
|
|
517
|
+
k_cot_out<float><<<nb, 128, 0, s>>>(n, q1.data_ptr<float>(), g.data_ptr<float>(), wq.data_ptr<float>());
|
|
518
|
+
k_cot_in<float><<<nb, 128, 0, s>>>(n, q.data_ptr<float>(), gt.data_ptr<float>(), gq.data_ptr<float>());
|
|
519
|
+
} else {
|
|
520
|
+
k_cot_out<double><<<nb, 128, 0, s>>>(n, q1.data_ptr<double>(), g.data_ptr<double>(), wq.data_ptr<double>());
|
|
521
|
+
k_cot_in<double><<<nb, 128, 0, s>>>(n, q.data_ptr<double>(), gt.data_ptr<double>(), gq.data_ptr<double>());
|
|
522
|
+
}
|
|
523
|
+
CKE(cudaGetLastError());
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
pybind11::dict attrs() {
|
|
527
|
+
pybind11::dict d;
|
|
528
|
+
auto one = [&](const char* name, const void* fn) {
|
|
529
|
+
cudaFuncAttributes a; CKE(cudaFuncGetAttributes(&a, fn));
|
|
530
|
+
int occ = 0; CKE(cudaOccupancyMaxActiveBlocksPerMultiprocessor(&occ, fn, 32, 0));
|
|
531
|
+
d[name] = pybind11::make_tuple(a.numRegs, a.localSizeBytes, a.sharedSizeBytes, occ);
|
|
532
|
+
};
|
|
533
|
+
#if defined(D16_BODY_MUS_SPLIT) // the class kernels the step runs (the full instantiation is the reset's k_mus_equil only)
|
|
534
|
+
one("k_mus_c0_f32", reinterpret_cast<const void*>(sg::k_mus<float, D16_BODY_MC0_NS, D16_BODY_MC0_KD, D16_BODY_MC0_NSLOT, NQ, NV, NM, D16_BODY_MC0_NM, false>));
|
|
535
|
+
one("k_mus_c1_f32", reinterpret_cast<const void*>(sg::k_mus<float, D16_BODY_MC1_NS, D16_BODY_MC1_KD, D16_BODY_MC1_NSLOT, NQ, NV, NM, D16_BODY_MC1_NM, sg::kMusWideAccIn>));
|
|
536
|
+
one("k_mus_taped_c0_f32", reinterpret_cast<const void*>(sg::k_mus_taped<float, D16_BODY_MC0_NS, D16_BODY_MC0_KD, D16_BODY_MC0_NSLOT, NQ, NV, NM,
|
|
537
|
+
sg::MusTapeSub<float>, D16_BODY_MC0_NM, false>));
|
|
538
|
+
one("k_mus_taped_c1_f32", reinterpret_cast<const void*>(sg::k_mus_taped<float, D16_BODY_MC1_NS, D16_BODY_MC1_KD, D16_BODY_MC1_NSLOT, NQ, NV, NM,
|
|
539
|
+
sg::MusTapeSub<float>, D16_BODY_MC1_NM, sg::kMusWideAccIn>));
|
|
540
|
+
one("muscle_adj_taped_c0_f32", reinterpret_cast<const void*>(sg::muscle_adj_taped<float, D16_BODY_MC0_NS, D16_BODY_MC0_KD, D16_BODY_MC0_NSLOT, NQ, NV, NM,
|
|
541
|
+
D16_BODY_MC0_NM, false>));
|
|
542
|
+
#if defined(D16_BODY_MUS_W2) // the narrow class the step runs: two warps per world (PREREG_MW2.md), at 64 threads per block
|
|
543
|
+
auto one64 = [&](const char* name, const void* fn) {
|
|
544
|
+
cudaFuncAttributes a; CKE(cudaFuncGetAttributes(&a, fn));
|
|
545
|
+
int occ = 0; CKE(cudaOccupancyMaxActiveBlocksPerMultiprocessor(&occ, fn, 64, 0));
|
|
546
|
+
d[name] = pybind11::make_tuple(a.numRegs, a.localSizeBytes, a.sharedSizeBytes, occ);
|
|
547
|
+
};
|
|
548
|
+
one64("k_mus_c0w2_f32", reinterpret_cast<const void*>(sg::k_mus_w2<float, D16_BODY_MC0_NS, D16_BODY_MC0_KD, D16_BODY_MC0_NSLOT, NQ, NV, NM, D16_BODY_MC0_NM>));
|
|
549
|
+
one64("k_mus_taped_c0w2_f32", reinterpret_cast<const void*>(sg::k_mus_taped_w2<float, D16_BODY_MC0_NS, D16_BODY_MC0_KD, D16_BODY_MC0_NSLOT, NQ, NV, NM,
|
|
550
|
+
sg::MusTapeSub<float>, D16_BODY_MC0_NM>));
|
|
551
|
+
one64("muscle_adj_taped_c0w2_f32", reinterpret_cast<const void*>(sg::muscle_adj_taped_w2<float, D16_BODY_MC0_NS, D16_BODY_MC0_KD, D16_BODY_MC0_NSLOT, NQ, NV,
|
|
552
|
+
NM, D16_BODY_MC0_NM>));
|
|
553
|
+
#endif
|
|
554
|
+
one("muscle_adj_taped_c1_f32", reinterpret_cast<const void*>(sg::muscle_adj_taped<float, D16_BODY_MC1_NS, D16_BODY_MC1_KD, D16_BODY_MC1_NSLOT, NQ, NV, NM,
|
|
555
|
+
D16_BODY_MC1_NM, sg::kMusWideAccIn>));
|
|
556
|
+
#else
|
|
557
|
+
one("k_mus_f32", reinterpret_cast<const void*>(KMUS14(float)));
|
|
558
|
+
#endif
|
|
559
|
+
one("kpre14_f32", reinterpret_cast<const void*>(kpre14<float>));
|
|
560
|
+
one("kpost14_f32", reinterpret_cast<const void*>(kpost14_f32));
|
|
561
|
+
one("kpost14_big_f32", reinterpret_cast<const void*>(kpost14_big_f32));
|
|
562
|
+
return d;
|
|
563
|
+
}
|
|
564
|
+
} // namespace
|
|
565
|
+
|
|
566
|
+
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
|
|
567
|
+
m.def("init", &init, "upload the 14x model: the law's values (generated) and F's muscle tables (f32 and f64 lists, dims)");
|
|
568
|
+
m.def("control_step", &control_step, "one composed 14x control step on device tensors (see engine14.py)");
|
|
569
|
+
m.def("equil_lce", &equil_lce, "P1: the reset's fibre equilibrium on the 14x law (k_mus_equil) for the masked worlds (see engine14.py)");
|
|
570
|
+
m.def("act", &act, "the engine's activation alone (k_mus's first stage, k_act14): u, a_prev, a_new [n, NM]; dt");
|
|
571
|
+
m.def("act_vjp", &act_vjp, "its VJP (muscle_activation_vjp, k_act14_vjp): u, a_prev, a_bar, u_bar, a_prev_bar [n, NM]; dt");
|
|
572
|
+
m.def("adjoint", &adjoint, "one control step's backward (C's adj14_control_step; rigid until C's step 4)");
|
|
573
|
+
m.def("adjoint_raw", &adjoint_raw, "the backward in raw coordinates: the boundary charts fused around the adjoint (Step14's call)");
|
|
574
|
+
m.def("charts", &charts, "the two boundary chart kernels alone (the gate's check)");
|
|
575
|
+
m.def("adjoint_mus_raw", &adjoint_mus_raw, "the composed backward with the muscles (C's step 4) in raw coordinates (Step14's call)");
|
|
576
|
+
m.def("mus_scratch_elems", [](int64_t n) { return static_cast<int64_t>(d16::adj14::adj14_mus_scratch_elems(static_cast<int>(n))); },
|
|
577
|
+
"the composed backward's scratch elements for n worlds");
|
|
578
|
+
m.def("hand_words", []() { return HL.words; }, "the hand record's words");
|
|
579
|
+
m.def("sizes", []() { return std::vector<int64_t>{NQ, NV, NM, MD::NB, MD::NPR, MD::NSUB, D16_BODY_NS, D16_BODY_MKD, D16_BODY_NSLOT}; },
|
|
580
|
+
"the body this extension was built for: nq, nv, nm, nb, npr, nsub, ns, mkd, nslot (engine14.SIZE_FIELDS)");
|
|
581
|
+
#ifdef D16_X14_MILLARD
|
|
582
|
+
m.def("law", []() { return 1; }, "the muscle law this extension was built for: 0 Geyer 2010, 1 Millard 2013 (D16_X14_MILLARD)");
|
|
583
|
+
#else
|
|
584
|
+
m.def("law", []() { return 0; }, "the muscle law this extension was built for: 0 Geyer 2010, 1 Millard 2013 (D16_X14_MILLARD)");
|
|
585
|
+
#endif
|
|
586
|
+
m.def("attrs", &attrs, "(regs, local bytes, static shared bytes, blocks / SM) of the f32 kernels");
|
|
587
|
+
#if defined(D16_X14_ADJ5) // (11-08; up/PREREG_X14ADJ5.md) present only in a build with the 14x's k_adj14 at 5 per SM: bench_final and paper_package assert its absence
|
|
588
|
+
m.def("x14_adj5", []() { return 1; }, "this extension was built with D16_X14_ADJ5 (deck-only numbers)");
|
|
589
|
+
#endif
|
|
590
|
+
#if defined(D16_X14_ROWCF) // (11-08; rowcf/PREREG_X14ROWCF.md) present only in a build with the 14x's row closed form: bench_final and paper_package assert its absence
|
|
591
|
+
m.def("x14_rowcf", []() { return 1; }, "this extension was built with D16_X14_ROWCF (deck-only numbers)");
|
|
592
|
+
#endif
|
|
593
|
+
#if defined(D16_B416_KPOST9) // (11-09; kpost9/PREREG_KPOST9.md) present only in a build with the 416's kpost14 at 9 per SM: bench_final and paper_package assert its absence
|
|
594
|
+
m.def("b416_kpost9", []() { return 1; }, "this extension was built with D16_B416_KPOST9 (deck-only numbers)");
|
|
595
|
+
#endif
|
|
596
|
+
}
|