Skip to content

Commit

Permalink
[CUDA] Allow sm_50,52,53 GPUs
Browse files Browse the repository at this point in the history
LLVM accepts them since r233575.

Differential Revision: http://reviews.llvm.org/D20405

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270084 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Artem-B committed May 19, 2016
1 parent ef47283 commit 7fc77c9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/Basic/Targets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1689,6 +1689,9 @@ class NVPTXTargetInfo : public TargetInfo {
GK_SM30,
GK_SM35,
GK_SM37,
GK_SM50,
GK_SM52,
GK_SM53,
} GPU;

public:
Expand Down Expand Up @@ -1787,6 +1790,15 @@ class NVPTXTargetInfo : public TargetInfo {
case GK_SM37:
CUDAArchCode = "370";
break;
case GK_SM50:
CUDAArchCode = "500";
break;
case GK_SM52:
CUDAArchCode = "520";
break;
case GK_SM53:
CUDAArchCode = "530";
break;
default:
llvm_unreachable("Unhandled target CPU");
}
Expand Down Expand Up @@ -1836,6 +1848,9 @@ class NVPTXTargetInfo : public TargetInfo {
.Case("sm_30", GK_SM30)
.Case("sm_35", GK_SM35)
.Case("sm_37", GK_SM37)
.Case("sm_50", GK_SM50)
.Case("sm_52", GK_SM52)
.Case("sm_53", GK_SM53)
.Default(GK_NONE);

return GPU != GK_NONE;
Expand Down
4 changes: 4 additions & 0 deletions lib/Driver/ToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,10 @@ void Generic_GCC::CudaInstallationDetector::init(
} else if (GpuArch == "compute_35") {
CudaLibDeviceMap["sm_35"] = FilePath;
CudaLibDeviceMap["sm_37"] = FilePath;
} else if (GpuArch == "compute_50") {
CudaLibDeviceMap["sm_50"] = FilePath;
CudaLibDeviceMap["sm_52"] = FilePath;
CudaLibDeviceMap["sm_53"] = FilePath;
}
}

Expand Down
3 changes: 3 additions & 0 deletions test/CodeGen/nvptx-cpus.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_30 -O3 -S -o %t %s -emit-llvm
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_35 -O3 -S -o %t %s -emit-llvm
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_37 -O3 -S -o %t %s -emit-llvm
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_50 -O3 -S -o %t %s -emit-llvm
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_52 -O3 -S -o %t %s -emit-llvm
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_53 -O3 -S -o %t %s -emit-llvm

// Make sure clang accepts all supported architectures.

Expand Down

0 comments on commit 7fc77c9

Please sign in to comment.