[ROCm] Always require `--iree-hip-target` (#18645)
Do not default to any arbitrary chip -- better to fail during
compilation than at runtime.
No test because, AFAICT, it's not possible to match error with an
unknown location using `--verify-diagnostic`.
diff --git a/compiler/plugins/target/ROCM/ROCMTarget.cpp b/compiler/plugins/target/ROCM/ROCMTarget.cpp
index 2175db7..0a30937 100644
--- a/compiler/plugins/target/ROCM/ROCMTarget.cpp
+++ b/compiler/plugins/target/ROCM/ROCMTarget.cpp
@@ -54,7 +54,7 @@
namespace {
struct ROCmOptions {
- std::string target = "gfx908";
+ std::string target = "";
std::string targetFeatures = "";
std::string bitcodeDirectory = getDefaultBitcodeDirectory();
int wavesPerEu = 0;
@@ -98,6 +98,11 @@
}
LogicalResult verify(mlir::Builder &builder) const {
+ if (target.empty()) {
+ return emitError(builder.getUnknownLoc())
+ << "HIP target not set; did you forget to pass "
+ "'--iree-hip-target'?";
+ }
if (GPU::normalizeHIPTarget(target).empty()) {
return emitError(builder.getUnknownLoc(), "Unknown HIP target '")
<< target << "'";