OpenASIP  2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BFEarlyBypasser Class Reference

#include <BFEarlyBypasser.hh>

Inheritance diagram for BFEarlyBypasser:
Inheritance graph
Collaboration diagram for BFEarlyBypasser:
Collaboration graph

Public Member Functions

 BFEarlyBypasser (BF2Scheduler &sched, MoveNode &mn)
 
bool operator() ()
 
- Public Member Functions inherited from BFOptimization
 BFOptimization (BF2Scheduler &sched)
 
virtual bool isFinishFront ()
 
virtual void mightBeReady (MoveNode &mn)
 
- Public Member Functions inherited from Reversible
virtual void undo ()
 
virtual ~Reversible ()
 
void deleteChildren (std::stack< Reversible * > &children)
 
int id ()
 
 Reversible ()
 

Private Member Functions

int bypassSourceLatestCycle (MoveNode &bypassSrc, MoveNode &bypassDst)
 

Private Attributes

MoveNodedst_
 
int bypassDistance_ = 5
 

Additional Inherited Members

- Static Public Member Functions inherited from BFOptimization
static void clearPrologMoves ()
 
static MoveNodegetSisterTrigger (const MoveNode &mn, const TTAMachine::Machine &mach)
 
- Protected Member Functions inherited from BFOptimization
DataDependenceGraphddg ()
 
DataDependenceGraphrootDDG ()
 
const DataDependenceGraphddg () const
 
DataDependenceGraphprologDDG ()
 
SimpleResourceManagerrm () const
 
SimpleResourceManagerprologRM () const
 
BUMoveNodeSelectorselector ()
 
const TTAMachine::MachinetargetMachine () const
 
unsigned int ii () const
 
MoveNodeDuplicatorduplicator () const
 
virtual bool assign (int cycle, MoveNode &, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU_=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, const TTAMachine::Bus *prologBus=nullptr, int immWriteCycle=-1, int prologImmWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1, bool ignoreGuardWriteCycle=false)
 
virtual void unassign (MoveNode &mn, bool disposePrologCopy=true)
 
virtual int rmEC (int cycle, MoveNode &mn, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, const TTAMachine::Bus *prologBus=nullptr, int immWriteCycle=-1, int prologImmWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1)
 
virtual int rmLC (int cycle, MoveNode &mn, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, const TTAMachine::Bus *prologBus=nullptr, int immWriteCycle=-1, int prologImmWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1)
 
virtual bool canAssign (int cycle, MoveNode &mn, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, const TTAMachine::Bus *prologBus=nullptr, int immWriteCycle=-1, int prologImmWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1, bool ignoreGWN=false)
 
bool putAlsoToPrologEpilog (int cycle, MoveNode &mn)
 
void setPrologSrcFUAnno (MoveNode &prologMN, MoveNode &loopMN)
 
void setPrologDstFUAnno (MoveNode &prologMN, MoveNode &loopMN)
 
void setJumpGuard (MoveNode &mn)
 
void unsetJumpGuard (MoveNode &mn)
 
bool needJumpGuard (const MoveNode &mn, int cycle)
 
int jumpGuardAvailableCycle (const MoveNode &mn)
 
bool canBeSpeculated (const Operation &op)
 
bool canBeSpeculated (const MoveNode &mn)
 
bool usePrologMove (const MoveNode &mn)
 
bool canBeScheduled (const MoveNode &mn)
 
const TTAMachine::RegisterFileRFReadPortCountPreventsScheduling (const MoveNode &mn)
 
bool immCountPreventsScheduling (const MoveNode &mn)
 
- Protected Member Functions inherited from Reversible
bool runPreChild (Reversible *preChild)
 
bool runPostChild (Reversible *preChild)
 
bool runChild (std::stack< Reversible * > &children, Reversible *child)
 
bool runChild (Reversible *child, bool pre)
 
void undoAndRemovePreChildren ()
 
void undoAndRemovePostChildren ()
 
void undoAndRemoveChildren (std::stack< Reversible * > &children)
 
virtual void undoOnlyMe ()
 
- Protected Attributes inherited from BFOptimization
BF2Schedulersched_
 
- Protected Attributes inherited from Reversible
std::stack< Reversible * > preChildren_
 
std::stack< Reversible * > postChildren_
 
- Static Protected Attributes inherited from BFOptimization
static std::map< MoveNode *, MoveNode *, MoveNode::ComparatorprologMoves_
 

Detailed Description

Definition at line 42 of file BFEarlyBypasser.hh.

Constructor & Destructor Documentation

◆ BFEarlyBypasser()

BFEarlyBypasser::BFEarlyBypasser ( BF2Scheduler sched,
MoveNode mn 
)

Definition at line 141 of file BFEarlyBypasser.cc.

