Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[compiler][python] Make target_backends optional #18151

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions compiler/bindings/python/iree/compiler/tools/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,16 @@ def build_compile_command_line(
List of strings of command line.
"""
iree_compile = find_tool("iree-compile")
if not options.target_backends:
raise ValueError("Expected a non-empty list for 'target_backends'")

cl = [
iree_compile,
input_file,
f"--iree-input-type={options.input_type!s}",
f"--iree-vm-bytecode-module-output-format={options.output_format!s}",
]
for target_backend in options.target_backends:
cl.append(f"--iree-hal-target-backends={target_backend}")
if options.target_backends is not None:
for target_backend in options.target_backends:
cl.append(f"--iree-hal-target-backends={target_backend}")

# Output file.
if options.output_file:
Expand Down
6 changes: 0 additions & 6 deletions compiler/bindings/python/test/tools/compiler_core_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ def testQueryTargets(self):
# The VMVX target is always enabled.
self.assertIn("vmvx", target_names)

def testNoTargetBackends(self):
with self.assertRaisesRegex(
ValueError, "Expected a non-empty list for 'target_backends'"
):
binary = iree.compiler.tools.compile_str(SIMPLE_MUL_ASM)

def testCompileStr(self):
binary = iree.compiler.tools.compile_str(
SIMPLE_MUL_ASM, target_backends=iree.compiler.tools.DEFAULT_TESTING_BACKENDS
Expand Down
Loading