[flang-commits] [clang] [flang] [Flang][AMDGPU] Add rocm-path flag (PR #88190)
Dominik Adamski via flang-commits
flang-commits at lists.llvm.org
Thu Apr 11 06:27:18 PDT 2024
================
@@ -345,7 +345,13 @@ void Flang::AddAMDGPUTargetArgs(const ArgList &Args,
// Check ROCm path if specified
const ToolChain &TC = getToolChain();
- TC.getDeviceLibs(Args);
+ std::string HIPVersion;
+ llvm::raw_string_ostream HIPInfo(HIPVersion);
+ TC.printVerboseInfo(HIPInfo);
+ llvm::StringRef HIPInfoStrRef(HIPInfo.str());
+ if (!HIPInfoStrRef.contains("Found HIP installation") &&
----------------
DominikAdamski wrote:
Clang reports an error if `--rocm-path` points to an invalid directory. I need to do a similar check for Flang.
The ROCm toolchain checks rocm-path within function `RocmInstallationDetector::checkCommonBitcodeLibs`. This function is called inside `ROCMToolChain::addClangTargetOptions` or `ROCMToolChain::getCommonDeviceLibNames`. `ROCMToolChain::getCommonDeviceLibNames` is called by `AMDGPUOpenMPToolChain::getDeviceLibs`. I decided not to call `ROCMToolChain::addClangTargetOptions` because Flang does not support all Clang options. That's why I initially decided to call `AMDGPUOpenMPToolChain::getDeviceLibs` to check the ROCm path. The second (current) approach is a workaround to emit an error if rocm-path is specified incorrectly.
https://github.com/llvm/llvm-project/pull/88190
More information about the flang-commits
mailing list