GPUOcelot
|
DivergenceAnalysis implements divergence analysis. The divergence analysis goes over the program dataflow graph and finds all the variables that will always hold the same values for every thread. More...
#include <DivergenceAnalysis.h>
Public Types | |
typedef std::set< BranchInfo > | branch_set |
typedef DataflowGraph::InstructionVector::const_iterator | const_instruction_iterator |
Public Member Functions | |
DivergenceAnalysis () | |
Constructor, already making the analysis of a input kernel. | |
virtual void | analyze (ir::IRKernel &k) |
Analyze the control and data flow graphs searching for divergent variables and blocks. | |
bool | isDivBlock (DataflowGraph::const_iterator &block) const |
Tests if a block ends with a divergent branch instruction. | |
bool | isDivBlock (DataflowGraph::iterator &block) const |
Tests if a block ends with a divergent branch instruction. | |
bool | isDivBranch (const const_instruction_iterator &instruction) const |
Tests if a block ends with a divergent branch instruction. | |
bool | isDivInstruction (const DataflowGraph::Instruction &instruction) const |
Tests if a instruction uses divergent variables. | |
bool | isPossibleDivBranch (const const_instruction_iterator &instruction) const |
Tests if a instruction is a possibly divergent branch. | |
branch_set & | getDivergentBranches () |
Returns set of all divergent branches of the kernel. | |
branch_set & | getNonDivergentBranches () |
Returns a set of all not divergent branches of the kernel. | |
const DivergenceGraph & | getDivergenceGraph () const |
Get the data-flow/divergence graph built by the analysis. | |
const DataflowGraph * | getDFG () const |
Returns the kernel dataflow graph. | |
void | setControlFlowAnalysis (bool doControlFlowAnalysis) |
DivergenceAnalysis implements divergence analysis. The divergence analysis goes over the program dataflow graph and finds all the variables that will always hold the same values for every thread.
typedef std::set<BranchInfo> analysis::DivergenceAnalysis::branch_set |
typedef DataflowGraph::InstructionVector::const_iterator analysis::DivergenceAnalysis::const_instruction_iterator |
analysis::DivergenceAnalysis::DivergenceAnalysis | ( | ) |
Constructor, already making the analysis of a input kernel.
void analysis::DivergenceAnalysis::analyze | ( | ir::IRKernel & | k | ) | [virtual] |
Analyze the control and data flow graphs searching for divergent variables and blocks.
1) Makes data flow analysis that detects divergent variables and blocks based on divergent sources, such as t.id, laneId 2) Makes control flow analysis that detects new divergent variables based on the dependency of variables of variables created on divergent paths
Implements analysis::KernelAnalysis.
const DataflowGraph * analysis::DivergenceAnalysis::getDFG | ( | ) | const |
Returns the kernel dataflow graph.
const DivergenceGraph & analysis::DivergenceAnalysis::getDivergenceGraph | ( | ) | const |
Get the data-flow/divergence graph built by the analysis.
DivergenceAnalysis::branch_set & analysis::DivergenceAnalysis::getDivergentBranches | ( | ) |
Returns set of all divergent branches of the kernel.
DivergenceAnalysis::branch_set & analysis::DivergenceAnalysis::getNonDivergentBranches | ( | ) |
Returns a set of all not divergent branches of the kernel.
bool analysis::DivergenceAnalysis::isDivBlock | ( | DataflowGraph::const_iterator & | block | ) | const |
Tests if a block ends with a divergent branch instruction.
Tests if a block ends with a divergent branch instruction (isDivBranchInstr)
bool analysis::DivergenceAnalysis::isDivBlock | ( | DataflowGraph::iterator & | block | ) | const |
Tests if a block ends with a divergent branch instruction.
Tests if a block ends with a divergent branch instruction (isDivBranchInstr)
bool analysis::DivergenceAnalysis::isDivBranch | ( | const const_instruction_iterator & | instruction | ) | const |
Tests if a block ends with a divergent branch instruction.
Tests if the a instruction is a branch instruction instruction and is possible a divergent instruction (isDivInstruction)
Tests if a branch instruction is divergent
bool analysis::DivergenceAnalysis::isDivInstruction | ( | const DataflowGraph::Instruction & | instruction | ) | const |
Tests if a instruction uses divergent variables.
Tests if any of the registers of a instruction is possible divergent.
bool analysis::DivergenceAnalysis::isPossibleDivBranch | ( | const const_instruction_iterator & | instruction | ) | const |
Tests if a instruction is a possibly divergent branch.
Tests if a instruction is a branch instruction with possibility of divergence.
void analysis::DivergenceAnalysis::setControlFlowAnalysis | ( | bool | doControlFlowAnalysis | ) |
If doControlFlowAnalysis is set to false, then we have the variance analysis of Straton et al.. Use it only for experiments.