mem-garnet: Change flitbuffer structure to deque

Flitbuffers act as FIFOs for internal links and output queues
in routers. This change replaces the use of vectors with deque
for performance improvements. The older implementation of using
a vector combined with a heap sort was both incorrect and
inefficient.

Incorrect because flit buffers should act strictly
as FIFO, sorting them based on time changes the order which affects
functionality in the case of DVFS enabled NoCs.

Change-Id: Ieba40f85628b7c7255e86792d40b8ce3d7ac34b5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44286
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Srikant Bharadwaj
2021-04-08 02:51:22 -04:00
parent 40c69e8f64
commit ef96d4cc5c

View File

@@ -55,8 +55,7 @@ class flitBuffer
getTopFlit()
{
flit *f = m_buffer.front();
std::pop_heap(m_buffer.begin(), m_buffer.end(), flit::greater);
m_buffer.pop_back();
m_buffer.pop_front();
return f;
}
@@ -70,13 +69,12 @@ class flitBuffer
insert(flit *flt)
{
m_buffer.push_back(flt);
std::push_heap(m_buffer.begin(), m_buffer.end(), flit::greater);
}
uint32_t functionalWrite(Packet *pkt);
private:
std::vector<flit *> m_buffer;
std::deque<flit *> m_buffer;
int max_size;
};