LLVM 22.0.0git
llvm::GenericUniformityAnalysisImpl< ContextT > Class Template Reference

Analysis that identifies uniform values in a data-parallel execution. More...

#include "llvm/ADT/GenericUniformityImpl.h"

Classes

struct  PhiInput
 Value/block pair representing a single phi input. More...

Public Types

using BlockT = typename ContextT::BlockT
using FunctionT = typename ContextT::FunctionT
using ValueRefT = typename ContextT::ValueRefT
using ConstValueRefT = typename ContextT::ConstValueRefT
using UseT = typename ContextT::UseT
using InstructionT = typename ContextT::InstructionT
using DominatorTreeT = typename ContextT::DominatorTreeT
using CycleInfoT = GenericCycleInfo<ContextT>
using CycleT = typename CycleInfoT::CycleT
using SyncDependenceAnalysisT = GenericSyncDependenceAnalysis<ContextT>
using DivergenceDescriptorT
using BlockLabelMapT = typename SyncDependenceAnalysisT::BlockLabelMap
using TemporalDivergenceTuple

Public Member Functions

 GenericUniformityAnalysisImpl (const DominatorTreeT &DT, const CycleInfoT &CI, const TargetTransformInfo *TTI)
void initialize ()
const FunctionTgetFunction () const
void addUniformOverride (const InstructionT &Instr)
 Mark UniVal as a value that is always uniform.
void markDivergent (const InstructionT &I)
 Examine I for divergent outputs and add to the worklist.
bool markDivergent (ConstValueRefT DivVal)
 Mark DivVal as a divergent value.
bool markDefsDivergent (const InstructionT &Instr)
 Mark outputs of Instr as divergent.
void compute ()
 Propagate divergence to all instructions in the region.
bool hasDivergence () const
 Whether any value was marked or analyzed to be divergent.
bool isAlwaysUniform (const InstructionT &Instr) const
 Whether Val will always return a uniform value regardless of its operands.
bool hasDivergentDefs (const InstructionT &I) const
bool isDivergent (const InstructionT &I) const
bool isDivergent (ConstValueRefT V) const
 Whether Val is divergent at its definition.
bool isDivergentUse (const UseT &U) const
bool hasDivergentTerminator (const BlockT &B) const
void print (raw_ostream &out) const
void recordTemporalDivergence (ConstValueRefT, const InstructionT *, const CycleT *)
bool hasDivergentDefs (const Instruction &I) const
bool markDefsDivergent (const Instruction &Instr)
void initialize ()
bool isDivergentUse (const Use &U) const
bool hasDivergentDefs (const MachineInstr &I) const
bool markDefsDivergent (const MachineInstr &Instr)
void initialize ()
bool isDivergentUse (const MachineOperand &U) const

Public Attributes

SmallVector< TemporalDivergenceTuple, 8 > TemporalDivergenceList

Protected Member Functions

void analyzeControlDivergence (const InstructionT &Term)
 Mark Term as divergent and push all Instructions that become divergent as a result on the worklist.

Protected Attributes

const ContextT & Context
const FunctionTF
const CycleInfoTCI
const TargetTransformInfoTTI = nullptr
DenseSet< ConstValueRefTDivergentValues
SmallPtrSet< const BlockT *, 32 > DivergentTermBlocks
std::vector< const InstructionT * > Worklist

Detailed Description

template<typename ContextT>
class llvm::GenericUniformityAnalysisImpl< ContextT >

Analysis that identifies uniform values in a data-parallel execution.

This analysis propagates divergence in a data-parallel context from sources of divergence to all users. It can be instantiated for an IR that provides a suitable SSAContext.

Definition at line 330 of file GenericUniformityImpl.h.

Member Typedef Documentation

◆ BlockLabelMapT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::BlockLabelMapT = typename SyncDependenceAnalysisT::BlockLabelMap

Definition at line 346 of file GenericUniformityImpl.h.

◆ BlockT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::BlockT = typename ContextT::BlockT

Definition at line 332 of file GenericUniformityImpl.h.

◆ ConstValueRefT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::ConstValueRefT = typename ContextT::ConstValueRefT

Definition at line 335 of file GenericUniformityImpl.h.

◆ CycleInfoT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::CycleInfoT = GenericCycleInfo<ContextT>

Definition at line 340 of file GenericUniformityImpl.h.

◆ CycleT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::CycleT = typename CycleInfoT::CycleT

Definition at line 341 of file GenericUniformityImpl.h.

◆ DivergenceDescriptorT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::DivergenceDescriptorT
Initial value:
typename SyncDependenceAnalysisT::DivergenceDescriptor

Definition at line 344 of file GenericUniformityImpl.h.

◆ DominatorTreeT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::DominatorTreeT = typename ContextT::DominatorTreeT

Definition at line 338 of file GenericUniformityImpl.h.

