Skip to content

Commit

Permalink
Fix embedded linker flag in python exposed iree-opt
Browse files Browse the repository at this point in the history
  • Loading branch information
qedawkins authored and github-actions[bot] committed Jul 13, 2023
1 parent d70ebd9 commit f394460
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions compiler/bindings/python/iree/compiler/tools/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,43 @@ def query_available_targets():
# Preprocessing for SHARK (for now simply exposes iree-opt)


def build_opt_command_line(
input_file: str, tfs: TempFileSaver, options: CompilerOptions
) -> List[str]:
"""Builds a command line for applying specified patterns.
Args:
input_file: The input file name.
tfs: TempFileSaver.
options: Compiler options.
Returns:
List of strings of command line.
"""
iree_opt = find_tool("iree-opt")
cl = [
iree_opt,
input_file,
]

# Output file.
if options.output_file:
cl.append(f"-o={options.output_file}")

# Tool paths.
lld_path = find_tool("iree-lld")
cl.append(f"--iree-llvmcpu-embedded-linker-path={lld_path}")

crash_reproducer_path = tfs.alloc_optional(
"core-reproducer.mlir", export_as=options.crash_reproducer_path
)
if crash_reproducer_path:
cl.append(f"--mlir-pass-pipeline-crash-reproducer={crash_reproducer_path}")

cl.extend(options.extra_args)
print(cl)
return cl


def build_opt_command_line(
input_file: str, tfs: TempFileSaver, options: CompilerOptions
) -> List[str]:
Expand Down

0 comments on commit f394460

Please sign in to comment.