Skip to content

Commit

Permalink
Change compile flag reporting to CLI input
Browse files Browse the repository at this point in the history
  • Loading branch information
eagarvey-amd committed Oct 4, 2024
1 parent fc6d018 commit 7d50dc8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion models/turbine_models/custom_models/sd_inference/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ def compile_to_vmfb(
mlir_source = "str"
input_ir_type = "auto"

print("Compiling to", device, "with flags:", flags)

# Forces a standard for naming files:
# If safe_name has target triple in it, get rid of target triple in mlir name
Expand All @@ -408,6 +407,24 @@ def compile_to_vmfb(
safe_vmfb_name = safe_name
safe_mlir_name = "".join(safe_name.split(target_triple))

if os.path.exists(module_str):
in_file = module_str
else:
in_file = "<input.mlir>"

out_file = f"{safe_vmfb_name}.vmfb"
iree_repro_cli_list = [
"iree_compile",
f"--iree-hal-target-backends={device}",
f"--iree-input-type={input_ir_type}",
in_file,
out_file,
]
iree_repro_cli_list.extend(flags)
iree_repro_cli = " ".join(iree_repro_cli_list)

print("Compiling to target:", device, " \nCLI equivalent:", iree_repro_cli)

if mlir_source == "file":
flatbuffer_blob = ireec.compile_file(
module_str,
Expand Down

0 comments on commit 7d50dc8

Please sign in to comment.