Docsity

Instruction Packing with IRF for Improved Processor Efficiency, Papers of Theatre

Partial preview of the text

Download Instruction Packing with IRF for Improved Processor Efficiency and more Papers Theatre in PDF only on Docsity!

FLORIDA STATE UNIVERSITY

COLLEGE OF ARTS AND SCIENCES

IMPROVING PROCESSOR EFFICIENCY THROUGH ENHANCED

INSTRUCTION FETCH

By STEPHEN R. HINES

A Dissertation submitted to the Department of Computer Science in partial fulfillment of the requirements for the degree of Doctor of Philosophy

Degree Awarded: Summer Semester, 2008

The members of the Committee approve the Dissertation of Stephen R. Hines defended on June 27, 2008.

David Whalley Professor Co-Directing Dissertation

Gary Tyson Professor Co-Directing Dissertation

Gordon Erlebacher Outside Committee Member

Robert van Engelen Committee Member

Piyush Kumar Committee Member

Andy Wang Committee Member

The Office of Graduate Studies has verified and approved the above named committee members.

ii

ACKNOWLEDGEMENTS

I would most like to thank my advisors Gary Tyson and David Whalley for their insightful discussions, support, and guidance throughout the Ph.D. process. Your kind words of encouragement let me know that you understood all too well the pressures of being a graduate student. You have certainly inspired my research career through all the great projects we have worked on together. I would also like to thank the other students that I have worked alongside for these past several years. Whether we were having a heated discussion about multicore, talking about Futurama, or playing a quick game of Magic, each of you certainly helped me to not only survive but thrive in this setting. Being a research assistant in our lab is probably more fun than it should be. I would especially like to thank Prasad Kulkarni for being a great friend and co-worker. It goes without saying that I am grateful for all of the love and support that my wife has given me. I would be pretty lost without you, and I am sure that I would have found a reason to leave this unfinished. I would also really like to thank the rest of my family and friends. Mom, Dad, Frank, Erin, Meena, Nanda, Mugunth,... ; you have always been there for me when I needed you most. I feel truly blessed to have each of you in my life.

iv

TABLE OF CONTENTS

List of Tables...................................... vii

