Add local tag caches to PathVisitors (#316)
* Add tag caches to PathVisitor and Search for visit_parallel Signed-off-by: Drew Lewis <cannada@google.com> * Apply clang-format * Update to avoid Search storing caches and touching Bfs.cc Signed-off-by: Drew Lewis <cannada@google.com> * Update to avoid Search storing caches and touching Bfs.cc Signed-off-by: Drew Lewis <cannada@google.com> * Fixed long lines and moved nullptr assignment to constructors Signed-off-by: Drew Lewis <cannada@google.com> --------- Signed-off-by: Drew Lewis <cannada@google.com>
This commit is contained in:
parent
9f3123cff1
commit
423c12c8f9
|
|
@ -256,7 +256,8 @@ public:
|
||||||
Edge *edge,
|
Edge *edge,
|
||||||
const RiseFall *to_rf,
|
const RiseFall *to_rf,
|
||||||
const MinMax *min_max,
|
const MinMax *min_max,
|
||||||
const PathAnalysisPt *path_ap);
|
const PathAnalysisPt *path_ap,
|
||||||
|
TagSet *tag_cache = nullptr);
|
||||||
Tag *thruClkTag(Path *from_path,
|
Tag *thruClkTag(Path *from_path,
|
||||||
Vertex *from_vertex,
|
Vertex *from_vertex,
|
||||||
Tag *from_tag,
|
Tag *from_tag,
|
||||||
|
|
@ -325,13 +326,14 @@ public:
|
||||||
const RiseFall *to_rf);
|
const RiseFall *to_rf);
|
||||||
|
|
||||||
Tag *findTag(const RiseFall *rf,
|
Tag *findTag(const RiseFall *rf,
|
||||||
const PathAnalysisPt *path_ap,
|
const PathAnalysisPt *path_ap,
|
||||||
const ClkInfo *tag_clk,
|
const ClkInfo *tag_clk,
|
||||||
bool is_clk,
|
bool is_clk,
|
||||||
InputDelay *input_delay,
|
InputDelay *input_delay,
|
||||||
bool is_segment_start,
|
bool is_segment_start,
|
||||||
ExceptionStateSet *states,
|
ExceptionStateSet *states,
|
||||||
bool own_states);
|
bool own_states,
|
||||||
|
TagSet *tag_cache = nullptr);
|
||||||
void reportTags() const;
|
void reportTags() const;
|
||||||
void reportClkInfos() const;
|
void reportClkInfos() const;
|
||||||
const ClkInfo *findClkInfo(const ClockEdge *clk_edge,
|
const ClkInfo *findClkInfo(const ClockEdge *clk_edge,
|
||||||
|
|
@ -515,19 +517,20 @@ protected:
|
||||||
void findAllArrivals(bool thru_latches);
|
void findAllArrivals(bool thru_latches);
|
||||||
void findArrivals1(Level level);
|
void findArrivals1(Level level);
|
||||||
Tag *mutateTag(Tag *from_tag,
|
Tag *mutateTag(Tag *from_tag,
|
||||||
const Pin *from_pin,
|
const Pin *from_pin,
|
||||||
const RiseFall *from_rf,
|
const RiseFall *from_rf,
|
||||||
bool from_is_clk,
|
bool from_is_clk,
|
||||||
const ClkInfo *from_clk_info,
|
const ClkInfo *from_clk_info,
|
||||||
const Pin *to_pin,
|
const Pin *to_pin,
|
||||||
const RiseFall *to_rf,
|
const RiseFall *to_rf,
|
||||||
bool to_is_clk,
|
bool to_is_clk,
|
||||||
bool to_is_reg_clk,
|
bool to_is_reg_clk,
|
||||||
bool to_is_segment_start,
|
bool to_is_segment_start,
|
||||||
const ClkInfo *to_clk_info,
|
const ClkInfo *to_clk_info,
|
||||||
InputDelay *to_input_delay,
|
InputDelay *to_input_delay,
|
||||||
const MinMax *min_max,
|
const MinMax *min_max,
|
||||||
const PathAnalysisPt *path_ap);
|
const PathAnalysisPt *path_ap,
|
||||||
|
TagSet *tag_cache = nullptr);
|
||||||
ExceptionPath *exceptionTo(const Path *path,
|
ExceptionPath *exceptionTo(const Path *path,
|
||||||
const Pin *pin,
|
const Pin *pin,
|
||||||
const RiseFall *rf,
|
const RiseFall *rf,
|
||||||
|
|
@ -706,6 +709,7 @@ public:
|
||||||
const StaState *sta);
|
const StaState *sta);
|
||||||
virtual void visitFaninPaths(Vertex *to_vertex);
|
virtual void visitFaninPaths(Vertex *to_vertex);
|
||||||
virtual void visitFanoutPaths(Vertex *from_vertex);
|
virtual void visitFanoutPaths(Vertex *from_vertex);
|
||||||
|
void initTagCache();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Return false to stop visiting.
|
// Return false to stop visiting.
|
||||||
|
|
@ -752,6 +756,7 @@ protected:
|
||||||
const MinMax *min_max,
|
const MinMax *min_max,
|
||||||
const PathAnalysisPt *path_ap) = 0;
|
const PathAnalysisPt *path_ap) = 0;
|
||||||
SearchPred *pred_;
|
SearchPred *pred_;
|
||||||
|
std::unique_ptr<TagSet> tag_cache_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Visitor called during forward search to record an
|
// Visitor called during forward search to record an
|
||||||
|
|
|
||||||
104
search/Search.cc
104
search/Search.cc
|
|
@ -1149,7 +1149,9 @@ ArrivalVisitor::init(bool always_to_endpoints,
|
||||||
VertexVisitor *
|
VertexVisitor *
|
||||||
ArrivalVisitor::copy() const
|
ArrivalVisitor::copy() const
|
||||||
{
|
{
|
||||||
return new ArrivalVisitor(always_to_endpoints_, pred_, this);
|
auto visitor = new ArrivalVisitor(always_to_endpoints_, pred_, this);
|
||||||
|
visitor->initTagCache();
|
||||||
|
return visitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrivalVisitor::~ArrivalVisitor()
|
ArrivalVisitor::~ArrivalVisitor()
|
||||||
|
|
@ -2035,17 +2037,25 @@ Search::inputDelayTag(const Pin *pin,
|
||||||
|
|
||||||
PathVisitor::PathVisitor(const StaState *sta) :
|
PathVisitor::PathVisitor(const StaState *sta) :
|
||||||
StaState(sta),
|
StaState(sta),
|
||||||
pred_(sta->search()->evalPred())
|
pred_(sta->search()->evalPred()),
|
||||||
|
tag_cache_(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PathVisitor::PathVisitor(SearchPred *pred,
|
PathVisitor::PathVisitor(SearchPred *pred,
|
||||||
const StaState *sta) :
|
const StaState *sta) :
|
||||||
StaState(sta),
|
StaState(sta),
|
||||||
pred_(pred)
|
pred_(pred),
|
||||||
|
tag_cache_(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PathVisitor::initTagCache()
|
||||||
|
{
|
||||||
|
tag_cache_ = std::make_unique<TagSet>(128, TagSet::hasher(this), TagSet::key_equal(this));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PathVisitor::visitFaninPaths(Vertex *to_vertex)
|
PathVisitor::visitFaninPaths(Vertex *to_vertex)
|
||||||
{
|
{
|
||||||
|
|
@ -2233,8 +2243,8 @@ PathVisitor::visitFromPath(const Pin *from_pin,
|
||||||
to_clk_info, to_pin, to_rf, min_max,
|
to_clk_info, to_pin, to_rf, min_max,
|
||||||
path_ap);
|
path_ap);
|
||||||
if (to_tag)
|
if (to_tag)
|
||||||
to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap);
|
to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap, tag_cache_.get());
|
||||||
from_arrival = search_->clkPathArrival(from_path, from_clk_info,
|
from_arrival = search_->clkPathArrival(from_path, from_clk_info,
|
||||||
clk_edge, min_max, path_ap);
|
clk_edge, min_max, path_ap);
|
||||||
to_arrival = from_arrival + arc_delay;
|
to_arrival = from_arrival + arc_delay;
|
||||||
}
|
}
|
||||||
|
|
@ -2249,7 +2259,7 @@ PathVisitor::visitFromPath(const Pin *from_pin,
|
||||||
latches_->latchOutArrival(from_path, arc, edge, path_ap,
|
latches_->latchOutArrival(from_path, arc, edge, path_ap,
|
||||||
to_tag, arc_delay, to_arrival);
|
to_tag, arc_delay, to_arrival);
|
||||||
if (to_tag)
|
if (to_tag)
|
||||||
to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap);
|
to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap, tag_cache_.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (from_tag->isClock()) {
|
else if (from_tag->isClock()) {
|
||||||
|
|
@ -2288,7 +2298,7 @@ PathVisitor::visitFromPath(const Pin *from_pin,
|
||||||
else {
|
else {
|
||||||
if (!(sdc_->isPathDelayInternalFromBreak(to_pin)
|
if (!(sdc_->isPathDelayInternalFromBreak(to_pin)
|
||||||
|| sdc_->isPathDelayInternalToBreak(from_pin))) {
|
|| sdc_->isPathDelayInternalToBreak(from_pin))) {
|
||||||
to_tag = search_->thruTag(from_tag, edge, to_rf, min_max, path_ap);
|
to_tag = search_->thruTag(from_tag, edge, to_rf, min_max, path_ap, tag_cache_.get());
|
||||||
arc_delay = search_->deratedDelay(from_vertex, arc, edge, false, path_ap);
|
arc_delay = search_->deratedDelay(from_vertex, arc, edge, false, path_ap);
|
||||||
if (!delayInf(arc_delay))
|
if (!delayInf(arc_delay))
|
||||||
to_arrival = from_arrival + arc_delay;
|
to_arrival = from_arrival + arc_delay;
|
||||||
|
|
@ -2450,10 +2460,11 @@ Search::clkInfoWithCrprClkPath(const ClkInfo *from_clk_info,
|
||||||
// Return nullptr if the result tag completes a false path.
|
// Return nullptr if the result tag completes a false path.
|
||||||
Tag *
|
Tag *
|
||||||
Search::thruTag(Tag *from_tag,
|
Search::thruTag(Tag *from_tag,
|
||||||
Edge *edge,
|
Edge *edge,
|
||||||
const RiseFall *to_rf,
|
const RiseFall *to_rf,
|
||||||
const MinMax *min_max,
|
const MinMax *min_max,
|
||||||
const PathAnalysisPt *path_ap)
|
const PathAnalysisPt *path_ap,
|
||||||
|
TagSet *tag_cache)
|
||||||
{
|
{
|
||||||
const Pin *from_pin = edge->from(graph_)->pin();
|
const Pin *from_pin = edge->from(graph_)->pin();
|
||||||
Vertex *to_vertex = edge->to(graph_);
|
Vertex *to_vertex = edge->to(graph_);
|
||||||
|
|
@ -2462,9 +2473,10 @@ Search::thruTag(Tag *from_tag,
|
||||||
const ClkInfo *from_clk_info = from_tag->clkInfo();
|
const ClkInfo *from_clk_info = from_tag->clkInfo();
|
||||||
bool to_is_reg_clk = to_vertex->isRegClk();
|
bool to_is_reg_clk = to_vertex->isRegClk();
|
||||||
Tag *to_tag = mutateTag(from_tag, from_pin, from_rf, false, from_clk_info,
|
Tag *to_tag = mutateTag(from_tag, from_pin, from_rf, false, from_clk_info,
|
||||||
to_pin, to_rf, false, to_is_reg_clk, false,
|
to_pin, to_rf, false, to_is_reg_clk, false,
|
||||||
// input delay is not propagated.
|
// input delay is not propagated.
|
||||||
from_clk_info, nullptr, min_max, path_ap);
|
from_clk_info, nullptr, min_max, path_ap,
|
||||||
|
tag_cache);
|
||||||
return to_tag;
|
return to_tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2617,19 +2629,20 @@ Search::thruClkInfo(Path *from_path,
|
||||||
// Find the tag for a path going from from_tag thru edge to to_pin.
|
// Find the tag for a path going from from_tag thru edge to to_pin.
|
||||||
Tag *
|
Tag *
|
||||||
Search::mutateTag(Tag *from_tag,
|
Search::mutateTag(Tag *from_tag,
|
||||||
const Pin *from_pin,
|
const Pin *from_pin,
|
||||||
const RiseFall *from_rf,
|
const RiseFall *from_rf,
|
||||||
bool from_is_clk,
|
bool from_is_clk,
|
||||||
const ClkInfo *from_clk_info,
|
const ClkInfo *from_clk_info,
|
||||||
const Pin *to_pin,
|
const Pin *to_pin,
|
||||||
const RiseFall *to_rf,
|
const RiseFall *to_rf,
|
||||||
bool to_is_clk,
|
bool to_is_clk,
|
||||||
bool to_is_reg_clk,
|
bool to_is_reg_clk,
|
||||||
bool to_is_segment_start,
|
bool to_is_segment_start,
|
||||||
const ClkInfo *to_clk_info,
|
const ClkInfo *to_clk_info,
|
||||||
InputDelay *to_input_delay,
|
InputDelay *to_input_delay,
|
||||||
const MinMax *min_max,
|
const MinMax *min_max,
|
||||||
const PathAnalysisPt *path_ap)
|
const PathAnalysisPt *path_ap,
|
||||||
|
TagSet *tag_cache)
|
||||||
{
|
{
|
||||||
ExceptionStateSet *new_states = nullptr;
|
ExceptionStateSet *new_states = nullptr;
|
||||||
ExceptionStateSet *from_states = from_tag->states();
|
ExceptionStateSet *from_states = from_tag->states();
|
||||||
|
|
@ -2713,8 +2726,8 @@ Search::mutateTag(Tag *from_tag,
|
||||||
|
|
||||||
if (new_states)
|
if (new_states)
|
||||||
return findTag(to_rf, path_ap, to_clk_info, to_is_clk,
|
return findTag(to_rf, path_ap, to_clk_info, to_is_clk,
|
||||||
from_tag->inputDelay(), to_is_segment_start,
|
from_tag->inputDelay(), to_is_segment_start, new_states,
|
||||||
new_states, true);
|
true, tag_cache);
|
||||||
else {
|
else {
|
||||||
// No state change.
|
// No state change.
|
||||||
if (to_clk_info == from_clk_info
|
if (to_clk_info == from_clk_info
|
||||||
|
|
@ -2724,9 +2737,8 @@ Search::mutateTag(Tag *from_tag,
|
||||||
&& from_tag->inputDelay() == to_input_delay)
|
&& from_tag->inputDelay() == to_input_delay)
|
||||||
return from_tag;
|
return from_tag;
|
||||||
else
|
else
|
||||||
return findTag(to_rf, path_ap, to_clk_info, to_is_clk,
|
return findTag(to_rf, path_ap, to_clk_info, to_is_clk, to_input_delay,
|
||||||
to_input_delay, to_is_segment_start,
|
to_is_segment_start, from_states, false, tag_cache);
|
||||||
from_states, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2972,16 +2984,22 @@ Search::tagCount() const
|
||||||
|
|
||||||
Tag *
|
Tag *
|
||||||
Search::findTag(const RiseFall *rf,
|
Search::findTag(const RiseFall *rf,
|
||||||
const PathAnalysisPt *path_ap,
|
const PathAnalysisPt *path_ap,
|
||||||
const ClkInfo *clk_info,
|
const ClkInfo *clk_info,
|
||||||
bool is_clk,
|
bool is_clk,
|
||||||
InputDelay *input_delay,
|
InputDelay *input_delay,
|
||||||
bool is_segment_start,
|
bool is_segment_start,
|
||||||
ExceptionStateSet *states,
|
ExceptionStateSet *states,
|
||||||
bool own_states)
|
bool own_states,
|
||||||
|
TagSet *tag_cache)
|
||||||
{
|
{
|
||||||
Tag probe(0, rf->index(), path_ap->index(), clk_info, is_clk, input_delay,
|
Tag probe(0, rf->index(), path_ap->index(), clk_info, is_clk, input_delay,
|
||||||
is_segment_start, states, false, this);
|
is_segment_start, states, false, this);
|
||||||
|
if (tag_cache) {
|
||||||
|
auto tag = tag_cache->findKey(&probe);
|
||||||
|
if (tag)
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
LockGuard lock(tag_lock_);
|
LockGuard lock(tag_lock_);
|
||||||
Tag *tag = tag_set_->findKey(&probe);
|
Tag *tag = tag_set_->findKey(&probe);
|
||||||
if (tag == nullptr) {
|
if (tag == nullptr) {
|
||||||
|
|
@ -3019,6 +3037,10 @@ Search::findTag(const RiseFall *rf,
|
||||||
}
|
}
|
||||||
if (own_states)
|
if (own_states)
|
||||||
delete states;
|
delete states;
|
||||||
|
|
||||||
|
if (tag_cache)
|
||||||
|
tag_cache->insert(tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3540,7 +3562,9 @@ RequiredVisitor::~RequiredVisitor()
|
||||||
VertexVisitor *
|
VertexVisitor *
|
||||||
RequiredVisitor::copy() const
|
RequiredVisitor::copy() const
|
||||||
{
|
{
|
||||||
return new RequiredVisitor(this);
|
auto visitor = new RequiredVisitor(this);
|
||||||
|
visitor->initTagCache();
|
||||||
|
return visitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue