【正文】
者必究 543 Handling Speculation ? Instruction fetch and decode places microinstructions in instruction pool ? Dispatch and Execution Unit issues microinstructions – Functional units are inside of the execution unit ? Dispatch unit uses speculation when issuing microinstructions ? As microinstructions finish, they do not write results to registers (or cache) but instead wait for the retire unit ? The retire unit writes all results back to data registers and/or cache @central south university 2022/6/1 余臘生 版權所有,違者必究 544 Source of Stalls ? This architecture is very plex and relies on being able to fetch and decode instructions quickly – The process breaks down when ? Less than 3 instructions can be fetched in 1 cycle ? Less than 3 instructions can be issued because instructions have different number of microoperations ? Limitation of reservation stations and reorder buffer slots ? Data dependences ? Data cache access results in a miss ? Branches are mispredicted – In the last 3 cases, this could cause the reorder buffer to stall, resulting in multiple microinstructions not being able to mit for several cycles ? Overall, the Pentium Pro has between .2 and stalls per instruction on SPEC 95 benchmarks, average 1+ stall per instruction ? And has an average CPI of around @central south university 2022/6/1 余臘生 版權所有,違者必究 545 Fallacies and Pitfalls ? F: Processors with lower CPIs will always be faster ? F: Processors with faster clock rates will always be faster ? P: Emphasizing an improvement in CPI by increasing issue rate while sacrificing clock rate can lead to lower performance ? P: Improving only one aspect of a multipleissue processor and expecting overall performance improvement ? P: Sometimes bigger and dumber is better – This specifically refers to using simpler branch prediction schemes than more plex ones @central south university 2022/6/1 余臘生 版權所有,違者必究 546 ?超標量流水處理機性能 ? 為便于比較,將單流水線普通標量處理機的指令級并行度記作 (1, 1),超標量處理機的指令級并行度記為 (m, 1)。 ? 在理想情況下, N條指令在單流水線普通標量處理機上的執(zhí)行時間為 ? T(1,1)=(kN1)Δt ? 其中, k是流水線的級數(shù), Δt是一個時鐘周期的時間長度。 ? 如果把相同的 N條指令在一臺每個時鐘周期發(fā)射 m條指令的超標量處理機上執(zhí)行,所需的執(zhí)行時間為 ? ? 其中,第一項是第一批 m條指令同時通過 m條指令流水線所需要的執(zhí)行間,而第二項是執(zhí)行其余 N- m條指令所需的時間。這時,每一個時鐘周期有 m條指令分別通過 m條指令流水線。 ? 超標量處理機相對于單流水普通標量處理機的加速比為 ? ? 當 N→∞ 時,在沒有資源沖突,沒有數(shù)據(jù)相關和控制相關的理想情況下 ? 超標量處理機的加速比最大為 ? S(m,1)max=m ? 如果與順序執(zhí)行結構相比,加速比為 km ? @central south university 2022/6/1 余臘生 版權所有,違者必究 547 ?超流水線處理機 ? 指令執(zhí)行時序 ? 典型處理機結構 ? 超流水線處理機性能 @central south university 余臘生 版權所有,違者必究 ? 兩種定義: 一個周期內能夠分時發(fā)射多條指令的處理機稱為 超流水線處理機。 指令流水線有 8個或更多功能段的流水線處理機稱為超流水線處理機。 ? 提高處理機性能的不同方法: 超標量處理機是通過增加硬件資源為代價來換取處理機性能的。 超流水線處理機則通過各硬件部件充分重疊工作來提高處理機性能。 ? 兩種不同并行性: 超標量處理機采用的是空間并行性 超流水線處理機采用的是時間并行性 @central south university 余臘生 版權所有,違者必究 ?指令執(zhí)行時序 – 每隔 1/n個時鐘周期發(fā)射一條指令,流水線周期為 1/n個時鐘周期 – 在超標量處理機中,流水線的有些功能段還可以進一步細分 – 例如: ID功能段可以再細分為譯碼、讀第一操作數(shù)和讀第二操作數(shù)三個流水段。也有些功能段不能再細分,如 WR功能段一般不再細分。因此有超流水線的另外一種定義:有 8個或 8個以上流水段的處理機稱為超流水線處理機 @central south university 余臘生 版權所有,違者必究 每個時鐘周期分時發(fā)送 3條指令的超流水線 IF 時鐘 周期 指令 I1 I2 I3 ID EX WR 1 2 3 4 5 6 I4 I5 I6 IF ID EX WR I7 I8 I9 IF ID EX WR IF ID EX WR IF ID EX WR IF ID EX WR IF ID EX WR IF ID EX WR IF ID EX WR @central south university 余臘生 版權所有,違者必究 ?典型處理機結構 – MIPS R4000處理機每個時鐘周期包含兩個流水段,是一種很標準的超流水線處理機結構。指令流水線有 8個流水段 –有兩個 Cache,指令 Cache和數(shù)據(jù) Cache的容量各 8KB,每個時鐘周期可以訪問Cache兩次,因此在一個時鐘周期內可以從指令 Cache中讀出兩條指令,從數(shù)據(jù) Cache中讀出或寫入兩個數(shù)據(jù)。 –主要運算部件有整數(shù)部件和浮點部件 @central south university 余臘生 版權所有,違者必究 譯碼數(shù)據(jù)Cache標志 標志指令Cache譯碼存入緩沖/對準器I B U S寫入緩沖器數(shù)據(jù)標志地址D B U S 系統(tǒng)控制浮點存儲管理部件寄存器堆指令快表浮點流水線專用通路指令 C a c h e控制 快表 T L B浮點控制寄存器 D V AI V A浮點乘法部件 地址部件浮點除法部件數(shù)據(jù) C a c h e控制 程序計數(shù)器浮點加法部件流水線通用寄存器堆轉換部件控制算術邏輯部件 A L U求平方根部件 裝入對準器 / 存入驅動器整數(shù)乘法/除法部件MIPS R4000 超流水線處理機結構@central south university 余臘生 版權所有,違者必究 MIPS R4000處理機的流水線操作 指令 Cache IF:取第一條指令 IS:取第二條指令 RF:讀寄存器堆,指令譯碼 EX:執(zhí)行指令 DF:取第一個數(shù)據(jù) DS:取第二個數(shù)據(jù) TC:數(shù)據(jù)標志 校驗; WB:寫回結果 指令 譯碼 讀寄 存器堆 ALU 數(shù)據(jù) Cache 標志檢驗 寄存 器堆 IF IS RF EX DF DS WB TC @central south university 余臘生 版權所有,違者必究 IF 流水線周期 當前 CPU周期 IS RF EX DF DS TC WB IF IS RF EX DF DS TC WB IF IS RF EX DF DS TC WB IF IS RF EX DF DS TC WB IF IS RF EX DF DS TC WB IF IS RF EX DF DS TC WB IF IS RF EX DF DS TC WB IF IS RF EX DF DS TC WB 主時 鐘 周期 MIPS R4000正常指令流水線工作時序 @central south university 余臘生 版權所有,違者必究 ? 如果在 LOAD指令之后的兩條指令中,任何一條指令要在它的 EX流水級使用這個數(shù)據(jù),則指令流水線要暫停一個時鐘周期 ? 采用順序發(fā)射方式 @central south university 余臘生 版權所有,違者必究 MIPS R4000正常指令流水線工作時序 暫停 IF IS RF EX DF DS TC WB IS RF EX DF DS TC WB RF EX DF DS TC WB EX DF DS TC WB EX DF DS T WB DF DS TC WB IF IS RF I1 I2 I3 I4 I5 I6 運行 運行 Load指令 使用 Load數(shù)據(jù) @central south university 余臘生 版權所有,違者必究 ? 超流水線處理機性能 – 指令級并行度為 (1,n)的超流水線處理機,執(zhí)行 N條指令所的時間為: – 超流水線處理機相對于單流水線普通標量處理機的加速比為: tnknT N ??? ? )(),( 11tnNktNknTTnS????????)1()1(),1()1,1(),( 1@central south university 余臘生 版權所有,違者必究 –即: –超流水線處理機的加速比的最大值為: ? S(1,n)MAX = n 1)1(),1(?????NnkNknnS@central south university 2022/6/1 余臘生 版權所有,違者必究 559 ?超標量超流水線處理機 ? 指令執(zhí)行時序 ? 典型處理機結構 ? 超標量流水線處理機性能 @central south university 余臘生 版權所有,違者必究 把超標量與超流水線技術結合在一起,就成為超標量超流水線處理機 ?指令執(zhí)行時序 超標量超流水線處理機