◆ FunctionT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::FunctionT = typename ContextT::FunctionT

Definition at line 333 of file GenericUniformityImpl.h.

◆ InstructionT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::InstructionT = typename ContextT::InstructionT

Definition at line 337 of file GenericUniformityImpl.h.

◆ SyncDependenceAnalysisT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::SyncDependenceAnalysisT = GenericSyncDependenceAnalysis<ContextT>

Definition at line 343 of file GenericUniformityImpl.h.

◆ TemporalDivergenceTuple

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::TemporalDivergenceTuple
Initial value:
std::tuple<ConstValueRefT, InstructionT *, const CycleT *>

Definition at line 348 of file GenericUniformityImpl.h.

◆ UseT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::UseT = typename ContextT::UseT

Definition at line 336 of file GenericUniformityImpl.h.

◆ ValueRefT

template<typename ContextT>
using llvm::GenericUniformityAnalysisImpl< ContextT >::ValueRefT = typename ContextT::ValueRefT

Definition at line 334 of file GenericUniformityImpl.h.

Constructor & Destructor Documentation

◆ GenericUniformityAnalysisImpl()

template<typename ContextT>
llvm::GenericUniformityAnalysisImpl< ContextT >::GenericUniformityAnalysisImpl ( const DominatorTreeT & DT,
const CycleInfoT & CI,
const TargetTransformInfo * TTI )
inline

Definition at line 351 of file GenericUniformityImpl.h.

References CI, Context, F, getFunction(), and TTI.

Member Function Documentation

◆ addUniformOverride()

template<typename ContextT>
void llvm::GenericUniformityAnalysisImpl< ContextT >::addUniformOverride ( const InstructionT & Instr)

Mark UniVal as a value that is always uniform.

Definition at line 827 of file GenericUniformityImpl.h.

Referenced by initialize().

◆ analyzeControlDivergence()

template<typename ContextT>
void llvm::GenericUniformityAnalysisImpl< ContextT >::analyzeControlDivergence ( const InstructionT & Term)
protected

Mark Term as divergent and push all Instructions that become divergent as a result on the worklist.

Definition at line 1065 of file GenericUniformityImpl.h.

References A(), assert(), B(), llvm::CallingConv::C, CI, Context, llvm::dbgs(), DivergentTermBlocks, llvm::getOutermostDivergentCycle(), llvm::insertIfNotContained(), LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::sort().

Referenced by compute().

◆ compute()

template<typename ContextT>
void llvm::GenericUniformityAnalysisImpl< ContextT >::compute ( )

Propagate divergence to all instructions in the region.

Divergence is seeded by calls to markDivergent.

Definition at line 1121 of file GenericUniformityImpl.h.

References analyzeControlDivergence(), assert(), Context, llvm::dbgs(), DivergentValues, I, isDivergent(), LLVM_DEBUG, and Worklist.

◆ getFunction()

template<typename ContextT>
const FunctionT & llvm::GenericUniformityAnalysisImpl< ContextT >::getFunction ( ) const
inline

Definition at line 358 of file GenericUniformityImpl.h.

References F.

Referenced by GenericUniformityAnalysisImpl().

◆ hasDivergence()

template<typename ContextT>
bool llvm::GenericUniformityAnalysisImpl< ContextT >::hasDivergence ( ) const
inline

Whether any value was marked or analyzed to be divergent.

Definition at line 379 of file GenericUniformityImpl.h.

References DivergentValues.

◆ hasDivergentDefs() [1/3]

Definition at line 21 of file UniformityAnalysis.cpp.

References I, and isDivergent().

◆ hasDivergentDefs() [2/3]

template<typename ContextT>
bool llvm::GenericUniformityAnalysisImpl< ContextT >::hasDivergentDefs ( const InstructionT & I) const

References I.

Referenced by isDivergent().

◆ hasDivergentDefs() [3/3]

Definition at line 22 of file MachineUniformityAnalysis.cpp.

References I, isDivergent(), and op.

◆ hasDivergentTerminator()

template<typename ContextT>
bool llvm::GenericUniformityAnalysisImpl< ContextT >::hasDivergentTerminator ( const BlockT & B) const
inline

Definition at line 399 of file GenericUniformityImpl.h.

References B(), and DivergentTermBlocks.

Referenced by print().

◆ initialize() [1/3]

template<typename ContextT>
void llvm::GenericUniformityAnalysisImpl< ContextT >::initialize ( )

◆ initialize() [2/3]

Definition at line 32 of file UniformityAnalysis.cpp.

References addUniformOverride(), F, I, instructions, markDivergent(), and TTI.

◆ initialize() [3/3]

◆ isAlwaysUniform()

template<typename ContextT>
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isAlwaysUniform ( const InstructionT & Instr) const

Whether Val will always return a uniform value regardless of its operands.

Definition at line 1156 of file GenericUniformityImpl.h.

Referenced by markDivergent().

◆ isDivergent() [1/2]

template<typename ContextT>
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isDivergent ( const InstructionT & I) const
inline

◆ isDivergent() [2/2]

template<typename ContextT>
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isDivergent ( ConstValueRefT V) const
inline

Whether Val is divergent at its definition.

Definition at line 395 of file GenericUniformityImpl.h.

References DivergentValues.

◆ isDivergentUse() [1/3]

Definition at line 132 of file MachineUniformityAnalysis.cpp.

References F, and isDivergent().

◆ isDivergentUse() [2/3]

bool llvm::GenericUniformityAnalysisImpl< SSAContext >::isDivergentUse ( const Use & U) const

Definition at line 92 of file UniformityAnalysis.cpp.

References llvm::cast(), llvm::dyn_cast(), and isDivergent().

◆ isDivergentUse() [3/3]

template<typename ContextT>
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isDivergentUse ( const UseT & U) const

◆ markDefsDivergent() [1/3]

Definition at line 27 of file UniformityAnalysis.cpp.

References llvm::cast(), and markDivergent().

◆ markDefsDivergent() [2/3]

template<typename ContextT>
bool llvm::GenericUniformityAnalysisImpl< ContextT >::markDefsDivergent ( const InstructionT & Instr)

Mark outputs of Instr as divergent.

Returns
Whether the tracked divergence state of any output has changed.

Referenced by markDivergent().

◆ markDefsDivergent() [3/3]

Definition at line 32 of file MachineUniformityAnalysis.cpp.

References assert(), F, markDivergent(), MRI, op, and TRI.

◆ markDivergent() [1/2]

template<typename ContextT>
void llvm::GenericUniformityAnalysisImpl< ContextT >::markDivergent ( const InstructionT & I)

Examine I for divergent outputs and add to the worklist.

Definition at line 797 of file GenericUniformityImpl.h.

References Context, llvm::dbgs(), DivergentTermBlocks, I, isAlwaysUniform(), LLVM_DEBUG, markDefsDivergent(), and Worklist.

Referenced by initialize(), markDefsDivergent(), and markDefsDivergent().

◆ markDivergent() [2/2]

template<typename ContextT>
bool llvm::GenericUniformityAnalysisImpl< ContextT >::markDivergent ( ConstValueRefT DivVal)

Mark DivVal as a divergent value.

Returns
Whether the tracked divergence state of DivVal changed.

Definition at line 817 of file GenericUniformityImpl.h.

References Context, llvm::dbgs(), DivergentValues, and LLVM_DEBUG.

◆ print()

template<typename ContextT>
void llvm::GenericUniformityAnalysisImpl< ContextT >::print ( raw_ostream & out) const

◆ recordTemporalDivergence()

template<typename ContextT>
void llvm::GenericUniformityAnalysisImpl< ContextT >::recordTemporalDivergence ( ConstValueRefT Val,
const InstructionT * User,
const CycleT * Cycle )

Definition at line 1149 of file GenericUniformityImpl.h.

References TemporalDivergenceList.

Member Data Documentation

◆ CI

template<typename ContextT>
const CycleInfoT& llvm::GenericUniformityAnalysisImpl< ContextT >::CI
protected

◆ Context

template<typename ContextT>
const ContextT& llvm::GenericUniformityAnalysisImpl< ContextT >::Context
protected

◆ DivergentTermBlocks

template<typename ContextT>
SmallPtrSet<const BlockT *, 32> llvm::GenericUniformityAnalysisImpl< ContextT >::DivergentTermBlocks
protected

◆ DivergentValues

template<typename ContextT>
DenseSet<ConstValueRefT> llvm::GenericUniformityAnalysisImpl< ContextT >::DivergentValues
protected

Definition at line 426 of file GenericUniformityImpl.h.

Referenced by compute(), hasDivergence(), isDivergent(), markDivergent(), and print().

◆ F

template<typename ContextT>
const FunctionT& llvm::GenericUniformityAnalysisImpl< ContextT >::F
protected

◆ TemporalDivergenceList

template<typename ContextT>
SmallVector<TemporalDivergenceTuple, 8> llvm::GenericUniformityAnalysisImpl< ContextT >::TemporalDivergenceList

Definition at line 405 of file GenericUniformityImpl.h.

Referenced by print(), and recordTemporalDivergence().

◆ TTI

template<typename ContextT>
const TargetTransformInfo* llvm::GenericUniformityAnalysisImpl< ContextT >::TTI = nullptr
protected

Definition at line 423 of file GenericUniformityImpl.h.

Referenced by GenericUniformityAnalysisImpl(), and initialize().

◆ Worklist

template<typename ContextT>
std::vector<const InstructionT *> llvm::GenericUniformityAnalysisImpl< ContextT >::Worklist
protected

Definition at line 430 of file GenericUniformityImpl.h.

Referenced by compute(), and markDivergent().


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