Skip to content

Commit 7d2813c

Browse files
committed
Add support for compile only backend. Allows for compilation using AIU stack without AIUs present on system
Signed-off-by: Kevin Tu <ktu@ibm.com>
1 parent b0cf126 commit 7d2813c

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

aiu_fms_testing_utils/scripts/inference.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@
138138
default="inductor",
139139
choices=["inductor", "eager", "aot_eager"],
140140
)
141+
parser.add_argument(
142+
"--compile_backend_aiu",
143+
type=str,
144+
help="Backend for AIU compilation",
145+
default="sendnn",
146+
choices=["sendnn", "sendnn_compile_only"],
147+
)
141148
parser.add_argument(
142149
"--compile_dynamic",
143150
action="store_true",
@@ -387,7 +394,10 @@
387394
print("must set AIU_WORLD_RANK_0")
388395
exit()
389396
os.environ.setdefault("FLEX_COMPUTE", "SENTIENT")
390-
os.environ.setdefault("FLEX_DEVICE", "PF")
397+
if args.compile_backend_aiu == "compile_only_backend":
398+
os.environ.setdefault("FLEX_DEVICE", "COMPILE")
399+
else:
400+
os.environ.setdefault("FLEX_DEVICE", "PF")
391401

392402
device = torch.device("cpu")
393403
else:
@@ -597,7 +607,7 @@ def select_int8_module(
597607
fx_config.backed_size_oblivious = "paged" in attn_name
598608
if is_aiu_backend:
599609
model.compile(
600-
backend="sendnn", options={"sendnn.dynamic": args.compile_dynamic_sendnn}
610+
backend=args.compile_backend_aiu, options={"sendnn.dynamic": args.compile_dynamic_sendnn}
601611
)
602612
else:
603613
# compiling can make first inference pass slow

0 commit comments

Comments
 (0)