Skip to content

Conversation

@leimao
Copy link

@leimao leimao commented Nov 18, 2025

I believe there are some bugs due to typo in programming.

@meta-cla meta-cla bot added the cla signed label Nov 18, 2025
@github-actions github-actions bot added the component: api [C++] Issues re: C++ API label Nov 18, 2025
@github-actions github-actions bot requested a review from narendasan November 18, 2025 04:54
@github-actions github-actions bot added component: lowering Issues re: The lowering / preprocessing passes component: core Issues re: The core compiler labels Nov 18, 2025
}
}

DataType::DataType(c10::ScalarType t) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are type constructors not direct translators

TORCHTRT_CHECK(
t == at::MemoryFormat::Contiguous || t == at::MemoryFormat::ChannelsLast,
"Tensor format is unsupported (" << t << ")");

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same thing here, value is held by a TensorFormat object

Copy link
Author

Choose a reason for hiding this comment

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

I misread this one. For the purpose of clarity, I think we should use m prefix for object member variables. Will revert these.

@narendasan
Copy link
Collaborator

@leimao thanks for the PR. For the changes to the TS C++ API, these are not bugs. We define a set of wrapped enums that abstract the TRT and PyTorch versions. This makes it easier to write code that may mix the two APIs arbitrarily.

Also as with FX, we are strongly pushing people to use Dynamo + AOTInductor to replace TorchScript as it is now deprecated in PyTorch and will be removed in PyTorch 2.14

@leimao
Copy link
Author

leimao commented Nov 18, 2025

@leimao thanks for the PR. For the changes to the TS C++ API, these are not bugs. We define a set of wrapped enums that abstract the TRT and PyTorch versions. This makes it easier to write code that may mix the two APIs arbitrarily.

Also as with FX, we are strongly pushing people to use Dynamo + AOTInductor to replace TorchScript as it is now deprecated in PyTorch and will be removed in PyTorch 2.14

@narendasan I believe there is still a bug, please review again. Thanks.

[](Stack& stack) {
auto attn_mask = pop(stack).to<at::Tensor>();
if (attn_mask.scalar_type() == at::kBool) {
attn_mask = attn_mask;
Copy link
Author

Choose a reason for hiding this comment

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

This one is unnecessary and is very confusing.

switch (t) {
case at::MemoryFormat::ChannelsLast:
value = TensorFormat::kChannelsLast;
break;
Copy link
Author

Choose a reason for hiding this comment

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

This one fixes an oversight of the implementation.

Copy link
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

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

LGTM, Would reiterate again that the torchscript frontend is in maintenance mode so unless there are bugs we likely will not change the implementation much. But we are highly interested in collecting reasons why Dynamo isnt working for your use case if thats the reason you are using TS so we can work to get those gaps closed prior to torchscript being removed

@leimao
Copy link
Author

leimao commented Nov 18, 2025

The test failures seems to be irrelevant to my change. Some warnings were treated as errors by compiler flags.

@leimao
Copy link
Author

leimao commented Nov 19, 2025

LGTM, Would reiterate again that the torchscript frontend is in maintenance mode so unless there are bugs we likely will not change the implementation much. But we are highly interested in collecting reasons why Dynamo isnt working for your use case if thats the reason you are using TS so we can work to get those gaps closed prior to torchscript being removed

I think I mentioned Dynamo worked in my case. But for some reason, in a different environment, I only have a lower version of Torch-TensorRT which does not seem to have the Dynamo path. Is there any performance difference between the FX path and Dynamo path based on your experience?

Also could you please take a lot at the test failures?

Thanks @narendasan.

@narendasan
Copy link
Collaborator

Also could you please take a lot at the test failures?

Yeah if you rebase it should resolve those issues

Is there any performance difference between the FX path and Dynamo path based on your experience?

They should be mostly the same but we have not been actively optimizing the FX path since Dynamo has superseded FX

@leimao
Copy link
Author

leimao commented Nov 19, 2025

Also could you please take a lot at the test failures?

Yeah if you rebase it should resolve those issues

Is there any performance difference between the FX path and Dynamo path based on your experience?

They should be mostly the same but we have not been actively optimizing the FX path since Dynamo has superseded FX

I have a noob question. Please bear with me if I did not ask it correctly. Since Dynamo will also produce FX graph as intermediate representation, which should be the same or similar to the one captured by Torch FX, what's the advantage of Torch-TensorRT-Dynamo over Torch-TensorRT-FX? Thanks.

@narendasan
Copy link
Collaborator

Since Dynamo will also produce FX graph as intermediate representation, which should be the same or similar to the one captured by Torch FX, what's the advantage of Torch-TensorRT-Dynamo over Torch-TensorRT-FX? Thanks.

Dynamo has better graph capture, and a fixed op set called Core ATen. This means dynamo has reproducible graphs and strong op coverage. Dynamo also fully supports current generation serialization workflows and other advanced use cases like dynamic shape.

FX graphs can include basically any operator in PyTorch so its more likely to hit unsupported ops. Also there are more limitations in how the graphs are traced which makes it hard to use for production.

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

Labels

cla signed component: api [C++] Issues re: C++ API component: core Issues re: The core compiler component: lowering Issues re: The lowering / preprocessing passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants