|
LLVM 24.0.0git
|
Analysis that identifies uniform values in a data-parallel execution. More...
#include "llvm/ADT/GenericUniformityImpl.h"
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 | SyncDependenceAnalysisT = GenericSyncDependenceAnalysis<ContextT> |
| using | DivergenceDescriptorT |
| using | TemporalDivergenceTuple |
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 FunctionT & | F |
| const CycleInfoT & | CI |
| const TargetTransformInfo * | TTI = nullptr |
| bool | HasBranchDivergence = false |
| SmallPtrSet< const BlockT *, 32 > | DivergentTermBlocks |
| DenseSet< ConstValueRefT > | UniformValues |
| std::vector< const InstructionT * > | Worklist |
| SmallPtrSet< const InstructionT *, 8 > | CustomUniformityCandidates |
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 326 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::BlockT = typename ContextT::BlockT |
Definition at line 328 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::ConstValueRefT = typename ContextT::ConstValueRefT |
Definition at line 331 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::CycleInfoT = GenericCycleInfo<ContextT> |
Definition at line 336 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::DivergenceDescriptorT |
Definition at line 339 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::DominatorTreeT = typename ContextT::DominatorTreeT |
Definition at line 334 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::FunctionT = typename ContextT::FunctionT |
Definition at line 329 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::InstructionT = typename ContextT::InstructionT |
Definition at line 333 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::SyncDependenceAnalysisT = GenericSyncDependenceAnalysis<ContextT> |
Definition at line 338 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::TemporalDivergenceTuple |
Definition at line 342 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::UseT = typename ContextT::UseT |
Definition at line 332 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::ValueRefT = typename ContextT::ValueRefT |
Definition at line 330 of file GenericUniformityImpl.h.
|
inline |
Definition at line 345 of file GenericUniformityImpl.h.
References CI, Context, F, getFunction(), and TTI.
| void llvm::GenericUniformityAnalysisImpl< ContextT >::addCustomUniformityCandidate | ( | const InstructionT * | I | ) |
Add an instruction that requires custom uniformity analysis.
Definition at line 865 of file GenericUniformityImpl.h.
References CustomUniformityCandidates, and I.
Referenced by initialize().
| void llvm::GenericUniformityAnalysisImpl< ContextT >::addUniformOverride | ( | const InstructionT & | Instr | ) |
Mark UniVal as a value that is always uniform.
Definition at line 859 of file GenericUniformityImpl.h.
Referenced by initialize().
|
protected |
Mark Term as divergent and push all Instructions that become divergent as a result on the worklist.
Definition at line 1101 of file GenericUniformityImpl.h.
References A(), assert(), B(), C(), CI, Context, llvm::dbgs(), DivergentTermBlocks, llvm::getOutermostDivergentCycle(), llvm::insertIfNotContained(), LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::sort().
Referenced by compute().
| void llvm::GenericUniformityAnalysisImpl< ContextT >::compute | ( | ) |
Propagate divergence to all instructions in the region.
Divergence is seeded by calls to markDivergent.
Definition at line 1157 of file GenericUniformityImpl.h.
References analyzeControlDivergence(), assert(), Context, llvm::dbgs(), HasBranchDivergence, hasDivergentDefs(), I, LLVM_DEBUG, and Worklist.
|
inline |
Call before erasing V, or a later instruction reusing its address may be misclassified as uniform.
Definition at line 410 of file GenericUniformityImpl.h.
References UniformValues.
|
inline |
Definition at line 354 of file GenericUniformityImpl.h.
References CI.
|
inline |
Definition at line 352 of file GenericUniformityImpl.h.
References F.
Referenced by GenericUniformityAnalysisImpl().
| bool llvm::GenericUniformityAnalysisImpl< SSAContext >::hasDivergentDefs | ( | const Instruction & | I | ) | const |
Definition at line 22 of file UniformityAnalysis.cpp.
References I, and isDivergent().
| bool llvm::GenericUniformityAnalysisImpl< ContextT >::hasDivergentDefs | ( | const InstructionT & | I | ) | const |
| bool llvm::GenericUniformityAnalysisImpl< MachineSSAContext >::hasDivergentDefs | ( | const MachineInstr & | I | ) | const |
Definition at line 22 of file MachineUniformityAnalysis.cpp.
References I, and isDivergent().
|
inline |
Definition at line 404 of file GenericUniformityImpl.h.
References B(), and DivergentTermBlocks.
Referenced by print().
| void llvm::GenericUniformityAnalysisImpl< ContextT >::initialize | ( | ) |
| void llvm::GenericUniformityAnalysisImpl< SSAContext >::initialize | ( | ) |
Definition at line 68 of file UniformityAnalysis.cpp.
References addCustomUniformityCandidate(), addUniformOverride(), llvm::AlwaysUniform, llvm::Custom, llvm::Default, DivergentTermBlocks, F, I, instructions, llvm::NeverUniform, llvm::SmallVectorTemplateBase< T, bool >::push_back(), TTI, UniformValues, and Worklist.
| void llvm::GenericUniformityAnalysisImpl< MachineSSAContext >::initialize | ( | ) |
Definition at line 50 of file MachineUniformityAnalysis.cpp.
References addUniformOverride(), llvm::AlwaysUniform, llvm::Custom, llvm::Default, F, markDivergent(), MBB, MI, llvm::NeverUniform, and UniformValues.
| bool llvm::GenericUniformityAnalysisImpl< ContextT >::isAlwaysUniform | ( | const InstructionT & | Instr | ) | const |
Whether Val will always return a uniform value regardless of its operands.
Definition at line 1186 of file GenericUniformityImpl.h.
Referenced by markDivergent().
| bool llvm::GenericUniformityAnalysisImpl< ContextT >::isCustomUniform | ( | const InstructionT & | I | ) | const |
Check if an instruction with Custom uniformity can be proven uniform based on its operands.
This queries the target-specific callback.
References I.
Referenced by markDivergent().
|
inline |
Whether Val is divergent at its definition.
When the target has no branch divergence, compute() is never called and everything is uniform. Otherwise, values not in UniformValues (e.g. newly created) are conservatively treated as divergent.
Definition at line 390 of file GenericUniformityImpl.h.
References HasBranchDivergence, and UniformValues.
Referenced by hasDivergentDefs(), hasDivergentDefs(), isDivergentUse(), isDivergentUse(), print(), and printDivergentArgs().
|
inline |
Definition at line 381 of file GenericUniformityImpl.h.
References assert(), DivergentTermBlocks, and I.
| bool llvm::GenericUniformityAnalysisImpl< MachineSSAContext >::isDivergentUse | ( | const MachineOperand & | U | ) | const |
Definition at line 151 of file MachineUniformityAnalysis.cpp.
References F, and isDivergent().
| bool llvm::GenericUniformityAnalysisImpl< SSAContext >::isDivergentUse | ( | const Use & | U | ) | const |
Definition at line 137 of file UniformityAnalysis.cpp.
References llvm::cast(), llvm::dyn_cast(), and isDivergent().
| bool llvm::GenericUniformityAnalysisImpl< ContextT >::isDivergentUse | ( | const UseT & | U | ) | const |
| bool llvm::GenericUniformityAnalysisImpl< SSAContext >::markDefsDivergent | ( | const Instruction & | Instr | ) |
Definition at line 28 of file UniformityAnalysis.cpp.
References llvm::cast(), and markDivergent().
| bool llvm::GenericUniformityAnalysisImpl< ContextT >::markDefsDivergent | ( | const InstructionT & | Instr | ) |
Mark outputs of Instr as divergent.
Referenced by markDivergent().
| bool llvm::GenericUniformityAnalysisImpl< MachineSSAContext >::markDefsDivergent | ( | const MachineInstr & | Instr | ) |
Definition at line 32 of file MachineUniformityAnalysis.cpp.
References assert(), F, markDivergent(), and TRI.
| void llvm::GenericUniformityAnalysisImpl< ContextT >::markDivergent | ( | const InstructionT & | I | ) |
Examine I for divergent outputs and add to the worklist.
Definition at line 822 of file GenericUniformityImpl.h.
References Context, CustomUniformityCandidates, llvm::dbgs(), DivergentTermBlocks, I, isAlwaysUniform(), isCustomUniform(), LLVM_DEBUG, markDefsDivergent(), and Worklist.
Referenced by initialize(), markDefsDivergent(), and markDefsDivergent().
| bool llvm::GenericUniformityAnalysisImpl< ContextT >::markDivergent | ( | ConstValueRefT | DivVal | ) |
Mark DivVal as a divergent value by removing it from UniformValues.
DivVal changed. Definition at line 849 of file GenericUniformityImpl.h.
References Context, llvm::dbgs(), LLVM_DEBUG, and UniformValues.
| void llvm::GenericUniformityAnalysisImpl< ContextT >::print | ( | raw_ostream & | Out | ) | const |
Definition at line 1205 of file GenericUniformityImpl.h.
References llvm::Block, C(), CI, Context, F, hasDivergentTerminator(), isDivergent(), printDivergentArgs(), T, and TemporalDivergenceList.
| bool llvm::GenericUniformityAnalysisImpl< SSAContext >::printDivergentArgs | ( | raw_ostream & | OS | ) | const |
Definition at line 53 of file UniformityAnalysis.cpp.
References Context, F, and isDivergent().
| bool llvm::GenericUniformityAnalysisImpl< ContextT >::printDivergentArgs | ( | raw_ostream & | Out | ) | const |
Print divergent arguments and return true if any were found.
IR specialization iterates F.args(); default is a no-op.
Definition at line 1192 of file GenericUniformityImpl.h.
Referenced by print().
| void llvm::GenericUniformityAnalysisImpl< ContextT >::recordTemporalDivergence | ( | ConstValueRefT | Val, |
| const InstructionT * | User, | ||
| CycleRef | C ) |
Definition at line 1180 of file GenericUniformityImpl.h.
References C(), and TemporalDivergenceList.
|
protected |
Definition at line 432 of file GenericUniformityImpl.h.
Referenced by analyzeControlDivergence(), GenericUniformityAnalysisImpl(), getCycleInfo(), and print().
|
protected |
Definition at line 430 of file GenericUniformityImpl.h.
Referenced by analyzeControlDivergence(), compute(), GenericUniformityAnalysisImpl(), markDivergent(), markDivergent(), print(), and printDivergentArgs().
|
protected |
Definition at line 452 of file GenericUniformityImpl.h.
Referenced by addCustomUniformityCandidate(), and markDivergent().
|
protected |
Definition at line 440 of file GenericUniformityImpl.h.
Referenced by analyzeControlDivergence(), hasDivergentTerminator(), initialize(), isDivergentTerminator(), and markDivergent().
|
protected |
Definition at line 431 of file GenericUniformityImpl.h.
Referenced by GenericUniformityAnalysisImpl(), getFunction(), initialize(), isDivergentUse(), markDefsDivergent(), print(), and printDivergentArgs().
|
protected |
Definition at line 438 of file GenericUniformityImpl.h.
Referenced by compute(), and isDivergent().
| SmallVector<TemporalDivergenceTuple, 8> llvm::GenericUniformityAnalysisImpl< ContextT >::TemporalDivergenceList |
Definition at line 418 of file GenericUniformityImpl.h.
Referenced by print(), and recordTemporalDivergence().
|
protected |
Definition at line 433 of file GenericUniformityImpl.h.
Referenced by GenericUniformityAnalysisImpl(), and initialize().
|
protected |
Definition at line 445 of file GenericUniformityImpl.h.
Referenced by forgetValue(), initialize(), isDivergent(), and markDivergent().
|
protected |
Definition at line 448 of file GenericUniformityImpl.h.
Referenced by compute(), initialize(), and markDivergent().