[clang] [flang] [Flang][AMDGPU] Add rocm-path flag (PR #88190)

Dominik Adamski via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 12 01:19:05 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:

test command:
`clang -fopenmp --offload-arch=gfx90a test.c`

Function call:
``` 
clang/lib/Driver/ToolChains/Clang.cpp : void Clang::ConstructJob
TC.addClangTargetOptions(Args, CmdArgs, JA.getOffloadingDeviceKind());
                                  |
                                  V
clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp: void AMDGPUOpenMPToolChain::addClangTargetOptions
   for (auto BCFile : getDeviceLibs(DriverArgs)) {
                                  |
                                  V
 clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp: AMDGPUOpenMPToolChain::getDeviceLibs (
                                  |
                                  V
   if (!RocmInstallation->hasDeviceLibrary()) {
        getDriver().Diag(diag::err_drv_no_rocm_device_lib) << 0;
        return {};
  }
  ``` 

https://github.com/llvm/llvm-project/pull/88190


More information about the cfe-commits mailing list