Add flag for toggling constant folding. (#1714)

This commit is contained in:
Ean Garvey
2023-08-04 06:55:52 -05:00
committed by GitHub
parent a5b13fcc2f
commit c9de2729b2
2 changed files with 12 additions and 0 deletions

View File

@@ -519,6 +519,12 @@ p.add_argument(
"in shark importer. Does nothing if import_mlir is false (the default).",
)
p.add_argument(
"--iree_constant_folding",
default=False,
action=argparse.BooleanOptionalAction,
help="Controls constant folding in iree-compile for all SD models.",
)
##############################################################################
# Web UI flags

View File

@@ -500,6 +500,12 @@ def get_opt_flags(model, precision="fp16"):
f"-iree-vulkan-target-triple={args.iree_vulkan_target_triple}"
)
if args.iree_constant_folding == False:
iree_flags.append("--iree-opt-const-expr-hoisting=False")
iree_flags.append(
"--iree-codegen-linalg-max-constant-fold-elements=9223372036854775807"
)
# Disable bindings fusion to work with moltenVK.
if sys.platform == "darwin":
iree_flags.append("-iree-stream-fuse-binding=false")