LLVM  5.0.0
AMDGPUSubtarget.h
Go to the documentation of this file.
1 //=====-- AMDGPUSubtarget.h - Define Subtarget for AMDGPU ------*- C++ -*-====//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //==-----------------------------------------------------------------------===//
9 //
10 /// \file
11 /// \brief AMDGPU specific subclass of TargetSubtarget.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUSUBTARGET_H
16 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUSUBTARGET_H
17 
18 #include "AMDGPU.h"
19 #include "R600FrameLowering.h"
20 #include "R600ISelLowering.h"
21 #include "R600InstrInfo.h"
22 #include "SIFrameLowering.h"
23 #include "SIISelLowering.h"
24 #include "SIInstrInfo.h"
25 #include "SIMachineFunctionInfo.h"
26 #include "Utils/AMDGPUBaseInfo.h"
27 #include "llvm/ADT/Triple.h"
33 #include <cassert>
34 #include <cstdint>
35 #include <memory>
36 #include <utility>
37 
38 #define GET_SUBTARGETINFO_HEADER
39 #include "AMDGPUGenSubtargetInfo.inc"
40 
41 namespace llvm {
42 
43 class StringRef;
44 
46 public:
47  enum Generation {
48  R600 = 0,
56  };
57 
58  enum {
76  };
77 
81  };
82 
83  enum TrapID {
92  };
93 
96  };
97 
98 protected:
99  // Basic subtarget description.
102  unsigned IsaVersion;
103  unsigned WavefrontSize;
107 
108  // Possibly statically set by tablegen, but may want to be overridden.
111 
112  // Dynamially set bits that enable features.
116  bool DX10Clamp;
127 
128  // Used as options.
134  bool DumpCode;
135 
136  // Subtarget statically properties set by tablegen
137  bool FP64;
138  bool IsGCN;
141  bool CIInsts;
142  bool GFX9Insts;
147  bool HasMovrel;
151  bool HasSDWA;
157  bool HasDPP;
163  bool CaymanISA;
164  bool CFALUBug;
168 
169  // Dummy feature to use for assembler in tablegen.
171 
175 
176 public:
177  AMDGPUSubtarget(const Triple &TT, StringRef GPU, StringRef FS,
178  const TargetMachine &TM);
179  ~AMDGPUSubtarget() override;
180 
182  StringRef GPU, StringRef FS);
183 
184  const AMDGPUInstrInfo *getInstrInfo() const override = 0;
185  const AMDGPUFrameLowering *getFrameLowering() const override = 0;
186  const AMDGPUTargetLowering *getTargetLowering() const override = 0;
187  const AMDGPURegisterInfo *getRegisterInfo() const override = 0;
188 
189  const InstrItineraryData *getInstrItineraryData() const override {
190  return &InstrItins;
191  }
192 
193  // Nothing implemented, just prevent crashes on use.
194  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
195  return &TSInfo;
196  }
197 
199 
200  bool isAmdHsaOS() const {
201  return TargetTriple.getOS() == Triple::AMDHSA;
202  }
203 
204  bool isMesa3DOS() const {
205  return TargetTriple.getOS() == Triple::Mesa3D;
206  }
207 
208  bool isOpenCLEnv() const {
210  TargetTriple.getEnvironmentName() == "amdgizcl";
211  }
212 
214  return Gen;
215  }
216 
217  unsigned getWavefrontSize() const {
218  return WavefrontSize;
219  }
220 
221  int getLocalMemorySize() const {
222  return LocalMemorySize;
223  }
224 
225  int getLDSBankCount() const {
226  return LDSBankCount;
227  }
228 
229  unsigned getMaxPrivateElementSize() const {
230  return MaxPrivateElementSize;
231  }
232 
234  return AS;
235  }
236 
237  bool has16BitInsts() const {
238  return Has16BitInsts;
239  }
240 
241  bool hasVOP3PInsts() const {
242  return HasVOP3PInsts;
243  }
244 
245  bool hasHWFP64() const {
246  return FP64;
247  }
248 
249  bool hasFastFMAF32() const {
250  return FastFMAF32;
251  }
252 
253  bool hasHalfRate64Ops() const {
254  return HalfRate64Ops;
255  }
256 
257  bool hasAddr64() const {
258  return (getGeneration() < VOLCANIC_ISLANDS);
259  }
260 
261  bool hasBFE() const {
262  return (getGeneration() >= EVERGREEN);
263  }
264 
265  bool hasBFI() const {
266  return (getGeneration() >= EVERGREEN);
267  }
268 
269  bool hasBFM() const {
270  return hasBFE();
271  }
272 
273  bool hasBCNT(unsigned Size) const {
274  if (Size == 32)
275  return (getGeneration() >= EVERGREEN);
276 
277  if (Size == 64)
278  return (getGeneration() >= SOUTHERN_ISLANDS);
279 
280  return false;
281  }
282 
283  bool hasMulU24() const {
284  return (getGeneration() >= EVERGREEN);
285  }
286 
287  bool hasMulI24() const {
288  return (getGeneration() >= SOUTHERN_ISLANDS ||
289  hasCaymanISA());
290  }
291 
292  bool hasFFBL() const {
293  return (getGeneration() >= EVERGREEN);
294  }
295 
296  bool hasFFBH() const {
297  return (getGeneration() >= EVERGREEN);
298  }
299 
300  bool hasMed3_16() const {
301  return getGeneration() >= GFX9;
302  }
303 
304  bool hasMin3Max3_16() const {
305  return getGeneration() >= GFX9;
306  }
307 
308  bool hasCARRY() const {
309  return (getGeneration() >= EVERGREEN);
310  }
311 
312  bool hasBORROW() const {
313  return (getGeneration() >= EVERGREEN);
314  }
315 
316  bool hasCaymanISA() const {
317  return CaymanISA;
318  }
319 
322  }
323 
324  bool isPromoteAllocaEnabled() const {
325  return EnablePromoteAlloca;
326  }
327 
330  }
331 
332  bool dumpCode() const {
333  return DumpCode;
334  }
335 
336  /// Return the amount of LDS that can be used that will not restrict the
337  /// occupancy lower than WaveCount.
338  unsigned getMaxLocalMemSizeWithWaveCount(unsigned WaveCount,
339  const Function &) const;
340 
341  /// Inverse of getMaxLocalMemWithWaveCount. Return the maximum wavecount if
342  /// the given LDS memory size is the only constraint.
343  unsigned getOccupancyWithLocalMemSize(uint32_t Bytes, const Function &) const;
344 
345  unsigned getOccupancyWithLocalMemSize(const MachineFunction &MF) const {
346  const auto *MFI = MF.getInfo<SIMachineFunctionInfo>();
347  return getOccupancyWithLocalMemSize(MFI->getLDSSize(), *MF.getFunction());
348  }
349 
350  bool hasFP16Denormals() const {
351  return FP64FP16Denormals;
352  }
353 
354  bool hasFP32Denormals() const {
355  return FP32Denormals;
356  }
357 
358  bool hasFP64Denormals() const {
359  return FP64FP16Denormals;
360  }
361 
364  }
365 
366  bool hasFPExceptions() const {
367  return FPExceptions;
368  }
369 
370  bool enableDX10Clamp() const {
371  return DX10Clamp;
372  }
373 
374  bool enableIEEEBit(const MachineFunction &MF) const {
376  }
377 
378  bool useFlatForGlobal() const {
379  return FlatForGlobal;
380  }
381 
384  }
385 
387  return UnalignedBufferAccess;
388  }
389 
391  return UnalignedScratchAccess;
392  }
393 
394  bool hasApertureRegs() const {
395  return HasApertureRegs;
396  }
397 
398  bool isTrapHandlerEnabled() const {
399  return TrapHandler;
400  }
401 
402  bool isXNACKEnabled() const {
403  return EnableXNACK;
404  }
405 
406  bool hasFlatAddressSpace() const {
407  return FlatAddressSpace;
408  }
409 
410  bool hasFlatInstOffsets() const {
411  return FlatInstOffsets;
412  }
413 
414  bool hasFlatGlobalInsts() const {
415  return FlatGlobalInsts;
416  }
417 
418  bool hasFlatScratchInsts() const {
419  return FlatScratchInsts;
420  }
421 
422  bool isMesaKernel(const MachineFunction &MF) const {
424  }
425 
426  // Covers VS/PS/CS graphics shaders
427  bool isMesaGfxShader(const MachineFunction &MF) const {
429  }
430 
431  bool isAmdCodeObjectV2(const MachineFunction &MF) const {
432  return isAmdHsaOS() || isMesaKernel(MF);
433  }
434 
435  bool hasFminFmaxLegacy() const {
437  }
438 
439  bool hasSDWA() const {
440  return HasSDWA;
441  }
442 
443  bool hasSDWAOmod() const {
444  return HasSDWAOmod;
445  }
446 
447  bool hasSDWAScalar() const {
448  return HasSDWAScalar;
449  }
450 
451  bool hasSDWASdst() const {
452  return HasSDWASdst;
453  }
454 
455  bool hasSDWAMac() const {
456  return HasSDWAMac;
457  }
458 
459  bool hasSDWAOutModsVOPC() const {
460  return HasSDWAOutModsVOPC;
461  }
462 
463  /// \brief Returns the offset in bytes from the start of the input buffer
464  /// of the first explicit kernel argument.
465  unsigned getExplicitKernelArgOffset(const MachineFunction &MF) const {
466  return isAmdCodeObjectV2(MF) ? 0 : 36;
467  }
468 
469  unsigned getAlignmentForImplicitArgPtr() const {
470  return isAmdHsaOS() ? 8 : 4;
471  }
472 
473  unsigned getImplicitArgNumBytes(const MachineFunction &MF) const {
474  if (isMesaKernel(MF))
475  return 16;
476  if (isAmdHsaOS() && isOpenCLEnv())
477  return 32;
478  return 0;
479  }
480 
481  // Scratch is allocated in 256 dword per wave blocks for the entire
482  // wavefront. When viewed from the perspecive of an arbitrary workitem, this
483  // is 4-byte aligned.
484  unsigned getStackAlignment() const {
485  return 4;
486  }
487 
488  bool enableMachineScheduler() const override {
489  return true;
490  }
491 
492  bool enableSubRegLiveness() const override {
493  return true;
494  }
495 
498 
499  /// \returns Number of execution units per compute unit supported by the
500  /// subtarget.
501  unsigned getEUsPerCU() const {
502  return AMDGPU::IsaInfo::getEUsPerCU(getFeatureBits());
503  }
504 
505  /// \returns Maximum number of work groups per compute unit supported by the
506  /// subtarget and limited by given \p FlatWorkGroupSize.
507  unsigned getMaxWorkGroupsPerCU(unsigned FlatWorkGroupSize) const {
508  return AMDGPU::IsaInfo::getMaxWorkGroupsPerCU(getFeatureBits(),
509  FlatWorkGroupSize);
510  }
511 
512  /// \returns Maximum number of waves per compute unit supported by the
513  /// subtarget without any kind of limitation.
514  unsigned getMaxWavesPerCU() const {
515  return AMDGPU::IsaInfo::getMaxWavesPerCU(getFeatureBits());
516  }
517 
518  /// \returns Maximum number of waves per compute unit supported by the
519  /// subtarget and limited by given \p FlatWorkGroupSize.
520  unsigned getMaxWavesPerCU(unsigned FlatWorkGroupSize) const {
521  return AMDGPU::IsaInfo::getMaxWavesPerCU(getFeatureBits(),
522  FlatWorkGroupSize);
523  }
524 
525  /// \returns Minimum number of waves per execution unit supported by the
526  /// subtarget.
527  unsigned getMinWavesPerEU() const {
528  return AMDGPU::IsaInfo::getMinWavesPerEU(getFeatureBits());
529  }
530 
531  /// \returns Maximum number of waves per execution unit supported by the
532  /// subtarget without any kind of limitation.
533  unsigned getMaxWavesPerEU() const {
534  return AMDGPU::IsaInfo::getMaxWavesPerEU(getFeatureBits());
535  }
536 
537  /// \returns Maximum number of waves per execution unit supported by the
538  /// subtarget and limited by given \p FlatWorkGroupSize.
539  unsigned getMaxWavesPerEU(unsigned FlatWorkGroupSize) const {
540  return AMDGPU::IsaInfo::getMaxWavesPerEU(getFeatureBits(),
541  FlatWorkGroupSize);
542  }
543 
544  /// \returns Minimum flat work group size supported by the subtarget.
545  unsigned getMinFlatWorkGroupSize() const {
546  return AMDGPU::IsaInfo::getMinFlatWorkGroupSize(getFeatureBits());
547  }
548 
549  /// \returns Maximum flat work group size supported by the subtarget.
550  unsigned getMaxFlatWorkGroupSize() const {
551  return AMDGPU::IsaInfo::getMaxFlatWorkGroupSize(getFeatureBits());
552  }
553 
554  /// \returns Number of waves per work group supported by the subtarget and
555  /// limited by given \p FlatWorkGroupSize.
556  unsigned getWavesPerWorkGroup(unsigned FlatWorkGroupSize) const {
557  return AMDGPU::IsaInfo::getWavesPerWorkGroup(getFeatureBits(),
558  FlatWorkGroupSize);
559  }
560 
561  /// \returns Subtarget's default pair of minimum/maximum flat work group sizes
562  /// for function \p F, or minimum/maximum flat work group sizes explicitly
563  /// requested using "amdgpu-flat-work-group-size" attribute attached to
564  /// function \p F.
565  ///
566  /// \returns Subtarget's default values if explicitly requested values cannot
567  /// be converted to integer, or violate subtarget's specifications.
568  std::pair<unsigned, unsigned> getFlatWorkGroupSizes(const Function &F) const;
569 
570  /// \returns Subtarget's default pair of minimum/maximum number of waves per
571  /// execution unit for function \p F, or minimum/maximum number of waves per
572  /// execution unit explicitly requested using "amdgpu-waves-per-eu" attribute
573  /// attached to function \p F.
574  ///
575  /// \returns Subtarget's default values if explicitly requested values cannot
576  /// be converted to integer, violate subtarget's specifications, or are not
577  /// compatible with minimum/maximum number of waves limited by flat work group
578  /// size, register usage, and/or lds usage.
579  std::pair<unsigned, unsigned> getWavesPerEU(const Function &F) const;
580 
581  /// Creates value range metadata on an workitemid.* inrinsic call or load.
582  bool makeLIDRangeMetadata(Instruction *I) const;
583 };
584 
585 class R600Subtarget final : public AMDGPUSubtarget {
586 private:
587  R600InstrInfo InstrInfo;
588  R600FrameLowering FrameLowering;
589  R600TargetLowering TLInfo;
590 
591 public:
592  R600Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
593  const TargetMachine &TM);
594 
595  const R600InstrInfo *getInstrInfo() const override {
596  return &InstrInfo;
597  }
598 
599  const R600FrameLowering *getFrameLowering() const override {
600  return &FrameLowering;
601  }
602 
603  const R600TargetLowering *getTargetLowering() const override {
604  return &TLInfo;
605  }
606 
607  const R600RegisterInfo *getRegisterInfo() const override {
608  return &InstrInfo.getRegisterInfo();
609  }
610 
611  bool hasCFAluBug() const {
612  return CFALUBug;
613  }
614 
615  bool hasVertexCache() const {
616  return HasVertexCache;
617  }
618 
619  short getTexVTXClauseSize() const {
620  return TexVTXClauseSize;
621  }
622 };
623 
624 class SISubtarget final : public AMDGPUSubtarget {
625 private:
626  SIInstrInfo InstrInfo;
627  SIFrameLowering FrameLowering;
628  SITargetLowering TLInfo;
629  std::unique_ptr<GISelAccessor> GISel;
630 
631 public:
632  SISubtarget(const Triple &TT, StringRef CPU, StringRef FS,
633  const TargetMachine &TM);
634 
635  const SIInstrInfo *getInstrInfo() const override {
636  return &InstrInfo;
637  }
638 
639  const SIFrameLowering *getFrameLowering() const override {
640  return &FrameLowering;
641  }
642 
643  const SITargetLowering *getTargetLowering() const override {
644  return &TLInfo;
645  }
646 
647  const CallLowering *getCallLowering() const override {
648  assert(GISel && "Access to GlobalISel APIs not set");
649  return GISel->getCallLowering();
650  }
651 
652  const InstructionSelector *getInstructionSelector() const override {
653  assert(GISel && "Access to GlobalISel APIs not set");
654  return GISel->getInstructionSelector();
655  }
656 
657  const LegalizerInfo *getLegalizerInfo() const override {
658  assert(GISel && "Access to GlobalISel APIs not set");
659  return GISel->getLegalizerInfo();
660  }
661 
662  const RegisterBankInfo *getRegBankInfo() const override {
663  assert(GISel && "Access to GlobalISel APIs not set");
664  return GISel->getRegBankInfo();
665  }
666 
667  const SIRegisterInfo *getRegisterInfo() const override {
668  return &InstrInfo.getRegisterInfo();
669  }
670 
672  this->GISel.reset(&GISel);
673  }
674 
675  // XXX - Why is this here if it isn't in the default pass set?
676  bool enableEarlyIfConversion() const override {
677  return true;
678  }
679 
681  unsigned NumRegionInstrs) const override;
682 
683  bool isVGPRSpillingEnabled(const Function& F) const;
684 
685  unsigned getMaxNumUserSGPRs() const {
686  return 16;
687  }
688 
689  bool hasSMemRealTime() const {
690  return HasSMemRealTime;
691  }
692 
693  bool hasMovrel() const {
694  return HasMovrel;
695  }
696 
697  bool hasVGPRIndexMode() const {
698  return HasVGPRIndexMode;
699  }
700 
701  bool useVGPRIndexMode(bool UserEnable) const {
702  return !hasMovrel() || (UserEnable && hasVGPRIndexMode());
703  }
704 
705  bool hasScalarCompareEq64() const {
706  return getGeneration() >= VOLCANIC_ISLANDS;
707  }
708 
709  bool hasScalarStores() const {
710  return HasScalarStores;
711  }
712 
713  bool hasInv2PiInlineImm() const {
714  return HasInv2PiInlineImm;
715  }
716 
717  bool hasDPP() const {
718  return HasDPP;
719  }
720 
721  bool enableSIScheduler() const {
722  return EnableSIScheduler;
723  }
724 
725  bool debuggerSupported() const {
726  return debuggerInsertNops() && debuggerReserveRegs() &&
728  }
729 
730  bool debuggerInsertNops() const {
731  return DebuggerInsertNops;
732  }
733 
734  bool debuggerReserveRegs() const {
735  return DebuggerReserveRegs;
736  }
737 
738  bool debuggerEmitPrologue() const {
739  return DebuggerEmitPrologue;
740  }
741 
742  bool loadStoreOptEnabled() const {
743  return EnableLoadStoreOpt;
744  }
745 
746  bool hasSGPRInitBug() const {
747  return SGPRInitBug;
748  }
749 
750  bool has12DWordStoreHazard() const {
752  }
753 
754  bool hasSMovFedHazard() const {
756  }
757 
758  bool hasReadM0Hazard() const {
760  }
761 
762  unsigned getKernArgSegmentSize(const MachineFunction &MF, unsigned ExplictArgBytes) const;
763 
764  /// Return the maximum number of waves per SIMD for kernels using \p SGPRs SGPRs
765  unsigned getOccupancyWithNumSGPRs(unsigned SGPRs) const;
766 
767  /// Return the maximum number of waves per SIMD for kernels using \p VGPRs VGPRs
768  unsigned getOccupancyWithNumVGPRs(unsigned VGPRs) const;
769 
770  /// \returns true if the flat_scratch register should be initialized with the
771  /// pointer to the wave's scratch memory rather than a size and offset.
772  bool flatScratchIsPointer() const {
773  return getGeneration() >= GFX9;
774  }
775 
776  /// \returns SGPR allocation granularity supported by the subtarget.
777  unsigned getSGPRAllocGranule() const {
778  return AMDGPU::IsaInfo::getSGPRAllocGranule(getFeatureBits());
779  }
780 
781  /// \returns SGPR encoding granularity supported by the subtarget.
782  unsigned getSGPREncodingGranule() const {
783  return AMDGPU::IsaInfo::getSGPREncodingGranule(getFeatureBits());
784  }
785 
786  /// \returns Total number of SGPRs supported by the subtarget.
787  unsigned getTotalNumSGPRs() const {
788  return AMDGPU::IsaInfo::getTotalNumSGPRs(getFeatureBits());
789  }
790 
791  /// \returns Addressable number of SGPRs supported by the subtarget.
792  unsigned getAddressableNumSGPRs() const {
793  return AMDGPU::IsaInfo::getAddressableNumSGPRs(getFeatureBits());
794  }
795 
796  /// \returns Minimum number of SGPRs that meets the given number of waves per
797  /// execution unit requirement supported by the subtarget.
798  unsigned getMinNumSGPRs(unsigned WavesPerEU) const {
799  return AMDGPU::IsaInfo::getMinNumSGPRs(getFeatureBits(), WavesPerEU);
800  }
801 
802  /// \returns Maximum number of SGPRs that meets the given number of waves per
803  /// execution unit requirement supported by the subtarget.
804  unsigned getMaxNumSGPRs(unsigned WavesPerEU, bool Addressable) const {
805  return AMDGPU::IsaInfo::getMaxNumSGPRs(getFeatureBits(), WavesPerEU,
806  Addressable);
807  }
808 
809  /// \returns Reserved number of SGPRs for given function \p MF.
810  unsigned getReservedNumSGPRs(const MachineFunction &MF) const;
811 
812  /// \returns Maximum number of SGPRs that meets number of waves per execution
813  /// unit requirement for function \p MF, or number of SGPRs explicitly
814  /// requested using "amdgpu-num-sgpr" attribute attached to function \p MF.
815  ///
816  /// \returns Value that meets number of waves per execution unit requirement
817  /// if explicitly requested value cannot be converted to integer, violates
818  /// subtarget's specifications, or does not meet number of waves per execution
819  /// unit requirement.
820  unsigned getMaxNumSGPRs(const MachineFunction &MF) const;
821 
822  /// \returns VGPR allocation granularity supported by the subtarget.
823  unsigned getVGPRAllocGranule() const {
824  return AMDGPU::IsaInfo::getVGPRAllocGranule(getFeatureBits());
825  }
826 
827  /// \returns VGPR encoding granularity supported by the subtarget.
828  unsigned getVGPREncodingGranule() const {
829  return AMDGPU::IsaInfo::getVGPREncodingGranule(getFeatureBits());
830  }
831 
832  /// \returns Total number of VGPRs supported by the subtarget.
833  unsigned getTotalNumVGPRs() const {
834  return AMDGPU::IsaInfo::getTotalNumVGPRs(getFeatureBits());
835  }
836 
837  /// \returns Addressable number of VGPRs supported by the subtarget.
838  unsigned getAddressableNumVGPRs() const {
839  return AMDGPU::IsaInfo::getAddressableNumVGPRs(getFeatureBits());
840  }
841 
842  /// \returns Minimum number of VGPRs that meets given number of waves per
843  /// execution unit requirement supported by the subtarget.
844  unsigned getMinNumVGPRs(unsigned WavesPerEU) const {
845  return AMDGPU::IsaInfo::getMinNumVGPRs(getFeatureBits(), WavesPerEU);
846  }
847 
848  /// \returns Maximum number of VGPRs that meets given number of waves per
849  /// execution unit requirement supported by the subtarget.
850  unsigned getMaxNumVGPRs(unsigned WavesPerEU) const {
851  return AMDGPU::IsaInfo::getMaxNumVGPRs(getFeatureBits(), WavesPerEU);
852  }
853 
854  /// \returns Reserved number of VGPRs for given function \p MF.
855  unsigned getReservedNumVGPRs(const MachineFunction &MF) const {
856  return debuggerReserveRegs() ? 4 : 0;
857  }
858 
859  /// \returns Maximum number of VGPRs that meets number of waves per execution
860  /// unit requirement for function \p MF, or number of VGPRs explicitly
861  /// requested using "amdgpu-num-vgpr" attribute attached to function \p MF.
862  ///
863  /// \returns Value that meets number of waves per execution unit requirement
864  /// if explicitly requested value cannot be converted to integer, violates
865  /// subtarget's specifications, or does not meet number of waves per execution
866  /// unit requirement.
867  unsigned getMaxNumVGPRs(const MachineFunction &MF) const;
868 };
869 
870 } // end namespace llvm
871 
872 #endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUSUBTARGET_H
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
Definition: Triple.h:290
unsigned getAddressableNumVGPRs() const
unsigned getMinNumVGPRs(const FeatureBitset &Features, unsigned WavesPerEU)
bool hasCaymanISA() const
const AMDGPURegisterInfo * getRegisterInfo() const override=0
bool hasSMovFedHazard() const
The goal of this helper class is to gather the accessor to all the APIs related to GlobalISel...
Definition: GISelAccessor.h:29
unsigned getAddressableNumVGPRs(const FeatureBitset &Features)
bool isTrapHandlerEnabled() const
bool makeLIDRangeMetadata(Instruction *I) const
Creates value range metadata on an workitemid.* inrinsic call or load.
bool hasVertexCache() const
Interface definition for R600InstrInfo.
bool isVGPRSpillingEnabled(const Function &F) const
unsigned getMinNumSGPRs(unsigned WavesPerEU) const
bool hasUnalignedBufferAccess() const
unsigned getMaxNumVGPRs(unsigned WavesPerEU) const
int getLDSBankCount() const
bool hasFlatGlobalInsts() const
bool hasFastFMAF32() const
bool useVGPRIndexMode(bool UserEnable) const
AMDGPUSubtarget & initializeSubtargetDependencies(const Triple &TT, StringRef GPU, StringRef FS)
unsigned getVGPREncodingGranule() const
unsigned getMaxWorkGroupsPerCU(const FeatureBitset &Features, unsigned FlatWorkGroupSize)
const SIInstrInfo * getInstrInfo() const override
bool hasSDWAOmod() const
bool enableIEEEBit(const MachineFunction &MF) const
SelectionDAGTargetInfo TSInfo
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
unsigned getTotalNumVGPRs(const FeatureBitset &Features)
unsigned getMinWavesPerEU(const FeatureBitset &Features)
int getLocalMemorySize() const
bool loadStoreOptEnabled() const
bool hasFPExceptions() const
bool isAmdCodeObjectV2(const MachineFunction &MF) const
bool hasSDWAScalar() const
unsigned getWavesPerWorkGroup(const FeatureBitset &Features, unsigned FlatWorkGroupSize)
unsigned getImplicitArgNumBytes(const MachineFunction &MF) const
unsigned getMinNumVGPRs(unsigned WavesPerEU) const
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Definition: Function.h:186
unsigned getVGPREncodingGranule(const FeatureBitset &Features)
unsigned getMaxWavesPerEU(unsigned FlatWorkGroupSize) const
bool isMesaKernel(const MachineFunction &MF) const
unsigned getTotalNumVGPRs() const
unsigned getMaxWorkGroupsPerCU(unsigned FlatWorkGroupSize) const
unsigned getEUsPerCU(const FeatureBitset &Features)
Holds all the information related to register banks.
unsigned getOccupancyWithNumSGPRs(unsigned SGPRs) const
Return the maximum number of waves per SIMD for kernels using SGPRs SGPRs.
bool enableSIScheduler() const
unsigned getVGPRAllocGranule(const FeatureBitset &Features)
OpenCL uses address spaces to differentiate between various memory regions on the hardware...
Definition: AMDGPU.h:164
bool useFlatForGlobal() const
unsigned getSGPREncodingGranule() const
bool flatScratchIsPointer() const
std::pair< unsigned, unsigned > getWavesPerEU(const Function &F) const
const InstrItineraryData * getInstrItineraryData() const override
bool hasSDWAOutModsVOPC() const
const InstructionSelector * getInstructionSelector() const override
unsigned getMinFlatWorkGroupSize(const FeatureBitset &Features)
bool getScalarizeGlobalBehavior() const
unsigned getMaxWavesPerCU(const FeatureBitset &Features)
bool isMesaGfxShader(const MachineFunction &MF) const
unsigned getMaxNumSGPRs(const FeatureBitset &Features, unsigned WavesPerEU, bool Addressable)
bool hasCFAluBug() const
unsigned getMaxNumUserSGPRs() const
#define F(x, y, z)
Definition: MD5.cpp:55
bool isXNACKEnabled() const
bool hasFlatAddressSpace() const
bool hasVGPRIndexMode() const
const LegalizerInfo * getLegalizerInfo() const override
SISubtarget(const Triple &TT, StringRef CPU, StringRef FS, const TargetMachine &TM)
TrapHandlerAbi getTrapHandlerAbi() const
unsigned getMaxWavesPerEU(const FeatureBitset &Features)
const AMDGPUFrameLowering * getFrameLowering() const override=0
Itinerary data supplied by a subtarget to be used by a target.
unsigned getMaxFlatWorkGroupSize(const FeatureBitset &Features)
const RegisterBankInfo * getRegBankInfo() const override
Generation getGeneration() const
const SIRegisterInfo & getRegisterInfo() const
Definition: SIInstrInfo.h:125
bool hasHalfRate64Ops() const
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
bool hasSGPRInitBug() const
const R600FrameLowering * getFrameLowering() const override
bool hasSDWAMac() const
unsigned getMaxWavesPerCU(unsigned FlatWorkGroupSize) const
StringRef getEnvironmentName() const
getEnvironmentName - Get the optional environment (fourth) component of the triple, or "" if empty.
Definition: Triple.cpp:936
bool isCompute(CallingConv::ID cc)
unsigned getMaxWavesPerEU() const
unsigned getKernArgSegmentSize(const MachineFunction &MF, unsigned ExplictArgBytes) const
unsigned getTotalNumSGPRs(const FeatureBitset &Features)
bool hasFlatScratchInsts() const
unsigned getMaxWavesPerCU() const
bool isOpenCLEnv() const
R600Subtarget(const Triple &TT, StringRef CPU, StringRef FS, const TargetMachine &TM)
bool hasUnalignedScratchAccess() const
unsigned getMinFlatWorkGroupSize() const
unsigned getMinNumSGPRs(const FeatureBitset &Features, unsigned WavesPerEU)
SI DAG Lowering interface definition.
unsigned getOccupancyWithNumVGPRs(unsigned VGPRs) const
Return the maximum number of waves per SIMD for kernels using VGPRs VGPRs.
const R600InstrInfo * getInstrInfo() const override
bool hasScalarStores() const
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
bool hasFP32Denormals() const
bool debuggerReserveRegs() const
bool debuggerSupported() const
bool hasMovrel() const
bool hasMed3_16() const
unsigned getReservedNumSGPRs(const MachineFunction &MF) const
unsigned getMaxFlatWorkGroupSize() const
bool has16BitInsts() const
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
unsigned getOccupancyWithLocalMemSize(uint32_t Bytes, const Function &) const
Inverse of getMaxLocalMemWithWaveCount.
const AMDGPUInstrInfo * getInstrInfo() const override=0
bool hasScalarCompareEq64() const
unsigned getAddressableNumSGPRs() const
bool hasInv2PiInlineImm() const
bool isPromoteAllocaEnabled() const
bool hasFP64Denormals() const
bool hasFlatInstOffsets() const
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
const R600RegisterInfo * getRegisterInfo() const override
const AMDGPUTargetLowering * getTargetLowering() const override=0
unsigned getMinWavesPerEU() const
const SIRegisterInfo * getRegisterInfo() const override
unsigned getSGPRAllocGranule() const
bool debuggerInsertNops() const
AMDGPUAS getAMDGPUAS() const
void setScalarizeGlobalBehavior(bool b)
bool hasApertureRegs() const
bool isShader(CallingConv::ID cc)
bool isAmdHsaOS() const
void setGISelAccessor(GISelAccessor &GISel)
short getTexVTXClauseSize() 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...
bool enableSubRegLiveness() const override
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
bool supportsMinMaxDenormModes() const
Provides the logic to select generic machine instructions.
Define a generic scheduling policy for targets that don't provide their own MachineSchedStrategy.
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
Interface definition for SIInstrInfo.
bool unsafeDSOffsetFoldingEnabled() const
unsigned getMaxPrivateElementSize() const
R600 DAG Lowering interface definition.
bool enableEarlyIfConversion() const override
unsigned getReservedNumVGPRs(const MachineFunction &MF) const
Information about the stack frame layout on the AMDGPU targets.
const R600RegisterInfo & getRegisterInfo() const
Definition: R600InstrInfo.h:69
#define I(x, y, z)
Definition: MD5.cpp:58
const CallLowering * getCallLowering() const override
void overrideSchedPolicy(MachineSchedPolicy &Policy, unsigned NumRegionInstrs) const override
bool isMesa3DOS() const
const SIFrameLowering * getFrameLowering() const override
bool enableDX10Clamp() const
unsigned getTotalNumSGPRs() const
unsigned getExplicitKernelArgOffset(const MachineFunction &MF) const
Returns the offset in bytes from the start of the input buffer of the first explicit kernel argument...
~AMDGPUSubtarget() override
unsigned getWavefrontSize() const
bool hasDPP() const
unsigned getAddressableNumSGPRs(const FeatureBitset &Features)
AMDGPUSubtarget(const Triple &TT, StringRef GPU, StringRef FS, const TargetMachine &TM)
const SITargetLowering * getTargetLowering() const override
bool hasReadM0Hazard() const
unsigned getSGPREncodingGranule(const FeatureBitset &Features)
unsigned getEUsPerCU() const
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
Definition: Triple.h:299
unsigned getStackAlignment() const
unsigned getWavesPerWorkGroup(unsigned FlatWorkGroupSize) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasSMemRealTime() const
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
InstrItineraryData InstrItins
bool hasVOP3PInsts() const
const R600TargetLowering * getTargetLowering() const override
bool hasFminFmaxLegacy() const
unsigned getSGPRAllocGranule(const FeatureBitset &Features)
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:56
unsigned getMaxNumSGPRs(unsigned WavesPerEU, bool Addressable) const
bool hasBCNT(unsigned Size) const
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
std::pair< unsigned, unsigned > getFlatWorkGroupSizes(const Function &F) const
bool hasMin3Max3_16() const
bool hasFP16Denormals() const
bool hasSDWASdst() const
unsigned getMaxNumVGPRs(const FeatureBitset &Features, unsigned WavesPerEU)
bool hasAutoWaitcntBeforeBarrier() const
bool enableMachineScheduler() const override
bool debuggerEmitPrologue() const
unsigned getVGPRAllocGranule() const
bool has12DWordStoreHazard() const
unsigned getOccupancyWithLocalMemSize(const MachineFunction &MF) const
unsigned getAlignmentForImplicitArgPtr() const