Repository: Genesis-Embodied-AI/Genesis
File: genesis/engine/solvers/rigid/rigid_solver_decomp.py (Python)

Code before:
    # @@@@@@@@@ Composer starts here
    # decomposed kernels should happen in the block below. This block will be handled by composer and composed into a single kernel
    @ti.func
    def _func_forward_dynamics(self):
        self._func_compute_mass_matrix(
            implicit_damping=ti.static(self._integrator == gs.integrator.approximate_implicitfast)
        )
        self._func_factor_mass(implicit_damping=False)
        self._func_torque_and_passive_force()
        self._func_update_acc(update_cacc=False)
        self._func_update_force()
        # self._func_actuation()
        self._func_bias_force()
        self._func_compute_qacc()

    @ti.kernel
    def clear_external_forces(self):
        self._func_clear_external_force()

    def substep(self):
        from genesis.utils.tools import create_timer

        timer = create_timer("rigid", level=1, ti_sync=True, skip_first_call=True)
        self._kernel_step_1()
        timer.stamp("kernel_step_1")
 
        # constraint force
        self._func_constraint_force()
        timer.stamp("constraint_force")
        
        # Position, Velocity and Acceleration data must be consistent when computing links acceleration, otherwise it
        # would not corresponds to anyting physical. There is no other way than doing this right before integration,
        # because the acceleration at the end of the step is unknown for now as it may change discontinuous between
        # before and after integration under the effect of external forces and constraints. This means that
        # acceleration data will be shifted one timestep in the past, but there isn't really any way around.
        self._kernel_update_acc()

        self._kernel_step_2()
        timer.stamp("kernel_step_2")

    @ti.kernel
    def _kernel_step_1(self):
        ti.loop_config(serialize=self._para_level < gs.PARA_LEVEL.ALL)
        for i_b in range(self._B):
            self._func_forward_kinematics(i_b)
            self._func_COM_links(i_b)
            self._func_forward_velocity(i_b)
            self._func_update_geoms(i_b)

        self._func_forward_dynamics()


Review comment (suggestion):
Those changes are not relevant. 

Can you run
```
black --line-length 120 .
```

You can also install a git pre-commit hook to help you do it automatically before every commit.
```
pre-commit install 
```

Code after:

    @ti.kernel
    def _kernel_update_acc(self):
        self._func_update_acc(update_cacc=True)

    # @@@@@@@@@ Composer starts here
    # decomposed kernels should happen in the block below. This block will be handled by composer and composed into a single kernel
    @ti.func
    def _func_forward_dynamics(self):
        self._func_compute_mass_matrix(
            implicit_damping=ti.static(self._integrator == gs.integrator.approximate_implicitfast)
        )
        self._func_factor_mass(implicit_damping=False)
        self._func_torque_and_passive_force()
        self._func_update_acc(update_cacc=False)
        self._func_update_force()
        # self._func_actuation()
        self._func_bias_force()
        self._func_compute_qacc()

    @ti.kernel
    def _kernel_clear_external_force(self):
        self._func_clear_external_force()

    def substep(self):
        from genesis.utils.tools import create_timer

        timer = create_timer("rigid", level=1, ti_sync=True, skip_first_call=True)
        self._kernel_step_1()
        timer.stamp("kernel_step_1")

        # constraint force
        self._func_constraint_force()
        timer.stamp("constraint_force")

        self._kernel_step_2()
        timer.stamp("kernel_step_2")

    @ti.kernel
    def _kernel_step_1(self):
        ti.loop_config(serialize=self._para_level < gs.PARA_LEVEL.ALL)
        for i_b in range(self._B):
            self._func_forward_kinematics(i_b)
            self._func_COM_links(i_b)
            self._func_forward_velocity(i_b)
            self._func_update_geoms(i_b)

        self._func_forward_dynamics()

    @ti.func
    def _func_implicit_damping(self):