Skip to content

Skip TRTInterpreter.validate_conversion when partition already proved full support. - #4693

Merged
micwill755 merged 2 commits into
skip-conversion-recompilefrom
network-construct
Oct 14, 2026
Merged

micwill755 merged 2 commits into
skip-conversion-recompilefrom
network-construct

Conversation

@micwill755

@micwill755 micwill755 commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Skip TRTInterpreter.validate_conversion() when compile_module already proved full converter coverage (require_full_compilation and num_supported_ops == total_ops).
  • That __init__ walk is a second CONVERTERS.get() over every call_function / call_method / call_module node. Partition already did the same lookup via get_graph_converter_support. Under full compilation a missing-op warning cannot fire, so the extra pass is redundant.
  • Direct interpret_module_to_result / engine-converter / test-harness construction still validates (default skip_conversion_validation=False). Construct still CONVERTERS.gets per node when it converts.
  • Klein cold compile: interpreter.validate_conversion 0.102s → 0s.

PR 9 of the compile-startup stack; based on #4599.

Type of change

  • Performance (non-breaking; skips a redundant converter-support walk)

Test plan

  • Klein NVFP4 cold compile (GPU transformer, torchtrt-213rc10): skip-off validate_conversion 0.102s; skip-on the hook does not run. Engine still builds; steady ~0.43s.
  • Dedicated unit test that __init__ skips validate_conversion when the flag is set, and still warns when it is not
  • Existing dynamo conversion / partition tests (CI)

Checklist

  • Code follows project style (pre-commit: isort, ruff, black, mypy)
  • Self-review
  • Comment on why the skip is valid
  • Docs update (not needed)
  • New tests
  • Labels

Stack created with GitHub Stacks CLI • Give Feedback 💬

@meta-cla meta-cla Bot added the cla signed label Sep 8, 2026
@github-actions github-actions Bot added component: conversion Issues re: Conversion stage 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 Sep 8, 2026
@github-actions
github-actions Bot requested a review from zewenli98 September 8, 2026 22:37
@micwill755
micwill755 requested review from cehongwang and narendasan and removed request for zewenli98 September 8, 2026 22:38
@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from c722fbb to 6339d3b Compare September 9, 2026 22:54
@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from 6339d3b to caed6cf Compare September 16, 2026 23:22
@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from caed6cf to 141e926 Compare September 16, 2026 23:23
@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from 141e926 to 7762e49 Compare September 29, 2026 17:44
input_binding_names: Optional[Sequence[str]] = None,
output_binding_names: Optional[Sequence[str]] = None,
_debugger_config: Optional[DebuggerConfig] = None,
skip_conversion_validation: bool = False,

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.

Consider set default to True if majority of time we don't need the validation?

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.

We should leave the default False. We only skip it inside compile_module, after that function has already confirmed every op has a converter. If the default were True, every other caller would skip the check too, even when nobody has confirmed that.

@cehongwang cehongwang 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.

LGTM

@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from 7762e49 to 949a239 Compare October 6, 2026 20:38
@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from 949a239 to 78b03f6 Compare October 6, 2026 21:34

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/impl/moe.py	2026-10-06 21:35:02.978349+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/impl/moe.py	2026-10-06 21:35:33.188930+00:00
@@ -94,11 +94,13 @@
        ctx, offs, torch.int32, f"{name}_offs_i32", target, source_ir
    )
    offs_row = impl.shuffle.reshape(
        ctx, target, source_ir, f"{name}_offs_row", offs_i32, (1, -1)
    )
-    passed = impl.elementwise.le(ctx, target, source_ir, f"{name}_passed", offs_row, rows)
+    passed = impl.elementwise.le(
+        ctx, target, source_ir, f"{name}_passed", offs_row, rows
+    )
    group = impl.reduce.sum(
        ctx,
        target,
        source_ir,
        f"{name}_group",
--- /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py	2026-10-06 21:35:02.976781+00:00
+++ /home/runner/work/TensorRT/TensorRT/py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py	2026-10-06 21:35:36.927809+00:00
@@ -4640,13 +4640,11 @@
    if key in kwargs and kwargs[key] is not None:
        return kwargs[key]
    return args_bounds_check(args, index, default)


-def histc_validator(
-    node: Node, settings: Optional[CompilationSettings] = None
-) -> bool:
+def histc_validator(node: Node, settings: Optional[CompilationSettings] = None) -> bool:
    bins = _arg_or_kwarg(node.args, node.kwargs, 1, "bins", 100)
    lo = _arg_or_kwarg(node.args, node.kwargs, 2, "min", 0)
    hi = _arg_or_kwarg(node.args, node.kwargs, 3, "max", 0)
    if not all(
        isinstance(v, (int, float)) and not isinstance(v, bool) for v in (bins, lo, hi)

@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from 78b03f6 to 1e45324 Compare October 13, 2026 19:06
@micwill755
micwill755 force-pushed the network-construct branch 3 times, most recently from 79542fa to d05a422 Compare October 13, 2026 22:09
@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from a6afa53 to c693a4b Compare October 13, 2026 23:12
@micwill755 micwill755 added this to the v2.16.0 milestone Oct 13, 2026
@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from c693a4b to 7a6ca3d Compare October 13, 2026 23:41
… full support.

compile_module already walks CONVERTERS via get_graph_converter_support. Under require_full_compilation with a complete count, the extra get() pass in interpreter __init__ cannot find missing ops, so skip it.
The flag was accepted by interpret_module_to_result but never handed to the helper that reads it, so engine builds raised NameError.
@micwill755
micwill755 force-pushed the skip-conversion-recompile branch from 7a6ca3d to 0693ab4 Compare October 13, 2026 23:51
@micwill755
micwill755 removed this pull request from stack #4533 October 13, 2026 23:52
@micwill755
micwill755 merged commit 0fdefb3 into skip-conversion-recompile Oct 14, 2026
micwill755 added a commit that referenced this pull request Oct 20, 2026
micwill755 added a commit that referenced this pull request Nov 20, 2026
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: conversion Issues re: Conversion stage component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants