Loop Interchange : 루프의 순서 바꿈, 바깥 쪽이 row를 담당하도록, spatial locality 향상
Loop Fusion/Fission : 두 개의 루프로 할지, 하나의 루프 안에 계산할지 정하는 것, fusion은 temporal locality 향상, Fission은 레지스터를 적게 쓸 수 있어 load/store 연산을 줄일 수 있음 (fusion은 한 루프에 너무 많은 load/store 를 쓰게 됨)
Hardware Prefetching
miss penalty / miss rate 줄임
when / where / what to be prefetched? 를 항상 고려해야 함
When : 너무 빠르게 prefetch하면 다른 useful data를 대체하게됨(cache pollution) 또한 그게 사용되기 전에 다시 replaced될 수 있음, 또 너무 느리면 processor stall을 멈출 수 없음
Where : Cache나 dedicated buffer에 저장, 캐시에 저장 시 cache pollution 가능
What : prefetch 정확도에 영향
Side Effects
prefetch된 데이터말고 evicted된 데이터가 필요하게 되면 cache pollution
불필요한 prefetch는 불필요한 memory bandwidth를 늘림
Software based : Prefetch function 사용
Hardware Based : 캐시 내에 특정 하드웨어를 사용
Software based가 정확도는 더 높지만, 컴파일러 support 필요함, Hardware Based가 더 일반적임
Alpha AXP 21064 : cache miss가 나면 request된 block과 그 연속된 다음 block 두 개를 prefetch
requested block(i)은 캐시에, 연속의 다음 block(i+1)은 instruction stream buffer에 저장 → avoid cache pollution
cache miss but hit in the instruction stream buffer, then move stream buffer data(i + 1) into cache and prefetch next block(i + 2)
Strided Prefetch : b, b + N, b + 2N이 access된 것이 관찰되면, b + 3N을 prefetch
Dead Block Problem : dead된 데이터는 빨리 evict하자,(대부분의 데이터는 dead임) 그러나 실제로는 dead data를 찾는 기법들이 있는데 실제 상황에 exploit하기 어려움
너무 많은 prefetch는 memory bandwidth를 잡아먹음 → performance degradation
Compiler-controlled prefetching
MSHR(Miss State Holding Register)
프로세서가 캐시에게 request를 보내면, MSHR은 request 정보를 저장한다.(requested data의 주소, read/write 정보, 기타 등등). MSHR은 해당 정보를 cache에서 가져올 수 있을 때까지 계속 지니고 있는다.
만약 요청한 데이터가 캐시에 없으면 MSHR은 miss state가 된다. 그 다음 MSHR이 캐시에서 해당 데이터를 가지고 올 수 있기 전까지는 다른 요청들을 처리하고 있는다. 마침내 캐시에서 가지고 올 수 있을때 비로소 해당 요청을 처리한다.
Non blocking cache
cache miss가 나도 그 다음 요청을 계속해서 이행한다. 메모리 측에서도 마찬가지로 병렬로 처리가 가능해야한다.(Bank 이용)
Memory
Accessing DRAM cells with time constraints
TRCD
TRAS + TRP = TRC
TRCD + CAS = TRAS…??
Memory Access Scheduling Problem
FCFS : 처음 온 거 처음 serve → 매우 안 좋음
FR-FCFS(First-Ready First-Come-First-Served) : open row 먼저, idle bank 먼저
Read Over Write : 일반적으로 read가 write보다 urgent하다. 따라서 먼저 처리해야됨
Consecutive read or writes : DRAM I/O pin은 bi-directional인데 changing direction은 1-2 cycle이 소비된다. 따라서 연속으로 read나 write를 처리해 direction change를 가급적 줄여야됨
Memory Commands
캐시 미스 종류(Compulsory, Capacity, Conflict, Coherence), direct mapping cache에서의 캐시 히트 프로세스, 블록 크기의 이점과 단점, 6가지 캐시 최적화 방법(larger total cache capacity, higher associativity, pseudo associativity, higher number of cache levels, read miss를 write miss보다 먼저, address translation을 avoid), VIPT(Virtually Indexed Physically Tagged), 10가지 고급 캐시 최적화 방법(L1에서는 simple하고 작은 cache를 사용, way prediction, non-blocking cache, multi bank caches, critical word first, early restart, write merging in the write buffer, compiler optimization, hardware prefetching, MSHR), DRAM 셀에 대한 시간 제약, 메모리 접근 스케줄링 문제(FCFS, FR-FCFS, Read Over Write, Consecutive read or writes), 메모리 명령어 등에 대해 다루고 있다.
Open/Close Row Policy
언제 precharge할건지, close page policy는 column access가 끝나는대로 바로바로 precharge
open page policy는 다음 access가 row buffer hit이길 hope하면서 precharge를 delay : timeout을 통해 어느 정도 기다림