Remove legacy factorI/solveLD and clean up benchmarks/tests

Deletes mj_factorI_legacy and mj_solveLD_legacy from the engine and headers.
Updates factorI, solveLD, and inertia benchmarks to remove legacy targets
and only benchmark CSR.
Rewrites engine_core_smooth_test to verify CSR solver against mj_mulM
instead of legacy solver.

PiperOrigin-RevId: 942507341
Change-Id: I4281decb7018cfa3e46cb446efd5fe1179f6ae1f
This commit is contained in:
Yuval Tassa
2026-07-04 08:33:56 -07:00
committed by Copybara-Service
parent 10d6c01dce
commit 7c6f519879
6 changed files with 49 additions and 375 deletions
+7 -28
View File
@@ -30,7 +30,7 @@ static const int kNumBenchmarkSteps = 50;
// ----------------------------- benchmark ------------------------------------
static void BM_factorI(benchmark::State& state, bool legacy, bool coil) {
static void BM_factorI(benchmark::State& state, bool coil) {
static mjModel* m;
if (coil) {
m = LoadModelFromPath("plugin/elasticity/coil.xml");
@@ -46,21 +46,14 @@ static void BM_factorI(benchmark::State& state, bool legacy, bool coil) {
// M: mass matrix in CSR format
mjtNum* M = mj_stackAllocNum(d, m->nC);
mju_gather(M, d->qM, m->mapM2M, m->nC);
// LDlegacy: legacy LD matrix (size nM)
mjtNum* LDlegacy = mj_stackAllocNum(d, m->nM);
mju_copy(M, d->M, m->nC);
// benchmark
while (state.KeepRunningBatch(kNumBenchmarkSteps)) {
for (int i=0; i < kNumBenchmarkSteps; i++) {
if (legacy) {
mj_factorI_legacy(m, d, d->qM, LDlegacy, d->qLDiagInv);
} else {
mju_copy(d->qLD, M, m->nC);
mj_factorI(d->qLD, d->qLDiagInv, m->nv,
m->M_rownnz, m->M_rowadr, m->M_colind, nullptr);
}
mju_copy(d->qLD, M, m->nC);
mj_factorI(d->qLD, d->qLDiagInv, m->nv,
m->M_rownnz, m->M_rowadr, m->M_colind, nullptr);
}
}
@@ -71,31 +64,17 @@ static void BM_factorI(benchmark::State& state, bool legacy, bool coil) {
state.SetItemsProcessed(state.iterations());
}
void ABSL_ATTRIBUTE_NO_TAIL_CALL
BM_factorI_COIL_LEGACY(benchmark::State& state) {
MujocoErrorTestGuard guard;
BM_factorI(state, /*legacy=*/true, /*coil=*/true);
}
BENCHMARK(BM_factorI_COIL_LEGACY);
void ABSL_ATTRIBUTE_NO_TAIL_CALL
BM_factorI_COIL_CSR(benchmark::State& state) {
MujocoErrorTestGuard guard;
BM_factorI(state, /*legacy=*/false, /*coil=*/true);
BM_factorI(state, /*coil=*/true);
}
BENCHMARK(BM_factorI_COIL_CSR);
void ABSL_ATTRIBUTE_NO_TAIL_CALL
BM_factorI_H100_LEGACY(benchmark::State& state) {
MujocoErrorTestGuard guard;
BM_factorI(state, /*legacy=*/true, /*coil=*/false);
}
BENCHMARK(BM_factorI_H100_LEGACY);
void ABSL_ATTRIBUTE_NO_TAIL_CALL
BM_factorI_H100_CSR(benchmark::State& state) {
MujocoErrorTestGuard guard;
BM_factorI(state, /*legacy=*/false, /*coil=*/false);
BM_factorI(state, /*coil=*/false);
}
BENCHMARK(BM_factorI_H100_CSR);