Skip to content

slight code reorg and bug correction for cross_compile #3472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

apbose
Copy link
Collaborator

@apbose apbose commented Apr 14, 2025

Addresses the following for the cross_compile_for_windows feature-

  1. Slight code reorg
  2. replace cross_compile_flag with cross_compile_module
  3. Bug fix for 🐛 [Bug] Wrong output shape from cross compiled exported program #3400

@github-actions github-actions bot added component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Apr 14, 2025
@github-actions github-actions bot requested a review from peri044 April 14, 2025 20:35
@apbose apbose marked this pull request as draft April 14, 2025 20:35
# insert the no_placeholder node in the graph which should be replaced to the actual execute_engine node while load in the windows
trt_node = gm.graph.call_function(
torch.ops.tensorrt.no_op_placeholder_for_execute_engine.default,
(trt_module_node.args, *engine_info),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need to unpack this list?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We would still need to unpack the list. Else while loading in windows it shows

File "C:\Users\abose\Documents\work\TensorRT\torchTRT\Lib\site-packages\torch\_export\serde\serialize.py", line 2258, in deserialize_inputs
  args.append(actual_args[schema_arg.name])
        ~~~~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'name'

@apbose apbose marked this pull request as ready for review April 15, 2025 21:16
@@ -144,6 +144,7 @@ def no_op_placeholder_for_execute_engine(
serialized_hardware_compatible: str,
serialized_metadata: str,
serialized_target_platform: str,
serialized_require_output_allocator: str,
Copy link
Collaborator

@narendasan narendasan Apr 15, 2025

Choose a reason for hiding this comment

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

Move this placeholder op to runtime/meta_ops

getitem_nodes = trt_node.users
for idx, getitem_node in enumerate(getitem_nodes):
getitem_node.meta["val"] = trt_node.meta["val"][idx]
no_op_placeholder_node.replace_all_uses_with(trt_node)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a multi output testcase to the cross compile tests?

no_op_placeholder_node.replace_all_uses_with(trt_node)
getitem_nodes = trt_node.users
for idx, getitem_node in enumerate(getitem_nodes):
getitem_node.meta["val"] = trt_node.meta["val"][idx]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@narendasan this is the part which should address the bug

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: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths needs-release-cherrypick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants