Skip to content

Commit 87fc615

Browse files
authored
Merge pull request #2397 from pytorch/DLFW_main_changes
DLFW changes
2 parents 96fe09a + cc7cd06 commit 87fc615

File tree

2 files changed

+101
-88
lines changed

2 files changed

+101
-88
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
tensorboard>=1.14.0
22
protobuf==3.20.*
33
nvidia-pyindex
4-
--extra-index-url https://pypi.ngc.nvidia.com
5-
pytorch-quantization>=2.1.2
4+
--extra-index-url https://pypi.nvidia.com
5+
pytorch-quantization
66
tqdm

noxfile.py

Lines changed: 99 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
from distutils.command.clean import clean
2-
import nox
31
import os
42
import sys
3+
from distutils.command.clean import clean
4+
5+
import nox
56

67
# Use system installed Python packages
78
PYT_PATH = (
@@ -203,11 +204,11 @@ def run_base_tests(session):
203204
session.run_always("pytest", test)
204205

205206

206-
def run_fx_core_tests(session):
207-
print("Running FX core tests")
208-
session.chdir(os.path.join(TOP_DIR, "py/torch_tensorrt/fx/test"))
207+
def run_dynamo_backend_tests(session):
208+
print("Running Dynamo core tests")
209+
session.chdir(os.path.join(TOP_DIR, "tests/py/dynamo/"))
209210
tests = [
210-
"core",
211+
"backend",
211212
]
212213
for test in tests:
213214
if USE_HOST_DEPS:
@@ -216,65 +217,46 @@ def run_fx_core_tests(session):
216217
session.run_always("pytest", test)
217218

218219

219-
def run_fx_converter_tests(session):
220-
print("Running FX converter tests")
221-
session.chdir(os.path.join(TOP_DIR, "py/torch_tensorrt/fx/test"))
220+
def run_dynamo_converter_tests(session):
221+
print("Running Dynamo converter tests")
222+
session.chdir(os.path.join(TOP_DIR, "tests/py/dynamo/"))
222223
tests = [
223-
"converters",
224+
"conversion",
224225
]
225-
# Skipping this test as it fails inside NGC container with the following error.
226-
# Error Code 4: Internal Error (Could not find any implementation for node conv due to insufficient workspace. See verbose log for requested sizes.)
227-
skip_tests = "-k not conv3d"
228226
for test in tests:
229227
if USE_HOST_DEPS:
230-
session.run_always("pytest", test, skip_tests, env={"PYTHONPATH": PYT_PATH})
228+
session.run_always("pytest", test, env={"PYTHONPATH": PYT_PATH})
231229
else:
232-
session.run_always("pytest", test, skip_tests)
230+
session.run_always("pytest", test)
233231

234232

235-
def run_fx_lower_tests(session):
236-
print("Running FX passes and trt_lower tests")
237-
session.chdir(os.path.join(TOP_DIR, "py/torch_tensorrt/fx/test"))
238-
tests = [
239-
"passes/test_multi_fuse_trt.py",
240-
# "passes/test_fuse_permute_linear_trt.py",
241-
"passes/test_remove_duplicate_output_args.py",
242-
"passes/test_fuse_permute_matmul_trt.py",
243-
# "passes/test_graph_opts.py"
244-
"trt_lower",
245-
]
233+
def run_dynamo_lower_tests(session):
234+
print("Running Dynamo lowering passes")
235+
session.chdir(os.path.join(TOP_DIR, "tests/py/dynamo/"))
236+
tests = ["lowering"]
246237
for test in tests:
247238
if USE_HOST_DEPS:
248239
session.run_always("pytest", test, env={"PYTHONPATH": PYT_PATH})
249240
else:
250241
session.run_always("pytest", test)
251242

252243

253-
def run_fx_quant_tests(session):
254-
print("Running FX Quant tests")
255-
session.chdir(os.path.join(TOP_DIR, "py/torch_tensorrt/fx/test"))
256-
tests = [
257-
"quant",
258-
]
259-
# Skipping this test as it fails inside NGC container with the following error.
260-
# ImportError: cannot import name 'ObservationType' from 'torch.ao.quantization.backend_config.observation_type'
261-
skip_tests = "-k not conv_add_standalone_module"
244+
def run_dynamo_partitioning_tests(session):
245+
print("Running Dynamo Partitioning tests")
246+
session.chdir(os.path.join(TOP_DIR, "tests/py/dynamo/"))
247+
tests = ["partitioning"]
262248
for test in tests:
263249
if USE_HOST_DEPS:
264-
session.run_always("pytest", test, skip_tests, env={"PYTHONPATH": PYT_PATH})
250+
session.run_always("pytest", test, env={"PYTHONPATH": PYT_PATH})
265251
else:
266-
session.run_always("pytest", test, skip_tests)
252+
session.run_always("pytest", test)
267253

268254

269-
def run_fx_tracer_tests(session):
270-
print("Running FX Tracer tests")
271-
session.chdir(os.path.join(TOP_DIR, "py/torch_tensorrt/fx/test"))
272-
# skipping a test since it depends on torchdynamo
273-
# Enable this test once NGC moves to latest pytorch which has dynamo integrated.
255+
def run_dynamo_runtime_tests(session):
256+
print("Running Dynamo Runtime tests")
257+
session.chdir(os.path.join(TOP_DIR, "tests/py/dynamo/"))
274258
tests = [
275-
"tracer/test_acc_shape_prop.py",
276-
"tracer/test_acc_tracer.py",
277-
# "tracer/test_dispatch_tracer.py"
259+
"runtime",
278260
]
279261
for test in tests:
280262
if USE_HOST_DEPS:
@@ -283,30 +265,36 @@ def run_fx_tracer_tests(session):
283265
session.run_always("pytest", test)
284266

285267

286-
def run_fx_tools_tests(session):
287-
print("Running FX tools tests")
288-
session.chdir(os.path.join(TOP_DIR, "py/torch_tensorrt/fx/test"))
268+
def run_dynamo_model_compile_tests(session):
269+
print("Running model torch-compile tests")
270+
session.chdir(os.path.join(TOP_DIR, "tests/py/dynamo/models"))
289271
tests = [
290-
"tools",
272+
"test_models.py",
291273
]
292274
for test in tests:
293275
if USE_HOST_DEPS:
294-
session.run_always("pytest", test, env={"PYTHONPATH": PYT_PATH})
276+
session.run_always(
277+
"python",
278+
test,
279+
"--ir",
280+
str("torch_compile"),
281+
env={"PYTHONPATH": PYT_PATH},
282+
)
295283
else:
296-
session.run_always("pytest", test)
284+
session.run_always("python", test, "--ir", str("torch_compile"))
297285

298286

299-
def run_model_tests(session):
300-
print("Running model tests")
301-
session.chdir(os.path.join(TOP_DIR, "tests/py/ts"))
302-
tests = [
303-
"models",
304-
]
287+
def run_dynamo_model_export_tests(session):
288+
print("Running model torch-export tests")
289+
session.chdir(os.path.join(TOP_DIR, "tests/py/dynamo/models"))
290+
tests = ["test_models_export.py", "test_export_serde.py"]
305291
for test in tests:
306292
if USE_HOST_DEPS:
307-
session.run_always("pytest", test, env={"PYTHONPATH": PYT_PATH})
293+
session.run_always(
294+
"python", test, "--ir", str("dynamo"), env={"PYTHONPATH": PYT_PATH}
295+
)
308296
else:
309-
session.run_always("pytest", test)
297+
session.run_always("python", test, "--ir", str("dynamo"))
310298

311299

312300
def run_accuracy_tests(session):
@@ -403,37 +391,61 @@ def run_l0_api_tests(session):
403391
cleanup(session)
404392

405393

406-
def run_l0_fx_tests(session):
394+
def run_l0_dynamo_tests(session):
395+
if not USE_HOST_DEPS:
396+
install_deps(session)
397+
install_torch_trt(session)
398+
run_dynamo_backend_tests(session)
399+
run_dynamo_converter_tests(session)
400+
run_dynamo_lower_tests(session)
401+
cleanup(session)
402+
403+
404+
def run_l0_dynamo_backend_tests(session):
405+
if not USE_HOST_DEPS:
406+
install_deps(session)
407+
install_torch_trt(session)
408+
run_dynamo_backend_tests(session)
409+
cleanup(session)
410+
411+
412+
def run_l0_dynamo_converter_tests(session):
413+
if not USE_HOST_DEPS:
414+
install_deps(session)
415+
install_torch_trt(session)
416+
run_dynamo_converter_tests(session)
417+
cleanup(session)
418+
419+
420+
def run_l0_dynamo_lower_tests(session):
407421
if not USE_HOST_DEPS:
408422
install_deps(session)
409423
install_torch_trt(session)
410-
run_fx_core_tests(session)
411-
run_fx_converter_tests(session)
412-
run_fx_lower_tests(session)
424+
run_dynamo_lower_tests(session)
413425
cleanup(session)
414426

415427

416-
def run_l0_fx_core_tests(session):
428+
def run_l0_dynamo_model_tests(session):
417429
if not USE_HOST_DEPS:
418430
install_deps(session)
419431
install_torch_trt(session)
420-
run_fx_core_tests(session)
432+
run_dynamo_model_tests(session)
421433
cleanup(session)
422434

423435

424-
def run_l0_fx_converter_tests(session):
436+
def run_l0_dynamo_partitioning_tests(session):
425437
if not USE_HOST_DEPS:
426438
install_deps(session)
427439
install_torch_trt(session)
428-
run_fx_converter_tests(session)
440+
run_dynamo_partitioning_tests(session)
429441
cleanup(session)
430442

431443

432-
def run_l0_fx_lower_tests(session):
444+
def run_l0_dynamo_runtime_tests(session):
433445
if not USE_HOST_DEPS:
434446
install_deps(session)
435447
install_torch_trt(session)
436-
run_fx_lower_tests(session)
448+
run_dynamo_runtime_tests(session)
437449
cleanup(session)
438450

439451

@@ -446,12 +458,13 @@ def run_l0_dla_tests(session):
446458
cleanup(session)
447459

448460

449-
def run_l1_model_tests(session):
461+
def run_dynamo_model_tests(session):
450462
if not USE_HOST_DEPS:
451463
install_deps(session)
452464
install_torch_trt(session)
453465
download_models(session)
454-
run_model_tests(session)
466+
run_dynamo_model_compile_tests(session)
467+
run_dynamo_model_export_tests(session)
455468
cleanup(session)
456469

457470

@@ -465,13 +478,13 @@ def run_l1_int8_accuracy_tests(session):
465478
cleanup(session)
466479

467480

468-
def run_l1_fx_tests(session):
481+
def run_l1_dynamo_tests(session):
469482
if not USE_HOST_DEPS:
470483
install_deps(session)
471484
install_torch_trt(session)
472-
run_fx_quant_tests(session)
473-
run_fx_tracer_tests(session)
474-
run_fx_tools_tests(session)
485+
run_dynamo_model_tests(session)
486+
run_dynamo_partitioning_tests(session)
487+
run_dynamo_runtime_tests(session)
475488
cleanup(session)
476489

477490

@@ -499,27 +512,27 @@ def l0_api_tests(session):
499512

500513

501514
@nox.session(python=SUPPORTED_PYTHON_VERSIONS, reuse_venv=True)
502-
def l0_fx_tests(session):
515+
def l0_dynamo_tests(session):
503516
"""When a developer needs to check correctness for a PR or something"""
504-
run_l0_fx_tests(session)
517+
run_l0_dynamo_tests(session)
505518

506519

507520
@nox.session(python=SUPPORTED_PYTHON_VERSIONS, reuse_venv=True)
508-
def l0_fx_core_tests(session):
521+
def l0_dynamo_backend_tests(session):
509522
"""When a developer needs to check correctness for a PR or something"""
510-
run_l0_fx_core_tests(session)
523+
run_l0_dynamo_backend_tests(session)
511524

512525

513526
@nox.session(python=SUPPORTED_PYTHON_VERSIONS, reuse_venv=True)
514-
def l0_fx_converter_tests(session):
527+
def l0_dynamo_converter_tests(session):
515528
"""When a developer needs to check correctness for a PR or something"""
516-
run_l0_fx_converter_tests(session)
529+
run_l0_dynamo_converter_tests(session)
517530

518531

519532
@nox.session(python=SUPPORTED_PYTHON_VERSIONS, reuse_venv=True)
520-
def l0_fx_lower_tests(session):
533+
def l0_dynamo_lower_tests(session):
521534
"""When a developer needs to check correctness for a PR or something"""
522-
run_l0_fx_lower_tests(session)
535+
run_l0_dynamo_lower_tests(session)
523536

524537

525538
@nox.session(python=SUPPORTED_PYTHON_VERSIONS, reuse_venv=True)
@@ -531,13 +544,13 @@ def l0_dla_tests(session):
531544
@nox.session(python=SUPPORTED_PYTHON_VERSIONS, reuse_venv=True)
532545
def l1_model_tests(session):
533546
"""When a user needs to test the functionality of standard models compilation and results"""
534-
run_l1_model_tests(session)
547+
run_dynamo_model_tests(session)
535548

536549

537550
@nox.session(python=SUPPORTED_PYTHON_VERSIONS, reuse_venv=True)
538-
def l1_fx_tests(session):
551+
def l1_dynamo_tests(session):
539552
"""When a user needs to test the functionality of standard models compilation and results"""
540-
run_l1_fx_tests(session)
553+
run_l1_dynamo_tests(session)
541554

542555

543556
@nox.session(python=SUPPORTED_PYTHON_VERSIONS, reuse_venv=True)

0 commit comments

Comments
 (0)