Design and Evaluation of Compiler Algorithms for Pre-Execution

Design and Evaluation of Compiler Algorithms for Pre-Execution

Appears in Proceedings of the Tenth International Conference on Architectural Support for Programming Languages and Operating Systems(ASPLOS-X), October 2002, San Jose, CA. Design and Evaluation of Compiler Algorithms for Pre-Execution Dongkeun Kim and Donald Yeung Department of Electrical and Computer Engineering Institute for Advanced Computer Studies University of Maryland at College Park {dongkeun, yeung}@eng.umd.edu ABSTRACT these techniques are ineffective for irregular memory access Pre-execution is a promising latency tolerance technique patterns common in many important applications. Recently, that uses one or more helper threads running in spare hard- a more general latency tolerance technique has been pro- ware contexts ahead of the main computation to trigger posed, called pre-execution [1, 6, 7, 11, 12, 20, 23]. Pre- long-latency memory operations early, hence absorbing their execution uses idle execution resources, for example spare latency on behalf of the main computation. This paper in- hardware contexts in a simultaneous multithreading (SMT) vestigates a source-to-source C compiler for extracting pre- processor [22], to run one or more helper threads in front execution thread code automatically, thus relieving the pro- of the main computation. Such pre-execution threads are grammer or hardware from this onerous task. At the heart purely speculative, and their instructions are never commit- of our compiler are three algorithms. First, program slic- ted into the main computation. Instead, the pre-execution ing removes non-critical code for computing cache-missing threads run code designed to trigger cache misses. As long memory references, reducing pre-execution overhead. Sec- as the pre-execution threads execute far enough in front of ond, prefetch conversion replaces blocking memory refer- the main thread, they effectively hide the latency of the ences with non-blocking prefetch instructions to minimize cache misses so that the main thread experiences signifi- pre-execution thread stalls. Finally, threading scheme se- cantly fewer memory stalls. lection chooses the best scheme for initiating pre-execution A critical component of pre-execution is the construc- threads, speculatively parallelizing loops to generate thread- tion of the pre-execution thread code, a task that can be level parallelism when necessary for latency tolerance. We performed either in software or in hardware. Software- prototyped our algorithms using the Stanford University In- controlled pre-execution extracts code for pre-execution from termediate Format (SUIF) framework and a publicly avail- source code [12] or compiled binaries [7, 11, 20, 23] using off- able program slicer, called Unravel [13], and we evaluated line analysis techniques. This approach reduces hardware our compiler on a detailed architectural simulator of an SMT complexity since the hardware is not involved in thread con- processor. Our results show compiler-based pre-execution struction. In addition, off-line analysis can examine large improves the performance of 9 out of 13 applications, re- regions of code, and can exploit information about pro- ducing execution time by 22.7%. Across all 13 applications, gram structure to aid in constructing effective pre-execution our technique delivers an average speedup of 17.0%. These threads. In contrast, hardware-controlled pre-execution [1, performance gains are achieved fully automatically on con- 6] extracts code for pre-execution from dynamic instruction ventional SMT hardware, with only minimal modifications traces using trace-processing hardware. This approach is to support pre-execution threads. transparent, requiring no programmer or compiler interven- tion, and can examine runtime information in an on-line fashion. 1. INTRODUCTION Despite significant interest in pre-execution recently, there Processor performance continues to be limited by long- has been very little work on compiler support in this area. latency memory operations. In the past, researchers have Without a compiler, the applicability of software-controlled studied prefetching [5, 16] to tolerate memory latency, but pre-execution is limited. Generating pre-execution thread This research was supported in part by NSF Computer Sys- code is labor intensive and prone to human error. Even tems Architecture grant CCR-0093110, and in part by NSF if programmers are willing to create pre-execution code by CAREER Award CCR-0000988. hand, doing so would reduce code maintainability since mod- ifications to application code would require rewriting pre- execution code as well. Consequently, manual instrumenta- tion of software-controlled pre-execution is viable only when Permission to make digital or hard copies of all or part of this work for a large programming effort can be justified. In contrast, personal or classroom use is granted without fee provided that copies are compiler support would enable pre-execution for all pro- not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to grams. Pre-execution compilers can also potentially bene- republish, to post on servers or to redistribute to lists, requires prior specific fit hardware-controlled pre-execution by providing compile- permission and/or a fee. time information to assist hardware thread construction, re- ASPLOS X 10/02 San Jose, CA, USA ducing hardware complexity. Copyright 2002 ACM 1-58113-574-2/02/0010 ...$5.00. Thread Main Program Code Pre-Execution Code Initiation void foo(. .) { Scheme doall(clone_pre_exec, . .); void clone_pre_exec(. .) { for (i = start; i <= end; i++) { for (i = start; i <= end; i++) { . = B[A[i]]; . = B[A[i]]; bar(i, . .); Clone clone_bar(i, . .); Pre-Execution } } Apply Program Slicing Region } kill(); and Prefetch Conversion } Program void clone_bar(i, . .); Slicing Analysis void bar(i, . .) { . = C[A[i]]; . = C[A[i]]; } } Figure 1: Overview of compiler-based pre-execution. Profiling identifies cache-missing memory references (bold faced code) and a potential pre-execution region (shaded code). Program slicing analysis identifies non-critical code and opportunities for prefetch conversion. Loop analysis selects a thread initiation scheme. Finally, pre-execution thread source code is generated by cloning and applying optimizations. This paper presents the design, implementation, and eval- ory reference, and the shaded loop defines a potential pre- uation of a source-to-source C compiler for pre-execution. execution region for the reference. Notice a pre-execution To our knowledge, this is the first source-level compiler to region spans multiple procedures whenever loops call pro- automate pre-execution. Guided by profile information, our cedures containing cache misses. In Figure 1, the memory compiler extracts pre-execution thread code from applica- reference C[A[i]] in the bar procedure also cache misses tion code via static analysis. At the heart of our compiler frequently, and is included in the pre-execution region since are three algorithms: program slicing, prefetch conversion, bar is called from the same loop. and threading scheme selection. These algorithms enhance After cache-miss and loop iteration count profiles have the ability of the pre-execution threads to get ahead of the been acquired, our compiler performs a series of analyses. main thread, thus triggering cache misses sufficiently early First, program slicing identifies non-critical code for com- to overlap their latency. puting the cache-missing memory references. Program slic- To demonstrate their feasibility, we prototype our algo- ing also identifies cache-missing memory references that can rithms using the Stanford University Intermediate Format be converted into prefetches. Second, our compiler deter- (SUIF) framework, and a publicly available program slicer, mines the set of pre-execution regions to instrument, and called Unravel. Using our prototype, we conduct an ex- then selects a pre-execution thread initiation scheme for each perimental evaluation of compiler-based pre-execution on a region. We propose three schemes: Serial, DoAll,and detailed architectural simulator of an SMT processor. Our DoAcross. The last two schemes use speculative loop par- results show compiler-based pre-execution improves the per- allelization to initiate multiple pre-execution threads. Our formance of 9 out of 13 applications, providing a 22.7% re- compiler performs induction variable analysis, and uses pro- duction in execution time on average. Across all 13 applica- gram slicing information and loop iteration count profiles to tions, our technique delivers an average speedup of 17.0%. select the best scheme for each pre-execution region. These performance gains are achieved fully automatically Finally, pre-execution source code is generated by cloning on conventional SMT hardware, with only minimal modifi- each pre-execution region, including both the loop and called cations to support pre-execution threads. procedures. Program slicing and prefetch conversion opti- The rest of this paper is organized as follows. Section 2 mizations are applied to the cloned code, and thread initia- presents an overview of our compiler-based pre-execution tion code is inserted into the main program according to the technique. Next, Sections 3 and 4 present our algorithms selected thread initiation scheme. Figure 1 illustrates these for generating pre-execution code. Then, Section 5 discusses steps. several implementation issues, and Section 6 presents our results.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    12 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us