forked from OSchip/llvm-project
[CUDA] Only allow NVIDIA offload-arch during CUDA compilation.
Otherwise, if someone specifies a valid AMD arch, we may end up triggering an assertion on unexpected arch later on. Differential Revision: https://reviews.llvm.org/D105295
This commit is contained in:
parent
6245252d4c
commit
01d3a3dcab
|
@ -2785,7 +2785,7 @@ class OffloadingActionBuilder final {
|
|||
|
||||
StringRef getCanonicalOffloadArch(StringRef ArchStr) override {
|
||||
CudaArch Arch = StringToCudaArch(ArchStr);
|
||||
if (Arch == CudaArch::UNKNOWN) {
|
||||
if (Arch == CudaArch::UNKNOWN || !IsNVIDIAGpuArch(Arch)) {
|
||||
C.getDriver().Diag(clang::diag::err_drv_cuda_bad_gpu_arch) << ArchStr;
|
||||
return StringRef();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
// RUN: | FileCheck -check-prefix BAD %s
|
||||
// RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_19 -c %s 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix BAD %s
|
||||
// RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=gfx900 -c %s 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix BAD %s
|
||||
|
||||
// BAD: error: Unsupported CUDA gpu architecture
|
||||
|
||||
|
|
Loading…
Reference in New Issue