Skip to content

Commit 602fa5b

Browse files
[NVPTX] Add target options for PTX 3.2/4.0 and SM 5.0 (Maxwell)
Default PTX version is set to PTX 3.2 llvm-svn: 211929
1 parent c3f31eb commit 602fa5b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

llvm/lib/Target/NVPTX/NVPTX.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@ def SM30 : SubtargetFeature<"sm_30", "SmVersion", "30",
3434
"Target SM 3.0">;
3535
def SM35 : SubtargetFeature<"sm_35", "SmVersion", "35",
3636
"Target SM 3.5">;
37+
def SM50 : SubtargetFeature<"sm_50", "SmVersion", "50",
38+
"Target SM 5.0">;
3739

3840
// PTX Versions
3941
def PTX30 : SubtargetFeature<"ptx30", "PTXVersion", "30",
4042
"Use PTX version 3.0">;
4143
def PTX31 : SubtargetFeature<"ptx31", "PTXVersion", "31",
4244
"Use PTX version 3.1">;
45+
def PTX32 : SubtargetFeature<"ptx32", "PTXVersion", "32",
46+
"Use PTX version 3.2">;
47+
def PTX40 : SubtargetFeature<"ptx40", "PTXVersion", "40",
48+
"Use PTX version 4.0">;
4349

4450
//===----------------------------------------------------------------------===//
4551
// NVPTX supported processors.
@@ -52,6 +58,7 @@ def : Proc<"sm_20", [SM20]>;
5258
def : Proc<"sm_21", [SM21]>;
5359
def : Proc<"sm_30", [SM30]>;
5460
def : Proc<"sm_35", [SM35]>;
61+
def : Proc<"sm_50", [SM50]>;
5562

5663

5764
def NVPTXInstrInfo : InstrInfo {

llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,10 @@ NVPTXSubtarget &NVPTXSubtarget::initializeSubtargetDependencies(StringRef CPU,
4545

4646
ParseSubtargetFeatures(TargetName, FS);
4747

48-
// We default to PTX 3.1, but we cannot just default to it in the initializer
49-
// since the attribute parser checks if the given option is >= the default.
50-
// So if we set ptx31 as the default, the ptx30 attribute would never match.
51-
// Instead, we use 0 as the default and manually set 31 if the default is
52-
// used.
53-
if (PTXVersion == 0)
54-
PTXVersion = 31;
48+
// Set default to PTX 3.2 (CUDA 5.5)
49+
if (PTXVersion == 0) {
50+
PTXVersion = 32;
51+
}
5552

5653
return *this;
5754
}

0 commit comments

Comments
 (0)