LLVM 24.0.0git
llvm::TargetTransformInfo::UnrollingPreferences Struct Reference

Parameters that control the generic loop unrolling transformation. More...

#include "llvm/Analysis/TargetTransformInfo.h"

Public Attributes

unsigned Threshold = 150
 The cost threshold for the unrolled loop.
unsigned MaxPercentThresholdBoost = 400
 If complete unrolling will reduce the cost of the loop, we will boost the Threshold by a certain percent to allow more aggressive complete unrolling.
unsigned OptSizeThreshold = 0
 The cost threshold for the unrolled loop when optimizing for size (set to UINT_MAX to disable).
unsigned PartialThreshold = 150
 The cost threshold for the unrolled loop, like Threshold, but used for partial/runtime unrolling (set to UINT_MAX to disable).
unsigned PartialOptSizeThreshold = 0
 The cost threshold for the unrolled loop when optimizing for size, like OptSizeThreshold, but used for partial/runtime unrolling (set to UINT_MAX to disable).
unsigned DefaultUnrollRuntimeCount = 8
 Default unroll count for loops with run-time trip count.
unsigned MaxCount = std::numeric_limits<unsigned>::max()
unsigned MaxUpperBound = 8
 Set the maximum upper bound of trip count.
unsigned FullUnrollMaxCount = std::numeric_limits<unsigned>::max()
 Set the maximum unrolling factor for full unrolling.
unsigned BEInsns = 2
bool Partial = false
 Allow partial unrolling (unrolling of loops to expand the size of the loop body, not only to eliminate small constant-trip-count loops).
bool Runtime = false
 Allow runtime unrolling (unrolling of loops to expand the size of the loop body even when the number of loop iterations is not known at compile time).
bool AllowRemainder = true
 Allow generation of a loop remainder (extra iterations after unroll).
bool AllowExpensiveTripCount = false
 Allow emitting expensive instructions (such as divisions) when computing the trip count of a loop for runtime unrolling.
bool Force = false
 Apply loop unroll on any kind of loop (mainly to loops that fail runtime unrolling).
bool UpperBound = false
 Allow using trip count upper bound to unroll loops.
bool UnrollRemainder = false
 Allow unrolling of all the iterations of the runtime loop remainder.
bool UnrollAndJam = false
 Allow unroll and jam. Used to enable unroll and jam for the target.
unsigned UnrollAndJamInnerLoopThreshold = 60
 Threshold for unroll and jam, for inner loop size.
unsigned MaxIterationsCountToAnalyze = 10
 Don't allow loop unrolling to simulate more than this number of iterations when checking full unroll profitability.
bool UnrollVectorizedLoop = false
 Disable runtime unrolling by default for vectorized loops.
unsigned SCEVExpansionBudget = 4
 Don't allow runtime unrolling if expanding the trip count takes more than SCEVExpansionBudget.
bool RuntimeUnrollMultiExit = false
 Allow runtime unrolling multi-exit loops.
bool AddAdditionalAccumulators = false
 Allow unrolling to add parallel reduction phis.

Detailed Description

Parameters that control the generic loop unrolling transformation.

Definition at line 686 of file TargetTransformInfo.h.

Member Data Documentation

◆ AddAdditionalAccumulators

bool llvm::TargetTransformInfo::UnrollingPreferences::AddAdditionalAccumulators = false

Allow unrolling to add parallel reduction phis.

Definition at line 776 of file TargetTransformInfo.h.

Referenced by getAppleRuntimeUnrollPreferences(), and tryToUnrollLoop().

◆ AllowExpensiveTripCount

bool llvm::TargetTransformInfo::UnrollingPreferences::AllowExpensiveTripCount = false

Allow emitting expensive instructions (such as divisions) when computing the trip count of a loop for runtime unrolling.

Definition at line 747 of file TargetTransformInfo.h.

Referenced by llvm::computeUnrollCount(), llvm::PPCTTIImpl::getUnrollingPreferences(), llvm::SystemZTTIImpl::getUnrollingPreferences(), shouldRuntimeUnroll(), and tryToUnrollLoop().

◆ AllowRemainder

bool llvm::TargetTransformInfo::UnrollingPreferences::AllowRemainder = true

Allow generation of a loop remainder (extra iterations after unroll).

Definition at line 744 of file TargetTransformInfo.h.

Referenced by computeUnrollAndJamCount(), llvm::gatherUnrollingPreferences(), shouldPartialUnroll(), shouldPragmaUnroll(), shouldRuntimeUnroll(), and tryToUnrollLoop().

◆ BEInsns

◆ DefaultUnrollRuntimeCount

unsigned llvm::TargetTransformInfo::UnrollingPreferences::DefaultUnrollRuntimeCount = 8

◆ Force

bool llvm::TargetTransformInfo::UnrollingPreferences::Force = false

◆ FullUnrollMaxCount

unsigned llvm::TargetTransformInfo::UnrollingPreferences::FullUnrollMaxCount = std::numeric_limits<unsigned>::max()

Set the maximum unrolling factor for full unrolling.

Like MaxCount, but applies even if full unrolling is selected. This allows a target to fall back to Partial unrolling if full unrolling is above FullUnrollMaxCount.

Definition at line 730 of file TargetTransformInfo.h.

Referenced by llvm::gatherUnrollingPreferences(), llvm::SystemZTTIImpl::getUnrollingPreferences(), and shouldFullUnroll().

◆ MaxCount

◆ MaxIterationsCountToAnalyze

unsigned llvm::TargetTransformInfo::UnrollingPreferences::MaxIterationsCountToAnalyze = 10

Don't allow loop unrolling to simulate more than this number of iterations when checking full unroll profitability.

Definition at line 764 of file TargetTransformInfo.h.

Referenced by llvm::gatherUnrollingPreferences(), llvm::AMDGPUTTIImpl::getUnrollingPreferences(), and shouldFullUnroll().

◆ MaxPercentThresholdBoost

unsigned llvm::TargetTransformInfo::UnrollingPreferences::MaxPercentThresholdBoost = 400

If complete unrolling will reduce the cost of the loop, we will boost the Threshold by a certain percent to allow more aggressive complete unrolling.

This value provides the maximum boost percentage that we can apply to Threshold (The value should be no less than 100). BoostedThreshold = Threshold * min(RolledCost / UnrolledCost, MaxPercentThresholdBoost / 100) E.g. if complete unrolling reduces the loop execution time by 50% then we boost the threshold by the factor of 2x. If unrolling is not expected to reduce the running time, then we do not increase the threshold.

Definition at line 705 of file TargetTransformInfo.h.

Referenced by llvm::gatherUnrollingPreferences(), and shouldFullUnroll().

◆ MaxUpperBound

unsigned llvm::TargetTransformInfo::UnrollingPreferences::MaxUpperBound = 8

Set the maximum upper bound of trip count.

Allowing the MaxUpperBound to be overrided by a target gives more flexiblity on certain cases. By default, MaxUpperBound uses UnrollMaxUpperBound which value is 8.

Definition at line 726 of file TargetTransformInfo.h.

Referenced by llvm::computeUnrollCount(), llvm::gatherUnrollingPreferences(), llvm::AArch64TTIImpl::getUnrollingPreferences(), shouldPragmaUnroll(), and shouldRuntimeUnroll().

◆ OptSizeThreshold

unsigned llvm::TargetTransformInfo::UnrollingPreferences::OptSizeThreshold = 0

◆ Partial

◆ PartialOptSizeThreshold

unsigned llvm::TargetTransformInfo::UnrollingPreferences::PartialOptSizeThreshold = 0

The cost threshold for the unrolled loop when optimizing for size, like OptSizeThreshold, but used for partial/runtime unrolling (set to UINT_MAX to disable).

Definition at line 715 of file TargetTransformInfo.h.

Referenced by llvm::gatherUnrollingPreferences(), llvm::AArch64TTIImpl::getUnrollingPreferences(), llvm::ARMTTIImpl::getUnrollingPreferences(), llvm::BasicTTIImplBase< BasicTTIImpl >::getUnrollingPreferences(), llvm::RISCVTTIImpl::getUnrollingPreferences(), and llvm::WebAssemblyTTIImpl::getUnrollingPreferences().

◆ PartialThreshold

◆ Runtime

◆ RuntimeUnrollMultiExit

bool llvm::TargetTransformInfo::UnrollingPreferences::RuntimeUnrollMultiExit = false

Allow runtime unrolling multi-exit loops.

Should only be set if the target determined that multi-exit unrolling is profitable for the loop. Fall back to the generic logic to determine whether multi-exit unrolling is profitable if set to false.

Definition at line 774 of file TargetTransformInfo.h.

Referenced by llvm::AArch64TTIImpl::getUnrollingPreferences(), and tryToUnrollLoop().

◆ SCEVExpansionBudget

unsigned llvm::TargetTransformInfo::UnrollingPreferences::SCEVExpansionBudget = 4

Don't allow runtime unrolling if expanding the trip count takes more than SCEVExpansionBudget.

Definition at line 769 of file TargetTransformInfo.h.

Referenced by llvm::gatherUnrollingPreferences(), getAppleRuntimeUnrollPreferences(), llvm::AArch64TTIImpl::getUnrollingPreferences(), and tryToUnrollLoop().

◆ Threshold

unsigned llvm::TargetTransformInfo::UnrollingPreferences::Threshold = 150

The cost threshold for the unrolled loop.

Should be relative to the getInstructionCost values returned by this API, and the expectation is that the unrolled loop's instructions when run through that interface should not exceed this cost. However, this is only an estimate. Also, specific loops may be unrolled even with a cost above this threshold if deemed profitable. Set this to UINT_MAX to disable the loop body cost restriction.

Definition at line 694 of file TargetTransformInfo.h.

Referenced by computeUnrollAndJamCount(), llvm::computeUnrollCount(), llvm::gatherUnrollingPreferences(), llvm::AMDGPUTTIImpl::getUnrollingPreferences(), llvm::NVPTXTTIImpl::getUnrollingPreferences(), shouldFullUnroll(), shouldPragmaUnroll(), and tryToUnrollLoop().

◆ UnrollAndJam

bool llvm::TargetTransformInfo::UnrollingPreferences::UnrollAndJam = false

Allow unroll and jam. Used to enable unroll and jam for the target.

Definition at line 756 of file TargetTransformInfo.h.

Referenced by llvm::AArch64TTIImpl::getUnrollingPreferences(), llvm::ARMTTIImpl::getUnrollingPreferences(), llvm::RISCVTTIImpl::getUnrollingPreferences(), and tryToUnrollAndJamLoop().

◆ UnrollAndJamInnerLoopThreshold

unsigned llvm::TargetTransformInfo::UnrollingPreferences::UnrollAndJamInnerLoopThreshold = 60

Threshold for unroll and jam, for inner loop size.

The 'Threshold' value above is used during unroll and jam for the outer loop size. This value is used in the same manner to limit the size of the inner loop.

Definition at line 761 of file TargetTransformInfo.h.

Referenced by computeUnrollAndJamCount(), llvm::AArch64TTIImpl::getUnrollingPreferences(), llvm::ARMTTIImpl::getUnrollingPreferences(), and tryToUnrollAndJamLoop().

◆ UnrollRemainder

bool llvm::TargetTransformInfo::UnrollingPreferences::UnrollRemainder = false

◆ UnrollVectorizedLoop

bool llvm::TargetTransformInfo::UnrollingPreferences::UnrollVectorizedLoop = false

Disable runtime unrolling by default for vectorized loops.

Definition at line 766 of file TargetTransformInfo.h.

Referenced by llvm::LoopVectorizationPlanner::executePlan(), and llvm::AMDGPUTTIImpl::getUnrollingPreferences().

◆ UpperBound


The documentation for this struct was generated from the following file: