1 / 16

Mikael Collin and Mats Brorsson KTH, Royal Institute of Technology Stockholm Sweden

Two-Level Dictionary Code Compression: a New Scheme to Improve Instruction Code Density of Embedded Applications. Mikael Collin and Mats Brorsson KTH, Royal Institute of Technology Stockholm Sweden. Motivation. Continuous increase of cpu controlled, mobile, and handheld products

deo
Télécharger la présentation

Mikael Collin and Mats Brorsson KTH, Royal Institute of Technology Stockholm Sweden

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Two-Level Dictionary Code Compression: a New Scheme to Improve Instruction Code Density of Embedded Applications Mikael Collin and Mats Brorsson KTH, Royal Institute of Technology Stockholm Sweden

  2. Motivation • Continuous increase of cpu controlled, mobile, and handheld products • Ever diminishing distinction between desktop & embedded applications • Increased software complexity and performance demands • More advanced processors • Energy consumption battery life time • Objective & contribution of this study • Introduce a 2-level dictionary code compression method • Compression of both instructions and instruction sequences • Up to 16 instructions into a 32 bit entity • Improve on compression ratio (code density) • Reduce energy consumption in the instruction fetch path

  3. Compressed code Original Code word Dictionary code A A B 0 1 2 E DeCompress C E F FIFO D F 3 E 4 5 J J K F K G H Decode Decode Fetch Fetch I J K 0 B 1 C 2 D 3 G 4 H 5 I ... n-1 x Dictionary entries Dictionary code compression • The basics • Frequently executed instructions are replaced for short code words • Code words are then during execution substituted for the real instruction • Dictionary contents based on execution profiles • Energy benefits due to less I-cache accesses • Dynamic compression ratio • Smaller binaries, reduced code size • Static compression ratio • High compression ratio (code density) depends on number of dictionary entries [ Lefurgy et al., MICRO-1997 ] One-Level

  4. Methods to improve code density • Larger code words • More entries, larger dictionaries • Code word size affects code density • Smaller code words • Higher code density • Fewer dictionary entries • Sequence compression, [ Lefurgy et al., MICRO-1997 ] • Code words represents a sequence of up to 4 uncompressed instructions • Requires a large dictionary • 256 code words results in a 4kB large dictionary • High possibility for unused dictionary space

  5. 0 1 2 n-1 0 1 2 n-1 I-cache 1 2 3 9 Sequence dictionary Code word dictionary add r1,r1,r3 • 32 bit fetch word • 1 uncompressed instruction • or 2-16 compressed instructions • 1-4 sequence codes, or 2-3 instruction codes • Retrieve a 35 bit sequence word • 1-4 Compressed instructions • 1-4 8 bit instruction codes (ICW) • Re-instate the original instruction 2 4 7 5 Two-level compression • Combination of instruction- and sequence compression • Possible to fetch up to 16 instructionsin a single 32 bit cache access • Flexible and storage efficient • Compressed sequences are built using individually compressed instructions • Separate dictionaries • Instruction code words & Sequence code words

  6. x y z gcc Profiler C profile gcc a gcc c b d a a a a Profiler b b b C b e c c c c f f f gcc f g g g a a g a h h h f h d d d b Fitness_fx() e e e d b b b b c c c e i i i c g x x 0 0 f j j j c f f i f d ... ... g b b g g 3 3 j d i c c 4 4 f h j h h g f f 5 5 h e g g g h 6 6 4 3 5 Sequence dictionary 0 4 3 5 h h 0 7 7 e h 6 7 a d e 1 d 6 7 1 ... ... i ... ... ? ? Code word dictionary n-1 n-1 1 0 n-1 n-1 x 0 i y e Code word dictionary 1 j 2 ... j i n-1 i j j Profiling & Compression procedure Fitness fx • Select the blocks that contributes the most to compression • Based on a gain per cost policy • Prioritize high gain, low price Code word allocation Code word allocation Code generation Instruction reSchedule Instruction reSchedule Sequence construction Sequence construction Code generation Execution profiling • Off-line profiling of the uncompressed application • Track & count the access frequency of accessed addresses

  7. Profiling and code analysis results Total execution • ~117000 analyzed Basic Blocks (BB:s) • Corresponds to 1.36 Billion instructions 90:10 rule of thumb • Only 929 BB:s constitutes 90% of all profiled BB:s • Average 61.9 blocks per application • Only 75 BB:s > 16 instructions, ~ 5 per test application

  8. Compression potential < 64 < 16

  9. Merge potential

  10. Code generation results • Static compression, code size reduction, is compromised • More focus is put on dynamic properties • Profiling strategy and fitness function • Differences in method • 1-level: individual instructions, 2-level: sequences • Sequence merge improves on static code size • Load-Store re-order has minimal impact on code size

  11. BTB Pipeline back-end E,M,WB Pipeline back-end E,M,WB Pipeline back-end E,M,WB Decode Decode Decode Fetch FIFO FIFO FIFO BTB Code word Dictionary Sequence Dictionary Fetch BTB Code word Dictionary DeCompress DeSequence Fetch DeCompress Sequence Dictionary Code word Dictionary DeCompress FIFO Architecture • Scalar 7 stage in-order pipeline (MIPS based ISA) • Dedicated decompression stages • On chip level-1 data & instruction caches • Off chip main memory • Bimodal branch predictor and branch target buffer (BTB) • Fetch word size 32 bits • Sequence dictionary • Contains up to 256 35 bit entries (Sequence Words) • Code word dictionary • Contains up to 256 31 bit entries (Code Words)

  12. Evaluation methodology • Architectures studied & compared • Base-line: 5-stage scalar pipeline (no compression) • 1-level: 6-stage pipeline, 256 entry dictionary + (a theoretical 512 entry dictionary) • 2-level: 7-stages pipeline, 256_256 entry dictionary • On-chip level-1 caches, off-chip memory • 1024 entry bimodal branch predictor • 128 entry branch target buffer (BTB) • Simulation using SimpleScalar & Wattch • Wattch enhanced with energy models for off-chip memory • Simulation parameters: 0.18μm, 1.8V, 400MHz • Test applications • 15 MediaBench applications • Measurements • Dynamic compression ratio • Energy savings and performance impact

  13. Dynamic compression ratio • About 8-47% improved fetch ratio, on average ~20% • Dynamic compression ratio is primary affected by: • Number of instruction code words, dictionary size • Code composition • Number and size of the basic blocks This is due to a single 401 instruction large basic block that corresponds to 53% of the entire execution More efficient to increase the number of instruction code words

  14. Dynamic ratio reflects on energy • 2-21% improvement on instruction fetch path energy • Fewer instruction cache accesses and BTB-lookups • Increased energy need for the two decompression stages & dictionaries • Yields ~9% energy improvement in total processor energy • The fetch path corresponds to ~30% of the entire processor

  15. Performance • High miss-predict penalty impacts on performance • Prediction accuracy & number of branch/jump instructions • Virtually increased cache capacity • Performance improvement for working sets larger than the physical cache size

  16. Conclusions • 2-level dictionary compression method • Compression of up to 16 instructions long sequences, 1 cache access • Two separate dictionaries, two distinct code word types • Compression of both individual instructions and sequences • Storage effective architecture • On average ~20% improvement on compression ratio • Corresponds to ~9% improvement in total processor energy consumption • Code word count still is the primary factor for good compression • Performance • Working set and cache size • Number of branches & prediction accuracy is a dominant factor

More Related