Skip to content

Improve workspace batching and analytic IK buffer reuse - #606

Open
yuecideng wants to merge 4 commits into
mainfrom
perf/workspace-batching
Open

Improve workspace batching and analytic IK buffer reuse#606
yuecideng wants to merge 4 commits into
mainfrom
perf/workspace-batching

Conversation

@yuecideng

Copy link
Copy Markdown
Contributor

Description

Reduce workspace-analysis overhead by replacing 1,000 individual FK calls for dynamic bounds with one batch and reusing analytic IK candidate storage. Robot batch methods now broadcast base transforms, preserve leading batch axes through solver adapters, and avoid redundant target allocations and single-seed reductions.

  • Reuse UR/OPW scratch buffers with thread/stream synchronization and independent ownership of returned tensors. Pack OPW live joint limits into one host transfer and reuse the UR TCP inverse tensor.
  • Repair Sobol/LHS/importance sampling implementations, isolate sampler RNG state, and make scrambled Sobol the default. Explicit random sampling remains available.
  • Add opt-in constrained-domain sampling and compact result storage, including compatible runtime-cache/preview handling and cache-key invalidation. Constrained-domain reachability uses a different denominator; compact results omit rejected-point diagnostics.
  • Add real UR5/CobotMagic benchmarks, focused regression tests, and updated project context/API docstrings.

UR retains all 512 candidates, validity thresholds, and nearest-seed selection. Candidate-enumeration/kernel changes are outside this PR.

On RTX PRO 5000, warm dynamic-bounds estimation improves from 879.6 to 1.47 ms for UR5 and 143.5 to 0.83 ms for CobotMagic. Fixed-domain analysis gains vary, with some UR multi-seed cases around 1.3x and several cases near parity. CPU and CUDA each have 22 comparison cases with identical reported success rates and FK residuals. These are renderer-free measurements, not complete simulation startup timings; Torch memory counters do not include baseline Warp allocations.

See the benchmark methodology, results and reproduction commands.

Dependencies: no new dependencies.

Type of change

  • Enhancement (improves existing functionality)

Validation

  • 169 affected workspace, solver, robot-config, batched motion-generator and workspace-randomization tests passed, including real simulation and CUDA stream tests.
  • 32 Robot CPU/CUDA tests passed in a separate process; 23 project-context tests passed.
  • The initial combined process passed 199 cases and hit Torch Dynamo's eight-recompilation limit in two Robot CUDA FK cases. Both pass in the separate Robot run; production compiler settings are unchanged.
  • Black 26.3.1 (black .), git diff --check, context validation and API documentation coverage (1,853/1,853 exports) passed.
  • Independent code review found no remaining actionable issues. The full repository test suite and Sphinx HTML build were not run; validation covers the affected behavior.

Screenshots

Not applicable; numerical comparisons are in the benchmark report.

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation.
  • Public API changes are reflected in API docstrings and the API documentation gate passes.
  • I have added tests that prove the changed behavior.
  • Dependencies have been reviewed; no updates are required.

@yuecideng yuecideng added enhancement New feature or request solver Robot kinematics solver robot Module related to robot labels Sep 10, 2026
@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

Summary

  • Adds batch-preserving solver adapters and broadcasted Robot frame transforms.
  • Introduces caller-independent UR/OPW scratch-buffer reuse across threads and CUDA streams.
  • Adds constrained-domain sampling, compact result archives, isolated sampler RNG state, and scrambled Sobol defaults.
  • Updates workspace tooling, cache identity, documentation, benchmarks, and focused regression coverage.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    S[Workspace sampler] --> A[Workspace analyzer]
    A --> R[Robot batch FK or IK]
    R --> F[Broadcast root-frame transforms]
    F --> B[Solver batch adapter]
    B --> K[Analytic kernel]
    K <--> M[Synchronized reusable scratch buffers]
    K --> O[Caller-owned result tensors]
    O --> C{Retain diagnostics?}
    C -->|Yes| D[Full analysis result]
    C -->|No| P[Compact reachable result]
    D --> X[Runtime cache and preview]
    P --> X
Loading

Reviews (4) · Last reviewed commit: "fix workspace batching GPU regressions"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request robot Module related to robot solver Robot kinematics solver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants