Efficient Resource Management during Instruction Scheduling for the EPIC
ld    a = [x]                 {mii:   ld    a = [x]                  2. Background
           add   b = y, e              ...
detailed description of all of these micro-architectural
         features for the Itanium processor can be found in [12]....
To achieve efficiency in both space and time, we take               BuildFSA {
         a functional-unit-centric approach...
High-level Instruction Scheduler                                   Micro-level Scheduler

IssueOp(op, cycle) {                                                 IssueOp function, unoccupied FUs are first selected f...
1.20                                                                                                                     1...
Efficient resource management during instruction scheduling ...
Efficient resource management during instruction scheduling ...
Upcoming SlideShare
Loading in …5

Efficient resource management during instruction scheduling ...


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Efficient resource management during instruction scheduling ...

  1. 1. Efficient Resource Management during Instruction Scheduling for the EPIC Architecture Dong-Yuan Chen, Lixia Liu, Chen Fu†, Shuxin Yang†, Chengyong Wu†, Roy Ju † Intel Labs Institute of Computing Technology Intel Corporation Chinese Academy of Sciences Santa Clara, CA 95052 Beijing, P. R. China Abstract tend to specialize execution units according to functional Effective and efficient modeling and management of types (e.g. memory, ALU, floating-point, etc.) and even hardware resources have always been critical toward have asymmetric functionality within the same types. A generating highly efficient code in optimizing compilers. given instruction can sometimes be issued only to a The instruction templates and dispersal rules of the EPIC particular unit within the same type, and such decisions architecture add new complexity in managing resource could even be affected by surrounding instructions. constraints to instruction scheduler. We extended a finite A simple but sub-optimal approach to deal with these state automaton (FSA) approach to efficiently manage all new and complex templates and instruction dispatching key resource constraints of an EPIC architecture on-the- constraints is to add a separate instruction-packing phase fly during instruction scheduling. We have fully integrated after instruction scheduling. However, the example in the FSA-based resource management into the instruction Figure 1 argues for an intelligent scheduling phase scheduler in the Open Research Compiler for the EPIC equipped with better resource management to achieve architecture. Our integrated approach shows up to 12% optimal performance. Assume a hypothetical speedup on some SPECint2000 benchmarks and 4.5% implementation of EPIC that can issue three instructions speedup on average for all SPECint2000 benchmarks on per cycle. It has two memory (M) execution units and two an Itanium machine when compares to an instruction ALU (I) units. For simplicity, assume there are only two scheduler with decoupled resource management. In the instruction templates: MII and MMI, where M and I meantime, the instruction scheduling time of our specify the functional unit types in the respective template approach is reduced by 4% on average. slots. The order of slots in a template defines the sequential semantics within a cycle. The string “;;” marks 1. Introduction a stop bit, the explicit cycle break specified by the compiler to the hardware. Anti-dependences are allowed The Explicitly Parallel Instruction Computing (EPIC) in the same cycle as long as the instructions are ordered to architecture exemplified by the Intel Itanium Processor reflect such dependences. Family (IPF) relies heavily on compilers to statically For the six instructions in Figure 1, a traditional schedule instructions to fully utilize its wide execution instruction scheduler based on dependence critical paths resources. The majority of instruction schedulers use the may derive a two-cycle schedule as shown in Figure 1(a) dependence critical path lengths as the primary cost even if it takes into account the availability of execution function to schedule instructions. Modeling of execution units. However, in the decoupled approach, a subsequent resources is dealt with in an ad hoc way if at all, often in a instruction-packing phase cannot find any available manner of scattering the hardware details across the entire template to bundle the three instructions in the first scheduling phase. The EPIC architecture [11] introduces schedule cycle, since they require a non-existent MIM the notion of instruction bundles and templates, which template. Reordering the three instructions to use the limit the instruction mixes presented to the hardware so MMI template is not feasible due to the anti-dependence that instructions can be dispatched efficiently to execution on y. The bundling phase ends up forcing the “ld y = units. Instruction templates impose new constraints on [f]” instruction into an extra cycle, resulting in a three- instruction packing and dispatching, adding new cycle schedule. The bundling phase could attempt to complexity to resource management. In fact, such new reorder instructions beyond the current cycle with constraints are not unique to EPIC. Modern processors sophistication similar to instruction scheduling. This Proceedings of the 12th International Conference on Parallel Architectures and Compilation Techniques (PACT’03) 1089-795X/03 $17.00 © 2003 IEEE
  2. 2. ld a = [x] {mii: ld a = [x] 2. Background add b = y, e add b = y, e ld y = [f] ;; // can’t fit add x = h, i ;;} 2.1 EPIC and terminology ld c = [g] {mmi: ld y = [f] add x = h, I ld c = [g] EPIC [11] uses wide instruction words as in the Very add d = j, k ;; add d = j, k ;;} Long Instruction Word (VLIW) architecture. There are four functional unit types – M (memory), I (integer), F (a) Decoupled scheduling (b) Integrated scheduling (floating point), and B (branch) on IPF. Each instruction also has an instruction type – M, I, A, F, B, and L. The Figure 1. Decoupled vs. integrated template instruction type specifies the functional unit type where selection. an instruction can be executed, where instruction type A (i.e., ALU instructions) can be dispatched to functional would however defeat the purpose of a decoupled units of either type M or I, and instruction type L approach to separate instruction scheduling from bundling consumes one I and one F units. Instructions are encoded for simplicity. In contrast, if template selection is into bundles where each bundle contains three instructions integrated into the resource management of an instruction with a specific instruction template. Each instruction scheduler, the optimal scheduling can be achieved using occupies one slot in a bundle. A template specifies the two templates (MII and MMI) in two respective cycles as functional unit type for each contained instruction. There shown in Figure 1(b). are 12 basic templates, such as MII, MMI, MFI, MIB, etc. Instruction scheduling is already one of the most A stop bit dictates that the instructions before and after complex phases in an optimizing compiler. Adding in the the stop bit are to be executed at different cycles. Each modeling of instruction templates makes it an even more challenging task. This is further complicated by the basic template type has two versions: one with a stop bit after the third slot and one without. Two of the basic instruction dispersal rules that govern the dispatching of templates, MI_I and M_MI, have a stop bit in the middle an instruction sequence onto execution units at each of a bundle. We call the two compressed templates cycle, the compressed templates for packing instructions because they allow the packing of instructions from from different cycles, the one-to-many mapping different cycles into smaller code size. On IPF, flow and possibility from instructions to functional units, etc. output register dependences are generally disallowed In this work, we propose an extended finite-state (with a few exceptions) within a cycle, but register anti- automaton (FSA) to model all the resource constraints dependences are generally allowed. during instruction scheduling. Each state represents the Each implementation of the EPIC architecture has its currently occupied functional units of a cycle and is own micro-architectural features. For example, the augmented with instruction templates and dispatching information. The scheduling of an instruction triggers the Itanium processor [12] can issue and execute up to six instructions (two bundles) per cycle. It has a total of 9 transition of states. Our extended FSA successfully functional units (FU): 2 M-units (M0 and M1), 2 I-units models the new notion of instruction templates and the set (I0 and I1), 2 F-units (F0 and F1), and 3 B-units (B0, B1, of instructions dispersal rules on the EPIC architecture B2). Functional units under the same type may be with both compilation time and space efficiency. Our asymmetric, requiring certain instructions to be executed experimental results show that modeling these additional only to a particular FU of a FU type. Each processor resource constraints is crucial toward achieving high generation may also have different instruction latencies performance on Itanium. We also encapsulated the and execution-pipeline bypasses, resulting in varying modeling and management of hardware resources in a latencies between the same pair of dependent instructions micro-level scheduler to allow easy migration to future when they are dispatched to different FUs. Each processor implementations of the EPIC architecture or any future generation has its own set of instruction dispersal rules processors with similar resource constraints. In the rest of the paper, Section 2 provides that describes how each instruction is dispersed to a FU in an instruction sequence. Depending on the bundle background information and definitions of terminology. location (the first or second in a cycle) and slot location in Section 3 details the functional-unit based finite-state an instruction fetch cycle, the same instruction may be automaton and its construction. Section 4 discusses dispersed to different FUs. How one instruction is ordered instruction scheduling with an integrated modeling of all or aligned could force another instruction intended for the resource constraints based on the FSA. Section 5 presents same cycle to be stalled to a later cycle due to conflict in the experimental results that compare our integrated critical FUs. On Itanium, in a cycle started with an MII approach with decoupled approaches. Section 6 discusses bundle, the first I instruction always goes to the I0 unit. If the related work, and Section 7 concludes this paper. the second I instruction can be executed only on I0, which is already taken, it will be forced into the next cycle. A Proceedings of the 12th International Conference on Parallel Architectures and Compilation Techniques (PACT’03) 1089-795X/03 $17.00 © 2003 IEEE
  3. 3. detailed description of all of these micro-architectural features for the Itanium processor can be found in [12]. 0x01 0x1DC 2.2 High- and micro-level instruction scheduling M0 M1 I0 0x00 0x02 0x06 Our integrated instruction scheduler divides the task 0x19D I0 I1 of instruction scheduling into two – the high-level 0x0E B2 0x04 instruction scheduling and the micro-level scheduling. F0 The high-level instruction scheduling determines the issue 0x1E 0x100 cycle of each instruction according to dependences and instruction execution latencies. It applies ILP (instruction- level parallelism) enabling transformations such as speculation, sets the scheduling priority of instructions, LegalTA and decides when an instruction is to be executed. The micro-level scheduling takes care of the placement of num_of_TAs instructions and resource management within an TAs MLX MI_I MFI MI_I MLX M LX MLX MFI execution cycle, based on the intra-cycle instruction dependences specified by the high-level scheduler. The MFB M II MFI MIB MFI MFI MFI M LX MLX MIB micro-level scheduling shields the complicated resource management of the EPIC architecture from high-level Figure 2. Functional-unit based FSA. scheduling algorithm, making migrating to a different generation of EPIC processors easier. proper slot locations in a bundle is critical toward Both the high-level and micro-level instruction achieving a high quality schedule. schedulers retrieve machine-specific information from the The importance of template selection intuitively machine description structures prepared off-line by a suggests a template-centric model for managing resources. machine model builder (MM builder). The machine When an instruction is being scheduled, a template- description structures specify the numbers and types of centric model first decides the template assignment for the machine resources (such as machine width, functional current schedule cycle and the slot location for the units, and templates), the instruction latency, the pipeline instruction. The instruction latency and the executing bypass constraints, etc. The functional-unit based FSA is functional unit of the instruction are then derived from the also part of machine description structures built off-line. instruction template and slot location assigned per The machine description structures become part of the instruction dispersal rules. All possible template static data in the compiler executable after the compiler is assignments are enumerated dynamically at each built. The MM builder constructs the machine description scheduling attempt to select the template and slot. from a published parameter file [13] that describes the To improve the compile-time overhead in dynamic micro-architecture details of an Itanium processor. template-assignments enumeration, one could build a template-based FSA off-line to guide the selection of 3. Functional-unit based finite-state template assignments. The template-based FSA would automata model the template assignment and slot usage of an execution cycle. Each state in a template-based FSA Finite state automata have been used in several would record all the possible selections of instruction modern instruction schedulers to model the resource templates under certain slot usage in a single execution contention in execution pipelines [1, 20]. A well-designed cycle. When an instruction was scheduled, an unused slot FSA often results in a simple and compact S would be picked for the instruction and the FSA would implementation and exhibits better efficiency in both transit to the next state where the slot S becomes taken. space and time. Template assignment would be selected from the set of While the pipeline resource contention of Itanium is templates in the state. Size is one major problem in such a simple to model, the instruction templates and dispersal template-based FSA. For the two-bundle wide Itanium, rules introduce new challenges. The latency between a there are at least 68 possible template assignments in a pair of dependent instructions depends not only on the cycle, after accounting for the availability of functional type of source instruction but also on the functional unit units. The theoretical upper bound on the number of states where it is executed. The bundle template and the slot in a template-based FSA is 268, the size of the power set location in a bundle determine the functional unit of all possible template assignments. Even with assigned to execute an instruction. Hence selecting the aggressive trimming, a template-based FSA still needs instruction template and placing instructions into the dozens of thousand states. Proceedings of the 12th International Conference on Parallel Architectures and Compilation Techniques (PACT’03) 1089-795X/03 $17.00 © 2003 IEEE
  4. 4. To achieve efficiency in both space and time, we take BuildFSA { a functional-unit-centric approach. At the core is a FOREACH FU usage set PV DO { Functional-Unit-based FSA (or FU-FSA in short) that is FOREACH template assignment T with built off-line. Each state in the FU-FSA represents the set at most 2 bundles DO { of functional units that are in use (FU usage set) in a TV = FU usage set of T; schedule cycle. Instructions scheduled into a schedule IF (PV is a subset of TV) { IF (PV is not in FSA) { cycle are treated as a sequence of FU-FSA state Add PV as a new FSA state; transitions. Instruction templates and dispersal rules are } modeled in each state by a list of legal template Add T to FSA[PV].TAs; assignments of the state. A template assignment is legal } for a state if its FU usage set is a superset of the FU usage } set of the state. Only states with at least one legal template IF (PV is in FSA) { assignment are included in the FU-FSA. Sort FSA[PV].TAs according to When an instruction is being scheduled, the micro- priority criteria; } level scheduler looks for a FU P for the instruction that } can lead to a legal transition in the FU-FSA. A state Build FSA transition table; transition is legal if the new FU usage set is a valid FU- } FSA state and at least one template assignment for the new state satisfies the dependence constraints for all Figure 3. Building an FU-FSA for Itanium. instructions currently scheduled in the cycle per the instruction dispersal rules. When there is no intra-cycle possible sequence of transitions of the FU-FSA from the instruction dependence, the legal FU-FSA transition initial state 0x00 to the state 0x1E, following the check is simply verifying the new FU usage set is indeed transition path M1->I0->I1->F0. a state in the FU-FSA. The construction of FU-FSA When instruction scheduling for a cycle has guarantees that at least one legal template assignment completed and it is time to finalize the template selection exists for each state. When there are intra-cycle for the cycle, the list of legal template assignments of the dependences in the schedule cycle, the legal FU-FSA current FU-FSA state is scanned to find a template transition check needs to ensure the existence of at least assignment that can best realize the set of instructions in one template assignment that can lay out instructions in the cycle. One simple approach is to pick the first the required dependence order. This is accomplished by template assignment in the list that satisfies all required scanning the list of legal template assignments of the new constraints. By properly arranging the list of template FU-FSA state. In either case, the final selection of assignments for each state during the FU-FSA template assignment is needed only when scheduling for a construction, we can optimize the template selection to cycle has completed, instead of done at every scheduling minimize code size (or bundle count). A smaller code size attempt. in general leads to better performance due to a reduction The FU-FSA is much more space efficient than the in I-cache misses. For instance, to minimize code size for template-based FSA. The FU-FSA for the nine-FU Itanium, we sort the list of template assignments Itanium has at most 29 states, much smaller than that of a according to the following priorities: template-based FSA. After excluding states with no legal 1. Ascending bundle count. template assignment, the FU-FSA for Itanium contains 2. Putting template assignments with compressed 235 states. Each state has no more than 38 legal template template(s) ahead of full template(s). assignments, while 75% of the states have less than 10 Figure 3 outlines the algorithm for constructing the legal template assignments. Therefore the FU-FSA is very FU-FSA for the two-bundle wide Itanium. It can be easily compact in term of memory usage and is highly scalable extended to generate a FU-FSA for any EPIC processor to a wider machine. that can issue N bundles per cycle. The algorithm Figure 2 illustrates a FU-FSA where the FU usage set enumerates all possible FU usage patterns, represented as in each state is represented as a bit vector. When a FU is a FU usage set PV. For each PV, we scan all possible assigned to an instruction during instruction scheduling, template assignments of up to 2 bundles. If a template the current state transits to a new state by setting the bit assignment T has a FU usage set TV per instruction corresponding to the newly occupied FU. For example, if dispersal rules and TV is a superset of PV, T is a legal the current state is 0x00 and the new instruction occupies template assignment for PV. In this case, PV is added to the M0 unit (bit 0 in the bit vector), the new state will be the set of FU-FSA states. The template assignment T is 0x01. Each state has a structure LegalTA, which contains also added to the list of legal template assignments (TAs) a list of legal template assignments (TAs) for that state for the state PV, that is, FSA[PV]. After all template per instruction dispersal rules. Figure 2 also highlights a assignments for the FU usage set PV have been examined, Proceedings of the 12th International Conference on Parallel Architectures and Compilation Techniques (PACT’03) 1089-795X/03 $17.00 © 2003 IEEE
  5. 5. High-level Instruction Scheduler Micro-level Scheduler Start BB EndBB() Candidate Lis t Yes ignment Finalize temp late ass ignment empty? curCycle s election for the curCycle End BB No AdvanceCycle() Yes Yes Cycle full or Yes empty? curCycle empty? all candidate tried? No Advance cycle No Finalize temp late assignment ignment selection for prevCycle prevCycle Select ne xt candidate, cand, Mark cand fro m the candidate list curCycle prevCycle = curCycle Return Return as tried in NULL curCycle = NULL current cycle IssueOp(cand) No Can cand be iss ued transition Make FSA state transition at the current cycle? operation with cand operation Yes OK? FSA trans ition OK? Co mmit cand to current cycle No No Update candidate list Yes state Co mmit new state Restore original state Restore original state Return SUCCESS SUCCESS Return FAIL Return FAIL Figure 4. Interaction between high-level and micro-level instruction scheduling. the list of legal template assignments for PV is sorted available FU for the candidate instruction and sees according to the priority functions described above. whether the FU results in a legal FU-FSA state transition. Finally the FU-FSA transition table is constructed after all If IssueOp completes successfully, the candidate legal states of FU-FSA are included. instruction is committed to the cycle. If IssueOp is not able to fit the instruction in the current cycle, the 4. Instruction scheduler with integrated instruction scheduler marks the candidate instruction as being tried already. In either case, the scheduler picks resource management another candidate instruction from the candidate list to schedule until the current cycle is full or there is no more With a FU-FSA based micro-level scheduler taking candidate instruction to try. The instruction scheduler then care of the resource management, the instruction closes the current cycle and advances to the next cycle. scheduler can focus on high-level scheduling decision. The instruction scheduler now needs to decide when Figure 4 highlights the interaction between the high-level to finalize the template assignment for each cycle. One instruction scheduler and the micro-level scheduler. On alternative is to finalize the template assignment on-the- the left-hand side is the flow of a typical instruction fly as soon as scheduling for a cycle is completed (the 1- scheduler. The right-hand side shows the functions done cycle template selection heuristic). The template selection in the micro-level scheduler. algorithm looks at the one-cycle window in making The instruction scheduler repeatedly picks the best template assignment. Or one may defer the template candidate from a list of instructions that are ready for assignment until the whole schedule region is completely execution at the current cycle. It then consults the micro- scheduled. Selecting the template assignments for several level scheduler through the IssueOp function to check for cycles at once allow better packing of instructions in resource availability. The IssueOp function determines adjacent cycles by exploiting compressed templates. whether there is a FU available for the candidate However, it requires extra compilation time and a larger instruction and whether there exists a legal template space for maintaining the states of several cycles. assignment that satisfies instruction dependence Our instruction scheduler employs a 2-cycle template constraints if exist. Using the FU-FSA, it simply picks an selection heuristic that is able to utilize compressed templates for better instruction packing while incurs Proceedings of the 12th International Conference on Parallel Architectures and Compilation Techniques (PACT’03) 1089-795X/03 $17.00 © 2003 IEEE
  6. 6. IssueOp(op, cycle) { IssueOp function, unoccupied FUs are first selected for funcUnits= FUs op can be issued to; the new instruction op, as shown in the first FOREACH freeUnits = unoccupied FUs in cycle; loop over the candidate FUs. When a tentative FU is // Try available FUs first. selected for op, the cycle is updated to reflect the candidateUnits = funcUnits & freeUnits; assignment. The new FU-FSA state is checked to make FOREACH FU in candidateUnits DO { sure it is a legal state. Furthermore, if there are Record op issued to FU in cycle; dependences among instructions within the cycle, the list state = getFSAState(cycle); IF (state is valid) { of legal template assignments (TAs) for the new state IF (intra-cycle dependence in cycle) { must be examined to ensure at least one legal template FOREACH ta in FSA[state].TAs DO { assignment exists for the required instruction sequence in IF (ChkCycleDep(cycle,ta)==TRUE) RETURN SUCCESS; the cycle. The ChkCycleDep function performs the } dependence check given a template assignment and the } ELSE RETURN SUCCESS; instructions scheduled in the cycle with their FU } assignments. Back out op from FU in cycle; } If op is not able to use any of the unoccupied FUs, occupied but valid FUs for op are tried next. IssueOp will // Try permuting FU assignments. re-arrange the FU assignments for instructions already candidateUnits = funcUnits & ~freeUnits; scheduled in the current cycle to exploit the best resource FOREACH FU in candidateUnits DO { IF (FU is locked) CONTINUE; usage. It involves backing out the FU assignment for one old_op = cycle->op_in_FU(FU); or more instructions and re-arranges the mapping of Back out old_op from FU in cycle; instructions to FUs. The second FOREACH loop over the Issue and lock op to FU in cycle; IF (IssueOp(old_op, cycle)== TRUE) candidate FUs performs this FU re-mapping. A FU RETURN SUCCESS; locking mechanism avoids repeating previously tried Back out op from FU in cycle; combinations to ensure termination of the algorithm. Record old_op issued to FU in cycle; Heuristics that give higher priority to the most } RETURN FAIL; constrained instructions can be applied to reduce the } search space during FU re-mapping. Figure 5. Pseudo code for IssueOp using FU- 4.1 Software pipelining using FU-FSA FSA. The FU-FSA model can be easily integrated into a minimal compilation time and space overhead. Instead of software-pipelining scheduler as well. The FU-FSA-based finalizing the template assignment as soon as the micro-level scheduler works on cycle-level resource scheduling of a cycle is done, the template assignment is management. It relies on the high-level scheduler to selected with a one-cycle delay to give a window of two provide dependence information (both intra- and inter- schedule cycles for template selection. Only the states of cycle) among instructions. For illustration purpose, let us two cycles need to be maintained during instruction assume that the high-level scheduler for software scheduling, namely, the previous cycle (prevCycle) and pipelining is a modulo scheduler. The modulo scheduler the current cycle (curCycle). When the high-level would model the modulo resource reservation table as N scheduler advances a cycle, the AdvanceCycle function in consecutive scheduling cycles in the FU-FSA-based the micro-level scheduler is invoked to finalize the template assignment for the previous cycle. By looking at micro-scheduler, where N is the initiation interval of the pipelined schedule under construction. When querying both previous and current cycles when selecting the final template assignment of the previous cycle, it allows the micro-level scheduler for resource availability at a utilization of compressed templates. It results in a good schedule cycle C, the modulo scheduler will send the balance between the quality of generated code and the query to the schedule cycle (C mod N) in the micro-level space and time efficiency of the instruction scheduler. scheduler. The modulo scheduler also provides the micro- Once scheduling for the basic block is completed, the level scheduler information on intra-modulo-cycle EndBB function in the micro-scheduler is called to instruction dependences that account for both loop- finalize the template assignment of both the previous and independent and loop-carried dependences. The final current cycles. template assignments for all the N schedule cycles will be considered and selected at once after a final schedule is The pseudo code in Figure 5 illustrates a simplified implementation of IssueOp using the FU-FSA. Inside the constructed by the modulo scheduler. Proceedings of the 12th International Conference on Parallel Architectures and Compilation Techniques (PACT’03) 1089-795X/03 $17.00 © 2003 IEEE
  7. 7. 1.20 1.3 1.2 1.10 Code Size Reduction Ratio 1.1 1.00 BASE-2 BASE-2 1.0 Speedup BASE-1 BASE-1 0.90 FUFSA-2 FUFSA-2 0.9 FUFSA-1 FUFSA-1 0.80 0.8 0.70 0.7 0.60 0.6 r x p n f r 2 ip k c cf G ty vp ol se rte m ip ga eo gc r x p n f er p2 ip gz m AV k c cf af G tw ty vp ol rte m ga eo bz lb r gc vo m AV cr gz rs af pa tw i r rl b bz vo cr pe pa pe Benchmarks Benchma rks Figure 6. CPU cycles speedup over BASE-2. Figure 7. Code Size with respect to BASE-2. instruction scheduler and heuristics. In the BASE 5. Experimental results configuration, the instruction scheduler performs scheduling based on instruction dependences, instruction The proposed instruction scheduling integrated with latency, pipeline bypass constraints, issue width, and the FU-FSA-based resource management for the EPIC functional unit availability. But instruction dispersal rules architecture has been fully implemented in the EPIC Open and templates are only taken into account during a Research Compiler (ORC) [19]. We compare our subsequent, independent bundling phase that is dedicated integrated approach with an approach of decoupled to pack instructions under templates. The independent instruction scheduling and template selection in terms of bundling phase invoked after the local scheduling uses the run-time and compilation-time performance. same FU-FSA-based machine model and micro-level ORC includes advanced program optimizations, such scheduler in much the same way as in FUFSA. The as inter-procedural analysis and optimizations, loop-nest bundling phase is not allowed to reorder instructions transformations, machine-independent optimizations, and across the cycle boundary marked by the upstream profile-guided optimizations and scheduling. The global schedulers. instruction scheduling reorders instructions across basic In the FUFSA configuration, the instruction blocks. There has been a large amount of research work scheduler incorporates the FU-FSA-based resource done on instruction scheduler [2,3,8,9,15,16,17,22]. Our management that accounts for instruction latency, pipeline global instruction scheduler uses a forward, cycle bypass constraints, issue width, types of FUs, templates, scheduling algorithm based on [2]. But it performs on the and dispersal rules. Instructions are packed under scope of single-entry-multiple-exit regions, which contain templates on-the-fly when instructions are scheduled multiple basic blocks with internal control flow transfers. without a separate bundling phase. The enhanced cost function is based on the path lengths For each of the BASE and FUFSA configurations, we (to the last cycle) weighted by the execution frequency in collected data on two bundling heuristics. The first a global dependence DAG built for the scheduling region. heuristic (1-cycle template selection) selects the template The global instruction scheduling also utilizes special for instructions in a cycle as soon as scheduling to the EPIC architectural features and performs control and data cycle is done. It effectively ignores the two compressed speculation to move load instructions across branches and templates, MI_I and M_MI. These configurations are potential aliasing stores. In case there are spills from called BASE-1 and FUFSA-1 respectively. The second register allocation, the local scheduling is invoked for the heuristic (2-cycle template selection) defers the template affected basic blocks. The local scheduling operates on a selection of a completed cycle until the next schedule basic block scope without speculation. Both the global cycle is done, enabling the use of compressed templates to and local instruction scheduling incorporate our FU-FSA reduce code size. We called these configurations BASE-2 based resource management. and FUFSA-2. Note FUFSA-2 is the target approach of We compare two levels of integration in resource this work as described in the preceding sections. management and instruction scheduling for Itanium We measured performance using all 12 SPECint2000 processors, namely, the decoupled bundling approach benchmark programs with full reference input sets. These (BASE) and our integrated FU-FSA resource modeling benchmark programs are compiled using ORC with the approach (FUFSA). Both BASE and FUFSA use the same peak performance options, which include inter-procedural optimizations, function inlining, profile feedback, and Proceedings of the 12th International Conference on Parallel Architectures and Compilation Techniques (PACT’03) 1089-795X/03 $17.00 © 2003 IEEE
  8. 8. UNSTALLED_PIPELINE_CYCLE TAKEN_BRANCH_CYCLE 1.05 RSE_ACTIVE_CYCLE DEPENDENCY_SCOREBOARD_CYCLE DATA_ACCESS_CYCLES 1.00 1.2 PIPELINE_BACKEND_FLUSH_CYCLE ISSUE_LIMIT_CYCLE Cycle distribution normalized to BASE-2 INST_ACCESS_CYCLE 0.95 1.0 0.90 Reduction Ratio BASE-2 0.8 0.85 BASE-1 0.80 FUFSA-2 0.6 FUFSA-1 0.75 0.4 ` 0.70 0.2 0.65 0.60 0.0 FUFSA-2 FUFSA-1 FUFSA-2 FUFSA-1 FUFSA-2 FUFSA-1 FUFSA-2 FUFSA-1 r BASE-2 BASE-1 BASE-2 BASE-1 BASE-2 BASE-1 BASE-2 BASE-1 x p n f er k 2 ip ty c cf G vp ol rt e m ip ga eo gc gz m af AV rs tw rl b bz vo cr pa pe Benchma rks crafty eon bzip2 perlbmk Benchmark Configurations Figure 9. Scheduling time with respect to Figure 8. Cycle breakdown for crafty, eon, BASE-2. bzip2 and perlbmk. have been normalized with respect to the total cycles of BASE-2. extensive intra-procedural and Itanium-specific As shown in Figure 8, FUFSA mainly reduces cycles optimizations. The generated codes are run and measured in two stall categories – ISSUE_LIMIT_CYCLE and on a 733 MHz Itanium Workstation with 2 MB L3 cache INST_ACCESS_CYCLE. The ISSUE_LIMIT_CYCLE and 1 GB memory, running RedHat 7.1 version of Linux. counts all cycle breaks that are due to the explicit Figure 6 shows the speedup in CPU cycles of all insertion of stop bit in the generated code or the implicit configurations over BASE-2. FUFSA-2 outperforms insertion of stop bit by the processor when resources are BASE-2 on all benchmarks, with an average of 4.5% oversubscribed. The BASE configuration does not speedup. Crafty and Eon show an impressive speedup of account for the constraints of instruction templates and over 12%. We also observed that in general the 2-cycle dispersal rules during instruction scheduling. Thus it is template selection heuristic performs better than the 1- more aggressive in scheduling instructions into certain cycle template selection heuristic. On average, BASE-2 cycles even though there is no instruction template to gets a 1.8% speedup over BASE-1 and FUFSA-2 obtains pack them into a single cycle. The independent bundling a 2.26% speedup over FUFSA-1. phase then needs to split these cycles to fit instruction Figure 7 compares the code size of the four templates. The FUFSA configuration takes into account configurations by measuring the size of the text sections the effect of instruction templates and dispersal rules in the generated binaries. Note that a shorter bar in Figure during scheduling, avoiding the template selection 7 indicates a smaller code size. It is clear that FUFSA-2 is deficiency. The FUFSA configurations thus have fewer able to generate code that is smaller than BASE-2 does. cycles in the ISSUE_LIMIT_CYCLE categories. On the The static code size from FUFSA-2 is reduced by 9.32% four benchmarks, FUFSA-2 gets 2-4% speedup over with respect to BASE-2. Furthermore we are able to BASE-2 and FUFSA-1 obtains 2-6% speedup over reduce static code size by about 10% when compressed BASE-1 due to the reduction of ISSUE_LIMIT_CYCLE. templates are used to pack instructions, as observed from FUFSA also shows significant cycle reduction over the reduction achieved by BASE-2 over BASE-1 and BASE in the INST_ACCESS_CYCLE stall category, FUFSA-2 over FUFSA-1. which counts cycles lost to I-cache or ITLB misses. To further understand how FUFSA improves FUFSA-2 gains 12% on crafty and 9.5% on eon over performance, we use the PFMON (version 0.06) tool to BASE-2 in INST_ACCESS_CYCLE. The reduction in I- measure dynamic execution statistics through the Itanium cache and ITLB misses can be attributed to the fact that performance monitors. Due to space limitation, we select the code generated by FUFSA is more compact than the two programs, crafty and eon, which benefit the most code from BASE. For benchmarks that spend significant from the FUFSA approach, and two other programs, execution cycles waiting for I-cache and ITLB misses, bzip2 and perlbmk, which receive only small such as crafty and eon, FUFSA is able to achieve higher improvements from the FUFSA approach. Figure 8 shows speedup over BASE by reducing the impact from I-cache the distribution of dynamic cycles under the Itanium stall and ITLB misses. On the other hand, benchmarks that categories for each of the four programs. Readers are have fewer cycles in the INST_ACCESS_CYCLE referred to [12] for the full description of each stall category, such as bzip2 and perlbmk, get a lower speedup category. The cycle distributions for each configuration from FUFSA over BASE. Proceedings of the 12th International Conference on Parallel Architectures and Compilation Techniques (PACT’03) 1089-795X/03 $17.00 © 2003 IEEE