mem: model data array bank in classic cache
Review Request #1809 - Created March 31, 2013 and updated
| Information | |
|---|---|
| Xiangyu Dong | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 9818:438f37f51ba2 --------------------------- mem: model data array bank in classic cache The classic cache does not model data array bank, i.e. if a read/write is being serviced by a cache bank, no other requests should be sent to this bank. This patch models a multi-bank cache. Features include: 1. detect if the bank interleave granularity is larger than cache line size 2. add CacheBank debug flag 3. Differentiate read and write latency 3a. read latency is named as read_latency 3b. write latency is named as write_latency 4. Add write_latency, num_banks, bank_itlv_bit into the Python parser 5. Enabling bank model by --l1-bank-model, --l2-bank-model, --l3-bank-model Not modeled in this patch: Due to the lack of retry mechanism in the cache master port, the access form the memory side will not be denied if the bank is in service. Instead, the bank service time will be extended. This is equivalent to an infinite write buffer for cache fill operations.
Posted (April 15, 2013, 11:01 a.m.)
Thanks for this patch, it's nice to be able to model bank contention! What about blocking the port when there is a bank conflict and some number of write buffers are occupied?
-
configs/common/Options.py (Diff revision 1) -
because the are defaults all these are going to override the defaults in Caches.py when ConfigCaches.py is run. we do this other places, but it's good to know and perhaps they should be the same latency as the other defaults?
Posted (April 16, 2013, 3:47 a.m.)
Thanks for the patch. I have some high-level comments at this point, most important is how to deal with the blocking.
-
configs/common/CacheConfig.py (Diff revision 1) -
high or low?
-
configs/common/Options.py (Diff revision 1) -
type?
-
configs/common/Options.py (Diff revision 1) -
For the address striping in the bus I opted for the high bit. I don't really care too much, but it would be good to keep it consistent.
-
src/mem/cache/base.hh (Diff revision 1) -
This is rather unfortunate. Please keep as much as possible private/protected
-
src/mem/cache/base.hh (Diff revision 1) -
const
-
src/mem/cache/base.hh (Diff revision 1) -
private for the attributes
-
src/mem/cache/base.hh (Diff revision 1) -
See base/addr_range for an example of the use of the bit operators.
-
src/mem/cache/base.cc (Diff revision 1) -
I would suggest parentheses to make the binding more clear
-
src/mem/cache/base.cc (Diff revision 1) -
fatal?
-
src/mem/cache/base.cc (Diff revision 1) -
const
-
src/mem/cache/base.cc (Diff revision 1) -
return inService && nextIdleTick <= curTick()
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
csprintf used in most other places
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
bank.push_back?
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
I would suggest iterators. At least use bank.size() for the limit
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
Are there other cases here?
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
Can we not use the same method for both cases and consider the bank one of the reasons used for blocking (and thus also call unblock once the bank is available)?
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
I am not sure I understand this bit. Is the bank blocked until a response comes back? If so, why? Is the idea not to block while the read/write port of the SRAM is busy?
Posted (July 18, 2013, 6:28 a.m.)
Hi Xiangyu, Any chance of getting the cache banking/blocking patches going again? They would be a very useful addition and I don't think there's too much work involved finishing this off. Thanks in advance
Review request changed
Updated (July 18, 2013, 12:33 p.m.)
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 10 (+224 -10) |
Posted (July 19, 2013, 1:54 a.m.)
Some minor concerns that hopefully can be fixed quickly. Thanks for the update.
-
configs/common/CacheConfig.py (Diff revision 10) -
Stick to "a=b" or "a = b" throughout. This applies to the I and D cache as well.
-
configs/common/Options.py (Diff revision 10) -
I'm tempted to say we group these based on L1, L2 and L3. Any other opinions on this one?
-
src/mem/cache/BaseCache.py (Diff revision 10) -
I think we might have touched on this already, but I'm all in favour of changing this to read_latency as part of this patch.
-
src/mem/cache/BaseCache.py (Diff revision 10) -
Is there a point in having these defaults if the command-line options override then anyways? Int -> Unsigned?
-
src/mem/cache/BaseCache.py (Diff revision 10) -
Unsigned
-
src/mem/cache/base.hh (Diff revision 10) -
A line or two per method (in doxygen format) would be greatly appreciated.
-
src/mem/cache/base.hh (Diff revision 10) -
I'd say do the rename as part of this patch. Anyone else got opinions on this one?
-
src/mem/cache/base.hh (Diff revision 10) -
Already do this once in the constructor.
-
src/mem/cache/base.hh (Diff revision 10) -
I would suggest to precompute the mask and shift in the constructor as I imagine this will be called a lot. Any idea what this patch does to the simulator performance btw?
-
src/mem/cache/cache_impl.hh (Diff revision 10) -
should officially be bank_id (as it is a local variable)
-
src/mem/cache/cache_impl.hh (Diff revision 10) -
This is fine, just wanted to point out that you can also do: for (auto b = cache->bank.begin(); b != cache->bank.end(); ++b) if ((*b)->serviceDone()) etc The unfortunate bit here is that we iterate over all the banks for every cache access. I don't know what the performance impact is, but it worries me a bit. The benefit of having events per bank is that they only do what they have to, and only when they have to.
-
src/mem/cache/cache_impl.hh (Diff revision 10) -
if (blocked) ?
-
src/mem/cache/cache_impl.hh (Diff revision 10) -
80 char
-
src/mem/cache/cache_impl.hh (Diff revision 10) -
Same concern as above. I'd suggest to add an event per bank to do the clearing.
Review request changed
Updated (July 19, 2013, 4:13 p.m.)
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 11 (+272 -30) |
Posted (July 20, 2013, 3:05 a.m.)
-
src/mem/cache/cache_impl.hh (Diff revision 11) -
Why is this here and not in base.cc? Alternatively, move all the things from base.hh to cache.hh, I honestly do not know which is more suitable. I would actually guess the latter.
-
src/mem/cache/cache_impl.hh (Diff revision 11) -
Same as above. How come this is not in base.cc?
-
src/mem/cache/cache_impl.hh (Diff revision 11) -
Will this not create problems? If there is a retry event scheduled, then surely we should not get another attempt at giving us a new packet. If we "sink" the second request then there will only be a single retry and the protocol would break down. Should this not say assert(!sendRetryEvent.scheduled()); and then schedule a send retry?
A few more things that are popping up. Thanks for all the updates. It would be great if Ali or Steve could also have a look before we ship this.
Review request changed
Updated (July 31, 2013, 2:52 p.m.)
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 12 (+276 -31) |
Posted (July 31, 2013, 3:17 p.m.)
Almost there :-) Do all the normal regressions pass (with the 1 bank default)? If so, do you know what the performance impact is?
-
configs/common/Caches.py (Diff revision 12) -
Could we not let num_banks be 1 by default and leave this out here? Similary so for the interleaving bit. Make it 0 by default and if num_banks is 1 then it is never needed.
-
configs/common/Options.py (Diff revision 12) -
Could you add "(cycles)" at the end?
-
configs/common/Options.py (Diff revision 12) -
I am not sure it's worth removing this functionality, but would we ever want to interleave on anything besides cache line granularity?
-
src/mem/cache/BaseCache.py (Diff revision 12) -
See previous remark. I suggest making this 1 by default
-
src/mem/cache/base.hh (Diff revision 12) -
perhaps add a sentence that this is to model contention and does not actually hold any data
-
src/mem/cache/base.hh (Diff revision 12) -
port -> bank
-
src/mem/cache/base.cc (Diff revision 12) -
I would suggest p->bank_intlv_high_bit ? p->bank_intlv_high_bit : ceilLog2(blkSize) + bankIntlvBits
-
src/mem/cache/base.cc (Diff revision 12) -
The name is a bit misleading, is it not?
-
src/mem/cache/cache_impl.hh (Diff revision 12) -
else? fatal? lat = readLatency? I would think if pkt->isWrite(), lat = writeLatency, and in all other cases lat = readLatency.
-
src/mem/cache/cache_impl.hh (Diff revision 12) -
Do outside the if/else?
-
src/mem/cache/cache_impl.hh (Diff revision 12) -
I would really consider this a todo and a next follow-on patch
-
src/mem/cache/cache_impl.hh (Diff revision 12) -
bank_busy?
-
src/mem/cache/cache_impl.hh (Diff revision 12) -
..., wait until the cache is unblocked and then send a retry
-
src/mem/cache/cache_impl.hh (Diff revision 12) -
Could it be extended?
Review request changed
Updated (Aug. 1, 2013, 12:11 a.m.)
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 13 (+303 -31) |
Review request changed
Updated (Aug. 1, 2013, 12:15 a.m.)
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 14 (+293 -31) |
