Repository navigation
nav: the GPU drive applies material, terrain, slope and lam policies, with telemetry and Python - #786
Merged
Merged
Conversation
drive_step_cuda refused any net with risk/slope look-ahead columns or lam heads, because the fused kernel was geometry-only. It now mirrors the CPU drive: - a device material-stack sampler (material_sample_point's six channels) and the soft/hard material force, into F and the steering bias; - coef_feats' risk column (the worse of material risk and the terrain's grade cost at each probe) and slope column, in the CPU's column order; - the two-head sigmoid lam columns in the device MLP, and the learned lam_soft / lam_hard (times lam_soft_scale / lam_hard_scale) in place of the fixed columns; - veh_params::terrain (grade force, infeasible-slope barrier) and the slope governors (veh_params::slope), in the fused and unfused kernels. drive_step_material_cuda is the GPU twin of drive_step_material. The GPU drive still refuses the plant arm (not ported); sim_world_cuda, which holds no material or terrain, refuses risk and slope nets. nav_drive_cuda_parity_test holds both entry points to the CPU drive tick by tick (worst 4.8e-7 on sm_86 against a 1e-5 contract) with a material stack, a terrain, a risk net, a slope net, a v1 lam-head net and a two-head sigmoid net reading grip, risk and slope.
drive_step_cuda and drive_step_material_cuda take the optional drive_telemetry the CPU drives take and fill it the same way: the coefficients, the applied lams, mu, mrisk (the worse of material and terrain risk; the terrain's alone, with its weights, without a material stack), steer, curvature, clearance and binding, and U_nav with its terms and the conservative force at the tick's start pose (nav_potential.h is host and device). The parity test compares every field (worst relative 2.5e-6 on sm_86). pycvc.nav_drive_step_material_cuda is nav_drive_step_material's twin on the GPU, without map_id (the GPU drive reads plane 0), with optional grip, terrain, slope, lam authority scales and telemetry (a dict of (N,) arrays); mat_field None runs drive_step_cuda. A refusal from the drive is caught with the GIL released and raised once it is back. pycvc.nav_drive_cuda_available() reports a device. test_pycvc_nav_cuda.py checks the binding against the CPU binding and self-skips without CUDA.
transfix
force-pushed
the
feat/nav-gpu-material-parity
branch
from
October 24, 2026 05:03
7d7d2be to
4e7f0e0
Compare
transfix
enabled auto-merge (squash)
October 24, 2026 15:49
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.
Follows #785 (merged): the risk column reads terrain risk as material risk, as #785 makes the CPU drive do.
What
drive_step_cudarefused any net with risk or slope look-ahead columns or lam heads, because the fused kernel was geometry-only. The GPU drive now mirrors the CPU drive:material_stack(material_sample_point), and the soft and hard material force (F = -lam_soft grad r - lam_hard db grad phi) into F and the steering bias.coef_feats' risk column (the worse of material risk and the terrain's grade cost at each probe) and slope column, in the CPU's column order.lam_soft/lam_hard(timeslam_soft_scale/lam_hard_scale) replace the fixed columns.veh_params::terrain(grade force, infeasible-slope barrier) and the slope governors (veh_params::slope), in the fused and the unfused (bicycle_rollout_cuda) kernels.drive_telemetry *and fill it the same way, U_nav's terms included (mrisk= max(material, terrain)).drive_step_material_cuda, the GPU twin ofdrive_step_material.pycvc.nav_drive_step_material_cuda(the twin ofnav_drive_step_materialwithoutmap_id, with optional grip, terrain, slope, lam scales andtelemetry=1) andpycvc.nav_drive_cuda_available(). New symbols; no existing signature changes.Still refused, with messages saying so: the plant arm (
veh_params::plant) on the GPU; risk/slope nets with nothing to read; a material drive with a null lam column for a net with no head for it; risk/slope nets insim_world_cuda, which holds no material or terrain. The precise-math flags (-fmad=false, IEEE div/sqrt, no ftz) are unchanged.Tests
nav_drive_cuda_parity_test(new, 9 cases): CUDA == CPU tick by tick with a material stack, a terrain, the slope governors, a risk net, a slope net, a v1 lam-head net and a two-head sigmoid net reading grip, risk and slope; everydrive_telemetryfield; the refusals (host-side, run without a device). Worst state difference 4.8e-7 and worst telemetry difference 2.5e-6 (relative) on an RTX 3050 Ti (sm_86), against 1e-5. Removing the terrain from the GPU risk probe fails the three risk cases.test_pycvc_nav_cuda.py(new, 25 checks): the binding againstnav_drive_step_materialwithin 1e-5, telemetry, terrain, slope, refusals. Self-skips without CUDA or a device, so on the pycvc-linux lane (CUDA off) it only proves the binding compiles and imports.DriveStepCudaRefusesRiskLamNetis removed: that net now runs.nav_drive_refinements_test,nav_material_rollout_cuda_test,nav_material_deploy_test,nav_terrain_test,nav_test(NavSimWorldCuda).CUDA parity is not a CI gate (CI has no GPU); the numbers above are from one sm_86 device.