200 likes | 309 Views
AES Encryption Code Generator. Undergraduate Research Project by Paul Magrath. Supervised by Dr David Gregg. Motivation. What is AES? Why is it interesting? Widely used. New intrinsics. Motivation. How do we write optimized code for these new instructions? Problem: Hand coded assembly.
E N D
AES Encryption Code Generator Undergraduate Research Project by Paul Magrath. Supervised by Dr David Gregg.
Motivation • What is AES? • Why is it interesting? • Widely used. • New intrinsics. AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Motivation • How do we write optimized code for these new instructions? • Problem: Hand coded assembly. • Solution: A domain specific code generator. AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Motivation • Why a domain specific code generator? • Effective • Proven • Speed • Maintainability • Tunability AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Motivation • So: AES Encryption Code Generator. AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Background • AES-NI arrives in ‘Westmere’ (due 2010) AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
AES Code Generator • Takes in input AES encryption loop file. • Generates variants of loop. • Compiles, runs repeatedly and get median of runtimes of each variant. • Reports best variant runtime achieved. AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
AES Code Generator AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
AES Code Generator • Steaming store • Unwind inner loop • Use local variables • Unwind outer loop • Interleave • Parallel (OpenMP) • Prefetch to cache • Prefetch to register Variant Options AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
AES Code Generator • Implementation: • Python wrapper • C++ application • PapiEx integration AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
AES Code Generator • Testing: • Intel C Compiler • GNU C Compiler • 32 Bit • 64 Bit • Simulator AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
AES Code Generator • Experimental Results from: • Intel Core 2 Quad • Intel Core 2 Duo • Intel Pentium 4 Dual AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Experimental Results • So...what was learnt? AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
The Basics Cycles vs Variants Applied Variant Applied AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Unwinding Outer Loop Level of Unwinding and Local Variables AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Parallel – Intel Core 2 Quad Level of Unwinding and Local Variables AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Parallel – Intel Core 2 Duo Level of Unwinding and Local Variables AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Generator Tunability • Intel Core 2 Quad Core (64-bit) • Intel Pentium 4 Dual Processor (64-bit) AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Future Work • Genetic search algorithms. • Intel Shannon. AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin
Questions? AES Encryption Code Generator - Paul Magrath - Trinity College, Dublin