Skip to content

feat: Dynamo refactor #2104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions py/torch_tensorrt/_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ def _get_target_ir(module_type: _ModuleType, ir: str) -> _IRType:
else:
if ir == "default":
# Options are listed in order of preference
if module_is_fxable:
logging.log(
logging.Level.Info, "ir was set to default, using dynamo as ir"
)
return _IRType.dynamo
elif module_is_tsable:
if module_is_tsable:
logging.log(
logging.Level.Warning,
"Input graph is a Torchscript module but the ir provided is default (dynamo). Please set ir=torchscript to suppress the warning. Compiling the module with ir=ts",
)
return _IRType.ts
elif module_is_fxable:
logging.log(
logging.Level.Info, "ir was set to default, using dynamo as ir"
)
return _IRType.dynamo
else:
raise ValueError("Module was provided in an unsupported format")
else:
Expand Down
5 changes: 5 additions & 0 deletions tests/py/dynamo/models/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_resnet18(ir):
"pass_through_build_failures": True,
"optimization_level": 1,
"min_block_size": 8,
"ir": "torch_compile",
}

trt_mod = torchtrt.compile(model, **compile_spec)
Expand Down Expand Up @@ -66,6 +67,7 @@ def test_mobilenet_v2(ir):
"pass_through_build_failures": True,
"optimization_level": 1,
"min_block_size": 8,
"ir": "torch_compile",
}

trt_mod = torchtrt.compile(model, **compile_spec)
Expand Down Expand Up @@ -99,6 +101,7 @@ def test_efficientnet_b0(ir):
"pass_through_build_failures": True,
"optimization_level": 1,
"min_block_size": 8,
"ir": "torch_compile",
}

trt_mod = torchtrt.compile(model, **compile_spec)
Expand Down Expand Up @@ -141,6 +144,7 @@ def test_bert_base_uncased(ir):
"pass_through_build_failures": True,
"optimization_level": 1,
"min_block_size": 8,
"ir": "torch_compile",
}
trt_mod = torchtrt.compile(model, **compile_spec)

Expand Down Expand Up @@ -178,6 +182,7 @@ def test_resnet18_half(ir):
"pass_through_build_failures": True,
"optimization_level": 1,
"min_block_size": 8,
"ir": "torch_compile",
}

trt_mod = torchtrt.compile(model, **compile_spec)
Expand Down
4 changes: 4 additions & 0 deletions tests/py/dynamo/models/test_models_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_resnet18(ir):
"pass_through_build_failures": True,
"optimization_level": 1,
"min_block_size": 8,
"ir": "dynamo",
}

trt_mod = torchtrt.compile(model, **compile_spec)
Expand Down Expand Up @@ -66,6 +67,7 @@ def test_mobilenet_v2(ir):
"pass_through_build_failures": True,
"optimization_level": 1,
"min_block_size": 8,
"ir": "dynamo",
}

trt_mod = torchtrt.compile(model, **compile_spec)
Expand Down Expand Up @@ -99,6 +101,7 @@ def test_efficientnet_b0(ir):
"pass_through_build_failures": True,
"optimization_level": 1,
"min_block_size": 8,
"ir": "dynamo",
}

trt_mod = torchtrt.compile(model, **compile_spec)
Expand Down Expand Up @@ -132,6 +135,7 @@ def test_resnet18_half(ir):
"pass_through_build_failures": True,
"optimization_level": 1,
"min_block_size": 8,
"ir": "dynamo",
}

trt_mod = torchtrt.compile(model, **compile_spec)
Expand Down