Skip to content

Commit a9edd01

Browse files
committed
update
1 parent 383ae00 commit a9edd01

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,18 @@ void NVPTXSubtarget::anchor() {}
3434

3535
NVPTXSubtarget &NVPTXSubtarget::initializeSubtargetDependencies(StringRef CPU,
3636
StringRef FS) {
37-
// Provide the default CPU if we don't have one.
38-
TargetName = std::string(CPU);
37+
TargetName = std::string(CPU);
3938

40-
ParseSubtargetFeatures(CPU.empty() ? "sm_30" : CPU,
41-
/*TuneCPU=*/CPU.empty() ? "sm_30" : CPU, FS);
39+
ParseSubtargetFeatures(getTargetName(), /*TuneCPU=*/getTargetName(), FS);
4240

43-
// Re-map SM version numbers, SmVersion carries the regular SMs which do
44-
// have relative order, while FullSmVersion allows distinguishing sm_90 from
45-
// sm_90a, which would *not* be a subset of sm_91.
46-
SmVersion = getSmVersion();
41+
// Re-map SM version numbers, SmVersion carries the regular SMs which do
42+
// have relative order, while FullSmVersion allows distinguishing sm_90 from
43+
// sm_90a, which would *not* be a subset of sm_91.
44+
SmVersion = getSmVersion();
4745

48-
// Set default to PTX 6.0 (CUDA 9.0)
49-
if (PTXVersion == 0) {
50-
PTXVersion = 60;
46+
// Set default to PTX 6.0 (CUDA 9.0)
47+
if (PTXVersion == 0) {
48+
PTXVersion = 60;
5149
}
5250

5351
return *this;

llvm/lib/Target/NVPTX/NVPTXSubtarget.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
111111
// - 0 represents base GPU model,
112112
// - non-zero value identifies particular architecture-accelerated variant.
113113
bool hasAAFeatures() const { return getFullSmVersion() % 10; }
114+
115+
// If the user did not provide a target we default to the `sm_30` target.
114116
std::string getTargetName() const {
115117
return TargetName.empty() ? "sm_30" : TargetName;
116118
}

0 commit comments

Comments
 (0)