isa-aging envelhecimento de conjuntos de...
TRANSCRIPT
![Page 1: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/1.jpg)
ISA-AgingEnvelhecimento de Conjuntos de Instruções
Slides baseados na apresentação do artigo
SHRINK: Reducing the ISA Complexity Via Instruction Recycling
ISCA 2015
Rodolfo Azevedo
ERAD-SP 2017
![Page 2: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/2.jpg)
![Page 3: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/3.jpg)
Quiz
Abra a página:
kahoot.it
Aguarde o PIN number
![Page 4: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/4.jpg)
ISA-AgingEnvelhecimento de Conjuntos de Instruções
Slides baseados na apresentação do artigo
SHRINK: Reducing the ISA Complexity Via Instruction Recycling
ISCA 2015
Rodolfo Azevedo
ERAD-SP 2017
![Page 5: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/5.jpg)
EU
![Page 6: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/6.jpg)
Introduction
ISA
Aging
x86 code is bigger than RISC (ARM)
![Page 7: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/7.jpg)
What about other
architectures?
ARM
![Page 8: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/8.jpg)
What about other
architectures?PowerPC
![Page 9: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/9.jpg)
• Intel 8086 family, variable-length format
• Operation code: opcode + other bits to
uniquely identify an instruction
The x86 instruction set
![Page 10: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/10.jpg)
Example
![Page 11: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/11.jpg)
2.7
4.13.8
Average instruction opcode
size by x86 features
• Variable-length format no longer benefits most
used instruction
![Page 12: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/12.jpg)
AVX & SSE (vs x87)
SPEC2006FP
• Modern compilers use AVX or SSE as default
ISA for floating point calculations
![Page 13: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/13.jpg)
Solutions?
![Page 14: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/14.jpg)
Breaking Backward
Compatibility
• 3 Radical approaches:
• (A) Reduce all opcodes to 2 bytes
• (B) Reduce all opcodes to 1 or 2 bytes
• 240 instruction encoded using 1-byte
opcodes
• (C) Convert to a RISC-like ISA encoding
• Use ARM ISA for evaluation
![Page 15: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/15.jpg)
Breaking Backward
Compatibility
A2-byte opcodes
B1 or 2-byte
opcodes
CRISC-like ISA
![Page 16: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/16.jpg)
Evaluation
• x86 code is bigger than RISC (ARM) for most
programs
• Solution (B) encoding shows that variable-length is
better than RISC and x86.
x86
180 176
![Page 17: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/17.jpg)
However...
• Breaking x86 backward compatibility is
not an option.
• Software base
• Market
• What now?
![Page 18: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/18.jpg)
Recycling
Mechanism
![Page 19: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/19.jpg)
Recycling Mechanism• Remove outdated and unused instructions
• Re-use opcode space to encode new
instructions while maintaining backward
compatibility
Benefits
• Open room for encoding new instructions with
less bits - improving program size and cache.
• x86 complexity can be reduced, opening
market for specific domains; e.g. low-end
embedded devices (Quark?).
![Page 20: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/20.jpg)
Two examples
![Page 21: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/21.jpg)
• ISA release vs
revisions
/ISA Releases
![Page 22: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/22.jpg)
• ISA release vs
revisions
/ISA Releases
![Page 23: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/23.jpg)
Emulation
• Old software revision executing on new
processor revision leads to backward
compatibility issues
• Solution: software emulation mechanism via
CPU generated traps.
• Allows non-sequential ISA evolution disputes
over new extensions (XOP, FMA4, ...):
vendors could emulate each other instructions
using the trap mechanism.
![Page 24: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/24.jpg)
![Page 25: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/25.jpg)
Emulation
• Emulation must avoid using outdated
instructions
• Emulation Routines:
• Operating System
• Firmware
![Page 26: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/26.jpg)
Hardware
ISA
Revision
• 4-bits for ISA revision: extend PTE & TLB (6%
increase in Core i7 920)
• Processor Front-end
![Page 27: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/27.jpg)
Software Support
• Linker
• Operating System Loader
• Executable header annotated with software
revision
![Page 28: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/28.jpg)
Evaluation
• Static and Dynamic instruction analysis of
Linux and Windows from 1995-2012
![Page 29: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/29.jpg)
Static Analysis
• 505 unused instruction opcodes in all disks
(30% of all 32-bit opcodes)
• 80% multimedia instructions - still on
adoption
• There were no unused 1 and 2 bytes
opcodes
• From 1995 to 2012:
• 30 instructions disappeared in Linux and 10
on windows.
![Page 30: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/30.jpg)
Dead Instructions
Last time a specific amount of
opcodes were last seen
![Page 31: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/31.jpg)
Dead Instructions
22 opcodes were
last seen in Linux by 1996
Last time a specific amount of
opcodes were last seen
![Page 32: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/32.jpg)
Additional 8 opcodes
disappeared by Ubuntu 8
Dead Instructions
Last time a specific amount of
opcodes were last seen
![Page 33: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/33.jpg)
6 opcodes were
last seen in Win95
Dead Instructions
Last time a specific amount of
opcodes were last seen
![Page 34: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/34.jpg)
Additional 4 opcodes
disappeared by WinXP
Dead Instructions
Last time a specific amount of
opcodes were last seen
![Page 35: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/35.jpg)
Dynamic Analysis
![Page 36: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/36.jpg)
Emulation Overhead
• Experiment - Linux kernel trap implementation
• Tolerating a 5% overhead: we can re-encode
40% of the x86 ISA
![Page 37: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/37.jpg)
Case Study
AVX Re-encoding
• Re-encode most used AVX instructions
using 1-byte and 2-byte opcodes
• Several scenarios = AVX(n, m):
• n - number of reused 1-byte opcodes
• m - number of reused 2-byte opcodes
![Page 38: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/38.jpg)
SPEC2006FP - Code Size
Relative to the original compiled AVX version
• AVX-(5,6) is 5.3% smaller on
average
![Page 39: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/39.jpg)
Cache EffectsAVX(5,6)
32K L1 I-Cache
![Page 40: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/40.jpg)
Conclusion• Static and Dynamic analysis shows that a great
number of x86 instructions are obsolete.
• Recycling mechanism: re-encoding instructions
without breaking backward compatibility
• Tolerating a 5% overhead: we can re-encode
40% of the x86 ISA
• Case study: AVX re-encoding yields 5.3%
smaller binaries and reduction up to 53% in
cache misses.
![Page 41: ISA-Aging Envelhecimento de Conjuntos de Instruçõeseradsp2017.lasdpc.icmc.usp.br/wp-content/uploads/...Envelhecimento de Conjuntos de Instruções Slides baseados na apresentação](https://reader034.vdocuments.net/reader034/viewer/2022052007/601c1e134f53ad3905436b48/html5/thumbnails/41.jpg)
Questions?