Kim Seon Deok
register renaming, superscalar 본문
Register renaming
speculative tomasulo알고리즘에서 ROB는 instruction commit을 순서대로 실행하고 speculative reigster 값은 commit 될 때까지 storage에 존재하게 된다.
speculative register는 physical register에 저장된다.
physical register의 갯수 >= architectural register 갯수 이다.
따라서 더 많은 data를 저장할 수 있기 때문에 같은 architectural register 값을 여러 physical reigster에 저장할 수 있다.
이를 register renaming이라 한다.
(OoO 프로세스를 구현하려면 더 많은 갯수의 register가 필요하다. speculation이 가능한 tomasulo 알고리즘은 ROB entry number로 data를 구분한다,)
architectureal register는 physical register에 dynamic하게 매핑된다.
- architectureal register는 multiple physical register에 매핑될 수 있다.
- dispatch단계에서 architectural register는 physical register로 rename 된다.
- instruction이 register를 target으로 할 때 새로운 physical register가 할당되고 매핑은 가장 최근의 physical register 값으로 바뀌게 된다.
- physical register는 가장 최근의 architectural register 값을 hold한다.
speculative instruction scheduling
speculative scheduling에서 instruction scheduler는 instruction이 issue되면 predict를 수행한다.
static pipeline 아키텍쳐에서 data는 ALU의 출력값에서부터 forwarding될 수 있었지만 OoO프로세서는 data forwarding을 지원하지 않는다. 따라서 data forwarding을 지원하도록 하기 위해 speculative scheduling을 사용한다.
sepculative scheduling이 가능한 이유
보통 execution engine, execution unit은 fixed latency를 갖는다.
instruction이 execution unit에 issue되면 결과값은 fixed latency로 생성된다.
따라서 dependent한 instruction이 execution unit에 issue되면 result를 또 다른 instruction forward할 수 있다.
prediction
- branch prediction
- memory disambiguation
- RAS
- value prediction
value prediction
instruction이 준비된 상태가 아니더라도 input operand의 값을 predict 함으로써 instruction의 실행을 speculative하게 시작하도록 하는 것
많은 instruction의 computed value는 predictable하다.
- same value
- 최근 value 중 하나의 값
- value 값이 일정한 stride로 증가하거나 감소하는 경우
긴 latency를 가진 instruciton이 decode 단계에서 detect되면, 그 값은 predict될 수 있고 dispatch 단계에서 physical register에 저장될 수 있다.
- PC에 의해 access되는 prediction table 사용
- predict된 값은 dependent한 instruction이 register를 읽도록 함으로써 speculative하게 사용될 수 있다.
- parent instruction이 issue되기 전에 child instruction이 issue될 수 있다.
- parent instruction이 실행이 완료되면 destination register에 있는 value값은 predict된 값과 비교한다.
(비교한 값이 같다면 execution은 계속 진행되고, 다르다면 비교한 값은 register에 저장되고 mispredict된 값은 ROB나 I-cache로 flush된다.)
superscalar
한 clock에 더 많은 instruction을 issue하는 것
더 많은 ILP를 exploit하도록 해서 IPC가 1보다 커지도록 만드는 기법이다.
cycle 당 multiple instruction을 dispatch하는 것의 한계
1. frontend 단계에서 dependent한 instruction을 rename해주어야 한다.
- dependent한 instruction은 sequential하게 진행된다.
가장 worst case에서 동일한 cycle에 dispatch된 모든 instruction들은 renaming 단계에서 3개의 front-end RAT entry에 액세스해야 한다.
따라서 이럴 경우 rename stage를 더 빠르게 만들거나 1 cycle에서 실행되는 renaming을 더 복잡한 logic에서 수행되도록 함으로써 해결할 수 있다.
- 원하는 rate로 instruction fetch queue를 동시에 채우기가 어렵다.
superscalar 방식으로 16개의 instruction을 한 clock에 fetch하는 경우 I-cache로부터 적어도 16개의 instruction을 fetch해야 한다. (4~5개의 instruction을 포함하는 basic block이 2~3개가 되므로)
16개의 instruction에서 평균적으로 2~3개의 branch 명령어들이 포함되어 있다. (각 basic block의 마지막 instruction은 대체로 branch instruction)
branch가 predict된 경우 : I-cache block 간에 동일한 cycle에서 instruction을 fetch해야 한다.
branch가 predict되지 않은 경우 : 16개의 연속된 instruction이 다른 I-cache block에 속할 가능성이 높다
이를 해결하기 위해선 instruction cache block을 instruction trace cache로 대체하는 방법이 있다.
trace cache는 (instruction의 dynamic trace를 추적하며 일반적인 instruction cache와 다르게 instructino을 dynamic thread 순서대로 연속적으로 instruction을 전달한다.)
2. backend 단계는 bottleneck이 발생하지 않도록 설계되어야 한다.
dynamic하게 연산을 실행하기 위해서 functional unit이 충분히 있어야 하고 structural hazard의 발생을 줄어야 한다.
이로 인해서 CDB가 여러 개 필요할 수 있다.
CDB가 여러개가 있다면 multiple instruction을 support할 수 있게 되므로 bandwidth가 향상된다.
single 프로세서에서는 프로세스의 성능을 높이기가 어렵다.
out-of-order processor, speculative, superscalar 기법을 프로세스에 적용하였지만
이 기법으로도 performance 향상 폭이 점점 saturated되고 있다.
hardware logic이 복잡해지면서 saturated semiconductor technology를 사용하게 됨으로써 이는 더 어려워지고 있다.
따라서 multi-core architecture를 적용하게 되었고 TLP를 이용해서 성능을 향상시키고자 한다.
'Advanced computer architecture' 카테고리의 다른 글
VLIW(2) & Vector Processor (0) | 2024.02.08 |
---|---|
VLIW(1) (0) | 2024.02.02 |
Speculative executions (0) | 2024.01.19 |
Static pipeline with out-of-order execution completion(2) (0) | 2024.01.11 |
Scoreboarding (0) | 2024.01.08 |