gpu-compute: Fix TLB coalescer starvation
Currently, we are storing coalesced accesses in
an std::unordered_map indexed by a tick index, i.e.
issue tick / coalescing window. If there are
multiple coalesced requests, at different tick
indexes, to the same virtual address, then the
TLB coalescer will issue just the first one.
However, std::unordered_map is not a sorted
container and we issue coalesced requests by iterating
through such container. This means that the coalesced
request sent in TLBCoalescer::processProbeTLBEvent is
not necessarly the oldest one. Because of this, in
cases of high contention the oldest coalesced request
will have a huge TLB access latency.
To fix this issue, we will use an std::map which is
a sorted container and therefore guarantees the
oldest coalesced request will be sent first.
Reviewed-by: Matt Sinclair <email@example.com>
Reviewed-by: Matthew Poremba <firstname.lastname@example.org>
Maintainer: Matt Sinclair <email@example.com>
Tested-by: kokoro <firstname.lastname@example.org>
diff --git a/src/gpu-compute/tlb_coalescer.hh b/src/gpu-compute/tlb_coalescer.hh
index b97801b..fce8740 100644
@@ -100,7 +100,7 @@
* option is to change it to curTick(), so we coalesce based
* on the receive time.
- typedef std::unordered_map<int64_t, std::vector<coalescedReq>>
+ typedef std::map<int64_t, std::vector<coalescedReq>>