본문 바로가기

Computer Architecture75

파이프라이닝(Pipelining)과 비순차적 명령어 처리(Out-of-order execution) 컴퓨터구조 수업시간에 교수님께서 파이프라이닝으로 인한 hazard 문제와 그 해결책들에 대해 설명해 주시면서 out-of-order core 이야기를 하셨는데요,,, 관심이 있으면 찾아보라고 하셔서 한번 찾아보았습니당. 세상에는 알아가야 될 게 정말 많네요... ㅎㅎ 비순차적 명령어 처리(out-of-order execution) 비순차적 명령어 코어(out-of-order core) 먼저, 비순차적 명령어 처리에 대해 이해하기 위해서는 컴퓨터의 CPU에서 명령어들을 처리하는 과정에 대한 이해가 필요하다. 간단하게 요약하면: 컴퓨터는 명령어를 처리한다. 그리고 이 명령어들을 좀 더 빠르게 처리하기 위해 어떤 기법(파이프라이닝; pipelining)을 이용한다. 그런데 이 기법을 이용하면, 명령어들 간의 .. 2023. 11. 20.
[CA] Lecture #22 Control Hazard : beq에서 branch 여부는 원칙적으로 EX 단계가 끝나고, MEM 단계에서 알 수 있다. --> beq instruction 다음에 어떤 연산을 수행해야 할 지, 따라서 어떤 PC 값을 설정해야 할 지( PC+4 또는 PC+offset)를 알기 위해서는 3 STALL이 발생한다. ▶ beq: PC-relative branch MIPS: PC = (PC+4) + (immediate * 4) Reducing Branch Delay: Register Compactor ▶ Register Compactor : ID 단계의 Register file에서 beq에서 비교 연산에 사용되는 레지스터 값을 읽고, 그 결과를 IF 단계의 MUX에 전달하여, (PC + 4) 또는 (PC + .. 2023. 11. 17.
[컴퓨터구조] 1115 Address Subdivision Index: Block 구분 Offset: 하나의 block 내의 byte 구분 Tag: 나머지 Example: Larger Block Size Block address (index): 몇 번째 block인가? Block number (offset): 진짜 몇 번째 block인가? (modulo 연산) Block Size Considerations Block 크기가 크면, 즉 하나의 block에서 많은 byte를 copy하면, cache miss rate ↓ 하지만, 하나의 block에서 너무 많은 byte를 copy하면, copy할 수 있는 block의 개수는 줄어들 수밖에 없다. 또, 하나의 block에서 너무 많은 byte를 copy하면, 결국 그 block에서 .. 2023. 11. 15.
[CA] Lecture #21 Hazards Data Hazards : Register file에서 서로 다른 instruction에 대한 WB과 ID가 동시에 일어나기 때문에 발생하는 hazard. In the Pipeline EX hazard MEM hazard Cf) 세 번째 WB, ID는 같은 time에 일어나도 괜찮다! : ID에서 wirte 먼저, read 나중에 일어나기 때문이다. Solution: Forwarding EX hazard, MEM hazard --> forwarding! 세 번째는 forwarding 할 필요 없다. Data Hazard Detection EX hazard (ver.1) : EX/MEM pipeline register에 저장된 destination register = ID/EX pipelin.. 2023. 11. 15.
[CA] Lecture #20 A Pipelined Datapath ▶ Five Stages: IF: Instruction fetch. ID: Instruction decode & register file read. EX: Execution or address calculation. MEM: Data memory access. WB: Write back. Single-Cycle Datapath Control Hazard: branch 여부에 따라 PC값이 달라진다. - Branch (x) --> PC+4 - Branch (o) --> (PC+4) + offset Data Hazard: Register file에서 서로 다른 instruction에 대한 WB과 ID가 동시에 일어나기 때문에 발생한다. Pipeline Registers .. 2023. 11. 14.
[컴퓨터구조] 1113 (2) Ch5. Cache & Memory Systems Memory Technology SRAM (Static RAM): CPU 내의 캐시 메모리에서 사용된다. DRAM (Dynamic RAM) Magnetic disk: 하드디스크 --> store everything in non-volatile way. Principle of Locality Temporal locality: Items accessed recently are likely to be accessed again soon. Sptial locality: Items near those accessed recently are likely to be accessed soon. Taking Advantage of Locality ▶ Memory hierarchy 모든 것을 disk에 저장한다. Disk.. 2023. 11. 13.
[컴퓨터구조] 1113 (1) Performance CPU Clocking Clock period: clock cycle 시간 Clock frequency (rate): clock cycle이 1 초에 몇 번 일어나는가? CPU Time = (clock cycle이 몇 번이나 일어나는가?) * (한 번의 clock cycle에는 몇 초가 걸리는가?) = (clock cycle이 몇 번이나 일어나는가?) / (clock cycle 속도) Clock cycle 횟수를 줄인다. (CPU Clock Cycles ↓) Clock 속도를 높인다. (Clock Rate ↑) Instruction Count & CPI(Clock Per Instruction) ▶ Instruction Count: 몇 개의 instruction이 필요한가? ▶ CPI.. 2023. 11. 13.
[컴퓨터구조] 1108 Branch Prediction 1-Bit Predictor: shortcoming ▷ Inner loop가 두 번 mispredict한다. j==N일 때 mispredict: branch해야 하는데 branch하지 않는 것으로 predict. (j == N-1 에서 branch하지 않았기 때문) j==0일 때 mispredict: branch하지 말아야 하는데 branch하는 것으로 predict. (j == N에서 branch했기 때문) 2-Bit Predictor : Branch 여부가 한 번 바뀌었을 때는 아직 상태 유지하고, 두 번 바뀌어야 예측을 바꾼다. Calculating the Branch Target ▷ Problem: branch할 위치는 계속 계산해야 한다. ▷ Solution: b.. 2023. 11. 9.
[컴퓨터구조] 1106 Data Hazard : Data hazard는 data가 WB되기 전에 ID되면 발생한다. Data hazard occur when data is used before it is stored. ▶ Data hazard 종류: EX hazard MEM hazard 1) EX hazard: forwarding : EX hazard는 1 prior result를 forwarding하면 해결할 수 있다. (No delay) 2) MEM hazard: forwarding : MEM hazard는 2 prior result를 한 번 가지고 있다가, forwarding하면 해결할 수 있다. (No delay) (Forwarding하지 않는 경우) Data Hazard Solution: Forwarding 1) EX.. 2023. 11. 9.