|
LLVM 23.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 | CycleT = typename CycleInfoT::CycleT |
| using | SyncDependenceAnalysisT = GenericSyncDependenceAnalysis<ContextT> |
| using | DivergenceDescriptorT |
| using | BlockLabelMapT = typename SyncDependenceAnalysisT::BlockLabelMap |
| 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 330 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::BlockLabelMapT = typename SyncDependenceAnalysisT::BlockLabelMap |
Definition at line 346 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::BlockT = typename ContextT::BlockT |
Definition at line 332 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::ConstValueRefT = typename ContextT::ConstValueRefT |
Definition at line 335 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::CycleInfoT = GenericCycleInfo<ContextT> |
Definition at line 340 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::CycleT = typename CycleInfoT::CycleT |
Definition at line 341 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::DivergenceDescriptorT |
Definition at line 344 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::DominatorTreeT = typename ContextT::DominatorTreeT |
Definition at line 338 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::FunctionT = typename ContextT::FunctionT |
Definition at line 333 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::InstructionT = typename ContextT::InstructionT |
Definition at line 337 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::SyncDependenceAnalysisT = GenericSyncDependenceAnalysis<ContextT> |
Definition at line 343 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::TemporalDivergenceTuple |
Definition at line 348 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::UseT = typename ContextT::UseT |
Definition at line 336 of file GenericUniformityImpl.h.
| using llvm::GenericUniformityAnalysisImpl< ContextT >::ValueRefT = typename ContextT::ValueRefT |
Definition at line 334 of file GenericUniformityImpl.h.
|
inline |
Definition at line 351 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 859 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 853 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 1097 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().
| void llvm::GenericUniformityAnalysisImpl< ContextT >::compute | ( | ) |
Propagate divergence to all instructions in the region.
Divergence is seeded by calls to markDivergent.
Definition at line 1153 of file GenericUniformityImpl.h.
References analyzeControlDivergence(), assert(), Context, llvm::dbgs(), HasBranchDivergence, I, isDivergent(), LLVM_DEBUG, and Worklist.
|
inline |
Definition at line 358 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 |
References I.
Referenced by isDivergent().
| bool llvm::GenericUniformityAnalysisImpl< MachineSSAContext >::hasDivergentDefs | ( | const MachineInstr & | I | ) | const |
Definition at line 22 of file MachineUniformityAnalysis.cpp.
References I, isDivergent(), and op.
|
inline |
Definition at line 410 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, block, llvm::Custom, llvm::Default, F, instr, markDivergent(), MI, llvm::NeverUniform, uniformity, 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 1183 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 |
Definition at line 385 of file GenericUniformityImpl.h.
References DivergentTermBlocks, hasDivergentDefs(), and I.
Referenced by compute(), hasDivergentDefs(), hasDivergentDefs(), isDivergentUse(), isDivergentUse(), print(), and printDivergentArgs().
|
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 396 of file GenericUniformityImpl.h.
References HasBranchDivergence, and UniformValues.
| 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(), op, and TRI.
| void llvm::GenericUniformityAnalysisImpl< ContextT >::markDivergent | ( | const InstructionT & | I | ) |
Examine I for divergent outputs and add to the worklist.
Definition at line 816 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 843 of file GenericUniformityImpl.h.
References Context, llvm::dbgs(), LLVM_DEBUG, and UniformValues.
| void llvm::GenericUniformityAnalysisImpl< ContextT >::print | ( | raw_ostream & | out | ) | const |
Definition at line 1202 of file GenericUniformityImpl.h.
References block, 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 1189 of file GenericUniformityImpl.h.
Referenced by print().
| void llvm::GenericUniformityAnalysisImpl< ContextT >::recordTemporalDivergence | ( | ConstValueRefT | Val, |
| const InstructionT * | User, | ||
| const CycleT * | Cycle ) |
Definition at line 1176 of file GenericUniformityImpl.h.
References TemporalDivergenceList.
|
protected |
Definition at line 435 of file GenericUniformityImpl.h.
Referenced by analyzeControlDivergence(), and GenericUniformityAnalysisImpl().
|
protected |
Definition at line 433 of file GenericUniformityImpl.h.
Referenced by analyzeControlDivergence(), compute(), GenericUniformityAnalysisImpl(), markDivergent(), markDivergent(), print(), and printDivergentArgs().
|
protected |
Definition at line 455 of file GenericUniformityImpl.h.
Referenced by addCustomUniformityCandidate(), and markDivergent().
|
protected |
Definition at line 443 of file GenericUniformityImpl.h.
Referenced by analyzeControlDivergence(), hasDivergentTerminator(), initialize(), isDivergent(), and markDivergent().
|
protected |
Definition at line 434 of file GenericUniformityImpl.h.
Referenced by GenericUniformityAnalysisImpl(), getFunction(), initialize(), isDivergentUse(), markDefsDivergent(), print(), and printDivergentArgs().
|
protected |
Definition at line 441 of file GenericUniformityImpl.h.
Referenced by compute(), and isDivergent().
| SmallVector<TemporalDivergenceTuple, 8> llvm::GenericUniformityAnalysisImpl< ContextT >::TemporalDivergenceList |
Definition at line 420 of file GenericUniformityImpl.h.
Referenced by print(), and recordTemporalDivergence().
|
protected |
Definition at line 436 of file GenericUniformityImpl.h.
Referenced by GenericUniformityAnalysisImpl(), and initialize().
|
protected |
Definition at line 448 of file GenericUniformityImpl.h.
Referenced by initialize(), isDivergent(), and markDivergent().
|
protected |
Definition at line 451 of file GenericUniformityImpl.h.
Referenced by compute(), initialize(), and markDivergent().