Rebase on master branch

This commit is contained in:
Sébastien Crozet
2022-03-06 11:32:25 +01:00
committed by Sébastien Crozet
parent 815de4beff
commit 891c08177d
13 changed files with 199 additions and 181 deletions

View File

@@ -1,6 +1,5 @@
{ {
"rust-analyzer.cargo.features": [ "rust-analyzer.cargo.features": [
"simd-stable", "simd-stable"
"parallel"
] ]
} }

324
.vscode/tasks.json vendored
View File

@@ -9,7 +9,7 @@
}, },
"tasks": [ "tasks": [
{ {
"label": "run 3d (no-simd - release) ", "label": "🚀 run 3d",
"type": "shell", "type": "shell",
"command": "cargo", "command": "cargo",
"args": [ "args": [
@@ -25,7 +25,7 @@
"group": "build" "group": "build"
}, },
{ {
"label": "run 3d (simd - release) ", "label": "🚀 run 3d 🌈 simd",
"type": "shell", "type": "shell",
"command": "cargo", "command": "cargo",
"args": [ "args": [
@@ -41,7 +41,7 @@
"group": "build" "group": "build"
}, },
{ {
"label": "run 3d (simd - parallel - release) ", "label": "🚀 run 3d 🌈 simd 🪢 parallel",
"type": "shell", "type": "shell",
"command": "cargo", "command": "cargo",
"args": [ "args": [
@@ -57,7 +57,179 @@
"group": "build" "group": "build"
}, },
{ {
"label": "run 3d (simd - parallel - debug) ", "label": "🚀 run 2d",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_examples2",
"--release",
"--features",
"other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "🚀 run 2d 🌈 simd",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_examples2",
"--release",
"--features",
"simd-stable,other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "🚀 run 2d 🌈 simd 🪢 parallel",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_examples2",
"--release",
"--features",
"simd-stable,other-backends,parallel",
"--",
"--pause"
],
"group": "build"
},
{
"label": "⏱ bench 3d",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks3",
"--release",
"--features",
"other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "⏱ bench 3d 🌈 simd",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks3",
"--release",
"--features",
"simd-stable,other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "⏱ bench 3d 🌈 simd 🪢 parallel",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks3",
"--release",
"--features",
"simd-stable,other-backends,parallel",
"--",
"--pause"
],
"group": "build"
},
{
"label": "⏱ bench 2d",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks2",
"--release",
"--features",
"other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "⏱ bench 2d 🌈 simd",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks2",
"--release",
"--features",
"simd-stable,other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "⏱ bench 2d 🌈 simd 🪢 parallel",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks2",
"--release",
"--features",
"simd-stable,other-backends,parallel",
"--",
"--pause"
],
"group": "build"
},
{
"label": "🪲 debug 3d",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_examples3",
"--",
"--pause"
],
"group": "build"
},
{
"label": "🪲 debug 3d 🌈 simd",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_examples3",
"--features",
"simd-stable",
"--",
"--pause"
],
"group": "build"
},
{
"label": "🪲 debug 3d 🌈 simd 🪢 parallel",
"type": "shell", "type": "shell",
"command": "cargo", "command": "cargo",
"args": [ "args": [
@@ -70,150 +242,6 @@
"--pause" "--pause"
], ],
"group": "build" "group": "build"
},
{
"label": "run 2d (no-simd - release) ",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_examples2",
"--release",
"--features",
"other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "run 2d (simd - release) ",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_examples2",
"--release",
"--features",
"simd-stable,other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "run 2d (simd - parallel - release) ",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_examples2",
"--release",
"--features",
"simd-stable,other-backends,parallel",
"--",
"--pause"
],
"group": "build"
},
{
"label": "bench 3d (no-simd - release) ",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks3",
"--release",
"--features",
"other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "bench 3d (simd - release) ",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks3",
"--release",
"--features",
"simd-stable,other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "bench 3d (simd - parallel - release) ",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks3",
"--release",
"--features",
"simd-stable,other-backends,parallel",
"--",
"--pause"
],
"group": "build"
},
{
"label": "bench 2d (no-simd - release) ",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks2",
"--release",
"--features",
"other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "bench 2d (simd - release) ",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks2",
"--release",
"--features",
"simd-stable,other-backends",
"--",
"--pause"
],
"group": "build"
},
{
"label": "bench 2d (simd - parallel - release) ",
"type": "shell",
"command": "cargo",
"args": [
"run",
"--bin",
"all_benchmarks2",
"--release",
"--features",
"simd-stable,other-backends,parallel",
"--",
"--pause"
],
"group": "build"
} }
] ]
] ]

