LLVM: lib/Target/NVPTX/NVPTXSubtarget.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

18

19using namespace llvm;

20

21#define DEBUG_TYPE "nvptx-subtarget"

22

23#define GET_SUBTARGETINFO_ENUM

24#define GET_SUBTARGETINFO_TARGET_DESC

25#define GET_SUBTARGETINFO_CTOR

26#include "NVPTXGenSubtargetInfo.inc"

27

30 cl::desc("NVPTX Specific: Disable generation of f16 math ops."),

32

34 cl::desc("NVPTX Specific: Disable generation of "

35 "f32x2 instructions and registers."),

37

38

39void NVPTXSubtarget::anchor() {}

40

43 TargetName = std::string(CPU);

44

46

47

48

49

51

52

53 if (PTXVersion == 0) {

54 PTXVersion = 60;

55 }

56

57 return *this;

58}

59

61 const std::string &FS,

64 FullSmVersion(200), SmVersion(getSmVersion()),

66 TSInfo = std::make_unique();

67}

68

70

72 return TSInfo.get();

73}

74

79 return false;

80

82 return llvm::any_of(SMVersions, [&](unsigned SM) {

83

84 if (SMVer == 101 || SM == 101)

85 return SMVer == SM &&

86

87

88 !(PTXVer >= 90 && SMVer == 101);

89

91 });

92}

93

98 return false;

99

101 return llvm::any_of(SMVersions, [&](unsigned SM) {

102 return SMVer == SM &&

103

104

105 !(PTXVer >= 90 && SMVer == 101);

106 });

107}

108

112

114 return SmVersion >= 100 && PTXVersion >= 86 && NoF32x2;

115}

116

119 return false;

120

121 switch (Opcode) {

122

129 case ISD::FEXP2:

130 case ISD::FCEIL:

131 case ISD::FFLOOR:

132 case ISD::FNEARBYINT:

133 case ISD::FRINT:

134 case ISD::FROUNDEVEN:

135 case ISD::FTRUNC:

137

138 case ISD::FMINNUM:

139 case ISD::FMAXNUM:

140 case ISD::FMAXNUM_IEEE:

141 case ISD::FMINNUM_IEEE:

142 case ISD::FMAXIMUM:

143 case ISD::FMINIMUM:

145 }

146 return true;

147}

148

150 std::string const &FailureMessage) const {

152 return;

153

155 "NVPTX SM architecture \"{}\" and PTX version \"{}\" do not support {}. "

156 "Requires SM >= 90 and PTX >= 78.",

158}

static cl::opt< bool > NoF32x2("nvptx-no-f32x2", cl::Hidden, cl::desc("NVPTX Specific: Disable generation of " "f32x2 instructions and registers."), cl::init(false))

static cl::opt< bool > NoF16Math("nvptx-no-f16-math", cl::Hidden, cl::desc("NVPTX Specific: Disable generation of f16 math ops."), cl::init(false))

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

void failIfClustersUnsupported(std::string const &FailureMessage) const

Definition NVPTXSubtarget.cpp:149

bool hasPTXWithAccelSMs(unsigned PTXVersion, ArrayRef< unsigned > SMVersions) const

Definition NVPTXSubtarget.cpp:94

std::string getTargetName() const

void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)

unsigned getPTXVersion() const

~NVPTXSubtarget() override

bool hasNativeBF16Support(int Opcode) const

Definition NVPTXSubtarget.cpp:117

unsigned int getFullSmVersion() const

unsigned int getSmVersion() const

bool hasFamilySpecificFeatures() const

bool hasPTXWithFamilySMs(unsigned PTXVersion, ArrayRef< unsigned > SMVersions) const

Definition NVPTXSubtarget.cpp:75

bool hasF32x2Instructions() const

Definition NVPTXSubtarget.cpp:113

unsigned int getSmFamilyVersion() const

bool allowFP16Math() const

Definition NVPTXSubtarget.cpp:109

NVPTXSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const NVPTXTargetMachine &TM)

This constructor initializes the data members to match that of the specified module.

Definition NVPTXSubtarget.cpp:60

bool hasArchAccelFeatures() const

NVPTXSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)

Definition NVPTXSubtarget.cpp:41

const SelectionDAGTargetInfo * getSelectionDAGInfo() const override

Definition NVPTXSubtarget.cpp:71

Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...

StringRef - Represent a constant reference to a string, i.e.

Triple - Helper class for working with autoconf configuration names.

@ SETCC

SetCC operator - This evaluates to a true value iff the condition is true.

@ FADD

Simple binary floating point operators.

@ SELECT

Select(COND, TRUEVAL, FALSEVAL).

@ SELECT_CC

Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

bool any_of(R &&range, UnaryPredicate P)

Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.

auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)