Skip to content

Commit 92775f6

Browse files
committed
Revert windows solution. Not working
1 parent 66b40bd commit 92775f6

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

py/torch_tensorrt/dynamo/conversion/_TRTInterpreter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class UnsupportedOperatorException(RuntimeError):
7070

7171

7272
class TRTInterpreterResult(NamedTuple):
73-
engine: trt.ICudaEngine
73+
engine: trt.ICudaEngine | bytes
7474
input_names: Sequence[str]
7575
output_names: Sequence[str]
7676
weight_name_map: Optional[dict[Any, Any]]
@@ -596,7 +596,7 @@ def _save_weight_mapping(self) -> None:
596596
torch.cuda.empty_cache()
597597

598598
@needs_refit # type: ignore[misc]
599-
def _insert_engine_to_cache(self, hash_val: str, engine: bytes) -> None:
599+
def _insert_engine_to_cache(self, hash_val: str, engine: trt.ICudaEngine) -> None:
600600
serialized_engine = engine.serialize()
601601
# TODO: @Evan is waiting for TRT's feature to cache the weight-stripped engine
602602
# if not self.compilation_settings.strip_engine_weights:

py/torch_tensorrt/dynamo/utils.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -882,32 +882,3 @@ def release_memory() -> None:
882882
logger.warning("Failed to release CPU memory.")
883883
except Exception:
884884
logger.warning("Failed to release CPU memory.")
885-
886-
elif platform.system() == "Windows":
887-
from ctypes import wintypes
888-
889-
kernel32 = ctypes.WinDLL("kernel32", use_last_error=True)
890-
psapi = ctypes.WinDLL("psapi", use_last_error=True)
891-
892-
GetCurrentProcess = kernel32.GetCurrentProcess
893-
GetCurrentProcess.restype = wintypes.HANDLE
894-
hproc = GetCurrentProcess()
895-
896-
HeapSetInformation = kernel32.HeapSetInformation
897-
HeapSetInformation.argtypes = [
898-
wintypes.HANDLE,
899-
ctypes.c_int,
900-
ctypes.c_void_p,
901-
ctypes.c_size_t,
902-
]
903-
HeapSetInformation.restype = wintypes.BOOL
904-
GetProcessHeap = kernel32.GetProcessHeap
905-
GetProcessHeap.restype = wintypes.HANDLE
906-
ok = False
907-
try:
908-
HeapOptimizeResources = 3
909-
hheap = GetProcessHeap()
910-
if HeapSetInformation(hheap, HeapOptimizeResources, None, 0):
911-
ok = True
912-
except Exception:
913-
logger.warning("Failed to release CPU memory.")

0 commit comments

Comments
 (0)