-
Notifications
You must be signed in to change notification settings - Fork 364
fix/feat: Add support for 64bit Tensor inputs FX aten [9 / x] #2021
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
from torch_tensorrt._Device import Device | ||
from torch_tensorrt._enums import EngineCapability |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes were required to avoid circular import errors in Python. Updates to #1983 could potentially fix this issue.
76a4cdc
to
6635bdc
Compare
d533463
to
4e843a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to Python style guidelines:
--- py/torch_tensorrt/dynamo/backend/utils.py 2023-06-21 01:08:42.236399 +0000
+++ py/torch_tensorrt/dynamo/backend/utils.py 2023-06-21 01:09:05.163004 +0000
@@ -73,10 +73,11 @@
"Invalid device provided. Supported options: torch.device | torch_tensorrt.Device"
)
return device
+
def parse_dynamo_kwargs(kwargs: Dict) -> CompilationSettings:
"""Parses the kwargs field of a Dynamo backend
Args:
kwargs: Keyword arguments dictionary provided to the backend
6635bdc
to
7548ad2
Compare
4e843a3
to
993d8d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
7548ad2
to
9cf1785
Compare
993d8d2
to
edf0bf7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
9cf1785
to
921dd2f
Compare
edf0bf7
to
9a9820a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
921dd2f
to
46b585b
Compare
9a9820a
to
183ba3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
46b585b
to
eca6d00
Compare
183ba3a
to
938dfad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
eca6d00
to
fb6f8eb
Compare
938dfad
to
dd3bad9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to Python style guidelines:
--- py/torch_tensorrt/dynamo/fx_ts_compat/lower.py 2023-07-07 22:25:55.960522 +0000
+++ py/torch_tensorrt/dynamo/fx_ts_compat/lower.py 2023-07-07 22:26:11.127951 +0000
@@ -8,11 +8,15 @@
import torch.fx as fx
import torch.nn as nn
import torch_tensorrt.fx.tracer.dispatch_tracer.aten_tracer as aten_tracer
from torch.fx.passes.splitter_base import SplitResult
-from torch_tensorrt.dynamo.common import TRTInterpreter, TRTInterpreterResult, use_python_runtime_parser
+from torch_tensorrt.dynamo.common import (
+ TRTInterpreter,
+ TRTInterpreterResult,
+ use_python_runtime_parser,
+)
from .lower_setting import LowerSetting
from .passes.lower_pass_manager_builder import LowerPassManagerBuilder
from .passes.pass_utils import PassFunc, validate_inference
from torch_tensorrt.fx.tools.timing_cache_utils import TimingCacheManager
from torch_tensorrt.fx.tools.trt_splitter import TRTSplitter, TRTSplitterSetting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
- Add `common` directory which stores code common to both the compile and export path, to reduce code duplication and better organize the repository - Update necessary imports, promote the `_defaults` module to `torch_tensorrt.dynamo._defaults`
- Add default, setting, and function arguments for `truncate_long_and_double` in Dynamo - Add utilities for repairing long/double inputs to TRT engines, including support for autocasting back to long/double after the computation completes - Add multiple helper functions to enable easy testing and diagnosis of long/double IO to TRT engines - Add necessary compiler code to enable usage of the `truncate_long_and_double` argument as a switch for the feature - Add Dynamo compile support for `truncate_long_and_double` compilation argument by intercepting long/double type inputs and casting them to their 32-bit counterparts prior to usage in TRT-accelerated subgraphs, then casting back if necessary - Add robust logic to handle 64-bit inputs and outputs - Add test cases for long and double scenarios - Centralize truncation utility for later use in Dynamo export path
fb6f8eb
to
21847e3
Compare
- Add `truncate_long_and_double` argument in FX settings to allow 64bit inputs - Utilize existing Dynamo functionality to repair FX aten graphs with 64bit inputs - Refactor imports in Dynamo to avoid circular import issue from new dependency issues - Add test cases to validate new feature
dd3bad9
to
c4a0e9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
dfa04ed
to
9548c7f
Compare
Closing this in favor of #1983 |
Description
truncate_long_and_double
argument in FX settings to allow 64bit inputsNote: Breaks
python setup.py install --fx-only
by introducing Dynamo dependency in FX. Potential resolutions include moving Dynamo utilities out of the Dynamo directory, or changing C++ requiring imports in Dynamo, etc.Fixes #2008
Type of change
Checklist: