Skip to content

Commit 4726ed6

Browse files
tp5uiuclanluo-nvidia
authored andcommitted
tests: hide torch-trt DLLs on Windows too (#4343)
1 parent dfcbf0e commit 4726ed6

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

tests/py/dynamo/models/_cross_runtime_load_helper.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import argparse
2121
import glob
2222
import os
23+
import sys
2324

2425

2526
def _build_small_conv_model(torch):
@@ -76,11 +77,20 @@ def _hide_so_files(pkg_dir: str) -> list[tuple[str, str]]:
7677
lib_dir = os.path.join(pkg_dir, "lib")
7778
if not os.path.isdir(lib_dir):
7879
return []
80+
# Linux/macOS uses `libtorchtrt*` (the `lib` prefix); Windows uses
81+
# `torchtrt*.dll` / `torchtrt*.lib` (no prefix). See ``_features.py``
82+
# for the matching read side.
83+
patterns = (
84+
["torchtrt*.dll", "torchtrt*.lib"]
85+
if sys.platform.startswith("win")
86+
else ["libtorchtrt*"]
87+
)
7988
moved: list[tuple[str, str]] = []
80-
for path in glob.glob(os.path.join(lib_dir, "libtorchtrt*")):
81-
bak = path + ".bak"
82-
os.rename(path, bak)
83-
moved.append((bak, path))
89+
for pattern in patterns:
90+
for path in glob.glob(os.path.join(lib_dir, pattern)):
91+
bak = path + ".bak"
92+
os.rename(path, bak)
93+
moved.append((bak, path))
8494
return moved
8595

8696

0 commit comments

Comments
 (0)