141  :
142  BFOptimization(sched), dst_(mn) {
145  if (opts != NULL && opts->bypassDistance() > -1) {
147  }
148 }

References SchedulerCmdLineOptions::bypassDistance(), bypassDistance_, and Application::cmdLineOptions().

Here is the call graph for this function:

Member Function Documentation

◆ bypassSourceLatestCycle()

int BFEarlyBypasser::bypassSourceLatestCycle ( MoveNode bypassSrc,
MoveNode bypassDst 
)
private

Checks that bypass source does not WHAT???

Definition at line 91 of file BFEarlyBypasser.cc.

92  {
94 
95  int lc = INT_MAX;
96 
97  if (bypassSrc.isSourceOperation()) {
98  ProgramOperation& po = bypassSrc.sourceOperation();
99  for (int j = 0; j < po.inputMoveCount(); j++) {
100  MoveNode& inputMove = po.inputMove(j);
101  // may also be a shared operand
102  if (!sched_.isPreLoopSharedOperand(inputMove)) {
103  nodes.insert(&inputMove);
104  }
105  }
106 
107  for (int j = 0; j < po.outputMoveCount(); j++) {
108  MoveNode& outputMove = po.outputMove(j);
109  if (!sched_.isDeadResult(outputMove)) {
110  nodes.insert(&outputMove);
111  }
112  }
113  } else {
114  nodes.insert(&bypassSrc);
115  }
116 
117  for (auto mn : nodes) {
119  for (auto e : edges) {
120  MoveNode& head = ddg().headNode(*e);
121  if (head.isScheduled()) {
122  lc = std::min(lc, head.cycle());
123  continue;
124  }
125  if (&head == &bypassDst || head.isInFrontier() ||
126  e->isBackEdge() || nodes.count(&head)) {
127  continue;
128  }
129 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
130  std::cerr << "\t\t\t\tEdge almost preventing bypass from: "
131  << bypassSrc.toString() << "to: " <<bypassDst.toString()
132  << ": " << e->toString() << " dst: "
133  << head.toString() << std::endl;
134 #endif
135  return -1;
136  }
137  }
138  return lc;
139 }

References MoveNode::cycle(), BFOptimization::ddg(), BoostGraph< GraphNode, GraphEdge >::headNode(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), BF2Scheduler::isDeadResult(), MoveNode::isInFrontier(), BF2Scheduler::isPreLoopSharedOperand(), MoveNode::isScheduled(), MoveNode::isSourceOperation(), BoostGraph< GraphNode, GraphEdge >::outEdges(), ProgramOperation::outputMove(), ProgramOperation::outputMoveCount(), BFOptimization::sched_, MoveNode::sourceOperation(), and MoveNode::toString().

Referenced by operator()().

Here is the call graph for this function:

◆ operator()()

bool BFEarlyBypasser::operator() ( )
virtual

This performs the operation. Returns true if success, false if fail.

Implements Reversible.

Definition at line 48 of file BFEarlyBypasser.cc.

48  {
49 
50  if (bypassDistance_ == 0) return false;
51 
53  if (bypassEdge == NULL) {
54  return false;
55  }
56  MoveNode& src = ddg().tailNode(*bypassEdge);
57 
58  if (sched_.currentFront()->illegalBypassSources_.count(&src)) {
59 #ifdef DEBUG_BUBBLEFISH_SCHEDULER
60  std::cerr << "Bypass source illegal: " << src.toString() << std::endl;
61 #endif
62  return 0;
63  }
64 
65  if (!ddg().guardsAllowBypass(src, dst_, bypassEdge->isBackEdge())) {
66  return false;
67  }
68 
70  src, dst_, sched_.targetMachine())) {
71  return false;
72  }
73 
74  int bypassSourceLC = bypassSourceLatestCycle(src, dst_);
75  if (bypassSourceLC == -1) {
76  return false;
77  }
78 
79  if (bypassEdge->isBackEdge()) {
80  if (!src.isScheduled() || src.cycle() < (int)ii()) {
81  return false;
82  }
83  } else {
84  return runPreChild(new BFEarlyBypass(sched_, src, dst_));
85  }
86  return false;
87 }

References bypassDistance_, bypassSourceLatestCycle(), MachineConnectivityCheck::canBypass(), BF2Scheduler::currentFront(), MoveNode::cycle(), BFOptimization::ddg(), dst_, BF2Scheduler::findBypassEdge(), BFOptimization::ii(), BF2ScheduleFront::illegalBypassSources_, DataDependenceEdge::isBackEdge(), MoveNode::isScheduled(), Reversible::runPreChild(), BFOptimization::sched_, BoostGraph< GraphNode, GraphEdge >::tailNode(), BF2Scheduler::targetMachine(), and MoveNode::toString().

Here is the call graph for this function:

Member Data Documentation

◆ bypassDistance_

int BFEarlyBypasser::bypassDistance_ = 5
private

Definition at line 50 of file BFEarlyBypasser.hh.

Referenced by BFEarlyBypasser(), and operator()().

◆ dst_

MoveNode& BFEarlyBypasser::dst_
private

Definition at line 49 of file BFEarlyBypasser.hh.

Referenced by operator()().


The documentation for this class was generated from the following files:
BF2ScheduleFront::illegalBypassSources_
DataDependenceGraph::NodeSet illegalBypassSources_
Definition: BF2ScheduleFront.hh:71
BoostGraph::tailNode
virtual Node & tailNode(const Edge &edge) const
MoveNode::toString
std::string toString() const
Definition: MoveNode.cc:576
BoostGraph::headNode
virtual Node & headNode(const Edge &edge) const
DataDependenceEdge::isBackEdge
bool isBackEdge() const
Definition: DataDependenceEdge.hh:118
BFEarlyBypasser::dst_
MoveNode & dst_
Definition: BFEarlyBypasser.hh:49
BFOptimization::ii
unsigned int ii() const
Definition: BFOptimization.cc:85
BoostGraph< MoveNode, DataDependenceEdge >::NodeSet
std::set< MoveNode *, typename MoveNode ::Comparator > NodeSet
Definition: BoostGraph.hh:86
BF2Scheduler::targetMachine
const TTAMachine::Machine & targetMachine() const
Definition: BF2Scheduler.hh:127
BF2Scheduler::isDeadResult
bool isDeadResult(MoveNode &mn) const
Definition: BF2Scheduler.cc:798
ProgramOperation
Definition: ProgramOperation.hh:70
MoveNode
Definition: MoveNode.hh:65
SchedulerCmdLineOptions
Definition: SchedulerCmdLineOptions.hh:45
BFOptimization::sched_
BF2Scheduler & sched_
Definition: BFOptimization.hh:103
BFEarlyBypass
Definition: BFEarlyBypass.hh:39
MoveNode::sourceOperation
ProgramOperation & sourceOperation() const
Definition: MoveNode.cc:453
BF2Scheduler::findBypassEdge
DataDependenceEdge * findBypassEdge(const MoveNode &mn)
Definition: BF2Scheduler.cc:838
MachineConnectivityCheck::canBypass
static bool canBypass(const MoveNode &src, const MoveNode &user, const TTAMachine::Machine &targetMachine)
Definition: MachineConnectivityCheck.cc:1789
BFEarlyBypasser::bypassSourceLatestCycle
int bypassSourceLatestCycle(MoveNode &bypassSrc, MoveNode &bypassDst)
Definition: BFEarlyBypasser.cc:91
BF2Scheduler::isPreLoopSharedOperand
TTAMachine::FUPort * isPreLoopSharedOperand(MoveNode &mn) const
Definition: BF2Scheduler.cc:1625
MoveNode::cycle
int cycle() const
Definition: MoveNode.cc:421
BFEarlyBypasser::bypassDistance_
int bypassDistance_
Definition: BFEarlyBypasser.hh:50
BoostGraph< MoveNode, DataDependenceEdge >::EdgeSet
std::set< DataDependenceEdge *, typename DataDependenceEdge ::Comparator > EdgeSet
Definition: BoostGraph.hh:87
Application::cmdLineOptions
static CmdLineOptions * cmdLineOptions()
Definition: Application.cc:397
MoveNode::isSourceOperation
bool isSourceOperation() const
Definition: MoveNode.cc:168
BFOptimization::ddg
DataDependenceGraph & ddg()
Definition: BFOptimization.cc:70
ProgramOperation::inputMoveCount
int inputMoveCount() const
Definition: ProgramOperation.cc:600
ProgramOperation::outputMoveCount
int outputMoveCount() const
Definition: ProgramOperation.cc:610
BFOptimization::BFOptimization
BFOptimization(BF2Scheduler &sched)
Definition: BFOptimization.hh:75
BoostGraph::outEdges
virtual EdgeSet outEdges(const Node &node) const
BF2Scheduler::currentFront
BF2ScheduleFront * currentFront()
Definition: BF2Scheduler.hh:188
MoveNode::isInFrontier
bool isInFrontier() const
Reversible::runPreChild
bool runPreChild(Reversible *preChild)
Definition: Reversible.cc:127
DataDependenceEdge
Definition: DataDependenceEdge.hh:43
MoveNode::isScheduled
bool isScheduled() const
Definition: MoveNode.cc:409
SchedulerCmdLineOptions::bypassDistance
virtual int bypassDistance() const
Definition: SchedulerCmdLineOptions.cc:327
ProgramOperation::outputMove
MoveNode & outputMove(int index) const
Definition: ProgramOperation.cc:632
ProgramOperation::inputMove
MoveNode & inputMove(int index) const
Definition: ProgramOperation.cc:621