File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
clang/lib/Driver/ToolChains Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -344,8 +344,18 @@ void Flang::AddAMDGPUTargetArgs(const ArgList &Args,
344
344
}
345
345
346
346
// Check ROCm path if specified
347
+ if (!Args.getLastArg (options::OPT_rocm_path_EQ))
348
+ return ;
349
+
350
+ // If ROCm path is specified, check correctness of the path
347
351
const ToolChain &TC = getToolChain ();
348
- TC.getDeviceLibs (Args);
352
+ std::string HIPVersion;
353
+ llvm::raw_string_ostream HIPInfo (HIPVersion);
354
+ TC.printVerboseInfo (HIPInfo);
355
+ llvm::StringRef HIPInfoStrRef (HIPInfo.str ());
356
+ if (!HIPInfoStrRef.contains (" Found HIP installation" ) &&
357
+ !Args.getLastArg (options::OPT_nogpulib))
358
+ TC.getDriver ().Diag (diag::err_drv_no_rocm_device_lib) << 0 ;
349
359
}
350
360
351
361
void Flang::addTargetOptions (const ArgList &Args,
Original file line number Diff line number Diff line change 202
202
! RUN: | FileCheck --check-prefix=NO-LIBC-GPU-AMDGPU %s
203
203
! NO-LIBC-GPU-AMDGPU-NOT: "-lcgpu-amdgpu"
204
204
205
- ! RUN: rm -rf %t/Inputs
206
205
! RUN: not %flang -### -v --target=x86_64-unknown-linux-gnu -fopenmp \
207
206
! RUN: --offload-arch=gfx900 \
208
- ! RUN: --rocm-path=%t /Inputs/rocm %s 2>&1 \
207
+ ! RUN: --rocm-path=%S /Inputs/rocm %s 2>&1 \
209
208
! RUN: | FileCheck --check-prefix=ROCM-PATH-NOT-FOUND %s
210
209
! ROCM-PATH-NOT-FOUND: error: cannot find ROCm device library;
211
210
214
213
! RUN: cp -r %S/../../../clang/test/Driver/Inputs/rocm %t/Inputs
215
214
! RUN: mkdir -p %t/Inputs/rocm/share/hip
216
215
! RUN: mkdir -p %t/Inputs/rocm/hip
217
- ! RUN: mv %t/Inputs/rocm/bin/.hipVersion %t/Inputs/rocm/share/hip/version
216
+ ! RUN: mv %t/Inputs/rocm/bin/.hipVersion %t/Inputs/rocm/share/hip/version
218
217
219
218
! RUN: %flang -### -v --target=x86_64-unknown-linux-gnu -fopenmp \
220
219
! RUN: --offload-arch=gfx900 \
You can’t perform that action at this time.
0 commit comments