[Interactive Drive] Annotate nvtx and Optimize#382
Conversation
Reduce BEV waiting by delaying BEV by 1 chunk. Visually this looks better since it looks like GoogleMaps in a car (slightly behind real life, floating feeling). This is better for perf since we don't need to wait/worry on our BEV, we had a whole 8 frames to build the BEV+HUD delete things in a different order due to nuance in how they cause syncing (overlap) remove some unneeded cuda-stream passing (which introduced long cuda sync points which don't do anything) remove the python-GIL on code that does not need it
Greptile SummaryThis PR introduces NVTX profiling annotations across the Interactive Drive pipeline, offloads BEV panel image building and MJPEG BEV encoding to background thread pools, and decouples BEV rendering from the RGB critical path by delivering BEV one chunk behind RGB (eliminating the present-side wait). It also removes unnecessary
Confidence Score: 4/5Safe to merge after verifying the test failure and the two dead attributes in the HUD presenter. One newly added test asserts BEV prefetch deduplication via source_group_key that the production prepare_frame does not implement — the test will fail as written. The rest of the changes are correct and well-tested. integrations/omnidreams/tests/interactive_drive/test_presenter.py (failing test) and integrations/omnidreams/omnidreams/interactive_drive/slangpy_hud_presenter.py (two unread attributes). Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Main as Main Thread
participant Exec as Rasterizer Worker
participant BevPanel as BEV Panel Worker
Main->>Exec: render_rgb_frames(chunk N)
Exec-->>Main: rgb_frames
Main->>Main: poll_ready_bev() returns chunk N-1 BEV
Main->>Exec: render_bev_frames(chunk N) async
Main->>Main: "build_chunk(rgb=N, bev=N-1)"
Main->>Main: _update_bev_pil() stores lazy source
Main->>BevPanel: _build_bev_panel_image async
BevPanel-->>Main: cached Image on next poll
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Main as Main Thread
participant Exec as Rasterizer Worker
participant BevPanel as BEV Panel Worker
Main->>Exec: render_rgb_frames(chunk N)
Exec-->>Main: rgb_frames
Main->>Main: poll_ready_bev() returns chunk N-1 BEV
Main->>Exec: render_bev_frames(chunk N) async
Main->>Main: "build_chunk(rgb=N, bev=N-1)"
Main->>Main: _update_bev_pil() stores lazy source
Main->>BevPanel: _build_bev_panel_image async
BevPanel-->>Main: cached Image on next poll
Reviews (3): Last reviewed commit: "Merge branch 'main' into annotate-nvtx-a..." | Re-trigger Greptile |
|
/ok to test 79fc0c0 |
Changes:
Reduce BEV waiting by delaying BEV by 1 chunk. Visually this looks better since it looks like GoogleMaps in a car (slightly behind real life, floating feeling). This is better for perf since we don't need to wait/worry on our BEV, we had a whole 8 frames to build the BEV+HUD
Delete things in a different order due to nuance in how they cause syncing (overlap)
Remove some unneeded cuda-stream passing (which introduced long cuda sync points which don't do anything)
Remove the python-GIL on code that does not need it
Add NVTX annotations & nsys guide so that we have an easier time in exploring profiler driven optimizations in the future