Skip to content

dryrun stats observable - #4519

Open
jloftin-nv wants to merge 1 commit into
pytorch:mainfrom
jloftin-nv:dev-jloftin-dry-run-stats
Open

dryrun stats observable#4519
jloftin-nv wants to merge 1 commit into
pytorch:mainfrom
jloftin-nv:dev-jloftin-dry-run-stats

Conversation

@jloftin-nv

Copy link
Copy Markdown
Contributor

Description

dryrun=True builds a full DryRunTracker (coverage, unsupported ops, engine count) and only prints it. There is no supported way to read those stats for CI or sweeps without monkeypatching.

Mark dryrun_stats_display with @observable() so callers can register on observers.pre / post and capture the tracker without a new public API.

Fixes # (issue)

Type of change

Please delete options that are not relevant and/or add your own.

  • New feature (non-breaking change which adds functionality)

Checklist:

  • [X ] My code follows the style guidelines of this project (You can use the linters)
  • [ X] I have performed a self-review of my own code
  • [ X] I have commented my code, particularly in hard-to-understand areas and hacks
  • [X ] I have made corresponding changes to the documentation
  • [ X] I have added tests to verify my fix or my feature
  • [ X] New and existing unit tests pass locally with my changes
  • [ X] I have added the relevant labels to my PR in so that relevant reviewers are notified

@github-actions github-actions Bot added component: tests Issues re: Tests component: core Issues re: The core compiler component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Aug 18, 2026
@meta-cla meta-cla Bot added the cla signed label Aug 18, 2026
@github-actions
github-actions Bot requested a review from lanluo-nvidia August 18, 2026 21:58
@narendasan
narendasan requested a review from cehongwang August 18, 2026 22:56
@lanluo-nvidia lanluo-nvidia added this to the v2.15.0 milestone Aug 20, 2026

@micwill755 micwill755 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Request changes, for these:

  1. Docs missing. Checklist says docs were updated; they were not. Add the callback recipe to dryrun docs / observer docs.

  2. Hook does not always run. dryrun_stats_display is skipped on some compile_module early returns including num_supported_ops == 0 even with dryrun=True. Coverage sweeps of unsupported models would get no tracker. Call display or emit the tracker on those paths too.

trackers.append(ctx.args[0])

with dryrun_stats_display.observers.pre.add(capture):
torch_tensorrt.dynamo.compile(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

dynamo.compile() needs an ExportedProgram, not an nn.Module. Export first with torch.export.export(model, (x,)), then pass that into compile.

Also drop enabled_precisions={torch.float32}, enabled_precisions is deprecated as of TRT 11. Dynamo uses dtypes on the model and input so this FP32 test needs no precision argument.

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

Labels

cla signed component: api [Python] Issues re: Python API component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: tests Issues re: Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants