Skip to content

ssik build: cached-RR jointlock 7R artifacts take ~5-10 min (serial per-sub-chain sympy derivation); parallelize / cheaper leftvar probe #329

Description

@siddhss5

What

ssik build for a cached-RR jointlock 7R arm takes minutes of cold sympy work. Measured wall-clock (single-threaded, this machine):

arm build time primed sub-chain DHs
IHMC Alex V2 (left) 561 s (~9.4 min) 16
Flexiv Rizon 4 489 s (16 lock samples)
Flexiv Rizon 10 485 s (16)
Kassow KR810 272 s (fewer unique)

Why (cost breakdown)

For a non-SRS 7R whose locked-6R sub-chains dispatch to husty_pfurner.general_6r (RR-eligible), the seven_r composer primes the cached-RR derivation per unique locked-sub-chain DH — one Raghavan-Roth symbolic derivation each, ×16 (one per lock sample for Alex). Each derivation also runs AE-3 leftvar probing (_cached_best_leftvar evaluates multiple candidate leftvars — per the composer's own docstring, "3 symbolic derivations per DH"). So the cost is roughly 16 DHs × (leftvar probes + 1 final) × per-derivation sympy time.

The 16 derivations are independent and currently run serially on a single core.

Why it matters

Per [build-bake-aggressively] the build cost is an accepted tradeoff (it buys ~1 ms warm solves), so this is not about moving work out of build — it's that the build is slower than it needs to be, which hurts iteration when adding/refreshing arms (and was a visible surprise when assembling Alex).

Actionable directions (rough ranking)

  1. Parallelize the per-sub-chain derivations across cores — they're independent; ~Ncore speedup (9.4 min → ~1.5 min on 8 cores). Biggest, lowest-risk win.
  2. Cheaper AE-3 leftvar selection — picking the best leftvar currently costs ~3 full derivations/DH; a conditioning estimate that doesn't require a full derivation per candidate could cut that ~3×.
  3. Cross-sample / cross-arm DH dedup — confirm no near-duplicate sub-chain DHs are being derived twice (Alex shows 16 distinct, so likely none here, but worth a guard).
  4. Profile a single derivation (_cached_derivation / _derive_pq_for_arm) to find the dominant sympy step (Groebner/sp.reduced vs lambdify) — the keys in [rr-implementation-keys] (numeric DH at derive time, closed-form A^-1, sp.reduced) are applied; check none regressed.

Notes

Surfaced while building the IHMC Alex V2 arm (non-SRS 7R). The artifact is correct and fast at runtime (16 ms/pose post-#326); this is purely build-time wall-clock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions