Increase graph ParallelismReprot values to uint64_t
This commit is contained in:
parent
2247e1e345
commit
c0391990ad
|
|
@ -188,13 +188,13 @@ public:
|
|||
// Total cost of evaluating the whole graph. The ratio of m_totalGraphCost to
|
||||
// m_criticalPathCost gives us an estimate of the parallelizability of this graph which is
|
||||
// only as good as the guess returned by vertexCost.
|
||||
uint32_t m_totalGraphCost = 0;
|
||||
uint64_t m_totalGraphCost = 0;
|
||||
|
||||
// Cost of the critical path, in abstract units (the same units returned by the vertexCost)
|
||||
uint32_t m_criticalPathCost = 0;
|
||||
uint64_t m_criticalPathCost = 0;
|
||||
|
||||
size_t m_vertexCount = 0; // Number of vertexes in the graph
|
||||
size_t m_edgeCount = 0; // Number of edges in the grap
|
||||
uint64_t m_vertexCount = 0; // Number of vertexes in the graph
|
||||
uint64_t m_edgeCount = 0; // Number of edges in the grap
|
||||
|
||||
ParallelismReport() = default;
|
||||
|
||||
|
|
@ -203,17 +203,17 @@ public:
|
|||
ParallelismReport(const ParallelismReport&) = default;
|
||||
ParallelismReport& operator=(const ParallelismReport&) = default;
|
||||
|
||||
uint32_t totalGraphCost() const { return m_totalGraphCost; }
|
||||
uint32_t criticalPathCost() const { return m_criticalPathCost; }
|
||||
size_t vertexCount() const { return m_vertexCount; }
|
||||
size_t edgeCount() const { return m_edgeCount; }
|
||||
uint64_t totalGraphCost() const { return m_totalGraphCost; }
|
||||
uint64_t criticalPathCost() const { return m_criticalPathCost; }
|
||||
uint64_t vertexCount() const { return m_vertexCount; }
|
||||
uint64_t edgeCount() const { return m_edgeCount; }
|
||||
double parallelismFactor() const {
|
||||
return (static_cast<double>(m_totalGraphCost) / m_criticalPathCost);
|
||||
}
|
||||
};
|
||||
|
||||
ParallelismReport parallelismReport(
|
||||
std::function<uint32_t(const V3GraphVertex*)> vertexCost) const VL_MT_DISABLED;
|
||||
std::function<uint64_t(const V3GraphVertex*)> vertexCost) const VL_MT_DISABLED;
|
||||
|
||||
// CALLBACKS
|
||||
virtual void loopsMessageCb(V3GraphVertex* vertexp) VL_MT_DISABLED;
|
||||
|
|
|
|||
|
|
@ -525,21 +525,21 @@ double V3Graph::orderDFSIterate(V3GraphVertex* vertexp) {
|
|||
class GraphAlgParallelismReport final {
|
||||
// MEMBERS
|
||||
const V3Graph& m_graph; // The graph
|
||||
const std::function<uint32_t(const V3GraphVertex*)> m_vertexCost; // vertex cost function
|
||||
const std::function<uint64_t(const V3GraphVertex*)> m_vertexCost; // vertex cost function
|
||||
V3Graph::ParallelismReport m_report; // The result report
|
||||
|
||||
// CONSTRUCTORS
|
||||
explicit GraphAlgParallelismReport(const V3Graph& graph,
|
||||
std::function<uint32_t(const V3GraphVertex*)> vertexCost)
|
||||
std::function<uint64_t(const V3GraphVertex*)> vertexCost)
|
||||
: m_graph{graph}
|
||||
, m_vertexCost{vertexCost} {
|
||||
// For each node, record the critical path cost from the start
|
||||
// of the graph through the end of the node.
|
||||
std::unordered_map<const V3GraphVertex*, uint32_t> critPaths;
|
||||
std::unordered_map<const V3GraphVertex*, uint64_t> critPaths;
|
||||
GraphStreamUnordered serialize{&m_graph};
|
||||
for (const V3GraphVertex* vertexp; (vertexp = serialize.nextp());) {
|
||||
++m_report.m_vertexCount;
|
||||
uint32_t cpCostToHere = 0;
|
||||
uint64_t cpCostToHere = 0;
|
||||
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep; edgep = edgep->inNextp()) {
|
||||
++m_report.m_edgeCount;
|
||||
// For each upstream item, add its critical path cost to
|
||||
|
|
@ -570,6 +570,6 @@ public:
|
|||
};
|
||||
|
||||
V3Graph::ParallelismReport
|
||||
V3Graph::parallelismReport(std::function<uint32_t(const V3GraphVertex*)> vertexCost) const {
|
||||
V3Graph::parallelismReport(std::function<uint64_t(const V3GraphVertex*)> vertexCost) const {
|
||||
return GraphAlgParallelismReport::apply(*this, vertexCost);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1714,10 +1714,10 @@ private:
|
|||
|
||||
// Checking exact values here is maybe overly precise. What we're
|
||||
// mostly looking for is a healthy reduction in the number of mTaskGraphp.
|
||||
UASSERT_SELFTEST(uint32_t, report.criticalPathCost(), 19);
|
||||
UASSERT_SELFTEST(uint32_t, report.totalGraphCost(), 101);
|
||||
UASSERT_SELFTEST(uint32_t, report.vertexCount(), 14);
|
||||
UASSERT_SELFTEST(uint32_t, report.edgeCount(), 13);
|
||||
UASSERT_SELFTEST(uint64_t, report.criticalPathCost(), 19);
|
||||
UASSERT_SELFTEST(uint64_t, report.totalGraphCost(), 101);
|
||||
UASSERT_SELFTEST(uint64_t, report.vertexCount(), 14);
|
||||
UASSERT_SELFTEST(uint64_t, report.edgeCount(), 13);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
|||
Loading…
Reference in New Issue