Skip to content
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

cross compile for windows #3220

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
458a4d1
skip run_shape_analysis
lanluo-nvidia Oct 6, 2024
2f408f9
test
lanluo-nvidia Oct 6, 2024
1c5e86c
test
lanluo-nvidia Oct 6, 2024
ba487dc
test
lanluo-nvidia Oct 6, 2024
99d2274
Merge branch 'main' into lluo/save_remove_inputs
lanluo-nvidia Oct 6, 2024
2b43480
test
lanluo-nvidia Oct 6, 2024
92105ce
cross compile for windows initial check in
lanluo-nvidia Oct 7, 2024
dd24bdf
test
lanluo-nvidia Oct 7, 2024
e6c9fa4
add testcase
lanluo-nvidia Oct 7, 2024
9909eca
add test case
lanluo-nvidia Oct 8, 2024
312a79e
add test case
lanluo-nvidia Oct 8, 2024
b4e02e1
Merge branch 'main' into lluo/save_remove_inputs
lanluo-nvidia Oct 11, 2024
3d94f8b
test
lanluo-nvidia Oct 13, 2024
f43669a
Merge branch 'lluo/save_remove_inputs' into lluo/cross_compilation_fo…
lanluo-nvidia Oct 13, 2024
f4d0d27
test
lanluo-nvidia Oct 14, 2024
2a43ca1
add more logs
lanluo-nvidia Oct 14, 2024
76ddd66
test
lanluo-nvidia Oct 15, 2024
28ba6cc
Merge branch 'main' into lluo/save_remove_inputs
lanluo-nvidia Oct 15, 2024
b89cbe0
resolve comments
lanluo-nvidia Oct 15, 2024
079c4be
test
lanluo-nvidia Oct 15, 2024
90f1a60
clean up
lanluo-nvidia Oct 16, 2024
c38dc5b
test
lanluo-nvidia Oct 16, 2024
2843d37
Merge branch 'main' into lluo/save_remove_inputs
lanluo-nvidia Oct 16, 2024
b06a41b
Merge branch 'lluo/save_remove_inputs' into lluo/cross_compilation_fo…
lanluo-nvidia Oct 16, 2024
3eb48d7
test
lanluo-nvidia Oct 16, 2024
fedc5c2
Merge branch 'lluo/save_remove_inputs' into lluo/cross_compilation_fo…
lanluo-nvidia Oct 16, 2024
50eb0d8
replace dummy inference
lanluo-nvidia Oct 20, 2024
95ed602
test
lanluo-nvidia Oct 20, 2024
120f30d
test
lanluo-nvidia Oct 21, 2024
424cbf7
add run_test_with_dynamic_shape change
lanluo-nvidia Oct 21, 2024
2fc9cef
Merge branch 'main' into lluo/save_remove_inputs
lanluo-nvidia Oct 21, 2024
ef54cfc
split the PR, add dummy inference for converter test
lanluo-nvidia Oct 21, 2024
14f5d61
test
lanluo-nvidia Oct 22, 2024
7563959
test
lanluo-nvidia Oct 22, 2024
77355f0
test
lanluo-nvidia Oct 22, 2024
13361fd
add linear lowering meta val
lanluo-nvidia Oct 22, 2024
f0a9fef
add linear_lowering change
lanluo-nvidia Oct 23, 2024
cff64a4
test
lanluo-nvidia Oct 23, 2024
933abac
test
lanluo-nvidia Oct 23, 2024
8417684
resolve comments
lanluo-nvidia Oct 25, 2024
8676f88
test
lanluo-nvidia Oct 25, 2024
785d0b1
change solution: use no_op_placeholder during save and replace it wit…
lanluo-nvidia Oct 26, 2024
b85cb74
Merge branch 'lluo/save_remove_inputs' into lluo/cross_compilation_fo…
lanluo-nvidia Oct 26, 2024
5d594b1
test
lanluo-nvidia Oct 26, 2024
076f47a
resolve comments
lanluo-nvidia Oct 29, 2024
8250179
Merge branch 'main' into lluo/save_remove_inputs
lanluo-nvidia Oct 29, 2024
96e93e4
resolve comments
lanluo-nvidia Oct 29, 2024
7d055bf
Merge branch 'lluo/save_remove_inputs' into lluo/cross_compilation_fo…
lanluo-nvidia Oct 30, 2024
6e214d6
Merge branch 'main' into lluo/cross_compilation_for_windows
lanluo-nvidia Oct 30, 2024
cf0e0ae
resolve comments
lanluo-nvidia Oct 30, 2024
fb7fd1d
resolve comments
lanluo-nvidia Oct 31, 2024
8fc89dc
resolve comments
lanluo-nvidia Oct 31, 2024
63b3376
Merge branch 'main' into lluo/cross_compilation_for_windows
lanluo-nvidia Nov 1, 2024
1a1ba41
merge latest main
lanluo-nvidia Nov 1, 2024
96bc256
fix linting
lanluo-nvidia Nov 1, 2024
eebe1bc
test
lanluo-nvidia Nov 1, 2024
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
Prev Previous commit
Next Next commit
resolve comments
  • Loading branch information
