Skip to content

Commit e68f528

Browse files
authored
changing the setting_to_be_engine_invariant from tuple to set (#3984)
1 parent d823f82 commit e68f528

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

py/torch_tensorrt/dynamo/_engine_cache.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def canonicalize_graph(graph: torch.fx.Graph) -> str:
8888
input_specs_hash = sha256_hash(input_specs_data)
8989

9090
invariant_engine_specs = [
91-
str(getattr(settings, field)) for field in _SETTINGS_TO_BE_ENGINE_INVARIANT
91+
str(getattr(settings, field))
92+
for field in sorted(_SETTINGS_TO_BE_ENGINE_INVARIANT)
9293
]
9394
with io.BytesIO() as stream:
9495
engine_specs_data = pickle.dumps(invariant_engine_specs)

py/torch_tensorrt/dynamo/_settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def __setstate__(self, state: dict[str, Any]) -> None:
191191

192192

193193
# If any of the following setting is changed, the engine should be rebuilt.
194-
_SETTINGS_TO_BE_ENGINE_INVARIANT = (
194+
_SETTINGS_TO_BE_ENGINE_INVARIANT = {
195195
"enabled_precisions",
196196
"max_aux_streams",
197197
"version_compatible",
@@ -212,7 +212,7 @@ def __setstate__(self, state: dict[str, Any]) -> None:
212212
"autocast_max_output_threshold",
213213
"autocast_max_depth_of_reduction",
214214
"autocast_calibration_dataloader",
215-
)
215+
}
216216

217217

218218
if not hasattr(trt.SerializationFlag, "INCLUDE_REFIT"): # for TensorRT < 10.14

0 commit comments

Comments
 (0)