Repository navigation
nav: per-agent physics on the CUDA drive (device twin of #395) - #396
Merged
Merged
Conversation
Wire the per-agent columns (rr/body_rr/vmax/a_max/L) into the GPU drive so a heterogeneous fleet runs on CUDA too, matching the CPU rollout. - dev_veh gains the 5 borrowed device column pointers (null = the scalar, so the homogeneous path is bit-for-bit the legacy kernel). Mass is not here — the kinematic drive never reads it. - d_veh_for(v, i) substitutes the columns into a per-thread copy before d_bicycle, so every use site (incl. the L-derived dmax/tan_dmax/v_creep_cap and the vmax-derived sp_min) becomes per-agent with no change to d_bicycle — the device mirror of the CPU loop's shadowing. - upload_cols copies each set host column [n] to the device in both batch entry points (bicycle_rollout_cuda / drive_step_cuda) and frees them after. The persistent sim_world_cuda path keeps the scalar for now (a follow-up). Test: nav_drive_refinements_test CudaMatchesCpuWithPerAgentColumns — a heterogeneous fleet (distinct rr/vmax/a_max/L per agent) matches the CPU bicycle_rollout within the ~1e-5 float-equivalence contract. Verified on a GTX 1650 (both this and the existing scalar-path CUDA parity test pass); the null-column path leaves the CPU/CUDA parity gate byte-identical.
transfix
added a commit
that referenced
this pull request
Sep 22, 2026
Gap-analysis cleanup over the just-landed base (#394-#397). Correctness + doc-accuracy + test coverage in one module; no behavior change to the drive. - Sentinel leak (major): min_clearance_m and min_sep_m sit at the 1e30 "unmeasured" sentinel until a sampler / second vehicle lowers them; num() only nulls non-finite, so the base JSON record emitted "min_clearance_m":1e+30 — read by a trainer as *enormous* clearance, the inverse of "missing". Add a num_sentinel() helper that nulls >=1e29 and apply it to both fields in episode_nav_stats::to_json() (aggregate_nav already guarded min_sep_m; the per-episode record now matches). - Unit contract (major, root of the cvcdbg #113 bug): document nav_samplers.min_clearance_m as METRES and that sim_world::min_clearance() is NORMALIZED, so the caller must convert (/cfg.scale) before pointing it here. - Stale comments (minor): drive.h still said the CUDA twin ignores the per-agent columns; #396 wired rr/body_rr/vmax/a_max/L into the batch CUDA entry points. Correct both blocks (only the persistent sim_world_cuda path still scalars; mass stays CPU/downstream-only). - Mirror comment (minor): the header claimed field-parity with grl_snam.metrics.NavStats "pinned in cross-language parity tests" — neither true (veh_nav_stats is a superset; the match is grl_snam.scorecard, and parity is held by independent hand-computed corpora, not a gate). Correct it. - Tests: SentinelFieldsSerializeAsNull (the sentinel->null fix); BudgetEtaAndFuelBounds (the eta_multiple + fuel_budget bounds, previously only time_budget_s was exercised); and ScriptedTrajectoryAccumulators now calls e.to_json() to pin the base record shape + goals_reached. 5/5 pass locally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wires the per-agent physics columns (
rr/body_rr/vmax/a_max/L) into the GPU drive, so a heterogeneous fleet runs on CUDA too and matches the CPU rollout. Device twin of #395 (which did the CPU path).What
dev_vehgains the 5 borrowed device column pointers; null = the scalar, so the homogeneous path is bit-for-bit the legacy kernel. Mass isn't here — the kinematic drive never reads it.d_veh_for(v, i)substitutes the columns into a per-thread copy befored_bicycle, so every use site (incl. theL-deriveddmax/tan_dmax/v_creep_capandvmax-derivedsp_min) becomes per-agent with no change tod_bicycle— the device mirror of the CPU loop's shadowing.upload_colscopies each set host column to the device in both batch entry points (bicycle_rollout_cuda/drive_step_cuda) and frees them. The persistentsim_world_cudapath keeps the scalar for now (a follow-up).Validation
CudaMatchesCpuWithPerAgentColumns: a heterogeneous fleet (distinctrr/vmax/a_max/Lper agent) matches the CPUbicycle_rolloutwithin the ~1e-5 float-equivalence contract. Verified on a GTX 1650 — both this and the existing scalar-path CUDA parity test pass.Small, additive; completes the per-agent physics set across CPU + CUDA. (CI ubuntu builds without a GPU and skips the CUDA test via
GTEST_SKIP; it runs on a CUDA runner / dev box, as the other*_cudatests do.)