lanluo-nvidia committed Oct 15, 2024
commit b89cbe00846862537e5ad648bc487b026c51f320
12 changes: 6 additions & 6 deletions py/torch_tensorrt/_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ def save(
)
else:
if arg_inputs is not None:
raise ValueError(
"Provided model is a torch.jit.ScriptModule, do not allow user to provide inputs or arg_inputs."
logger.warning(
"Provided model is a torch.jit.ScriptModule, inputs or arg_inputs is not necessary during save."
)
torch.jit.save(module, file_path)
elif module_type == _ModuleType.ep:
Expand All @@ -514,8 +514,8 @@ def save(
)
else:
if arg_inputs is not None:
raise ValueError(
"Provided model is a torch.export.ExportedProgram, do not allow user to provide inputs or arg_inputs during save, it should be provided during export and compile stage"
logger.warning(
"Provided model is a torch.export.ExportedProgram, inputs or arg_inputs is not necessary during save, it uses the inputs or arg_inputs provided during export and compile"
)
torch.export.save(module, file_path)
elif module_type == _ModuleType.fx:
Expand All @@ -531,8 +531,8 @@ def save(
from torch_tensorrt.dynamo._exporter import export

if arg_inputs is not None:
raise ValueError(
"Provided model is a torch.fx.GraphModule and retrace is False, do not allow user to provide inputs or arg_inputs."
logger.warning(
"Provided model is a torch.fx.GraphModule and retrace is False, inputs or arg_inputs is not necessary during save."
)
exp_program = export(module)
torch.export.save(exp_program, file_path)
Expand Down
2 changes: 1 addition & 1 deletion py/torch_tensorrt/dynamo/_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def convert_exported_program_to_serialized_trt_engine(
CONVERTERS.set_compilation_settings(settings)

try:
_, interpreter_result = interpret_module_to_result(
interpreter_result, _ = interpret_module_to_result(
gm,
inputs=flattened_input_list,
arg_inputs=arg_input_list,
Expand Down
6 changes: 2 additions & 4 deletions py/torch_tensorrt/dynamo/_refit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
from torch_tensorrt.dynamo import partitioning
from torch_tensorrt.dynamo._exporter import inline_torch_modules
from torch_tensorrt.dynamo._settings import CompilationSettings
from torch_tensorrt.dynamo.conversion._conversion import (
infer_module_output_shapes_dtypes,
)
from torch_tensorrt.dynamo.conversion._conversion import infer_module_outputs
from torch_tensorrt.dynamo.conversion._ConverterRegistry import (
DYNAMO_CONVERTERS as CONVERTERS,
)
Expand Down Expand Up @@ -74,7 +72,7 @@ def construct_refit_mapping(
"CONSTANT": (trt.IConstantLayer, [("weights", "CONSTANT")]),
}

_, output_dtypes = infer_module_output_shapes_dtypes(
_, output_dtypes = infer_module_outputs(
module,
inputs,
settings.device,
Expand Down
12 changes: 6 additions & 6 deletions py/torch_tensorrt/dynamo/conversion/_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
logger = logging.getLogger(__name__)


def infer_module_output_shapes_dtypes(
def infer_module_outputs(
module: torch.fx.GraphModule,
inputs: Sequence[Input],
device: Device,
Expand Down Expand Up @@ -84,7 +84,7 @@ def interpret_module_to_result(
arg_inputs: Optional[Sequence[Input]] = None,
kwarg_inputs: Optional[dict[str, Any]] = None,
engine_cache: Optional[BaseEngineCache] = None,
) -> Tuple[List[Tuple[int]], TRTInterpreterResult]:
) -> Tuple[TRTInterpreterResult, List[Tuple[int]]]:
"""Interpret an FX module to the output shapes and a TRTInterpreterResult
Args:
module: FX GraphModule to interpret
Expand All @@ -95,10 +95,10 @@ def interpret_module_to_result(
settings: Compilation settings
engine_cache: Engine cache instance
Returns:
(List[Tuple[int]], TRTInterpreterResult)
(TRTInterpreterResult, List[Tuple[int]])
"""
if arg_inputs is not None:
output_shapes, output_dtypes = infer_module_output_shapes_dtypes(
output_shapes, output_dtypes = infer_module_outputs(
module,
arg_inputs,
settings.device,
Expand All @@ -107,7 +107,7 @@ def interpret_module_to_result(
)
else:
# args and kwargs are combined and flattened to one list
output_shapes, output_dtypes = infer_module_output_shapes_dtypes(
output_shapes, output_dtypes = infer_module_outputs(
module,
inputs,
settings.device,
Expand Down Expand Up @@ -145,7 +145,7 @@ def convert_module(
PythonTorchTensorRTModule or TorchTensorRTModule
"""

output_shapes, interpreter_result = interpret_module_to_result(
interpreter_result, output_shapes = interpret_module_to_result(
module, inputs, settings, engine_cache=engine_cache
)

Expand Down
8 changes: 3 additions & 5 deletions tests/py/dynamo/conversion/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

# Use interpreter, input spec, and test case from fx_ts_compat to test Dynamo Converter Registry
from torch_tensorrt.dynamo.conversion import TRTInterpreter
from torch_tensorrt.dynamo.conversion._conversion import (
infer_module_output_shapes_dtypes,
)
from torch_tensorrt.dynamo.conversion._conversion import infer_module_outputs
from torch_tensorrt.dynamo.lowering import (
get_decompositions,
post_lowering,
Expand Down Expand Up @@ -312,7 +310,7 @@ def run_test(

output_dtypes = None
if check_dtype:
_, output_dtypes = infer_module_output_shapes_dtypes(
_, output_dtypes = infer_module_outputs(
mod,
input_specs,
compilation_settings.device,
Expand Down Expand Up @@ -407,7 +405,7 @@ def run_test_with_dynamic_shape(
)

if check_dtype:
_, output_dtypes = infer_module_output_shapes_dtypes(
_, output_dtypes = infer_module_outputs(
mod,
input_specs,
compilation_settings.device,
Expand Down
Loading