Cleanup/simplify V3OrderParallel (#4959)

No functional change.
This commit is contained in:
Geza Lore 2024-03-10 18:15:45 +00:00 committed by GitHub
parent e4847464d4
commit 2247e1e345
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 631 additions and 736 deletions

View File

@ -2100,8 +2100,7 @@ public:
m_name = name; m_name = name;
} }
static AstVar* scVarRecurse(AstNode* nodep); static AstVar* scVarRecurse(AstNode* nodep);
void addProducingMTaskId(int id) { m_mtaskIds.insert(id); } void addMTaskId(int id) { m_mtaskIds.insert(id); }
void addConsumingMTaskId(int id) { m_mtaskIds.insert(id); }
const MTaskIdSet& mtaskIds() const { return m_mtaskIds; } const MTaskIdSet& mtaskIds() const { return m_mtaskIds; }
void pinNum(int id) { m_pinNum = id; } void pinNum(int id) { m_pinNum = id; }
int pinNum() const { return m_pinNum; } int pinNum() const { return m_pinNum; }

View File

@ -52,12 +52,12 @@ void processDomains(AstNetlist* netlistp, //
const TrigToSenMap& trigToSen, // const TrigToSenMap& trigToSen, //
const ExternalDomainsProvider& externalDomains); const ExternalDomainsProvider& externalDomains);
std::vector<AstActive*> createSerial(const OrderGraph& graph, // std::vector<AstActive*> createSerial(const OrderGraph& orderGraph, //
const std::string& tag, // const std::string& tag, //
const TrigToSenMap& trigToSenMap, // const TrigToSenMap& trigToSenMap, //
bool slow); bool slow);
AstExecGraph* createParallel(const OrderGraph& graph, // AstExecGraph* createParallel(const OrderGraph& orderGraph, //
const std::string& tag, // const std::string& tag, //
const TrigToSenMap& trigToSenMap, // const TrigToSenMap& trigToSenMap, //
bool slow); bool slow);

File diff suppressed because it is too large Load Diff

View File

@ -25,37 +25,11 @@
#include <list> #include <list>
class MTaskMoveVertex;
//************************************************************************* //*************************************************************************
// MTasks and graph structures // MTasks and graph structures
class AbstractMTask VL_NOT_FINAL : public V3GraphVertex { class ExecMTask final : public V3GraphVertex {
VL_RTTI_IMPL(AbstractMTask, V3GraphVertex) VL_RTTI_IMPL(ExecMTask, V3GraphVertex)
public:
explicit AbstractMTask(V3Graph* graphp) VL_MT_DISABLED : V3GraphVertex{graphp} {}
~AbstractMTask() override = default;
virtual uint32_t id() const = 0;
virtual uint32_t cost() const = 0;
};
class AbstractLogicMTask VL_NOT_FINAL : public AbstractMTask {
VL_RTTI_IMPL(AbstractLogicMTask, AbstractMTask)
public:
// TYPES
using VxList = std::list<MTaskMoveVertex*>;
// CONSTRUCTORS
explicit AbstractLogicMTask(V3Graph* graphp) VL_MT_DISABLED : AbstractMTask{graphp} {}
~AbstractLogicMTask() override = default;
// METHODS
// Set of logic vertices in this mtask. Order is not significant.
virtual const VxList* vertexListp() const = 0;
uint32_t id() const override = 0; // Unique id of this mtask.
uint32_t cost() const override = 0;
};
class ExecMTask final : public AbstractMTask {
VL_RTTI_IMPL(ExecMTask, AbstractMTask)
private: private:
AstMTaskBody* const m_bodyp; // Task body AstMTaskBody* const m_bodyp; // Task body
const uint32_t m_id; // Unique id of this mtask. const uint32_t m_id; // Unique id of this mtask.
@ -71,23 +45,19 @@ private:
public: public:
ExecMTask(V3Graph* graphp, AstMTaskBody* bodyp, uint32_t id) VL_MT_DISABLED ExecMTask(V3Graph* graphp, AstMTaskBody* bodyp, uint32_t id) VL_MT_DISABLED
: AbstractMTask{graphp}, : V3GraphVertex{graphp},
m_bodyp{bodyp}, m_bodyp{bodyp},
m_id{id} {} m_id{id} {}
AstMTaskBody* bodyp() const { return m_bodyp; } AstMTaskBody* bodyp() const { return m_bodyp; }
uint32_t id() const override VL_MT_SAFE { return m_id; } uint32_t id() const VL_MT_SAFE { return m_id; }
uint32_t priority() const { return m_priority; } uint32_t priority() const { return m_priority; }
void priority(uint32_t pri) { m_priority = pri; } void priority(uint32_t pri) { m_priority = pri; }
uint32_t cost() const override { return m_cost; } uint32_t cost() const { return m_cost; }
void cost(uint32_t cost) { m_cost = cost; } void cost(uint32_t cost) { m_cost = cost; }
void predictStart(uint64_t time) { m_predictStart = time; } void predictStart(uint64_t time) { m_predictStart = time; }
uint64_t predictStart() const { return m_predictStart; } uint64_t predictStart() const { return m_predictStart; }
void profilerId(uint64_t id) { m_profilerId = id; } void profilerId(uint64_t id) { m_profilerId = id; }
uint64_t profilerId() const { return m_profilerId; } uint64_t profilerId() const { return m_profilerId; }
string cFuncName() const {
// If this MTask maps to a C function, this should be the name
return "__Vmtask"s + "__" + cvtToStr(m_id);
}
string name() const override VL_MT_STABLE { return "mt"s + cvtToStr(id()); } string name() const override VL_MT_STABLE { return "mt"s + cvtToStr(id()); }
string hashName() const { return m_hashName; } string hashName() const { return m_hashName; }
void hashName(const string& name) { m_hashName = name; } void hashName(const string& name) { m_hashName = name; }
@ -96,6 +66,7 @@ public:
if (priority() || cost()) str << " [pr=" << priority() << " c=" << cvtToStr(cost()) << "]"; if (priority() || cost()) str << " [pr=" << priority() << " c=" << cvtToStr(cost()) << "]";
} }
}; };
inline std::ostream& operator<<(std::ostream& os, const ExecMTask& rhs) { inline std::ostream& operator<<(std::ostream& os, const ExecMTask& rhs) {
rhs.dump(os); rhs.dump(os);
return os; return os;