Nicolás Wolovick 20210330
Dependencia: clausura transitiva de la relación binaria depende-de.
Es una propiedad del programa.
RAW: read after write, true dependency.
1 *R2* <- R5 + R3
2 R4 <- *R2* + R3
WAR: write after read, output dependency.
1 R4 <- R1 + *R5*
2 *R5* <- R1 + R2
WAW: write after write, anti-dependency.
1 *R2* <- R4 + R7
2 *R2* <- R1 + R3
Loop típico
1 for (int i=0; i<N; ++i) {
2 a[i] = a[i] * 17;
3 }
Lo extiendo un poco, el for
es un azúcar sintáctico.
1 int i = 0;
2 while (i<N) {
3 a[i] = a[i] * 17;
4 ++i;
5 }
La línea 3
depende de la 4
cuando da la vuelta.
Fuerza secuencialidad
1 for (int i=0; i<N; i+=2) { // supongo N%2==0
2 a[i] = a[i] * 17;
3 a[i+1] = a[i+1] * 17;
4 }
Compilado con AVX2: gcc-10 -O1 -S -march=haswell unroll.c
1 leaq 8192(%rdi), %rax
2 vmovss .LC0(%rip), %xmm0
3 .L5:
4 vmulss (%rdi), %xmm0, %xmm1
5 vmovss %xmm1, (%rdi)
6 vmulss 4(%rdi), %xmm0, %xmm1
7 vmovss %xmm1, 4(%rdi)
8 addq $8, %rdi
9 cmpq %rax, %rdi
10 jne .L5
xmm1
!!! Ah!?-funroll-loops
.Evitar WAW y WAR mediante renombre de registros.
(+) Se acerca al IPC ideal.
1 R4 <- R1 + *R5*
2 *R5* <- R1 + R2
Register renaming o α-conversion ;)
1 R4 <- R1 + *R5*
2 R5' <- R1 + R2
3 // de acá para abajo `R5 -> R5'`
1 *R2* <- R4 + R7
2 *R2* <- R1 + R3
Después de renombre de registros
1 *R2* <- R4 + R7
2 *R2'* <- R1 + R3
3 // de acá para abajo `R2 -> R2'`
1 leaq 8192(%rdi), %rax
2 vmovss .LC0(%rip), %xmm0
3 .L5:
4 vmulss (%rdi), %xmm0, %xmm1
5 vmovss %xmm1, (%rdi)
6 vmulss 4(%rdi), %xmm0, %xmm1
7 vmovss %xmm1, 4(%rdi)
8 addq $8, %rdi
9 cmpq %rax, %rdi
10 jne .L5
%xmm1
.Las ideas sons las mismas, pero la frontera de los algoritmos y las estructuras de datos que la implementan se corren del software al hardware+firmware.
ARF: architecture register file << PRF: physical register file
Dependen del tipo: integer, floating point, vectorial.
The integer register file has 168 physical registers of 64 bits each. The floating point register file has 160 registers of 128 bits each.
Agner Fog, The microarchitecture of Intel and AMD CPUs, Chp 20, 2020.
WikiChip, Skylake (client) - Microarchitectures - Intel, 2020.
Henry Wong, Measuring Reorder Buffer Capacity, may 14th, 2013.
división
CDC 6600
.IBM 360/91
.Es increíble como todavía le pueden sacar jugo a la secuencialidad.
Koen Crijns, Intel five generation IPC test: Broadwell, Haswell, Ivy Bridge, Sandy Bridge and Nehalem, Hardware.Info, 2015
Timothy Prickett Morgan, The Huge Premium Intel Is Charging For Skylake Xeons, Sep 1 2017.
Aumenta el ancho del pipeline.
El IPC pico es N para un N-way superscalar µP.
(Anand Lal Shimpi)[http://en.wikipedia.org/wiki/Anand_Lal_Shimpi], Haswell's Wide Execution Engine, Anandtech, 2012.
(Anand Lal Shimpi)[http://en.wikipedia.org/wiki/Anand_Lal_Shimpi], Haswell's Wide Execution Engine, Anandtech, 2012.
(Anand Lal Shimpi)[http://en.wikipedia.org/wiki/Anand_Lal_Shimpi], Haswell's Wide Execution Engine, Anandtech, 2012.
Ian Cutress, The Intel Skylake-X Review: Core i9 7900X, i7 7820X and i7 7800X Tested, Anandtech, June 2017.
Mucha área del µP destinada a descubrir paralelismo.
¡Ya no paga más! Law of diminishing returns.
Pasarle la pelota al programador/compilador.
Explicitar el paralelismo.
8 copias de lo mismo, 8 cores.
Gran porcentaje de la superficie para extraer paralelismo y mitigar el memory wall.
Symmetric Multithreading
Michael Steil, Christian Hessmann, The Ultimate Apollo Guidance Computer Talk, 2017.
Por ahora solo uno.
Table of Contents | t |
---|---|
Exposé | ESC |
Full screen slides | e |
Presenter View | p |
Source Files | s |
Slide Numbers | n |
Toggle screen blanking | b |
Show/hide slide context | c |
Notes | 2 |
Help | h |