Emit an error when affinity analysis fails. (#18883)
Includes the flag I'd tell anyone to use if they filed a bug.
Fixes #18878.
diff --git a/compiler/src/iree/compiler/Dialect/Stream/Transforms/ConvertToStream.cpp b/compiler/src/iree/compiler/Dialect/Stream/Transforms/ConvertToStream.cpp
index 91f5c0f..92a3457 100644
--- a/compiler/src/iree/compiler/Dialect/Stream/Transforms/ConvertToStream.cpp
+++ b/compiler/src/iree/compiler/Dialect/Stream/Transforms/ConvertToStream.cpp
@@ -224,6 +224,11 @@
// for all SSA values we'll use during conversion are available.
AffinityAnalysis affinityAnalysis(getOperation());
if (failed(affinityAnalysis.run())) {
+ getOperation().emitError()
+ << "affinity analysis failed to converge (input program may have "
+ "invalid affinities assigned); use"
+ "`--iree-stream-annotate-input-affinities` to help identify the "
+ "invalid affinities";
return signalPassFailure();
}