diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2015-09-16 11:59:56 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2015-09-16 11:59:56 -0500 |
commit | cd9e4458139658c4ce8f038e3a44bdecd17fa75d (patch) | |
tree | c7403c142a9bf36869f75016c683b9c7ef731399 /src/mem/ruby/network/MessageBuffer.hh | |
parent | 78a1245b4115373856514eacf2264141e6cd4aca (diff) | |
download | gem5-cd9e4458139658c4ce8f038e3a44bdecd17fa75d.tar.xz |
ruby: message buffer, timer table: significant changes
This patch changes MessageBuffer and TimerTable, two structures used for
buffering messages by components in ruby. These structures would no longer
maintain pointers to clock objects. Functions in these structures have been
changed to take as input current time in Tick. Similarly, these structures
will not operate on Cycle valued latencies for different operations. The
corresponding functions would need to be provided with these latencies by
components invoking the relevant functions. These latencies should also be
in Ticks.
I felt the need for these changes while trying to speed up ruby. The ultimate
aim is to eliminate Consumer class and replace it with an EventManager object in
the MessageBuffer and TimerTable classes. This object would be used for
scheduling events. The event itself would contain information on the object and
function to be invoked.
In hindsight, it seems I should have done this while I was moving away from use
of a single global clock in the memory system. That change led to introduction
of clock objects that replaced the global clock object. It never crossed my
mind that having clock object pointers is not a good design. And now I really
don't like the fact that we have separate consumer, receiver and sender
pointers in message buffers.
Diffstat (limited to 'src/mem/ruby/network/MessageBuffer.hh')
-rw-r--r-- | src/mem/ruby/network/MessageBuffer.hh | 57 |
1 files changed, 15 insertions, 42 deletions
diff --git a/src/mem/ruby/network/MessageBuffer.hh b/src/mem/ruby/network/MessageBuffer.hh index 4209aea0f..4fdf4978d 100644 --- a/src/mem/ruby/network/MessageBuffer.hh +++ b/src/mem/ruby/network/MessageBuffer.hh @@ -55,24 +55,24 @@ class MessageBuffer : public SimObject typedef MessageBufferParams Params; MessageBuffer(const Params *p); - void reanalyzeMessages(Addr addr); - void reanalyzeAllMessages(); - void stallMessage(Addr addr); + void reanalyzeMessages(Addr addr, Tick current_time); + void reanalyzeAllMessages(Tick current_time); + void stallMessage(Addr addr, Tick current_time); // TRUE if head of queue timestamp <= SystemTime - bool isReady() const; + bool isReady(Tick current_time) const; void - delayHead() + delayHead(Tick current_time, Tick delta) { MsgPtr m = m_prio_heap.front(); std::pop_heap(m_prio_heap.begin(), m_prio_heap.end(), std::greater<MsgPtr>()); m_prio_heap.pop_back(); - enqueue(m, Cycles(1)); + enqueue(m, current_time, delta); } - bool areNSlotsAvailable(unsigned int n); + bool areNSlotsAvailable(unsigned int n, Tick curTime); int getPriority() { return m_priority_rank; } void setPriority(int rank) { m_priority_rank = rank; } void setConsumer(Consumer* consumer) @@ -86,20 +86,6 @@ class MessageBuffer : public SimObject m_consumer = consumer; } - void setSender(ClockedObject* obj) - { - DPRINTF(RubyQueue, "Setting sender: %s\n", obj->name()); - assert(m_sender == NULL || m_sender == obj); - m_sender = obj; - } - - void setReceiver(ClockedObject* obj) - { - DPRINTF(RubyQueue, "Setting receiver: %s\n", obj->name()); - assert(m_receiver == NULL || m_receiver == obj); - m_receiver = obj; - } - Consumer* getConsumer() { return m_consumer; } bool getOrdered() { return m_strict_fifo; } @@ -108,26 +94,20 @@ class MessageBuffer : public SimObject //! message queue. The function assumes that the queue is nonempty. const Message* peek() const; - const MsgPtr& - peekMsgPtr() const - { - assert(isReady()); - return m_prio_heap.front(); - } + const MsgPtr &peekMsgPtr() const { return m_prio_heap.front(); } - void enqueue(MsgPtr message) { enqueue(message, Cycles(1)); } - void enqueue(MsgPtr message, Cycles delta); + void enqueue(MsgPtr message, Tick curTime, Tick delta); //! Updates the delay cycles of the message at the head of the queue, //! removes it from the queue and returns its total delay. - Cycles dequeue(); + Tick dequeue(Tick current_time); - void recycle(); + void recycle(Tick current_time, Tick recycle_latency); bool isEmpty() const { return m_prio_heap.size() == 0; } bool isStallMapEmpty() { return m_stall_msg_map.size() == 0; } unsigned int getStallMapSize() { return m_stall_msg_map.size(); } - unsigned int getSize(); + unsigned int getSize(Tick curTime); void clear(); void print(std::ostream& out) const; @@ -148,17 +128,10 @@ class MessageBuffer : public SimObject uint32_t functionalWrite(Packet *pkt); private: - //added by SS - const Cycles m_recycle_latency; - void reanalyzeList(std::list<MsgPtr> &, Tick); private: // Data Members (m_ prefix) - //! The two ends of the buffer. - ClockedObject* m_sender; - ClockedObject* m_receiver; - //! Consumer to signal a wakeup(), can be NULL Consumer* m_consumer; std::vector<MsgPtr> m_prio_heap; @@ -170,12 +143,12 @@ class MessageBuffer : public SimObject StallMsgMapType m_stall_msg_map; const unsigned int m_max_size; - Cycles m_time_last_time_size_checked; + Tick m_time_last_time_size_checked; unsigned int m_size_last_time_size_checked; // variables used so enqueues appear to happen immediately, while // pop happen the next cycle - Cycles m_time_last_time_enqueue; + Tick m_time_last_time_enqueue; Tick m_time_last_time_pop; Tick m_last_arrival_time; @@ -193,7 +166,7 @@ class MessageBuffer : public SimObject int m_vnet_id; }; -Cycles random_time(); +Tick random_time(); inline std::ostream& operator<<(std::ostream& out, const MessageBuffer& obj) |