14 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUSUBTARGET_H 15 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUSUBTARGET_H 39 #define GET_SUBTARGETINFO_HEADER 40 #include "AMDGPUGenSubtargetInfo.inc" 41 #define GET_SUBTARGETINFO_HEADER 42 #include "R600GenSubtargetInfo.inc" 259 TrapHandlerAbiNone = 0,
260 TrapHandlerAbiHsa = 1
264 TrapIDHardwareReserved = 0,
265 TrapIDHSADebugTrap = 1,
267 TrapIDLLVMDebugTrap = 3,
268 TrapIDDebugBreakpoint = 7,
269 TrapIDDebugReserved8 = 8,
270 TrapIDDebugReservedFE = 0xfe,
271 TrapIDDebugReservedFF = 0xff
275 LLVMTrapHandlerRegValue = 1
280 std::unique_ptr<AMDGPUCallLowering> CallLoweringInfo;
281 std::unique_ptr<InstructionSelector> InstSelector;
282 std::unique_ptr<LegalizerInfo>
Legalizer;
283 std::unique_ptr<RegisterBankInfo> RegBankInfo;
399 static const unsigned MaxWaveScratchSize = (256 * 4) * ((1 << 13) - 1);
414 return &FrameLowering;
426 return CallLoweringInfo.get();
430 return InstSelector.get();
434 return Legalizer.get();
438 return RegBankInfo.get();
470 return MaxPrivateElementSize;
473 unsigned getConstantBusLimit(
unsigned Opcode)
const;
496 return HalfRate64Ops;
542 return HasFmaMixInsts;
566 return isAmdHsaOS() ? TrapHandlerAbiHsa : TrapHandlerAbiNone;
576 return EnableUnsafeDSOffsetFolding;
622 return FP64FP16Denormals;
627 return FP64FP16Denormals;
631 return FP64FP16Denormals;
644 return FlatForGlobal;
650 return CIInsts && EnableDS128;
667 return EnablePRTStrictNull;
671 return AutoWaitcntBeforeBarrier;
680 return UnalignedBufferAccess;
684 return UnalignedScratchAccess;
688 return HasApertureRegs;
704 return FlatAddressSpace;
708 return hasFlatAddressSpace();
712 return FlatInstOffsets;
716 return FlatGlobalInsts;
720 return FlatScratchInsts;
724 return ScalarFlatScratchInsts;
728 return HasFlatSegmentOffsetBug;
732 return getGeneration() >
GFX9;
736 return getGeneration() >=
GFX9;
740 return hasD16LoadStore() && !isSRAMECCEnabled();
750 return getGeneration() <
GFX9;
759 return getGeneration() >=
GFX9;
768 return AddNoCarryInsts;
772 return HasUnpackedD16VMem;
789 return HasSDWAScalar;
801 return HasSDWAOutModsVOPC;
837 return HasPkFmacF16Inst;
841 return HasAtomicFaddInsts;
845 return EnableSRAMECC;
849 return HasNoSdstCMPX;
857 return HasRegisterBanking;
861 return HasVOP3Literal;
865 return HasNoDataDepHazard;
926 unsigned NumRegionInstrs)
const override;
933 return HasSMemRealTime;
941 return HasVGPRIndexMode;
944 bool useVGPRIndexMode()
const;
951 return HasScalarStores;
955 return HasScalarAtomics;
967 return HasDPP && getGeneration() <
GFX10;
971 return HasDPP && getGeneration() <
GFX10;
983 return HasOffset3fBug;
987 return HasNSAEncoding;
990 bool hasMadF16()
const;
993 return EnableSIScheduler;
1005 return HasMFMAInlineLiteralBug;
1031 return HasVcmpxPermlaneHazard;
1035 return HasVMEMtoScalarWriteHazard;
1039 return HasSMEMtoVectorWriteHazard;
1043 return LDSMisalignedBug && !EnableCuMode;
1047 return HasInstFwdPrefetchBug;
1051 return HasVcmpxExecWARHazard;
1055 return HasLdsBranchVmemWARHazard;
1059 return HasNSAtoVMEMBug;
1064 unsigned getOccupancyWithNumSGPRs(
unsigned SGPRs)
const;
1068 unsigned getOccupancyWithNumVGPRs(
unsigned VGPRs)
const;
1074 unsigned computeOccupancy(
const MachineFunction &MF,
unsigned LDSSize = 0,
1086 return getGeneration() >=
GFX9;
1176 void getPostRAMutations(
1177 std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations)
1185 return getRegisterInfo()->getBoolRC();
1216 void adjustSchedDependency(
SUnit *Src,
SUnit *Dst,
SDep &Dep)
const override;
1227 bool HasVertexCache;
1230 short TexVTXClauseSize;
1243 return &FrameLowering;
1356 #endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUSUBTARGET_H
bool hasBCNT(unsigned Size) const
bool makeLIDRangeMetadata(Instruction *I) const
Creates value range metadata on an workitemid.* inrinsic call or load.
bool hasFP16Denormals(const Function &F) const
Alias for hasFP64FP16Denormals.
bool enableEarlyIfConversion() const override
bool hasLDSMisalignedBug() const
bool hasUsableDSOffset() const
True if the offset field of DS instructions works as expected.
bool hasVOP3Literal() const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
bool hasPkFmacF16Inst() const
bool privateMemoryResourceIsRangeChecked() const
bool hasApertureRegs() const
bool UnalignedBufferAccess
bool hasScalarPackInsts() const
bool hasScalarStores() const
bool enableMachineScheduler() const override
bool hasSMRDReadVALUDefHazard() const
A read of an SGPR by SMRD instruction requires 4 wait states when the SGPR was written by a VALU inst...
bool hasFlatScrRegister() const
bool isMesaKernel(const Function &F) const
unsigned getMinFlatWorkGroupSize() const override
This class represents lattice values for constants.
bool hasUsableDivScaleConditionOutput() const
Condition output from div_scale is usable.
Interface definition for R600InstrInfo.
bool hasReadM0MovRelInterpHazard() const
unsigned getImplicitArgNumBytes(const Function &F) const
unsigned getMaxFlatWorkGroupSize() const override
unsigned getMaxWorkGroupsPerCU(const MCSubtargetInfo *STI, unsigned FlatWorkGroupSize)
unsigned getOccupancyWithLocalMemSize(uint32_t Bytes, const Function &) const
Inverse of getMaxLocalMemWithWaveCount.
unsigned getMaxWorkGroupsPerCU(unsigned FlatWorkGroupSize) const override
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
bool isPromoteAllocaEnabled() const
bool d16PreservesUnusedBits() const
unsigned getMaxWorkGroupsPerCU(unsigned FlatWorkGroupSize) const override
bool hasFlatGlobalInsts() const
bool supportsMinMaxDenormModes() const
unsigned getVGPRAllocGranule(const MCSubtargetInfo *STI, Optional< bool > EnableWavefrontSize32)
This file describes how to lower LLVM calls to machine code calls.
bool HasVMEMtoScalarWriteHazard
bool hasFmaMixInsts() const
unsigned getSGPRAllocGranule() const
bool hasNSAtoVMEMBug() const
unsigned getMaxWavesPerCU(unsigned FlatWorkGroupSize) const
bool hasAtomicFaddInsts() const
bool hasTrigReducedRange() const
std::pair< unsigned, unsigned > getDefaultFlatWorkGroupSize(CallingConv::ID CC) const
bool hasVcmpxPermlaneHazard() const
const SIInstrInfo * getInstrInfo() const override
bool hasMergedShaders() const
bool UnalignedScratchAccess
bool ScalarFlatScratchInsts
virtual unsigned getMinWavesPerEU() const =0
unsigned getKernArgSegmentSize(const Function &F, Align &MaxAlign) const
InstrItineraryData InstrItins
bool hasFP64Denormals(const Function &F) const
Alias for hasFP64FP16Denormals.
Align getStackAlignment() const
unsigned getMinNumSGPRs(unsigned WavesPerEU) const
bool hasInstFwdPrefetchBug() const
bool hasFastFMAF32() const
Generation getGeneration() const
bool hasFlatSegmentOffsetBug() const
const SIRegisterInfo & getRegisterInfo() const
bool hasReadVCCZBug() const
Extra wait hazard is needed in some cases before s_cbranch_vccnz/s_cbranch_vccz.
const RegisterBankInfo * getRegBankInfo() const override
bool hasVOP3PInsts() const
unsigned getSGPREncodingGranule(const MCSubtargetInfo *STI)
bool hasDPPWavefrontShifts() const
bool hasScalarMulHiInsts() const
bool HasVcmpxPermlaneHazard
Holds all the information related to register banks.
bool DoesNotSupportSRAMECC
unsigned getWavesPerWorkGroup(const MCSubtargetInfo *STI, unsigned FlatWorkGroupSize)
bool isMesaGfxShader(const Function &F) const
bool hasDwordx3LoadStores() const
bool HasLdsBranchVmemWARHazard
int getLocalMemorySize() const
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
unsigned getMaxWavesPerEU(unsigned FlatWorkGroupSize) const override
bool hasLdsBranchVmemWARHazard() const
bool hasD16Images() const
bool hasSMovFedHazard() const
bool hasSDWAOutModsVOPC() const
bool vmemWriteNeedsExpWaitcnt() const
bool isTrapHandlerEnabled() const
bool hasFP64FP16Denormals(const Function &F) const
bool hasDot4Insts() const
unsigned getMaxNumSGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU, bool Addressable)
bool hasSMemRealTime() const
unsigned getTotalNumVGPRs(const MCSubtargetInfo *STI)
const TargetRegisterClass * getBoolRC() const
unsigned getMinWavesPerEU(const MCSubtargetInfo *STI)
static cl::opt< bool > ScalarizeGlobal("amdgpu-scalarize-global-loads", cl::desc("Enable global load scalarization"), cl::init(true), cl::Hidden)
static cl::opt< bool > EnableLoadStoreOpt("aarch64-enable-ldst-opt", cl::desc("Enable the load/store pair" " optimization pass"), cl::init(true), cl::Hidden)
unsigned getMinFlatWorkGroupSize(const MCSubtargetInfo *STI)
bool hasHalfRate64Ops() const
unsigned getSetRegWaitStates() const
Number of hazard wait states for s_setreg_b32/s_setreg_imm32_b32.
bool useFlatForGlobal() const
Align getAlignmentForImplicitArgPtr() const
unsigned getAddressableNumSGPRs() const
unsigned getMaxNumVGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU)
unsigned getMinWavesPerEU() const override
Align getStackAlignment() const
virtual unsigned getMaxWorkGroupsPerCU(unsigned FlatWorkGroupSize) const =0
Itinerary data supplied by a subtarget to be used by a target.
bool hasVMEMtoScalarWriteHazard() const
bool hasAddNoCarry() const
bool hasDot3Insts() const
const CallLowering * getCallLowering() const override
virtual unsigned getMinFlatWorkGroupSize() const =0
bool hasNoDataDepHazard() const
bool hasDot6Insts() const
bool isSRAMECCEnabled() const
bool HasMFMAInlineLiteralBug
bool hasUnalignedBufferAccess() const
const R600FrameLowering * getFrameLowering() const override
bool hasDot2Insts() const
const InstrItineraryData * getInstrItineraryData() const override
std::pair< unsigned, unsigned > getWavesPerEU(const Function &F) const
unsigned getMaxNumSGPRs(unsigned WavesPerEU, bool Addressable) const
bool hasScalarCompareEq64() const
unsigned getSGPREncodingGranule() const
unsigned getMinNumSGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU)
unsigned getMaxWavesPerCU() const
unsigned getEUsPerCU(const MCSubtargetInfo *STI)
unsigned getKnownHighZeroBitsForFrameIndex() const
Return the number of high bits known to be zero fror a frame index.
bool hasFminFmaxLegacy() const
unsigned getMaxWavesPerEU(unsigned FlatWorkGroupSize) const override
bool hasNSAEncoding() const
bool hasFPExceptions() const
bool enableMachineScheduler() const override
bool has16BitInsts() const
bool HasFlatSegmentOffsetBug
unsigned MaxPrivateElementSize
bool usePRTStrictNull() const
SI DAG Lowering interface definition.
bool HasVcmpxExecWARHazard
const SIFrameLowering * getFrameLowering() const override
bool isCuModeEnabled() const
bool hasLDSFPAtomics() const
bool hasSMEMtoVectorWriteHazard() const
const R600InstrInfo * getInstrInfo() const override
bool hasRegisterBanking() const
Generation getGeneration() const
const R600RegisterInfo & getRegisterInfo() const
bool hasMIMG_R128() const
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
unsigned getVGPREncodingGranule() const
bool hasGWSAutoReplay() const
bool hasOnlyRevVALUShifts() const
unsigned countLeadingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the most significant bit to the least stopping at the first 1...
bool hasUnalignedScratchAccess() const
bool enableSubRegLiveness() const override
bool EnableUnsafeDSOffsetFolding
TrapHandlerAbi getTrapHandlerAbi() const
bool hasVMEMReadSGPRVALUDefHazard() const
A read of an SGPR by a VMEM instruction requires 5 wait states when the SGPR was written by a VALU In...
constexpr char NumSGPRs[]
Key for Kernel::CodeProps::Metadata::mNumSGPRs.
bool hasScalarAtomics() const
This struct is a compact representation of a valid (non-zero power of two) alignment.
Triple - Helper class for working with autoconf configuration names.
bool hasFlatScratchInsts() const
bool hasVertexCache() const
unsigned getVGPRAllocGranule() const
bool hasUnpackedD16VMem() const
bool getScalarizeGlobalBehavior() const
bool hasOffset3fBug() const
bool hasVcmpxExecWARHazard() const
bool hasFlatAddressSpace() const
unsigned getWavefrontSize() const
const R600RegisterInfo * getRegisterInfo() const override
bool hasGWSSemaReleaseAll() const
unsigned getVGPREncodingGranule(const MCSubtargetInfo *STI, Optional< bool > EnableWavefrontSize32)
bool hasFP32Denormals(const Function &F) const
bool haveRoundOpsF64() const
Have v_trunc_f64, v_ceil_f64, v_rndne_f64.
bool hasDenormModeInst() const
bool enableSIScheduler() const
bool hasRFEHazards() const
bool AutoWaitcntBeforeBarrier
unsigned getTotalNumSGPRs(const MCSubtargetInfo *STI)
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
bool hasMadMixInsts() const
unsigned getAddressableNumSGPRs(const MCSubtargetInfo *STI)
unsigned getExplicitKernelArgOffset(const Function &F) const
Returns the offset in bytes from the start of the input buffer of the first explicit kernel argument...
bool hasMFMAInlineLiteralBug() const
bool hasD16LoadStore() const
bool hasMin3Max3_16() const
bool hasVGPRIndexMode() const
bool hasCaymanISA() const
bool hasSGPRInitBug() const
bool hasScalarFlatScratchInsts() const
bool HasInstFwdPrefetchBug
bool hasAutoWaitcntBeforeBarrier() const
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
unsigned getMaxWavesPerEU(const MCSubtargetInfo *STI)
unsigned getEUsPerCU() const
bool isShader(CallingConv::ID cc)
unsigned getMaxFlatWorkGroupSize(const MCSubtargetInfo *STI)
constexpr char NumVGPRs[]
Key for Kernel::CodeProps::Metadata::mNumVGPRs.
int getLDSBankCount() const
virtual ~AMDGPUSubtarget()
bool hasDPPBroadcasts() const
bool hasBCNT(unsigned Size) const
unsigned getMaxWavesPerCU(const MCSubtargetInfo *STI)
unsigned getAddressableNumVGPRs(const MCSubtargetInfo *STI)
TargetSubtargetInfo - Generic base class for all target subtargets.
bool flatScratchIsPointer() const
unsigned getMaxWavesPerEU() const
Provides the logic to select generic machine instructions.
Define a generic scheduling policy for targets that don't provide their own MachineSchedStrategy.
bool hasDot5Insts() const
bool enableSubRegLiveness() const override
bool hasNoSdstCMPX() const
SelectionDAGTargetInfo TSInfo
bool hasInv2PiInlineImm() const
Interface definition for SIInstrInfo.
short getTexVTXClauseSize() const
bool loadStoreOptEnabled() const
bool has12DWordStoreHazard() const
R600 DAG Lowering interface definition.
virtual unsigned getMaxFlatWorkGroupSize() const =0
AMDGPUSubtarget(const Triple &TT)
unsigned getTotalNumVGPRs() const
uint64_t getExplicitKernArgSize(const Function &F, Align &MaxAlign) const
int getIntegerAttribute(const Function &F, StringRef Name, int Default)
bool isXNACKEnabled() const
bool hasFlatInstOffsets() const
bool isAmdHsaOrMesa(const Function &F) const
bool HasSMEMtoVectorWriteHazard
unsigned getMaxFlatWorkGroupSize() const override
unsigned getMinFlatWorkGroupSize() const override
unsigned getMinNumVGPRs(unsigned WavesPerEU) const
bool hasSDWAScalar() const
const InstrItineraryData * getInstrItineraryData() const override
unsigned getMaxNumVGPRs(unsigned WavesPerEU) const
unsigned getMaxNumUserSGPRs() const
bool ldsRequiresM0Init() const
Return if most LDS instructions have an m0 use that require m0 to be iniitalized. ...
bool hasFlatLgkmVMemCountInOrder() const
bool hasDot1Insts() const
FMA - Perform a * b + c with no intermediate rounding step.
const LegalizerInfo * getLegalizerInfo() const override
unsigned getWavesPerWorkGroup(unsigned FlatWorkGroupSize) const
const R600TargetLowering * getTargetLowering() const override
Primary interface to the complete machine description for the target machine.
unsigned getMinNumVGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU)
void setScalarizeGlobalBehavior(bool b)
StringRef - Represent a constant reference to a string, i.e.
bool unsafeDSOffsetFoldingEnabled() const
unsigned getAddressableNumVGPRs() const
unsigned getMaxLocalMemSizeWithWaveCount(unsigned WaveCount, const Function &) const
Return the amount of LDS that can be used that will not restrict the occupancy lower than WaveCount...
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
unsigned getMinWavesPerEU() const override
const SITargetLowering * getTargetLowering() const override
std::pair< unsigned, unsigned > getFlatWorkGroupSizes(const Function &F) const
unsigned getTotalNumSGPRs() const
bool hasReadM0SendMsgHazard() const
unsigned getMaxPrivateElementSize() const
InstructionSelector * getInstructionSelector() const override
unsigned getSGPRAllocGranule(const MCSubtargetInfo *STI)
unsigned getWavefrontSizeLog2() const
Scheduling unit. This is a node in the scheduling DAG.
bool hasCodeObjectV3() const
const SIRegisterInfo * getRegisterInfo() const override