Skip to content

Commit

Permalink
Add error message for InlineExecutables with unsupported variants. (#…
Browse files Browse the repository at this point in the history
…14593)

Fixes #14587 (cc @dcaballe ).
`--iree-execution-model=inline-static` only works with
`--iree-hal-target-backends=vmvx-inline`. It was crashing when other
backends were used, so this adds a check and error log.

Sample logs:
```
D:\dev\projects\iree (inline-error-message)
λ ..\iree-build\tools\iree-compile.exe -iree-input-type=stablehlo --iree-hal-target-backends=llvm-cpu --iree-hal-target-backends=llvm-cpu --iree-llvmcpu-target-triple=x86_64-unknown-linux-gnu --iree-execution-model=inline-static ./tests/e2e/stablehlo_ops/add.mlir -o ../iree-tmp/add.vmfb
./tests/e2e/stablehlo_ops/add.mlir:0:0: error: InlineStatic execution model is not compatible with hal target 'llvm-cpu'
./tests/e2e/stablehlo_ops/add.mlir:0:0: note: see current operation:
"builtin.module"() ({
...
```
  • Loading branch information
ScottTodd authored Aug 8, 2023
1 parent d5c9283 commit 1a0b3fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions compiler/src/iree/compiler/API/Internal/Embed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,19 @@ bool Invocation::runPipeline(enum iree_compiler_pipeline_t pipeline) {
return false;
}

// InlineStatic (currently) only supports the `vmvx-inline` backend.
if (session.schedulingOptions.executionModel ==
SchedulingOptions::ExecutionModel::InlineStatic) {
for (auto target : session.halTargetOptions.targets) {
if (target != "vmvx-inline") {
parsedModule->emitError() << "InlineStatic execution model is not "
"compatible with hal target '"
<< target << "'";
return false;
}
}
}

buildIREEVMTransformPassPipeline(
session.targetRegistry, session.bindingOptions, session.inputOptions,
session.preprocessingOptions, session.highLevelOptimizationOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ class InlineExecutablesPass
// Build the dispatch function by calling the target function in a loop.
auto bodyFuncOp =
innerSymbolTable.lookup<func::FuncOp>(exportOp.getName());
if (!bodyFuncOp) {
return exportOp.emitOpError("missing body function");
}
if (bodyFuncOp.isPublic()) {
if (failed(rewriteWorkgroupSignature(layoutAttr, totalBindingCount,
bodyFuncOp))) {
Expand Down

0 comments on commit 1a0b3fd

Please sign in to comment.