Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/runtime/register_jit_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ static auto TORCHTRT_UNUSED TRTEngineTSRegistrtion =
.def("__str__", &TRTEngine::to_str)
.def("__repr__", &TRTEngine::to_str)
.def("__obj_flatten__", &TRTEngine::__obj_flatten__)
// Reporting "real" below puts the engine itself into torch's fake tensor
// dispatch cache key, and that cache compares keys with ==. Without this the
// second lookup raises "'__eq__' is not implemented", which breaks any
// re-export of a compiled module. Two handles to one engine are one engine.
.def(
"__eq__",
[](const c10::intrusive_ptr<TRTEngine>& self, const c10::intrusive_ptr<TRTEngine>& other) -> bool {
return self.get() == other.get();
})
// Reporting "real" makes torch's tracing_with_real skip fakification and hand
// the engine itself to the meta kernel, which reads only
// get_serialized_metadata() -- nothing executes or mutates it. Otherwise each
Expand Down
9 changes: 2 additions & 7 deletions tests/py/dynamo/conversion/test_cumsum_aten.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def forward(self, x):
)
return

self.run_test(
Cumsum(), inputs, immutable_weights=False, use_dynamo_tracer=True
)
self.run_test(Cumsum(), inputs, immutable_weights=False, use_dynamo_tracer=True)

@parameterized.expand(
[
Expand Down Expand Up @@ -108,10 +106,7 @@ def forward(self, x):
== opt_shape[positive_dim]
== max_shape[positive_dim]
)
if (
has_static_trip_count
and not is_tensorrt_rtx_version_supported("1.7")
):
if has_static_trip_count and not is_tensorrt_rtx_version_supported("1.7"):
with self.assertRaises(UnsupportedOperatorException):
self.run_test_with_dynamic_shape(
Cumsum(),
Expand Down
Loading