Repository navigation
Conversation
Add typed fluid scene ownership, observations and row-local refill; gate batching on native SPH capabilities. Generate and qualify the pouring Task Program in MuJoCo before replaying measured states in an independent SPH Gym. Package physical assets and keep source acceptance separate from fluid metrics. Requires DexSim world-isolated SPH support (d2d36fbcb) for batched scenes.
Use Hybrid by default with FastRT support, and route replay videos through the configured record_camera event. Add separate environment buffers, selected save/discard and configurable cadence to record_camera_data. Explicitly commit the final replay recording. Qualified two complete 744-frame Hybrid videos, both renderer smoke runs, row-local recording reset, 128 focused tests and the live Gym reset regression.
Sample a declared capped revolved profile and fill level on a deterministic lattice. Keep solid clearance separate from the free surface and retain the local template in memory for reset. Remove the default water_fill particle asset, resample the same recipe for spacing overrides, and preserve explicit point imports. Qualify complete two-environment Hybrid pouring and per-environment recordings.
2547154 to
0dd4d16
Compare
Standalone fluid performance: CUDA Graph and DFSPHCUDA Graph is enabled and replayed successfully. The dominant measured cost is GPU DFSPH projection work. This investigation uses the standalone CUDA Graph verification
The difference is below 1% in this single-run comparison and is not evidence of a statistically established speedup or regression. A separate Graph timing probe recorded 1,763.46 ms of GPU Graph execution in a 1,763.89 ms measurement window. Python scene preparation and submission are therefore not the primary throughput limit in this window. Why the workload is expensiveThe configuration uses a 240 Hz outer physics loop with six SPH substeps per update: 1,440 SPH substeps per simulated second. Each substep takes approximately 2.45 ms of GPU Graph execution, while advancing only 0.694 ms of simulated time. This accounts for approximately 0.28× real-time throughput, consistent with the earlier complete rollout measurements. Warp CUDA-event sampling in a separate Graph-disabled diagnostic run identifies these hotspots:
The coefficient and velocity-correction kernels account for approximately 78.3% combined. These diagnostic percentages include instrumentation effects and should not be interpreted as an exact per-kernel breakdown of Graph replay. At the 1.5 s sample point, density projection reached its 20-iteration cap, with a 0.0478% projection residual against the 0.01% target. Divergence projection took one iteration. The implementation expands the configured maximum iteration counts and uses device-side active flags to return early after convergence; Graph replay preserves that structure. The coefficient kernel performs per-particle atomic additions into one sample-count scalar and one error-sum scalar per world, while repeatedly accessing neighbor data. Atomic contention and neighbor-memory access are priority optimization candidates, but their individual contributions have not yet been isolated by ablation or hardware-counter profiling. Rendering is a smaller contributor: separate complete 6-second, single-environment runs took 20.68 s with NoRender and 23.22 s with FastRT plus recording, approximately 12.3% additional wall time. These timings exclude scene initialization. Suggested optimization order and limits
No solver or tutorial implementation was changed during this investigation. Raw timing, state-parity, CPU-profile, and GPU-activity records are retained as local qualification artifacts. |
[Medium impact] The PR adds a bounded fluid workflow to Newton simulations and their rendering path. The stack needs PR #790's fluid constructor calls updated before merging.
|
| device: torch.device = torch.device("cpu"), | ||
| ) -> None: |
There was a problem hiding this comment.
Dependent fluid creation breaks
The new FluidObject(cfg, device) signature breaks callers retained in PR #790. At its supplied head, embodichain/lab/sim/sim_manager.py:2856–2858 still passes points, pose, and on_write, as do two constructors in tests/sim/objects/test_fluid_object.py. These calls raise TypeError with this signature.
Update the dependent layer to use the new constructor and _initialize_spawn_source() before landing the stack.
Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/sim/objects/fluid.py
Line: 76-77
Comment:
**Dependent fluid creation breaks**
The new `FluidObject(cfg, device)` signature breaks callers retained in PR #790. At its supplied head, `embodichain/lab/sim/sim_manager.py:2856–2858` still passes `points`, `pose`, and `on_write`, as do two constructors in `tests/sim/objects/test_fluid_object.py`. These calls raise `TypeError` with this signature.
Update the dependent layer to use the new constructor and `_initialize_spawn_source()` before landing the stack.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Comments Outside DiffThese findings could not be posted inline.
|
Description
Add fixed-count fluid objects, procedural initial-fill sampling, world-frame particle state access/reset, particle/surface rendering, and a standalone multi-environment tutorial. Fluid solving now consistently enters through DexUni: scene contents activate DFSPH, and optional SPH settings are nested in
DexUniSolverCfg.sph_cfg. Standalonesolver_type: sphmappings report how to migrate.Fluid density and spacing belong to the fluid declaration. The tutorial uses a reconstructed mesh surface and static SDF container walls; DFSPH boundary collisions remain enabled without running a rigid-body solver in this fixed-only scene. Fluid render publication orders CUDA work and drains prior staged writes when necessary so cameras see explicit particle-state edits.
Stack and dependencies
codex/adapt-latest-dexsim.dexsim_engine>=0.5.1rc1,<0.5.2, but fluid use now requires a build exposingDexUniSolverCfg.sph_cfg. This change was qualified with DexSim0.5.1+0b8422cc6f6717058bd15371e61bd35cdbbe3c0c, Newton 1.7.0, Warp 1.17.0 and Torch 2.7.1+cu128. Published rc1 does not provide the DexUni/DFSPH composition.Validation
black .with 26.3.1 and 26.10.1, API coverage 3,278/3,278, context checks including 42 context tests, and the focused render benchmark smoke check passed.A synchronized NoRender comparison used a fixed-container scene on a shared RTX 5090, 1,728 float32 particles per environment, three runs of 120 steps after 10 warmup steps, and the same DFSPH settings. DexUni disabled rigid-rigid contacts for this fixed, kinematic-walled comparison; the original SPH baseline used a temporary compatibility bridge only for declaration/reset. Final particle position and velocity arrays matched exactly in both cases.
The measured wall-time includes manager/physics stepping and device completion, excludes setup/reset/warmup/rendering, and is specific to this shared-GPU workload. Sampled process GPU memory was approximately 768 MiB and 774 MiB respectively; sampling may miss short peaks. An additional four-environment NoRender profile measured DexUni at 2.86 ms/step with kinematic walls and 2.04 ms/step with static walls (median of 10 and 5 samples, respectively; 120 steps after 30 warmup steps). Particle positions and velocities at the final snapshot were identical; both measurements used the shared GPU.
The existing fluid lifecycle and camera tests were extended for the new dispatch and staging behavior; no tutorial-import tests were added. Fluid, physics configuration and rendering context now describe the capability and synchronization boundaries.
Type of change
Checklist
black ..