View File

@@ -24,7 +24,6 @@ resolver = "2"
[profile.release] [profile.release]
#debug = true #debug = true
#codegen-units = 1 #codegen-units = 1
#opt-level = 1
#lto = true #lto = true
[profile.dev] [profile.dev]

View File

@@ -58,6 +58,7 @@ pub fn init_world(testbed: &mut Testbed) {
&mut physics.colliders, &mut physics.colliders,
&mut physics.impulse_joints, &mut physics.impulse_joints,
&mut physics.multibody_joints, &mut physics.multibody_joints,
true,
); );
if let Some(graphics) = &mut graphics { if let Some(graphics) = &mut graphics {

View File

@@ -1,9 +1,7 @@
use na::SimdRealField;
use crate::dynamics::solver::MotorParameters; use crate::dynamics::solver::MotorParameters;
use crate::dynamics::{FixedJoint, MotorModel, PrismaticJoint, RevoluteJoint}; use crate::dynamics::{FixedJoint, MotorModel, PrismaticJoint, RevoluteJoint};
use crate::math::{Isometry, Point, Real, Rotation, UnitVector, Vector, SPATIAL_DIM}; use crate::math::{Isometry, Point, Real, Rotation, UnitVector, Vector, SPATIAL_DIM};
use crate::utils::WBasis; use crate::utils::{WBasis, WReal};
#[cfg(feature = "dim3")] #[cfg(feature = "dim3")]
use crate::dynamics::SphericalJoint; use crate::dynamics::SphericalJoint;
@@ -77,7 +75,7 @@ pub struct JointLimits<N> {
pub impulse: N, pub impulse: N,
} }
impl<N: SimdRealField<Element = Real>> Default for JointLimits<N> { impl<N: WReal> Default for JointLimits<N> {
fn default() -> Self { fn default() -> Self {
Self { Self {
min: -N::splat(Real::MAX), min: -N::splat(Real::MAX),

View File

@@ -12,7 +12,7 @@ use crate::dynamics::{
}; };
#[cfg(feature = "simd-is-enabled")] #[cfg(feature = "simd-is-enabled")]
use crate::math::{Isometry, SimdReal, SIMD_WIDTH}; use crate::math::{Isometry, SimdReal, SIMD_WIDTH};
use crate::math::{Real, DIM, SPATIAL_DIM}; use crate::math::{Real, SPATIAL_DIM};
use crate::prelude::MultibodyJointSet; use crate::prelude::MultibodyJointSet;
use na::DVector; use na::DVector;

View File

@@ -58,7 +58,7 @@ impl SolverBody<Real, 1> {
impl JointVelocityConstraintBuilder<Real> { impl JointVelocityConstraintBuilder<Real> {
pub fn lock_jacobians_generic( pub fn lock_jacobians_generic(
&self, &self,
params: &IntegrationParameters, _params: &IntegrationParameters,
jacobians: &mut DVector<Real>, jacobians: &mut DVector<Real>,
j_id: &mut usize, j_id: &mut usize,
joint_id: JointIndex, joint_id: JointIndex,
@@ -500,7 +500,7 @@ impl JointVelocityConstraintBuilder<Real> {
impl JointVelocityConstraintBuilder<Real> { impl JointVelocityConstraintBuilder<Real> {
pub fn lock_jacobians_generic_ground( pub fn lock_jacobians_generic_ground(
&self, &self,
params: &IntegrationParameters, _params: &IntegrationParameters,
jacobians: &mut DVector<Real>, jacobians: &mut DVector<Real>,
j_id: &mut usize, j_id: &mut usize,
joint_id: JointIndex, joint_id: JointIndex,

View File

@@ -3,7 +3,7 @@ use crate::dynamics::solver::joint_constraint::joint_velocity_constraint::{
}; };
use crate::dynamics::solver::joint_constraint::SolverBody; use crate::dynamics::solver::joint_constraint::SolverBody;
use crate::dynamics::solver::MotorParameters; use crate::dynamics::solver::MotorParameters;
use crate::dynamics::{IntegrationParameters, JointAxesMask, JointIndex, JointLimits, JointMotor}; use crate::dynamics::{IntegrationParameters, JointIndex, JointLimits};
use crate::math::{AngVector, Isometry, Matrix, Point, Real, Rotation, Vector, ANG_DIM, DIM}; use crate::math::{AngVector, Isometry, Matrix, Point, Real, Rotation, Vector, ANG_DIM, DIM};
use crate::utils::{IndexMut2, WCrossMatrix, WDot, WQuat, WReal}; use crate::utils::{IndexMut2, WCrossMatrix, WDot, WQuat, WReal};
use na::SMatrix; use na::SMatrix;
@@ -660,15 +660,14 @@ impl<N: WReal> JointVelocityConstraintBuilder<N> {
pub fn motor_linear_coupled_ground<const LANES: usize>( pub fn motor_linear_coupled_ground<const LANES: usize>(
&self, &self,
params: &IntegrationParameters, _joint_id: [JointIndex; LANES],
joint_id: [JointIndex; LANES], _body1: &SolverBody<N, LANES>,
body1: &SolverBody<N, LANES>, _body2: &SolverBody<N, LANES>,
body2: &SolverBody<N, LANES>, _motor_coupled_axes: u8,
motor_coupled_axes: u8, _motors: &[MotorParameters<N>],
motors: &[MotorParameters<N>], _limited_coupled_axes: u8,
limited_coupled_axes: u8, _limits: &[JointLimits<N>],
limits: &[JointLimits<N>], _writeback_id: WritebackId,
writeback_id: WritebackId,
) -> JointVelocityGroundConstraint<N, LANES> { ) -> JointVelocityGroundConstraint<N, LANES> {
todo!() todo!()
/* /*

View File

@@ -3,7 +3,6 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use rayon::Scope; use rayon::Scope;
use crate::data::{BundleSet, ComponentSet, ComponentSetMut}; use crate::data::{BundleSet, ComponentSet, ComponentSetMut};
use crate::dynamics::solver::generic_velocity_constraint::GenericVelocityConstraint;
use crate::dynamics::solver::{ use crate::dynamics::solver::{
AnyJointVelocityConstraint, AnyVelocityConstraint, ParallelSolverConstraints, AnyJointVelocityConstraint, AnyVelocityConstraint, ParallelSolverConstraints,
}; };
@@ -13,7 +12,6 @@ use crate::dynamics::{
RigidBodyType, RigidBodyVelocity, RigidBodyType, RigidBodyVelocity,
}; };
use crate::geometry::{ContactManifold, ContactManifoldIndex}; use crate::geometry::{ContactManifold, ContactManifoldIndex};
use crate::math::{Isometry, Real};
use na::DVector; use na::DVector;
use super::{DeltaVel, ParallelInteractionGroups, ParallelVelocitySolver}; use super::{DeltaVel, ParallelInteractionGroups, ParallelVelocitySolver};
@@ -139,7 +137,6 @@ impl ThreadContext {
pub struct ParallelIslandSolver { pub struct ParallelIslandSolver {
velocity_solver: ParallelVelocitySolver, velocity_solver: ParallelVelocitySolver,
positions: Vec<Isometry<Real>>,
parallel_groups: ParallelInteractionGroups, parallel_groups: ParallelInteractionGroups,
parallel_joint_groups: ParallelInteractionGroups, parallel_joint_groups: ParallelInteractionGroups,
parallel_contact_constraints: ParallelSolverConstraints<AnyVelocityConstraint>, parallel_contact_constraints: ParallelSolverConstraints<AnyVelocityConstraint>,
@@ -157,7 +154,6 @@ impl ParallelIslandSolver {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
velocity_solver: ParallelVelocitySolver::new(), velocity_solver: ParallelVelocitySolver::new(),
positions: Vec::new(),
parallel_groups: ParallelInteractionGroups::new(), parallel_groups: ParallelInteractionGroups::new(),
parallel_joint_groups: ParallelInteractionGroups::new(), parallel_joint_groups: ParallelInteractionGroups::new(),
parallel_contact_constraints: ParallelSolverConstraints::new(), parallel_contact_constraints: ParallelSolverConstraints::new(),
@@ -192,7 +188,6 @@ impl ParallelIslandSolver {
self.thread = ThreadContext::new(8); // TODO: could we compute some kind of optimal value here? self.thread = ThreadContext::new(8); // TODO: could we compute some kind of optimal value here?
// Interactions grouping. // Interactions grouping.
let mut j_id = 0;
self.parallel_groups.group_interactions( self.parallel_groups.group_interactions(
island_id, island_id,
islands, islands,

View File

@@ -13,7 +13,7 @@ use crate::dynamics::{
RigidBodyType, RigidBodyVelocity, RigidBodyType, RigidBodyVelocity,
}; };
use crate::geometry::ContactManifold; use crate::geometry::ContactManifold;
use crate::math::{Real, DIM, SPATIAL_DIM}; use crate::math::{Real, SPATIAL_DIM};
#[cfg(feature = "simd-is-enabled")] #[cfg(feature = "simd-is-enabled")]
use crate::{ use crate::{
dynamics::solver::{WVelocityConstraint, WVelocityGroundConstraint}, dynamics::solver::{WVelocityConstraint, WVelocityGroundConstraint},

View File

@@ -2,10 +2,9 @@ use super::{AnyJointVelocityConstraint, AnyVelocityConstraint, DeltaVel, ThreadC
use crate::concurrent_loop; use crate::concurrent_loop;
use crate::data::{BundleSet, ComponentSet, ComponentSetMut}; use crate::data::{BundleSet, ComponentSet, ComponentSetMut};
use crate::dynamics::{ use crate::dynamics::{
solver::{GenericVelocityConstraint, ParallelSolverConstraints}, solver::ParallelSolverConstraints, IntegrationParameters, IslandManager, JointGraphEdge,
IntegrationParameters, IslandManager, JointGraphEdge, MultibodyJointSet, RigidBodyDamping, MultibodyJointSet, RigidBodyDamping, RigidBodyForces, RigidBodyIds, RigidBodyMassProps,
RigidBodyForces, RigidBodyIds, RigidBodyMassProps, RigidBodyPosition, RigidBodyType, RigidBodyPosition, RigidBodyType, RigidBodyVelocity,
RigidBodyVelocity,
}; };
use crate::geometry::ContactManifold; use crate::geometry::ContactManifold;
use crate::math::Real; use crate::math::Real;

View File

@@ -7,7 +7,7 @@ use crate::dynamics::solver::{WVelocityConstraint, WVelocityGroundConstraint};
use crate::dynamics::{IntegrationParameters, RigidBodyIds, RigidBodyMassProps, RigidBodyVelocity}; use crate::dynamics::{IntegrationParameters, RigidBodyIds, RigidBodyMassProps, RigidBodyVelocity};
use crate::geometry::{ContactManifold, ContactManifoldIndex}; use crate::geometry::{ContactManifold, ContactManifoldIndex};
use crate::math::{Real, Vector, DIM, MAX_MANIFOLD_POINTS}; use crate::math::{Real, Vector, DIM, MAX_MANIFOLD_POINTS};
use crate::utils::{self, WAngularInertia, WBasis, WCross, WDot, WReal}; use crate::utils::{self, WAngularInertia, WBasis, WCross, WDot};
use na::DVector; use na::DVector;
use super::{DeltaVel, VelocityConstraintElement, VelocityConstraintNormalPart}; use super::{DeltaVel, VelocityConstraintElement, VelocityConstraintNormalPart};
@@ -405,7 +405,7 @@ pub(crate) fn compute_tangent_contact_directions<N>(
linvel2: &Vector<N>, linvel2: &Vector<N>,
) -> [Vector<N>; DIM - 1] ) -> [Vector<N>; DIM - 1]
where where
N: WReal, N: utils::WReal,
Vector<N>: WBasis, Vector<N>: WBasis,
{ {
use na::SimdValue; use na::SimdValue;

View File

@@ -712,7 +712,7 @@ impl NarrowPhase {
par_iter_mut!(&mut self.intersection_graph.graph.edges).for_each(|edge| { par_iter_mut!(&mut self.intersection_graph.graph.edges).for_each(|edge| {
let handle1 = nodes[edge.source().index()].weight; let handle1 = nodes[edge.source().index()].weight;
let handle2 = nodes[edge.target().index()].weight; let handle2 = nodes[edge.target().index()].weight;
let mut had_intersection = edge.weight; let had_intersection = edge.weight;
// TODO: remove the `loop` once labels on blocks is stabilized. // TODO: remove the `loop` once labels on blocks is stabilized.
'emit_events: loop { 'emit_events: loop {