mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Simplify LogicMTask/ExecMTask IDs (#4990)
There is no strong need to re-map LogicMTask IDs and it just adds extra processing. Instead we just allocate a separate set of ExecMTask IDs as they are created, which can also be used as the unique profiling ID as well. The only effect on the output of this is the change in mtask IDs emitted, which was fairly arbitrary to begin with.
This commit is contained in:
@@ -20,9 +20,51 @@
|
||||
#include "config_build.h"
|
||||
#include "verilatedos.h"
|
||||
|
||||
#include "V3Graph.h"
|
||||
#include "V3ThreadSafety.h"
|
||||
|
||||
class AstNetlist;
|
||||
class AstMTaskBody;
|
||||
|
||||
//*************************************************************************
|
||||
// MTasks and graph structures
|
||||
|
||||
class ExecMTask final : public V3GraphVertex {
|
||||
VL_RTTI_IMPL(ExecMTask, V3GraphVertex)
|
||||
private:
|
||||
AstMTaskBody* const m_bodyp; // Task body
|
||||
const uint32_t m_id; // Unique ID of this ExecMTask.
|
||||
static uint32_t s_nextId; // Next ID to use
|
||||
const std::string m_hashName; // Hashed name based on body for profile-driven optimization
|
||||
// Predicted critical path from the start of this mtask to the ends of the graph that are
|
||||
// reachable from this mtask. In abstract time units.
|
||||
uint32_t m_priority = 0;
|
||||
// Predicted runtime of this mtask, in the same abstract time units as priority().
|
||||
uint32_t m_cost = 0;
|
||||
uint64_t m_predictStart = 0; // Predicted start time of task
|
||||
VL_UNCOPYABLE(ExecMTask);
|
||||
|
||||
public:
|
||||
ExecMTask(V3Graph* graphp, AstMTaskBody* bodyp) VL_MT_DISABLED;
|
||||
AstMTaskBody* bodyp() const { return m_bodyp; }
|
||||
uint32_t id() const VL_MT_SAFE { return m_id; }
|
||||
uint32_t priority() const { return m_priority; }
|
||||
void priority(uint32_t pri) { m_priority = pri; }
|
||||
uint32_t cost() const { return m_cost; }
|
||||
void cost(uint32_t cost) { m_cost = cost; }
|
||||
void predictStart(uint64_t time) { m_predictStart = time; }
|
||||
uint64_t predictStart() const { return m_predictStart; }
|
||||
string name() const override VL_MT_STABLE { return "mt"s + std::to_string(id()); }
|
||||
string hashName() const { return m_hashName; }
|
||||
void dump(std::ostream& str) const;
|
||||
|
||||
static uint32_t numUsedIds() { return s_nextId; }
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, const ExecMTask& rhs) {
|
||||
rhs.dump(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
namespace V3ExecGraph {
|
||||
void implement(AstNetlist*) VL_MT_DISABLED;
|
||||
|
||||
Reference in New Issue
Block a user