List of Figures..................................... viii

    1. INTRODUCTION Abstract xi
    • 1.1 Instruction Fetch
    • 1.2 Instruction Register File
    • 1.3 Exploiting Guarantees of Fetch Behavior
    • 1.4 Contributions and Impact
    • 1.5 Dissertation Outline
    1. INSTRUCTION PACKING WITH AN IRF
    • 2.1 Motivation – Instruction Fetch Redundancy
    • 2.2 Packing Instructions Into Registers
    • 2.3 ISA Modifications
    • 2.4 Compiler Modifications
    • 2.5 Evaluation of Basic Instruction Packing
    • 2.6 Improving IRF Utilization via Register Windowing
    • 2.7 Increasing Packing Levels with Compiler Optimizations
    • 2.8 Experimental Evaluation of IRF
    • 2.9 Integration with Additional Fetch Energy Enhancements
    • 2.10 Asymmetric Pipeline Bandwidth
    • 2.11 Crosscutting Issues
    • 2.12 Concluding Remarks
    1. GUARANTEEING INSTRUCTION FETCH BEHAVIOR
    • 3.1 Motivation – Instruction Fetch Regularity
    • 3.2 Tagless Hit Instruction Cache (TH-IC)
    • 3.3 Experimental Evaluation of TH-IC
    • 3.4 Identifying Application Behavior with TH-IC
    • 3.5 Eliminating Unnecessary BTB, BP, and RAS Accesses
    • 3.6 Experimental Evaluation of LIFE
    • 3.7 Improving Next Sequential Line Prefetch with LIFE
    • 3.8 Concluding Remarks
    1. RELATED WORK
    • 4.1 Reducing Energy Consumption
    • 4.2 Reducing Code Size
    • 4.3 Reducing Execution Time
    1. FUTURE WORK
    • 5.1 Improvements for Instruction Packing
    • 5.2 Improvements for LIFE
    1. CONCLUSIONS
  • REFERENCES
  • BIOGRAPHICAL SKETCH
  • 2.1 Packed Instruction Types LIST OF TABLES
  • 2.2 MiBench Benchmarks
  • 2.3 Instruction Mix with 32-entry IRF
  • 2.4 Experimental Configurations
  • 2.5 High-end Embedded Configurations
  • 3.1 Baseline TH-IC Configuration
  • 3.2 Comparing Fetch Efficiency Across Different Application Domains
  • 3.3 Baseline LIFE Configuration
  • 3.4 Correlating Instruction and Data Flow Behavior
  • 3.5 Impact of LIFE with Next Sequential Line Prefetch
  • 1.1 Memory Hierarchy and Register Files LIST OF FIGURES
  • 2.1 Static and Dynamic Instruction Redundancy
  • 2.2 Instruction Register File
  • 2.3 Tightly Packed Format
  • 2.4 MIPS Instruction Format Modifications
  • 2.5 Compiling for IRF
  • 2.6 Selecting IRF Instructions
  • 2.7 Packing Instructions with an IRF
  • 2.8 Reducing Static Code Size
  • 2.9 Reducing Fetch Energy/Exec. Time
  • 2.10 Partitioning Functions for Software IRF Windows
  • 2.11 Reducing Fetch Energy by Software Partitioning IRF Windows
  • 2.12 Example of Each Function Being Allocated an IRF Window
  • 2.13 Encoding the IRF Window Number As Part of the Call Target Address
  • 2.14 Instruction Register File with Hardware Windowing
  • 2.15 Partitioning Functions for Hardware IRF Windows
  • 2.16 Reducing Fetch Energy by Varying the Number of Hardware Windows
  • 2.17 Reducing Fetch Energy with a 4 Partition IRF
  • 2.18 Register Re-assignment
  • 2.19 Scheduling Instructions for a Basic Block
  • 2.20 Instruction Scheduling Legend
  • 2.21 Intra-block Instruction Scheduling
  • 2.22 Duplicating Code to Reduce Code Size
  • 2.23 Predication with Packed Branches
  • 2.24 Scheduling with Backward Branches
  • 2.25 Instruction Scheduling for IRF
  • 2.26 Total Processor Energy with Optimized Packing
  • 2.27 Static Code Size with Optimized Packing
  • 2.28 Execution Time with Optimized Packing
  • 2.29 Evaluating Enhanced Promotion to the IRF
  • 2.30 Processor Energy Consumption with an IRF
  • 2.31 Static Code Size with an IRF
  • 2.32 Execution Time with an IRF
  • 2.33 Reducing Fetch Energy with a Loop Cache and/or IRF
  • 2.34 Reducing Fetch Energy Using a Combination of 8-entry Loop Cache and
    • Partition IRF
  • 2.35 Overlapping Fetch with an IRF
  • 2.36 Execution Efficiency with an L0 Instruction Cache and an IRF
  • 2.37 Energy Efficiency with an L0 Instruction Cache and an IRF
  • 2.38 Decoupling Instruction Fetch in an Out-of-Order Pipeline
  • 2.39 Execution Efficiency for Asymmetric Pipeline Bandwidth
  • 2.40 Energy Efficiency for Asymmetric Pipeline Bandwidth
  • 2.41 Energy-Delay^2 for Asymmetric Pipeline Bandwidth
  • 3.1 Traditional L0/Filter and Tagless Hit Instruction Cache Layouts
  • 3.2 LIFE Organization
  • 3.3 Terminology Used to Describe Tagless Hit Instruction Cache Accesses
  • 3.4 Fetch Address Breakdown
  • 3.5 Tagless Hit Instruction Cache
  • 3.6 TH-IC Example
  • 3.7 Tagless Hit IC Operation
  • 3.8 Tagless Hit Instruction Cache Line Configurations
  • 3.9 Performance Overhead of L0 Instruction Caches
  • 3.10 Energy Consumption of L0 and Tagless Hit Instruction Caches
  • 3.11 Hit Rate of L0 and Tagless Hit Instruction Caches
  • 3.12 Fetch Power of L0 and Tagless Hit Instruction Caches
  • 3.13 Energy-Delay^2 of L0 and Tagless Hit Instruction Caches
  • 3.14 Line Replacements
  • 3.15 Consecutive Hits
  • 3.16 Consecutive Non-misses
  • 3.17 LIFE Metadata Configurations
  • 3.18 Reducing BTB/BP/RAS Accesses Example
  • 3.19 Branch Taxonomy in TH-IC
  • 3.20 Impact of LIFE on Fetch Power
  • 3.21 Impact of LIFE on Processor Energy
  • 5.1 Possible Encodings for Split MISA/RISA
  • 5.2 Possible Encodings for Split Opcode/Operand RISA
  • 5.3 Extending RISA Parameterization

