1
- from distutils .command .clean import clean
2
- import nox
3
1
import os
4
2
import sys
3
+ from distutils .command .clean import clean
4
+
5
+ import nox
5
6
6
7
# Use system installed Python packages
7
8
PYT_PATH = (
@@ -203,11 +204,11 @@ def run_base_tests(session):
203
204
session .run_always ("pytest" , test )
204
205
205
206
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/ " ))
209
210
tests = [
210
- "core " ,
211
+ "backend " ,
211
212
]
212
213
for test in tests :
213
214
if USE_HOST_DEPS :
@@ -216,65 +217,46 @@ def run_fx_core_tests(session):
216
217
session .run_always ("pytest" , test )
217
218
218
219
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/ " ))
222
223
tests = [
223
- "converters " ,
224
+ "conversion " ,
224
225
]
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"
228
226
for test in tests :
229
227
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 })
231
229
else :
232
- session .run_always ("pytest" , test , skip_tests )
230
+ session .run_always ("pytest" , test )
233
231
234
232
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" ]
246
237
for test in tests :
247
238
if USE_HOST_DEPS :
248
239
session .run_always ("pytest" , test , env = {"PYTHONPATH" : PYT_PATH })
249
240
else :
250
241
session .run_always ("pytest" , test )
251
242
252
243
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" ]
262
248
for test in tests :
263
249
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 })
265
251
else :
266
- session .run_always ("pytest" , test , skip_tests )
252
+ session .run_always ("pytest" , test )
267
253
268
254
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/" ))
274
258
tests = [
275
- "tracer/test_acc_shape_prop.py" ,
276
- "tracer/test_acc_tracer.py" ,
277
- # "tracer/test_dispatch_tracer.py"
259
+ "runtime" ,
278
260
]
279
261
for test in tests :
280
262
if USE_HOST_DEPS :
@@ -283,30 +265,36 @@ def run_fx_tracer_tests(session):
283
265
session .run_always ("pytest" , test )
284
266
285
267
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 " ))
289
271
tests = [
290
- "tools " ,
272
+ "test_models.py " ,
291
273
]
292
274
for test in tests :
293
275
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
+ )
295
283
else :
296
- session .run_always ("pytest " , test )
284
+ session .run_always ("python " , test , "--ir" , str ( "torch_compile" ) )
297
285
298
286
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" ]
305
291
for test in tests :
306
292
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
+ )
308
296
else :
309
- session .run_always ("pytest " , test )
297
+ session .run_always ("python " , test , "--ir" , str ( "dynamo" ) )
310
298
311
299
312
300
def run_accuracy_tests (session ):
@@ -403,37 +391,61 @@ def run_l0_api_tests(session):
403
391
cleanup (session )
404
392
405
393
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 ):
407
421
if not USE_HOST_DEPS :
408
422
install_deps (session )
409
423
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 )
413
425
cleanup (session )
414
426
415
427
416
- def run_l0_fx_core_tests (session ):
428
+ def run_l0_dynamo_model_tests (session ):
417
429
if not USE_HOST_DEPS :
418
430
install_deps (session )
419
431
install_torch_trt (session )
420
- run_fx_core_tests (session )
432
+ run_dynamo_model_tests (session )
421
433
cleanup (session )
422
434
423
435
424
- def run_l0_fx_converter_tests (session ):
436
+ def run_l0_dynamo_partitioning_tests (session ):
425
437
if not USE_HOST_DEPS :
426
438
install_deps (session )
427
439
install_torch_trt (session )
428
- run_fx_converter_tests (session )
440
+ run_dynamo_partitioning_tests (session )
429
441
cleanup (session )
430
442
431
443
432
- def run_l0_fx_lower_tests (session ):
444
+ def run_l0_dynamo_runtime_tests (session ):
433
445
if not USE_HOST_DEPS :
434
446
install_deps (session )
435
447
install_torch_trt (session )
436
- run_fx_lower_tests (session )
448
+ run_dynamo_runtime_tests (session )
437
449
cleanup (session )
438
450
439
451
@@ -446,12 +458,13 @@ def run_l0_dla_tests(session):
446
458
cleanup (session )
447
459
448
460
449
- def run_l1_model_tests (session ):
461
+ def run_dynamo_model_tests (session ):
450
462
if not USE_HOST_DEPS :
451
463
install_deps (session )
452
464
install_torch_trt (session )
453
465
download_models (session )
454
- run_model_tests (session )
466
+ run_dynamo_model_compile_tests (session )
467
+ run_dynamo_model_export_tests (session )
455
468
cleanup (session )
456
469
457
470
@@ -465,13 +478,13 @@ def run_l1_int8_accuracy_tests(session):
465
478
cleanup (session )
466
479
467
480
468
- def run_l1_fx_tests (session ):
481
+ def run_l1_dynamo_tests (session ):
469
482
if not USE_HOST_DEPS :
470
483
install_deps (session )
471
484
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 )
475
488
cleanup (session )
476
489
477
490
@@ -499,27 +512,27 @@ def l0_api_tests(session):
499
512
500
513
501
514
@nox .session (python = SUPPORTED_PYTHON_VERSIONS , reuse_venv = True )
502
- def l0_fx_tests (session ):
515
+ def l0_dynamo_tests (session ):
503
516
"""When a developer needs to check correctness for a PR or something"""
504
- run_l0_fx_tests (session )
517
+ run_l0_dynamo_tests (session )
505
518
506
519
507
520
@nox .session (python = SUPPORTED_PYTHON_VERSIONS , reuse_venv = True )
508
- def l0_fx_core_tests (session ):
521
+ def l0_dynamo_backend_tests (session ):
509
522
"""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 )
511
524
512
525
513
526
@nox .session (python = SUPPORTED_PYTHON_VERSIONS , reuse_venv = True )
514
- def l0_fx_converter_tests (session ):
527
+ def l0_dynamo_converter_tests (session ):
515
528
"""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 )
517
530
518
531
519
532
@nox .session (python = SUPPORTED_PYTHON_VERSIONS , reuse_venv = True )
520
- def l0_fx_lower_tests (session ):
533
+ def l0_dynamo_lower_tests (session ):
521
534
"""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 )
523
536
524
537
525
538
@nox .session (python = SUPPORTED_PYTHON_VERSIONS , reuse_venv = True )
@@ -531,13 +544,13 @@ def l0_dla_tests(session):
531
544
@nox .session (python = SUPPORTED_PYTHON_VERSIONS , reuse_venv = True )
532
545
def l1_model_tests (session ):
533
546
"""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 )
535
548
536
549
537
550
@nox .session (python = SUPPORTED_PYTHON_VERSIONS , reuse_venv = True )
538
- def l1_fx_tests (session ):
551
+ def l1_dynamo_tests (session ):
539
552
"""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 )
541
554
542
555
543
556
@nox .session (python = SUPPORTED_PYTHON_VERSIONS , reuse_venv = True )
0 commit comments