



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















As the number of sets is reduced, the associativity is increased (total cache size and block size are fixed). Increasing associativity will reduce the number of conflict misses. Compulsory misses are independent of cache size and remain the same. While the overall miss rate is reduced (with increase in associativity), capacity misses will increase as percentage of the overall miss rate.
b. Consider the data remapping optimization discussed in class for improving the locality of memory references. Can you describe (in language form, not physical addresses) a memory reference pattern (stream of addresses) for which this optimization will be effective in improving the hit rate?
In general, when the profiled access patterns are representative of the actual access patterns, data remapping will be effective in improving the hit rate. Profile information in turn will be an effective predictor if the data sets that are used to generate the profile information are representative. Accesses to arrays of records, allocated on the heap are the primary target. A specific example is the structured accesses to elements of a list of records. The storage pattern for records can be re- mapped statically to substantially improve the hit rate or reduce cache size for the same hit rate.
c. The following figure shows the organization of the data cache in the Alpha 21264 microprocessor. Show where you would place a pre-fetch buffer or victim cache (pick one or the other) in the memory hierarchy. Show all, correct modified connections. Briefly describe how it would operate emphasizing its benefits.
The victim cache is between the next lower level of the memory hierarchy and the L cache. If a victim is found on a miss it is swapped with the contents of the L1 cache. This requires the tag to be also made available to the victim cache.
Additional interconnect dependencies will arise depending whether there is a L2 cache (are replaced lines in L2 in the victim cache?) and the update strategy. The preceding figure shows the simplest, common paths that are necessary.
The pre-fetch buffer is similarly placed between the L1 cache and the next level of the memory hierarchy. However, does not take evicted lines from the cache, but rather holds anticipated lines form the next level of the memory hierarchy. Typically, tags are checked concurrently with TLB on a miss in L1.
Block Size
Miss Rate 4 35.18% 8 22.57% 16 16.009% 32 12.47% 64 10.79% 128 10.27% 256 10.72% 512 12.75% 1K 16.41% 2K 23.15% 4K 32.97%
a. Why does the miss rate initially decrease as the block size increases? Why does it eventually start increasing again?
Initially increased spatial locality causes a decrease in miss rate that is subsequently overrun by decreased temporal locality.
b. Can the 128 byte block size result be guaranteed to provide the best average memory access time? Justify your answer.
No. Smaller block sizes may have slightly higher miss rate (e.g., 64 byte blocks) that may be overshadowed by the much larger miss penalty of a 128 byte block. The answer depends on the design of the cache-memory interface. For average memory access time the key is the behavior of the miss penalty, (1-h) * t (^) p , where t (^) p is the time to fetch a block from memory and (1-h) is the miss rate.
b. Fill in the following table Number of L2 cache lines/page 16 Number of entries in the page table 2M Page table size in pages 2K
Virtual Address
Physical Address
L1 Cache Address
L2 Cache Address
c. What is the function of the TLB (Translation Lookaside buffer)?
Translate virtual addresses into physical addresses.
d. In the preceding example, is it possible for the system to address the L cache concurrently with the address translation provided by the TLB? Justify your answer using the address breakdowns shown above. What would be the benefit of doing so? The L1 cache is addressed by the 15 lower bits of the address (9+6). Some of the bits needed to address the L1 cache will be provided by the virtual to physical translation. Thus, concurrent addressing of the data cache by itself will provide no benefit. In general the benefit would be that addressing of the L1 cache and the address translation can be overlapped.
e. Name two optimizations to improve the performance of this memory hierarchy. Specify whether the optimization improves, hit time, miss rate or miss penalty.
Any pair from Chapter 5.
f. If the local miss rate for the L1 is 4% and the local miss rate for the L cache is 40%, what is the increase in CPI if there are 1.25 memory references per instruction?
Stall cycles from an L2 miss = 0.016 * 468 cycles = 7.48 cycles Stall cycles from L1 miss and L2 hit = 0.04 * 8 cycles = 0.32 cycles Increase in CPI = 1.25 * (7.48 + 0.32)
g. On a page fault a page is transferred from disk. Write an expression showing all of the components of the latency in transferring a page from disk into main memory? Which of these components depend on the page size?
Latency = controller delay + seek time + rotational delay + transfer rate.
With optimized layouts, only the last term is
0x
0x
Tag
a. You wish to share data between two processes and all of the shared data fits within a single page. The L1 cache is virtually addressed. i. What set of virtual pages in each process’s address space can the shared page be mapped to ensure that synonyms will not exist in the L1 cache?
ii. How many alternative sets of virtual pages are there in the virtual address space that can be used to map shared virtual pages?
Based on the preceding analysis, there are 2^3 = 8 sets of pages.
19 13 Virtual Address
15 10 6 L1 Address
These three bits must be the same for the virtual pages that contain shared data. In this case, a reference to the shared page will always result in it being mapped to the same location in the L1 cache by both processes.
b. Imagine we have implemented the critical word first optimization. The processor issues an access for which a miss is generated in the L2 cache. What would be the improvement in latency in cycles to the L2 (ignore transfer to the processor) if we implemented the critical word first optimization?
First we must compute the L2 penalty in cycles in the “normal” case.
The 1024 byte line size = 128 64-bit words. This requires 8 memory cycles from 16 banks. With a split transaction bus, 7 address cycles can be overlapped with memory access (we assume that the memory system can support seven pending accesses). Thus we have,
Address cycle + (memory cycle + data transfer cycle) * 8
The data transfer of 16, 64-bit words takes 8 * 4 = 32 cycles (two words transferred at a time)
Thus the total penalty is 2 + (60 + 32) * 8 = 738 cycles
In a critical word first optimization this can at best produce a reduction in latency of
(address cycle + memory cycle + transfer cycle) = 2 + 60 + 4 = 66 cycles
The maximal reduction can be 738 – 66 = 672 cycles.
b. A 16 x 16 matrix is mapped into memory using a (3,1) skewing scheme. i. Assuming the first element is indexed as (0,0), in what memory module will you find (11,13). Show how you obtained the module number.
Memory module 14 = [(11*3) mod 16 + 13] mod 16
ii. What is the minimum number of memory accesses necessary to fetch all elements of the main diagonal, for example if conflict free access is possible the minimum number is 1.
Elements along the main forward diagonal are skewed by (3+1) = 4. The number of elements that can be concurrently accessed is (16/gcd(4,16)). The number of accesses is gcd(4,16) = 4.
c. We wish to overlap indexing of the L1 cache access with virtual to physical address translation. Answer either i. or ii. i. Demonstrate that this is indeed possible.
Not feasible.
ii. It is not possible, in which case determine the degree of associativity required to make it possible.
Virtual address
Physical Address Presented to the L
4 bits of the index field must be translated before you can index the cache. This can be avoided by increasing the cache associativity to
d. You wish to share data between two processes and all of the shared data fits within a single physical page which starts at 0x30001000. Process A maps the shared page to a virtual page starting at 0x4000A000 and Process B maps the shared physical page to virtual page starting 0x80006000. During operation, the machine context switches between processes A and B. The L1 cache is virtually addressed and is not flushed during context switches.
Process A has a reference to 0x4000A424. Process B as a reference to 0x80006424. Will these references result in synonyms in the L1 and if so in what cache lines?
They will result in synonyms because they address the same word in the shared page but produce different values of indices in for the cache.
The 10 bit cache line address from Process A’s address is 1010 0100 00 The 10 bit cache line address from Process B’s address is 0110 0100 00
e. If the L1 local miss rate is 3% and the L2 local miss rate is 30% what is the increase in CPI due to the cache misses.
Increase in cycles per reference is = 0.03 * 10 + 0.03 * 0.3 * 529 (this expression ignores the miss detection time in the L2 cache = 10 cycles) = 5.
If the number of memory references/instruction is M, the increase in CPI is M* 5.
f. Can references to physical pages 0x20008000 and 0x30004000 generate conflict misses between each other in the L2 cache? Provide the analysis to justify your answer.
Physical address as interpreted by the L
4 bits
12 bit page offset
The data miss rate in the L1 is 3% and the instruction miss rate is 2%. The local miss rate of the L2 is 20% for instructions and 40% for data.
The preceding assumes that the physical address is constructed to use as many bits as necessary. Note that the physical address could have been 32 bits where the higher order 2 bits would be 00.
The miss penalty from L2 to L1 = 4 + 7 x 2 = 18 cycles A miss in the L2 requires 256/32 = 8 accesses (256 words/line and 32 memory banks can deliver 32 words in one memory cycle).
For a split transaction bus and a memory system that can handle multiple requests the L miss penalty = 2 + (50 + 16) x 8 = 530 cycles. Note that to deliver 32 words that are accessed in a memory cycle requires 16 bus cycles since each cycle can transfer 64 bits.
Physical address
Virtual address
Addressing the L (breakdown of the physical address
Addressing the L (breakdown of the physical address
a. The following is a sequence of short questions. Keep you answers to the point. i. What is a non-blocking cache?
This cache does not block on a miss. Memory referencing continues. The number of outstanding misses that can be supported is prime factor in the design of such a cache.
ii. How many unique sets in the L2 cache does a memory page occupy?
A memory page contains 16 lines. These lines are (direct) mapped across 16 sets. The L cache contains more than 16 sets. Therefore each page will span 16 distinct sets.
b. If 60% of all memory accesses are for instructions, what is the increase in CPI due to misses in the memory hierarchy?
If 60% of all memory references are for instructions the remaining are for data. We first compute the number of memory references for each instruction. There is at least one reference for fetching an instruction. Then there is a probability of 40/60 of a data reference. Therefore we have an average if 1.667 memory references per instruction. (one could arrive at this quicker by computing 1/0.6)
We separately compute the effect of I misses and D misses. For each class, we must compute the effect of the L1 and L2 caches. We use the expressions for multi-level caches
The increase in CPI due to instruction misses = 0.02 x (18 + 0.2 x 530)
The increase in CPI due to data misses = 0.67 x [0.03 x (18 + 0.4 x 530)]
c. Assume that the matrix is stored in row major order (increasing value of the second index), the first element of the matrix is [0][0] and that a word interleaved memory organization is used.
int x[256][512]; for (j = 0; j < 512; j = j+1) for (i = 0; i < 256; i = i+1) x[i][j] = 2 * x[i][j];