ABSTRACT

Instruction fetch is an important pipeline stage for embedded processors, as it can consume a significant fraction of the total processor energy. This dissertation describes the design and implementation of two new fetch enhancements that seek to improve overall energy efficiency without any performance tradeoff. Instruction packing is a combination architectural/compiler technique that leverages code redundancy to reduce energy consump- tion, code size, and execution time. Frequently occurring instructions are placed into a small instruction register file (IRF), which requires less energy to access than an L1 instruction cache. Multiple instruction register references are placed in a single packed instruction, leading to reduced cache accesses and static code size. Hardware register windows and compiler optimizations tailored for instruction packing yield greater reductions in fetch energy consumption and static code size. The Lookahead Instruction Fetch Engine (LIFE) is a microarchitectural technique designed to exploit the regularity present in instruction fetch. The nucleus of LIFE is the Tagless Hit Instruction Cache (TH-IC), a small cache that assists the instruction fetch pipeline stage as it efficiently captures information about both sequential and non-sequential transitions between instructions. TH-IC provides a considerable savings in fetch energy without incurring the performance penalty normally associated with small filter instruction caches. Furthermore, TH-IC makes the common case (cache hit) more energy efficient by making the tag check unnecessary. LIFE extends TH-IC by making use of advanced control flow metadata to further improve utilization of fetch-associated structures such as the branch predictor, branch target buffer, and return address stack. LIFE enables significant reductions in total processor energy consumption with no impact on application execution times even for the most aggressive power-saving configuration. Both IRF and LIFE (including TH-IC) improve overall processor efficiency by actively recognizing and exploiting the common properties of instruction fetch.

xi

Figure 1.1: Memory Hierarchy and Register Files

compilers promote these frequently used data memory locations to registers in a process known as register allocation. However, there is no such analogue for frequently encountered instructions. Based on our analysis of both static and dynamic instruction redundancy, we developed the Instruction Register File (IRF) to provide a space-efficient and energy- efficient method for accessing these important instructions. Instruction Packing is our joint compiler/architectural technique for placing the most frequently accessed instructions into an IRF. Since the IRF size is small (typically 32 instructions), multiple register references can be packed together in a single instruction, leading to code size reductions. Instruction packing also allows energy to be saved, since some instruction cache accesses can now be replaced by cheaper register file accesses. Execution time is also slightly improved due to a reduction in size of the cache working set. Our research has focused on a prototype implementation of the IRF on top of the MIPS architecture [28]. The initial IRF supported parameterization to help capture greater redundancy in applications. We extended this work to include register windows, which allowed for increased IRF utilization without complicating instruction encoding [31]. The IRF has also been evaluated with other energy saving features such as an L0 instruction cache [30, 32] and a loop cache [31]. We have explored adapting traditional compiler optimizations such as register re-assignment, instruction scheduling, and instruction selection to improve Instruction Packing [33]. The IRF has also been used to decouple instruction fetch from the rest of the pipeline, leading to new energy/performance design points due to the asymmetry of pipeline bandwidth. The combination of these techniques results in an instruction set architecture (ISA) enhancement that reduces fetch energy, code size and execution time without any negative tradeoffs.

1.3 Exploiting Guarantees of Fetch Behavior

Filter or L0 instruction caches (L0-IC) are small, and typically direct-mapped caches placed before the L1 instruction cache (L1-IC) [40, 41]. Due to their small size, these caches reduce the average energy required for fetching an individual instruction. Unfortunately, the small size of the L0-IC can cause additional cache capacity and conflict misses. Any such miss in the L0-IC incurs an additional 1-cycle miss penalty prior to fetching the appropriate line from the L1-IC. The Tagless Hit Instruction Cache (TH-IC) is an alternative configuration for a small cache that allows it to be bypassed on potential misses [34]. Using just a few specialized metadata bits, instruction fetch behavior can be accurately tracked, and TH-IC can supply the fetched instruction when it is “guaranteed” to reside in it. In addition to capturing the majority of small cache hits, these guaranteed hits no longer require a tag comparison, thus further reducing fetch energy consumption. Although caches account for the bulk of energy consumption in the fetch stage, there are, however, other components of instruction fetch that can also have a sizable impact on the processor energy characteristics. In particular, speculation logic can account for a significant percentage of fetch energy consumption even for the limited speculation performed in scalar embedded processors. In fact, with advances in low-power instruction cache design, these other fetch components can dominate instruction fetch energy requirements. To complement TH-IC, we designed the Lookahead Instruction Fetch Engine (LIFE), which is a new approach for instruction fetch that attempts to reduce access to these power-critical structures when it can be determined that such an access is unnecessary [29]. LIFE uses the metadata-tracking capabilities of TH-IC to selectively disable these components when the fetched instruction is guaranteed to be non-speculative. This approach contributes further energy savings and does not negatively impact performance. LIFE can also be used as a filter for later pipeline decisions. We present a case study using next sequential line prefetch to show that LIFE can eliminate a significant fraction of useless prefetches, thereby saving more energy.

1.4 Contributions and Impact

The major contributions of this dissertation can be summarized as follows:

  1. We designed, implemented and thoroughly evaluated a new ISA enhancement known as Instruction Packing [28]. This technique utilizes an Instruction Register File 3

1.5 Dissertation Outline

The remainder of this dissertation is organized as follows. Chapter 2 discusses the design, implementation and evaluation of Instruction Packing with an Instruction Register File. Chapter 3 describes the design, implementation and evaluation of the Lookahead Instruction Fetch Engine and the Tagless Hit Instruction Cache. Chapter 4 provides an overview of related work in the area of instruction fetch enhancement. Chapter 5 outlines potential areas for further exploration. Finally, Chapter 6 presents our conclusions regarding Instruction Packing and the Lookahead Instruction Fetch Engine.

CHAPTER 2

INSTRUCTION PACKING WITH AN IRF

This chapter presents Instruction Packing, which is a joint compiler/architectural technique that we have developed for improving the overall efficiency of instruction fetch [28]. We also discuss several enhancements that we have made including the addition of hardware register windowing [31], and the adaptation of compiler optimizations [33]. Instruction packing has also been shown to be complementary to several other fetch energy reduction techniques [30, 32].

2.1 Motivation – Instruction Fetch Redundancy

Instruction fetch is an important pipeline stage for embedded systems, in that it can consume up to one-third of the total processor energy on a StrongARM SA-110 [56]. There are two primary areas for improvement in instruction fetch: enhancements to the instruction fetch mechanism and storage (caching), and enhancements to the instructions being fetched (ISA encoding). Improvements to the fetch mechanism often target energy efficiency and performance, while modifications to the instruction set encoding primarily focus on reducing static code size. These areas are partially related, in that instruction set encoding can often impact the strategies employed for instruction fetch and storage. For example, the complexity of x86 instructions necessitates the use of micro-op encoding and storage in trace caches for the Pentium-4 to maintain an adequate stream of instructions for execution [35]. Caching techniques have greatly improved the fetch of instructions from memory, however, instruction caches still require a significant amount of energy to operate since they are a relatively flat storage method. Caches need to be large enough to hold a significant portion of the working set of an application, and flexible enough to handle divergent control flow. In order to meet these performance goals, designers employ larger

6

approach allows multiple instructions to be packed together and specified (by register index) in a single instruction fetched from the instruction cache (IC). The process of coalescing multiple instruction register references together is known as Instruction Packing. Using a register file not only saves energy by reducing the number of instructions referenced from the IC, but also saves space by reducing the number of instructions stored in memory, and can improve execution time by streamlining instruction fetch and improving the IC hit rate. Instruction packing allows a designer to tighten the encoding of an application’s frequent instructions in an application-independent manner. Two new SRAM structures are required to support this instruction fetch optimization. The first is an Instruction Register File (IRF) to hold common instructions as specified by the compiler. The second is an Immediate Table (IMM) containing the most common immediate values used by instructions in the IRF. The ISA is modified to support fetching multiple instructions from the IRF. By specifying multiple IRF instructions within a single 32-bit instruction fetched from the IC, we can reduce the number of instructions in the program (saving space), reduce references to the IC (saving power), and effectively fetch more instructions per cycle (improving execution time). The IRF can be integrated into the pipeline architecture at the start of instruction decode, since the decode stage is not typically part of the critical path. If this is not the case for a particular pipeline implementation, then the IRF can be modified to hold partially decoded instructions, and IRF access can be overlapped from the end of instruction fetch to the start of instruction decode, reducing cycle time impact. Figure 2.2 shows the integration of the IRF at the beginning of instruction decode. If the instruction fetched from the IC is a packed instruction, instruction index fields select which of the IRF instructions to fetch and pass along to the next pipeline stage. Note that although the diagram only shows a single port, the IRF can be constructed with enough read ports to accommodate the bandwidth of the processor pipeline.

2.3 ISA Modifications

This section describes the changes necessary for an ISA to support references to a 32- instruction register file. We chose the MIPS ISA, since it is commonly known and has a simple encoding [61]. Instructions stored in memory will be referred to as the Memory ISA or MISA. Instructions placed in registers will be referred to as the Register ISA or RISA.

8

IF Stage

Instruction PC Cache (ROM or L1)

IF/ID

First Half of ID Stage

IRF

IMM Figure 2.2: Instruction Register File

6 bits 5 bits 5 bits 5 bits 5 bits opcode inst1 inst2 inst3 inst

5 bits inst

params^ param Figure 2.3: Tightly Packed Format

Note that the MISA and RISA need not use exactly the same instruction formats, however this dissertation presents only minor modifications to the RISA to keep the processor design from becoming too complex. MISA instructions that reference the RISA are designated as being packed.

2.3.1 Tightly Packed Instructions and Parameterization

Figure 2.3 shows the newly added T-type format for tightly packed instructions. This format allows several RISA instructions to be accessed from a single MISA instruction. Since the IRF contains 32 entries, a tightly packed instruction can consist of up to five instructions from the IRF. One IRF entry is always reserved for nop. Tightly packed instructions can support fewer than five RISA instructions by padding with the appropriate number of nop references. Hardware support halts execution of the packed instruction when a nop is encountered so there is no performance degradation. Preliminary studies showed that I-type instructions account for 51.91% of static instruc- tions and 43.45% of dynamic instructions executed. Further examination of immediate values present in these instructions revealed that many common values are used in a variety

9