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 "llvm/CodeGen/BasicTTIImpl.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
2017-08-09 07:53:55 +08:00
|
|
|
|
2016-03-25 09:00:32 +08:00
|
|
|
class AMDGPUTargetLowering;
|
2020-06-03 21:56:40 +08:00
|
|
|
class InstCombiner;
|
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:
|
2020-12-25 23:52:14 +08:00
|
|
|
explicit AMDGPUTTIImpl(const AMDGPUTargetMachine *TM, const Function &F);
|
2018-05-31 06:55:35 +08:00
|
|
|
|
|
|
|
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
|
|
|
|
TTI::UnrollingPreferences &UP);
|
[NFC] Separate Peeling Properties into its own struct (re-land after minor fix)
Summary:
This patch separates the peeling specific parameters from the UnrollingPreferences,
and creates a new struct called PeelingPreferences. Functions which used the
UnrollingPreferences struct for peeling have been updated to use the PeelingPreferences struct.
Author: sidbav (Sidharth Baveja)
Reviewers: Whitney (Whitney Tsang), Meinersbur (Michael Kruse), skatkov (Serguei Katkov), ashlykov (Arkady Shlykov), bogner (Justin Bogner), hfinkel (Hal Finkel), anhtuyen (Anh Tuyen Tran), nikic (Nikita Popov)
Reviewed By: Meinersbur (Michael Kruse)
Subscribers: fhahn (Florian Hahn), hiraditya (Aditya Kumar), llvm-commits, LLVM
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D80580
2020-07-11 02:38:08 +08:00
|
|
|
|
|
|
|
void getPeelingPreferences(Loop *L, ScalarEvolution &SE,
|
|
|
|
TTI::PeelingPreferences &PP);
|
2018-05-31 06:55:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2020-09-16 20:38:54 +08:00
|
|
|
bool IsGraphics;
|
2019-11-01 09:50:30 +08:00
|
|
|
bool HasFP32Denormals;
|
2020-07-31 08:56:54 +08:00
|
|
|
bool HasFP64FP16Denormals;
|
2020-06-19 07:32:17 +08:00
|
|
|
unsigned MaxVGPRs;
|
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::FeatureUnalignedScratchAccess,
|
2020-08-21 17:29:32 +08:00
|
|
|
AMDGPU::FeatureUnalignedAccessMode,
|
2017-08-08 01:08:44 +08:00
|
|
|
|
|
|
|
AMDGPU::FeatureAutoWaitcntBeforeBarrier,
|
|
|
|
|
|
|
|
// Property of the kernel/environment which can't actually differ.
|
|
|
|
AMDGPU::FeatureSGPRInitBug,
|
|
|
|
AMDGPU::FeatureXNACK,
|
|
|
|
AMDGPU::FeatureTrapHandler,
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-10-23 00:38:56 +08:00
|
|
|
static inline int getHalfRateInstrCost(
|
|
|
|
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput) {
|
|
|
|
return CostKind == TTI::TCK_CodeSize ? 2
|
|
|
|
: 2 * TargetTransformInfo::TCC_Basic;
|
2016-03-25 09:00:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: The size is usually 8 bytes, but takes 4x as many cycles. Maybe
|
|
|
|
// should be 2 or 4.
|
2020-10-23 00:38:56 +08:00
|
|
|
static inline int getQuarterRateInstrCost(
|
|
|
|
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput) {
|
|
|
|
return CostKind == TTI::TCK_CodeSize ? 2
|
|
|
|
: 4 * TargetTransformInfo::TCC_Basic;
|
2016-03-25 09:00:32 +08:00
|
|
|
}
|
|
|
|
|
2020-10-23 00:38:56 +08:00
|
|
|
// On some parts, normal fp64 operations are half rate, and others
|
|
|
|
// quarter. This also applies to some integer operations.
|
|
|
|
inline int get64BitInstrCost(
|
|
|
|
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput) const {
|
|
|
|
return ST->hasHalfRate64Ops() ? getHalfRateInstrCost(CostKind)
|
|
|
|
: getQuarterRateInstrCost(CostKind);
|
2016-03-25 09:00:32 +08:00
|
|
|
}
|
|
|
|
|
2015-01-31 19:17:59 +08:00
|
|
|
public:
|
2020-12-25 23:52:14 +08:00
|
|
|
explicit GCNTTIImpl(const AMDGPUTargetMachine *TM, const Function &F);
|
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
|
|
|
|
[NFC] Separate Peeling Properties into its own struct (re-land after minor fix)
Summary:
This patch separates the peeling specific parameters from the UnrollingPreferences,
and creates a new struct called PeelingPreferences. Functions which used the
UnrollingPreferences struct for peeling have been updated to use the PeelingPreferences struct.
Author: sidbav (Sidharth Baveja)
Reviewers: Whitney (Whitney Tsang), Meinersbur (Michael Kruse), skatkov (Serguei Katkov), ashlykov (Arkady Shlykov), bogner (Justin Bogner), hfinkel (Hal Finkel), anhtuyen (Anh Tuyen Tran), nikic (Nikita Popov)
Reviewed By: Meinersbur (Michael Kruse)
Subscribers: fhahn (Florian Hahn), hiraditya (Aditya Kumar), llvm-commits, LLVM
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D80580
2020-07-11 02:38:08 +08:00
|
|
|
void getPeelingPreferences(Loop *L, ScalarEvolution &SE,
|
|
|
|
TTI::PeelingPreferences &PP);
|
|
|
|
|
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;
|
2020-06-19 07:32:17 +08:00
|
|
|
unsigned getNumberOfRegisters(unsigned RCID) 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;
|
2020-11-25 02:42:43 +08:00
|
|
|
unsigned getMaximumVF(unsigned ElemWidth, unsigned Opcode) 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
|
|
|
|
2020-06-26 22:14:27 +08:00
|
|
|
bool isLegalToVectorizeMemChain(unsigned ChainSizeInBytes, Align Alignment,
|
2017-02-23 11:58:53 +08:00
|
|
|
unsigned AddrSpace) const;
|
2020-06-26 22:14:27 +08:00
|
|
|
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment,
|
2017-02-23 11:58:53 +08:00
|
|
|
unsigned AddrSpace) const;
|
2020-06-26 22:14:27 +08:00
|
|
|
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment,
|
2017-02-23 11:58:53 +08:00
|
|
|
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,
|
2020-04-28 21:11:27 +08:00
|
|
|
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput,
|
[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
|
|
|
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
|
|
|
|
2020-04-28 21:11:27 +08:00
|
|
|
unsigned getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind);
|
2015-12-17 02:37:19 +08:00
|
|
|
|
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.
|
2020-09-16 20:38:54 +08:00
|
|
|
if (IsGraphics)
|
2017-01-31 09:20:54 +08:00
|
|
|
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;
|
2020-05-16 02:54:51 +08:00
|
|
|
Value *rewriteIntrinsicWithAddressSpace(IntrinsicInst *II, Value *OldV,
|
|
|
|
Value *NewV) const;
|
2019-08-15 02:13:00 +08:00
|
|
|
|
2020-10-23 19:52:14 +08:00
|
|
|
bool canSimplifyLegacyMulToMul(const Value *Op0, const Value *Op1,
|
|
|
|
InstCombiner &IC) const;
|
2020-06-03 21:56:40 +08:00
|
|
|
Optional<Instruction *> instCombineIntrinsic(InstCombiner &IC,
|
|
|
|
IntrinsicInst &II) const;
|
|
|
|
Optional<Value *> simplifyDemandedVectorEltsIntrinsic(
|
|
|
|
InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts,
|
|
|
|
APInt &UndefElts2, APInt &UndefElts3,
|
|
|
|
std::function<void(Instruction *, unsigned, APInt, APInt &)>
|
|
|
|
SimplifyAndSetOp) const;
|
|
|
|
|
2016-07-07 01:30:56 +08:00
|
|
|
unsigned getVectorSplitCost() { return 0; }
|
2017-05-11 05:29:33 +08:00
|
|
|
|
2020-04-17 20:29:31 +08:00
|
|
|
unsigned getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, int Index,
|
|
|
|
VectorType *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
|
|
|
|
2020-04-28 21:11:27 +08:00
|
|
|
int getArithmeticReductionCost(
|
|
|
|
unsigned Opcode,
|
|
|
|
VectorType *Ty,
|
|
|
|
bool IsPairwise,
|
|
|
|
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput);
|
|
|
|
|
2020-05-20 16:18:42 +08:00
|
|
|
int getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
|
|
|
|
TTI::TargetCostKind CostKind);
|
2020-04-28 21:11:27 +08:00
|
|
|
int getMinMaxReductionCost(
|
|
|
|
VectorType *Ty, VectorType *CondTy, bool IsPairwiseForm, bool IsUnsigned,
|
|
|
|
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput);
|
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:
|
2020-12-25 23:52:14 +08:00
|
|
|
explicit R600TTIImpl(const AMDGPUTargetMachine *TM, const Function &F);
|
2018-05-31 06:55:35 +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
|
|
|
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);
|
[NFC] Separate Peeling Properties into its own struct (re-land after minor fix)
Summary:
This patch separates the peeling specific parameters from the UnrollingPreferences,
and creates a new struct called PeelingPreferences. Functions which used the
UnrollingPreferences struct for peeling have been updated to use the PeelingPreferences struct.
Author: sidbav (Sidharth Baveja)
Reviewers: Whitney (Whitney Tsang), Meinersbur (Michael Kruse), skatkov (Serguei Katkov), ashlykov (Arkady Shlykov), bogner (Justin Bogner), hfinkel (Hal Finkel), anhtuyen (Anh Tuyen Tran), nikic (Nikita Popov)
Reviewed By: Meinersbur (Michael Kruse)
Subscribers: fhahn (Florian Hahn), hiraditya (Aditya Kumar), llvm-commits, LLVM
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D80580
2020-07-11 02:38:08 +08:00
|
|
|
void getPeelingPreferences(Loop *L, ScalarEvolution &SE,
|
|
|
|
TTI::PeelingPreferences &PP);
|
2018-05-31 06:55:35 +08:00
|
|
|
unsigned getHardwareNumberOfRegisters(bool Vec) const;
|
|
|
|
unsigned getNumberOfRegisters(bool Vec) const;
|
|
|
|
unsigned getRegisterBitWidth(bool Vector) const;
|
|
|
|
unsigned getMinVectorRegisterBitWidth() const;
|
|
|
|
unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const;
|
2020-06-26 22:14:27 +08:00
|
|
|
bool isLegalToVectorizeMemChain(unsigned ChainSizeInBytes, Align Alignment,
|
2018-05-31 06:55:35 +08:00
|
|
|
unsigned AddrSpace) const;
|
2020-06-26 22:14:27 +08:00
|
|
|
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment,
|
2018-05-31 06:55:35 +08:00
|
|
|
unsigned AddrSpace) const;
|
2020-06-26 22:14:27 +08:00
|
|
|
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment,
|
2018-05-31 06:55:35 +08:00
|
|
|
unsigned AddrSpace) const;
|
|
|
|
unsigned getMaxInterleaveFactor(unsigned VF);
|
2020-04-28 21:11:27 +08:00
|
|
|
unsigned getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind);
|
2018-05-31 06:55:35 +08:00
|
|
|
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
|