Skip to content

Improve call site detection in capture mode and add it to hw decoder bench - #6445

Open
rostan-t wants to merge 2 commits into
NVIDIA:mainfrom
rostan-t:ndd-capture-trim-stack
Open

Improve call site detection in capture mode and add it to hw decoder bench#6445
rostan-t wants to merge 2 commits into
NVIDIA:mainfrom
rostan-t:ndd-capture-trim-stack

Conversation

@rostan-t

@rostan-t rostan-t commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Category:

New feature (non-breaking change which adds functionality)

Description:

Currently, the following fails to capture properly:

for _ in range(WARMUP_EPOCHS):
    run_epoch(reader)

for _ in range(NUM_EPOCHS):
    run_epoch(reader)

Operators were first captured in the warmup loop and the full call chain is used to identify a node so operators in the second loop fail to capture and fall back to normal execution.

This PR fixes this by trimming the call chain to only the required size. It also adds capture mode to L1_decoder_perf.

Additional information:

Affected modules and functionalities:

Dynamic capture mode.

Key points relevant for the review:

Does call chain trimming introduce silent regressions that I didn't think of?

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

Comment thread dali/python/nvidia/dali/experimental/dynamic/_capture.py Fixed
@dali-automaton

Copy link
Copy Markdown
Collaborator

CI MESSAGE: [61565034]: BUILD STARTED

@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR compacts captured operator call chains to the minimum depth needed for call-site distinction and invariant proofs, allowing a captured graph to be reused across warmup and measured loops.

  • Tracks source-analysis proof depth while classifying captured arguments.
  • Compacts the capture trie before building the pipeline and stops lookup at compacted terminals.
  • Adds warmup and nested proof-frame coverage.
  • Adds optional dynamic capture mode to the hardware decoder benchmark and enables it in the decoder performance job.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
dali/python/nvidia/dali/experimental/dynamic/_capture.py Adds proof-preserving call-trie compaction and early terminal lookup before captured-pipeline replay.
dali/python/nvidia/dali/experimental/dynamic/_source_analysis.py Propagates the stack depth required to preserve cross-frame invariant proofs.
dali/test/python/experimental_mode/test_capture.py Adds coverage for capture reuse across warmup loops and nested proof-frame call paths.
internal_tools/hw_decoder_bench.py Adds an opt-in capture mode for the dynamic RN50 decoder benchmark and supplies capture-compatible invariants and RNG state.
qa/TL1_decoder_perf/test.sh Enables dynamic capture for the L1 decoder performance benchmark.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Trace operator call] --> B[Build full call chain]
  B --> C[Classify arguments]
  C --> D[Record required proof depth]
  D --> E[Compact trie prefixes]
  E --> F[Build captured pipeline]
  F --> G[Later operator call]
  G --> H[Walk compacted trie]
  H --> I{Operator and arguments match?}
  I -->|Yes| J[Return captured pipeline output]
  I -->|No| K[Execute eagerly]
Loading

Reviews (3): Last reviewed commit: "Add ndd capture mode to decoder benchmar..." | Re-trigger Greptile

Comment thread dali/python/nvidia/dali/experimental/dynamic/_capture.py
Comment thread internal_tools/hw_decoder_bench.py
Comment thread dali/test/python/experimental_mode/test_capture.py

PERF_RESULT=$(perf_check "${LOG_RN50}" "$MIN_PERF")
PERF_RESULT_NDD=$(perf_check "${LOG_NDD}" "$MIN_PERF_NDD")
PERF_RESULT_NDD_CAPTURE=$(perf_check "${LOG_NDD_CAPTURE}" "$MIN_PERF")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you expect perf to match pipeline mode MIN_PERF?

@rostan-t rostan-t Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I measure on my workstation, even when tweaking parameters capture mode is consistently slower but the difference is under 3%.
This is not the same machine as used in CI, it's an RTX 6000 PRO but the CPU only has 16 cores.

I enabled L1 tests when triggering CI so we'll see.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Results from CI:

  • Pipeline mode throughput: 21567.07 frames/sec
  • Dynamic mode throughput: 17244.40 frames/sec
  • Dynamic capture mode throughput: 21525.88 frames/sec

Looks like capture mode does match the performance of pipeline mode 🎉

Comment thread internal_tools/hw_decoder_bench.py Outdated
@JanuszL JanuszL self-assigned this Aug 7, 2026
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
@rostan-t
rostan-t force-pushed the ndd-capture-trim-stack branch from d75ba62 to 67d12ba Compare August 7, 2026 14:08
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
@rostan-t
rostan-t force-pushed the ndd-capture-trim-stack branch from 67d12ba to 570a74a Compare August 7, 2026 14:10
Comment thread dali/python/nvidia/dali/experimental/dynamic/_capture.py Dismissed
@dali-automaton

Copy link
Copy Markdown
Collaborator

CI MESSAGE: [61575050]: BUILD STARTED

@dali-automaton

Copy link
Copy Markdown
Collaborator

CI MESSAGE: [61565034]: BUILD PASSED

@dali-automaton

Copy link
Copy Markdown
Collaborator

CI MESSAGE: [61575050]: BUILD PASSED

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants