2017-08-09 07:53:55 +08:00
|
|
|
//===- AMDGPUTargetTransformInfo.h - AMDGPU specific TTI --------*- C++ -*-===//
|
2015-01-31 19:17:59 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-01-31 19:17:59 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2017-08-09 07:53:55 +08:00
|
|
|
//
|
2015-01-31 19:17:59 +08:00
|
|
|
/// \file
|
|
|
|
/// This file a TargetTransformInfo::Concept conforming object specific to the
|
|
|
|
/// AMDGPU target machine. It uses the target's detailed information to
|
|
|
|
/// provide more precise answers to certain TTI queries, while letting the
|
|
|
|
/// target independent and default TTI implementations handle the rest.
|
2017-08-09 07:53:55 +08:00
|
|
|
//
|
2015-01-31 19:17:59 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-03-11 16:00:27 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUTARGETTRANSFORMINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_AMDGPUTARGETTRANSFORMINFO_H
|
2015-01-31 19:17:59 +08:00
|
|
|
|
|
|
|
#include "AMDGPU.h"
|
2017-08-09 07:53:55 +08:00
|
|
|
#include "AMDGPUSubtarget.h"
|
2015-01-31 19:17:59 +08:00
|
|
|
#include "AMDGPUTargetMachine.h"
|
AMDGPU: Remove #include "MCTargetDesc/AMDGPUMCTargetDesc.h" from common headers
Summary:
MCTargetDesc/AMDGPUMCTargetDesc.h contains enums for all the instuction
and register defintions, which are huge so we only want to include
them where needed.
This will also make it easier if we want to split the R600 and GCN
definitions into separate tablegenerated files.
I was unable to remove AMDGPUMCTargetDesc.h from SIMachineFunctionInfo.h
because it uses some enums from the header to initialize default values
for the SIMachineFunction class, so I ended up having to remove includes of
SIMachineFunctionInfo.h from headers too.
Reviewers: arsenm, nhaehnle
Reviewed By: nhaehnle
Subscribers: MatzeB, kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46272
llvm-svn: 332930
2018-05-22 10:03:23 +08:00
|
|
|
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
|
2017-08-09 07:53:55 +08:00
|
|
|
#include "Utils/AMDGPUBaseInfo.h"
|
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
2015-01-31 19:17:59 +08:00
|
|
|
#include "llvm/Analysis/TargetTransformInfo.h"
|
|
|
|
#include "llvm/CodeGen/BasicTTIImpl.h"
|
2017-08-09 07:53:55 +08:00
|
|
|
#include "llvm/IR/Function.h"
|
|
|
|
#include "llvm/MC/SubtargetFeature.h"
|
|
|
|
#include "llvm/Support/MathExtras.h"
|
|
|
|
#include <cassert>
|
2015-01-31 19:17:59 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
2017-08-09 07:53:55 +08:00
|
|
|
|
2016-03-25 09:00:32 +08:00
|
|
|
class AMDGPUTargetLowering;
|
2017-08-09 07:53:55 +08:00
|
|
|
class Loop;
|
|
|
|
class ScalarEvolution;
|
|
|
|
class Type;
|
|
|
|
class Value;
|
2015-01-31 19:17:59 +08:00
|
|
|
|
2016-03-11 16:00:27 +08:00
|
|
|
class AMDGPUTTIImpl final : public BasicTTIImplBase<AMDGPUTTIImpl> {
|
2017-08-09 07:53:55 +08:00
|
|
|
using BaseT = BasicTTIImplBase<AMDGPUTTIImpl>;
|
|
|
|
using TTI = TargetTransformInfo;
|
|
|
|
|
2015-02-01 22:01:15 +08:00
|
|
|
friend BaseT;
|
2015-01-31 19:17:59 +08:00
|
|
|
|
AMDGPU: Separate R600 and GCN TableGen files
Summary:
We now have two sets of generated TableGen files, one for R600 and one
for GCN, so each sub-target now has its own tables of instructions,
registers, ISel patterns, etc. This should help reduce compile time
since each sub-target now only has to consider information that
is specific to itself. This will also help prevent the R600
sub-target from slowing down new features for GCN, like disassembler
support, GlobalISel, etc.
Reviewers: arsenm, nhaehnle, jvesely
Reviewed By: arsenm
Subscribers: MatzeB, kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46365
llvm-svn: 335942
2018-06-29 07:47:12 +08:00
|
|
|
Triple TargetTriple;
|
2018-05-31 06:55:35 +08:00
|
|
|
|
2019-11-01 09:50:30 +08:00
|
|
|
const GCNSubtarget *ST;
|
2019-10-10 04:48:54 +08:00
|
|
|
const TargetLoweringBase *TLI;
|
|
|
|
|
|
|
|
const TargetSubtargetInfo *getST() const { return ST; }
|
|
|
|
const TargetLoweringBase *getTLI() const { return TLI; }
|
|
|
|
|
2018-05-31 06:55:35 +08:00
|
|
|
public:
|
|
|
|
explicit AMDGPUTTIImpl(const AMDGPUTargetMachine *TM, const Function &F)
|
2019-10-10 04:48:54 +08:00
|
|
|
: BaseT(TM, F.getParent()->getDataLayout()),
|
|
|
|
TargetTriple(TM->getTargetTriple()),
|
|
|
|
ST(static_cast<const GCNSubtarget *>(TM->getSubtargetImpl(F))),
|
|
|
|
TLI(ST->getTargetLowering()) {}
|
2018-05-31 06:55:35 +08:00
|
|
|
|
|
|
|
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
|
|
|
|
TTI::UnrollingPreferences &UP);
|
|
|
|
};
|
|
|
|
|
|
|
|
class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
|
|
|
|
using BaseT = BasicTTIImplBase<GCNTTIImpl>;
|
|
|
|
using TTI = TargetTransformInfo;
|
|
|
|
|
|
|
|
friend BaseT;
|
|
|
|
|
2018-07-12 04:59:01 +08:00
|
|
|
const GCNSubtarget *ST;
|
2020-02-04 01:33:43 +08:00
|
|
|
const SITargetLowering *TLI;
|
2018-05-31 06:55:35 +08:00
|
|
|
AMDGPUTTIImpl CommonTTI;
|
2017-01-31 09:20:54 +08:00
|
|
|
bool IsGraphicsShader;
|
2019-11-01 09:50:30 +08:00
|
|
|
bool HasFP32Denormals;
|
2015-02-01 22:01:15 +08:00
|
|
|
|
2017-08-08 01:08:44 +08:00
|
|
|
const FeatureBitset InlineFeatureIgnoreList = {
|
|
|
|
// Codegen control options which don't matter.
|
|
|
|
AMDGPU::FeatureEnableLoadStoreOpt,
|
|
|
|
AMDGPU::FeatureEnableSIScheduler,
|
|
|
|
AMDGPU::FeatureEnableUnsafeDSOffsetFolding,
|
|
|
|
AMDGPU::FeatureFlatForGlobal,
|
|
|
|
AMDGPU::FeaturePromoteAlloca,
|
|
|
|
AMDGPU::FeatureUnalignedBufferAccess,
|
|
|
|
AMDGPU::FeatureUnalignedScratchAccess,
|
|
|
|
|
|
|
|
AMDGPU::FeatureAutoWaitcntBeforeBarrier,
|
|
|
|
|
|
|
|
// Property of the kernel/environment which can't actually differ.
|
|
|
|
AMDGPU::FeatureSGPRInitBug,
|
|
|
|
AMDGPU::FeatureXNACK,
|
|
|
|
AMDGPU::FeatureTrapHandler,
|
2019-02-13 07:30:11 +08:00
|
|
|
AMDGPU::FeatureCodeObjectV3,
|
2017-08-08 01:08:44 +08:00
|
|
|
|
2019-04-03 09:58:57 +08:00
|
|
|
// The default assumption needs to be ecc is enabled, but no directly
|
|
|
|
// exposed operations depend on it, so it can be safely inlined.
|
|
|
|
AMDGPU::FeatureSRAMECC,
|
|
|
|
|
2017-08-08 01:08:44 +08:00
|
|
|
// Perf-tuning features
|
|
|
|
AMDGPU::FeatureFastFMAF32,
|
|
|
|
AMDGPU::HalfRate64Ops
|
|
|
|
};
|
|
|
|
|
2018-07-12 04:59:01 +08:00
|
|
|
const GCNSubtarget *getST() const { return ST; }
|
2015-02-01 22:01:15 +08:00
|
|
|
const AMDGPUTargetLowering *getTLI() const { return TLI; }
|
2015-01-31 19:17:59 +08:00
|
|
|
|
2016-03-25 09:00:32 +08:00
|
|
|
static inline int getFullRateInstrCost() {
|
|
|
|
return TargetTransformInfo::TCC_Basic;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int getHalfRateInstrCost() {
|
|
|
|
return 2 * TargetTransformInfo::TCC_Basic;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: The size is usually 8 bytes, but takes 4x as many cycles. Maybe
|
|
|
|
// should be 2 or 4.
|
|
|
|
static inline int getQuarterRateInstrCost() {
|
|
|
|
return 3 * TargetTransformInfo::TCC_Basic;
|
|
|
|
}
|
|
|
|
|
|
|
|
// On some parts, normal fp64 operations are half rate, and others
|
|
|
|
// quarter. This also applies to some integer operations.
|
|
|
|
inline int get64BitInstrCost() const {
|
|
|
|
return ST->hasHalfRate64Ops() ?
|
|
|
|
getHalfRateInstrCost() : getQuarterRateInstrCost();
|
|
|
|
}
|
|
|
|
|
2015-01-31 19:17:59 +08:00
|
|
|
public:
|
2018-05-31 06:55:35 +08:00
|
|
|
explicit GCNTTIImpl(const AMDGPUTargetMachine *TM, const Function &F)
|
2016-06-28 04:48:03 +08:00
|
|
|
: BaseT(TM, F.getParent()->getDataLayout()),
|
2018-07-12 04:59:01 +08:00
|
|
|
ST(static_cast<const GCNSubtarget*>(TM->getSubtargetImpl(F))),
|
2017-01-31 09:20:54 +08:00
|
|
|
TLI(ST->getTargetLowering()),
|
2018-05-31 06:55:35 +08:00
|
|
|
CommonTTI(TM, F),
|
2019-11-01 09:50:30 +08:00
|
|
|
IsGraphicsShader(AMDGPU::isShader(F.getCallingConv())),
|
2019-11-18 19:18:07 +08:00
|
|
|
HasFP32Denormals(AMDGPU::SIModeRegisterDefaults(F).allFP32Denormals()) {}
|
2015-01-31 19:17:59 +08:00
|
|
|
|
|
|
|
bool hasBranchDivergence() { return true; }
|
Resubmit: [DA][TTI][AMDGPU] Add option to select GPUDA with TTI
Summary:
Enable the new diveregence analysis by default for AMDGPU.
Resubmit with test updates since GPUDA was causing failures on Windows.
Reviewers: rampitec, nhaehnle, arsenm, thakis
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73315
2020-01-20 23:25:20 +08:00
|
|
|
bool useGPUDivergenceAnalysis() const;
|
2015-01-31 19:17:59 +08:00
|
|
|
|
[LoopUnroll] Pass SCEV to getUnrollingPreferences hook. NFCI.
Reviewers: sanjoy, anna, reames, apilipenko, igor-laevsky, mkuper
Subscribers: jholewinski, arsenm, mzolotukhin, nemanjai, nhaehnle, javed.absar, mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D34531
llvm-svn: 306554
2017-06-28 23:53:17 +08:00
|
|
|
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
|
|
|
|
TTI::UnrollingPreferences &UP);
|
2015-01-31 19:17:59 +08:00
|
|
|
|
|
|
|
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) {
|
|
|
|
assert(isPowerOf2_32(TyWidth) && "Ty width must be power of 2");
|
2016-05-19 00:10:19 +08:00
|
|
|
return TTI::PSK_FastHardware;
|
2015-01-31 19:17:59 +08:00
|
|
|
}
|
|
|
|
|
2017-06-21 04:38:06 +08:00
|
|
|
unsigned getHardwareNumberOfRegisters(bool Vector) const;
|
|
|
|
unsigned getNumberOfRegisters(bool Vector) const;
|
2017-08-09 07:53:55 +08:00
|
|
|
unsigned getRegisterBitWidth(bool Vector) const;
|
2017-06-21 04:38:06 +08:00
|
|
|
unsigned getMinVectorRegisterBitWidth() const;
|
2018-03-08 01:09:18 +08:00
|
|
|
unsigned getLoadVectorFactor(unsigned VF, unsigned LoadSize,
|
|
|
|
unsigned ChainSizeInBytes,
|
|
|
|
VectorType *VecTy) const;
|
|
|
|
unsigned getStoreVectorFactor(unsigned VF, unsigned StoreSize,
|
|
|
|
unsigned ChainSizeInBytes,
|
|
|
|
VectorType *VecTy) const;
|
2016-10-03 18:31:34 +08:00
|
|
|
unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const;
|
2017-02-23 11:58:53 +08:00
|
|
|
|
|
|
|
bool isLegalToVectorizeMemChain(unsigned ChainSizeInBytes,
|
|
|
|
unsigned Alignment,
|
|
|
|
unsigned AddrSpace) const;
|
|
|
|
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
|
|
|
unsigned Alignment,
|
|
|
|
unsigned AddrSpace) const;
|
|
|
|
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
|
|
|
unsigned Alignment,
|
|
|
|
unsigned AddrSpace) const;
|
AMDGPU: Implement getMemcpyLoopLoweringType
Summary: Based on a patch by Matt Arsenault.
Reviewers: rampitec, kerbowa, nhaehnle, arsenm
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77057
2020-03-30 21:33:55 +08:00
|
|
|
Type *getMemcpyLoopLoweringType(LLVMContext &Context, Value *Length,
|
|
|
|
unsigned SrcAddrSpace, unsigned DestAddrSpace,
|
|
|
|
unsigned SrcAlign, unsigned DestAlign) const;
|
|
|
|
|
|
|
|
void getMemcpyLoopResidualLoweringType(SmallVectorImpl<Type *> &OpsOut,
|
|
|
|
LLVMContext &Context,
|
|
|
|
unsigned RemainingBytes,
|
|
|
|
unsigned SrcAddrSpace,
|
|
|
|
unsigned DestAddrSpace,
|
|
|
|
unsigned SrcAlign,
|
|
|
|
unsigned DestAlign) const;
|
2015-05-07 01:12:25 +08:00
|
|
|
unsigned getMaxInterleaveFactor(unsigned VF);
|
2015-12-02 03:08:39 +08:00
|
|
|
|
2017-12-12 05:38:43 +08:00
|
|
|
bool getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info) const;
|
|
|
|
|
2016-03-25 09:00:32 +08:00
|
|
|
int getArithmeticInstrCost(
|
[ARM] Teach the Arm cost model that a Shift can be folded into other instructions
This attempts to teach the cost model in Arm that code such as:
%s = shl i32 %a, 3
%a = and i32 %s, %b
Can under Arm or Thumb2 become:
and r0, r1, r2, lsl #3
So the cost of the shift can essentially be free. To do this without
trying to artificially adjust the cost of the "and" instruction, it
needs to get the users of the shl and check if they are a type of
instruction that the shift can be folded into. And so it needs to have
access to the actual instruction in getArithmeticInstrCost, which if
available is added as an extra parameter much like getCastInstrCost.
We otherwise limit it to shifts with a single user, which should
hopefully handle most of the cases. The list of instruction that the
shift can be folded into include ADC, ADD, AND, BIC, CMP, EOR, MVN, ORR,
ORN, RSB, SBC and SUB. This translates to Add, Sub, And, Or, Xor and
ICmp.
Differential Revision: https://reviews.llvm.org/D70966
2019-12-08 23:33:24 +08:00
|
|
|
unsigned Opcode, Type *Ty,
|
|
|
|
TTI::OperandValueKind Opd1Info = TTI::OK_AnyValue,
|
|
|
|
TTI::OperandValueKind Opd2Info = TTI::OK_AnyValue,
|
|
|
|
TTI::OperandValueProperties Opd1PropInfo = TTI::OP_None,
|
|
|
|
TTI::OperandValueProperties Opd2PropInfo = TTI::OP_None,
|
|
|
|
ArrayRef<const Value *> Args = ArrayRef<const Value *>(),
|
|
|
|
const Instruction *CxtI = nullptr);
|
2016-03-25 09:00:32 +08:00
|
|
|
|
2015-12-17 02:37:19 +08:00
|
|
|
unsigned getCFInstrCost(unsigned Opcode);
|
|
|
|
|
2020-02-04 01:33:43 +08:00
|
|
|
bool isInlineAsmSourceOfDivergence(const CallInst *CI,
|
|
|
|
ArrayRef<unsigned> Indices = {}) const;
|
|
|
|
|
2015-12-02 03:08:39 +08:00
|
|
|
int getVectorInstrCost(unsigned Opcode, Type *ValTy, unsigned Index);
|
2015-12-16 02:04:38 +08:00
|
|
|
bool isSourceOfDivergence(const Value *V) const;
|
2017-06-16 03:33:10 +08:00
|
|
|
bool isAlwaysUniform(const Value *V) const;
|
2016-07-07 01:30:56 +08:00
|
|
|
|
2017-01-31 09:20:54 +08:00
|
|
|
unsigned getFlatAddressSpace() const {
|
|
|
|
// Don't bother running InferAddressSpaces pass on graphics shaders which
|
|
|
|
// don't use flat addressing.
|
|
|
|
if (IsGraphicsShader)
|
|
|
|
return -1;
|
2019-06-17 22:13:24 +08:00
|
|
|
return AMDGPUAS::FLAT_ADDRESS;
|
2017-01-31 09:20:54 +08:00
|
|
|
}
|
|
|
|
|
2019-08-15 02:13:00 +08:00
|
|
|
bool collectFlatAddressOperands(SmallVectorImpl<int> &OpIndexes,
|
|
|
|
Intrinsic::ID IID) const;
|
|
|
|
bool rewriteIntrinsicWithAddressSpace(IntrinsicInst *II,
|
|
|
|
Value *OldV, Value *NewV) const;
|
|
|
|
|
2016-07-07 01:30:56 +08:00
|
|
|
unsigned getVectorSplitCost() { return 0; }
|
2017-05-11 05:29:33 +08:00
|
|
|
|
|
|
|
unsigned getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index,
|
|
|
|
Type *SubTp);
|
2017-08-08 01:08:44 +08:00
|
|
|
|
|
|
|
bool areInlineCompatible(const Function *Caller,
|
|
|
|
const Function *Callee) const;
|
2017-09-20 12:25:58 +08:00
|
|
|
|
[AMDGPU] Tune inlining parameters for AMDGPU target (part 2)
Summary:
Most of IR instructions got better code size estimations after commit 47a5c36b.
So default parameters values should be updated to improve inlining and
unrolling for the target.
Reviewers: rampitec, arsenm
Reviewed By: rampitec
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, zzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70391
2019-11-18 21:42:34 +08:00
|
|
|
unsigned getInliningThresholdMultiplier() { return 11; }
|
[AMDGPU] Tune inlining parameters for AMDGPU target
Summary:
Since the target has no significant advantage of vectorization,
vector instructions bous threshold bonus should be optional.
amdgpu-inline-arg-alloca-cost parameter default value and the target
InliningThresholdMultiplier value tuned then respectively.
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, eraman, hiraditya, haicheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64642
llvm-svn: 366348
2019-07-18 00:51:29 +08:00
|
|
|
|
|
|
|
int getInlinerVectorBonusPercent() { return 0; }
|
2018-05-02 05:41:12 +08:00
|
|
|
|
|
|
|
int getArithmeticReductionCost(unsigned Opcode,
|
|
|
|
Type *Ty,
|
|
|
|
bool IsPairwise);
|
2019-12-19 05:29:21 +08:00
|
|
|
template <typename T>
|
2020-03-11 18:13:11 +08:00
|
|
|
int getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy, ArrayRef<T *> Args,
|
|
|
|
FastMathFlags FMF, unsigned VF,
|
|
|
|
const Instruction *I = nullptr);
|
2019-12-19 05:29:21 +08:00
|
|
|
int getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy,
|
|
|
|
ArrayRef<Type *> Tys, FastMathFlags FMF,
|
2020-03-11 18:13:11 +08:00
|
|
|
unsigned ScalarizationCostPassed = UINT_MAX,
|
|
|
|
const Instruction *I = nullptr);
|
2019-12-19 05:29:21 +08:00
|
|
|
int getIntrinsicInstrCost(Intrinsic::ID IID, Type *RetTy,
|
|
|
|
ArrayRef<Value *> Args, FastMathFlags FMF,
|
2020-03-11 18:13:11 +08:00
|
|
|
unsigned VF = 1, const Instruction *I = nullptr);
|
2018-05-10 05:18:34 +08:00
|
|
|
int getMinMaxReductionCost(Type *Ty, Type *CondTy,
|
|
|
|
bool IsPairwiseForm,
|
|
|
|
bool IsUnsigned);
|
[AMDGPU] Improve code size cost model
Summary:
Added estimation for zero size insertelement, extractelement
and llvm.fabs operators.
Updated inline/unroll parameters default values.
Reviewers: rampitec, arsenm
Reviewed By: arsenm
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68881
llvm-svn: 375109
2019-10-17 20:15:35 +08:00
|
|
|
unsigned getUserCost(const User *U, ArrayRef<const Value *> Operands);
|
2015-01-31 19:17:59 +08:00
|
|
|
};
|
|
|
|
|
2018-05-31 06:55:35 +08:00
|
|
|
class R600TTIImpl final : public BasicTTIImplBase<R600TTIImpl> {
|
|
|
|
using BaseT = BasicTTIImplBase<R600TTIImpl>;
|
|
|
|
using TTI = TargetTransformInfo;
|
|
|
|
|
|
|
|
friend BaseT;
|
|
|
|
|
AMDGPU: Separate R600 and GCN TableGen files
Summary:
We now have two sets of generated TableGen files, one for R600 and one
for GCN, so each sub-target now has its own tables of instructions,
registers, ISel patterns, etc. This should help reduce compile time
since each sub-target now only has to consider information that
is specific to itself. This will also help prevent the R600
sub-target from slowing down new features for GCN, like disassembler
support, GlobalISel, etc.
Reviewers: arsenm, nhaehnle, jvesely
Reviewed By: arsenm
Subscribers: MatzeB, kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46365
llvm-svn: 335942
2018-06-29 07:47:12 +08:00
|
|
|
const R600Subtarget *ST;
|
2018-05-31 06:55:35 +08:00
|
|
|
const AMDGPUTargetLowering *TLI;
|
|
|
|
AMDGPUTTIImpl CommonTTI;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit R600TTIImpl(const AMDGPUTargetMachine *TM, const Function &F)
|
|
|
|
: BaseT(TM, F.getParent()->getDataLayout()),
|
AMDGPU: Separate R600 and GCN TableGen files
Summary:
We now have two sets of generated TableGen files, one for R600 and one
for GCN, so each sub-target now has its own tables of instructions,
registers, ISel patterns, etc. This should help reduce compile time
since each sub-target now only has to consider information that
is specific to itself. This will also help prevent the R600
sub-target from slowing down new features for GCN, like disassembler
support, GlobalISel, etc.
Reviewers: arsenm, nhaehnle, jvesely
Reviewed By: arsenm
Subscribers: MatzeB, kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46365
llvm-svn: 335942
2018-06-29 07:47:12 +08:00
|
|
|
ST(static_cast<const R600Subtarget*>(TM->getSubtargetImpl(F))),
|
2018-05-31 06:55:35 +08:00
|
|
|
TLI(ST->getTargetLowering()),
|
|
|
|
CommonTTI(TM, F) {}
|
|
|
|
|
AMDGPU: Separate R600 and GCN TableGen files
Summary:
We now have two sets of generated TableGen files, one for R600 and one
for GCN, so each sub-target now has its own tables of instructions,
registers, ISel patterns, etc. This should help reduce compile time
since each sub-target now only has to consider information that
is specific to itself. This will also help prevent the R600
sub-target from slowing down new features for GCN, like disassembler
support, GlobalISel, etc.
Reviewers: arsenm, nhaehnle, jvesely
Reviewed By: arsenm
Subscribers: MatzeB, kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46365
llvm-svn: 335942
2018-06-29 07:47:12 +08:00
|
|
|
const R600Subtarget *getST() const { return ST; }
|
2018-05-31 06:55:35 +08:00
|
|
|
const AMDGPUTargetLowering *getTLI() const { return TLI; }
|
|
|
|
|
|
|
|
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
|
|
|
|
TTI::UnrollingPreferences &UP);
|
|
|
|
unsigned getHardwareNumberOfRegisters(bool Vec) const;
|
|
|
|
unsigned getNumberOfRegisters(bool Vec) const;
|
|
|
|
unsigned getRegisterBitWidth(bool Vector) const;
|
|
|
|
unsigned getMinVectorRegisterBitWidth() const;
|
|
|
|
unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const;
|
|
|
|
bool isLegalToVectorizeMemChain(unsigned ChainSizeInBytes, unsigned Alignment,
|
|
|
|
unsigned AddrSpace) const;
|
|
|
|
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
|
|
|
unsigned Alignment,
|
|
|
|
unsigned AddrSpace) const;
|
|
|
|
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
|
|
|
unsigned Alignment,
|
|
|
|
unsigned AddrSpace) const;
|
|
|
|
unsigned getMaxInterleaveFactor(unsigned VF);
|
|
|
|
unsigned getCFInstrCost(unsigned Opcode);
|
|
|
|
int getVectorInstrCost(unsigned Opcode, Type *ValTy, unsigned Index);
|
|
|
|
};
|
|
|
|
|
2015-01-31 19:17:59 +08:00
|
|
|
} // end namespace llvm
|
|
|
|
|
2017-08-09 07:53:55 +08:00
|
|
|
#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUTARGETTRANSFORMINFO_H
|