Skip to content

Commit 418dbbf

Browse files
tugsbayasgalanfacebook-github-bot
authored andcommitted
Explain what unlift config does
Summary: "Unlift" config depends on the "enable_aot" config. Let's make sure it is mentioned in the code. Reviewed By: gmagogsfm Differential Revision: D48181418 fbshipit-source-id: 91f83544f8daaf3814fdd6c4ed22785d571b3086
1 parent 578a818 commit 418dbbf

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

exir/capture/_capture.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,19 @@ def capture(
6060
out_spec = None
6161
# TODO (zhxchen17) Always functionalize in a second pass no matter which path is taken.
6262
flat_args = tuple(pytree.tree_flatten(args)[0])
63+
if not config.enable_aot:
64+
if config._unlift:
65+
raise ExportError(
66+
ExportErrorType.NOT_SUPPORTED,
67+
"_unlift config doesn't do anything without enable_aot enabled. Please do not set it",
68+
)
6369
if config.pt2_mode:
6470
if config.enable_aot:
71+
if config.enable_dynamic_shape:
72+
raise ExportError(
73+
ExportErrorType.NOT_SUPPORTED,
74+
"Under enable_aot, enable_dynamic_shapes flag doesn't do anything. Please do not set it",
75+
)
6576
if not config.enable_functionalization:
6677
raise ExportError(
6778
ExportErrorType.NOT_SUPPORTED,

exir/capture/_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CaptureConfig:
2222
enable_dynamic_shape: bool = False # This flag does nothing if enable_aot is True
2323
enable_aot: bool = False # When it's true it implies automatic dynamic shapes via default dynamo config
2424
_dynamo_config: "ExirDynamoConfig" = field(default_factory=ExirDynamoConfig)
25-
_unlift: bool = False
25+
_unlift: bool = False # This flag does nothing if enable_aot is False.
2626
_use_old_decomp_table: bool = False
2727

2828

exir/emit/test/test_emit.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ def test_model(eager_module):
568568
capture_config = exir.CaptureConfig(
569569
pt2_mode=True,
570570
enable_functionalization=True,
571-
enable_dynamic_shape=True,
572571
enable_aot=True,
573572
_unlift=False,
574573
)

0 commit comments

Comments
 (0)