From 20a7638c1584c98e1b2442a011c546f5d471631d Mon Sep 17 00:00:00 2001 From: Jakub Kuderski Date: Tue, 1 Oct 2024 00:13:13 -0400 Subject: [PATCH] [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`. --- compiler/plugins/target/ROCM/ROCMTarget.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/plugins/target/ROCM/ROCMTarget.cpp b/compiler/plugins/target/ROCM/ROCMTarget.cpp index 2175db72ba82..0a30937ba150 100644 --- a/compiler/plugins/target/ROCM/ROCMTarget.cpp +++ b/compiler/plugins/target/ROCM/ROCMTarget.cpp @@ -54,7 +54,7 @@ namespace mlir::iree_compiler::IREE::HAL { namespace { struct ROCmOptions { - std::string target = "gfx908"; + std::string target = ""; std::string targetFeatures = ""; std::string bitcodeDirectory = getDefaultBitcodeDirectory(); int wavesPerEu = 0; @@ -98,6 +98,11 @@ struct ROCmOptions { } 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 << "'";