Full text
Per-Task Energy Metering and Accounting in the Multicore Era Qixiao Liu Advisor Miquel Moret´o Planas Co-Advisors Jaume Abella Ferrer Francisco J. Cazorla Almeida Mateo Valero Cort´es Mem`oria del Projecte de Tesi Programa de Doctorat d’Arquitectura i Tecnologia de Computadors Departament d’Arquitectura de Computadors Universitat Polit`ecnica de Catalunya March 2016
Abstract Chip multi-core processors (CMPs) are the preferred processing platform across different domains such as data centers, real-time systems and mobile devices. In all those domains, energy is arguably the most expensive resource in a computing system, in particular with fastest growth. Therefore, measuring the energy usage draws vast attention. Current studies mostly focus on obtaining finer-granularity energy measurement, such as measuring power in smaller time intervals, distributing energy to hardware components or software components. Such studies focus on scenarios where system energy is measured, and under the assumption that only one program is running in the system. So far, there is no hardware-level mechanism proposed to distribute the system energy to multiple running programs in a resource sharing multi-core system in an exact way. In this thesis, for the first time, we formalize the need for per-task energy measurement in multicore by establishing a two-fold concept: per-task energy metering and sensible energy accounting. The former, for a task running in a multi-core system, provides estimates on the actual energy consumption corresponding to its resource usage. The latter provides estimates on the energy the task would have consumed running in isolation with a given fraction of the shared resources. Accurately determining the energy consumed by each task in a system will become of prominent importance in future multi-core based systems as it offers several benefits including (i) better application energy/performance optimizations, (ii) improved energyaware task scheduling and (iii) energy-aware billing in data centers. We have shown how these two concepts can be applied to the main components of a computing system: the processor and the memory system. In each, we have proposed models to ideally meter and account the energy. And by trading off the hardware cost with the estimation accuracy, we have obtained implementable and affordable mechanisms with high accuracy. We have also shown how these techniques can be applied in different scenarios, such as, to detect significant energy usage variations for any particular task and to develop more energy efficient scheduling policy for the multi-core system. i
Acknowledgment First and foremost, I want to thank my advisers, Dr. Miquel Moret´o, Dr. Jaume Abella, Dr. Francisco J. Cazorla and Professor Mateo Valero. They have taught me how highquality research in the computer architecture field is done. It has been a great honor to be supervised by them and I sincerely appreciate their contributions of time, ideas and guidance to make my Ph.D experience stimulating and enjoyable. Their joys and enthusiasms for the research are contagious and motivational for me, especially during the tough times of the study. They have also provided me with excellent examples as successful researchers and mentors. The members of the Computer Architecture and Operating System interface (CAOS) group have contributed immensely to my research and life here at Barcelona. The group has been a source of friendships as well as good advices. I’m especially grateful for Dr. Carlos Luque, whose work is one of the cornerstone of my thesis: the performance accounting. He vigorously shared his visions and experiences with me, and helped me to get over difficulties. I would like to thank Dr. Petar Radojkovic, from whom I have learned the successful and encouraging researching experiences. I want to thank Pradip Bose, Alper Buyuktosunoglu, Ramon Bertran and Victor Jimenez from IBM T.J Watson in New York, where I have spent five months for an internship, for their immense help in the research and life. It has been incentive to work with them with joy. They have taught me numerous knowledges and experiences on research with excellent mentoring skills. I am also grateful for Professor Daniel A. Jimenez from Texas A&M university. He has played an important role in the work we have collaborated together, I’m greatly influenced by his meticulous attitude and profound knowledge. In regards to the work here in Barcelona Supercomputing Center, I thank Francesc Subirada. With Mateo, they have spent numerous efforts in building this world class supercomputer and a fabulous workplace for researchers. It has been an great honor to stand by them exhibiting the MareNostrum, the stunning artifact to the visitors from my home country, China. i
ii ACKNOWLEDGMENT In particular, this work has been partially supported by the Spanish Ministry of Science and Innovation under grant TIN2012-34557; the HiPEAC Network of Excellence, by the European Research Council under the European Union’s 7th FP, ERC Grant Agreement n. 321253; and by a joint study agreement between IBM and BSC-CNS (number W1361154). I have also been funded by the Chinese Scholarship Council under grant 2010608015. At last, I would like to thank my parents for all their love, encouragements and supports. With all of that, I can pursue this Ph.D. Qixiao Liu March, 2016
Contents Abstract i Acknowledgment i Contents i 1 Introduction 1 1.1 ThesisContribution ............................... 6 1.2 ThesisStructure ................................. 9 2 Related Work 11 2.1 Energy Consumption in Computing Systems, A Taxonomy . . . . . . . . . 12 2.2 Computing System Power Measurement . . . . . . . . . . . . . . . . . . . . 14 2.3 Energy and Power Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.4 Summary ..................................... 20 3 Experimental Framework 21 3.1 SimulationFramework.............................. 21 3.2 Performance Simulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.3 PowerSimulators................................. 26 3.4 Benchmarks.................................... 28 3.5 Metrics ...................................... 34 4 Per-task Energy Metering for The Processor 37 4.1 Introduction.................................... 37 4.2 Ideal PTEM for the Multicore: LLC and Core . . . . . . . . . . . . . . . . . 39 4.3 An Implementable PTEM Approach . . . . . . . . . . . . . . . . . . . . . . 43 4.4 Evaluation..................................... 48 i
ii CONTENTS 4.5 CaseStudy .................................... 57 4.6 Summary ..................................... 62 5 Per-task Energy Metering for the DRAM Memory System 65 5.1 Introduction.................................... 65 5.2 DRAM Memory System Fundamentals . . . . . . . . . . . . . . . . . . . . . 67 5.3 Idealized PTEM for DRAM Memory . . . . . . . . . . . . . . . . . . . . . . 70 5.4 DReAM, an Implementable Approach . . . . . . . . . . . . . . . . . . . . . 77 5.5 Evaluation..................................... 79 5.6 CaseStudy .................................... 84 5.7 Summary ..................................... 92 6 Sensible Energy Accounting for the Processor 93 6.1 Introduction.................................... 93 6.2 Background.................................... 95 6.3 TheoreticalSEA ................................. 97 6.4 SEA for Multicores: LLC and Core . . . . . . . . . . . . . . . . . . . . . . . 101 6.5 Evaluation.....................................111 6.6 CaseStudy ....................................116 6.7 Summary .....................................120 7 Sensible Energy Accounting for the DRAM Memory System 121 7.1 Introduction....................................121 7.2 Background....................................125 7.3 Ideal SEA for DRAM Memory System . . . . . . . . . . . . . . . . . . . . . 126 7.4 SADEA, an Implementable Approach of SEA . . . . . . . . . . . . . . . . . 129 7.5 Evaluation.....................................135 7.6 Summary .....................................139 8 Conclusion and Future Directions 141 8.1 ThesisConclusion ................................141 8.2 Future Works and Impact . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 9 Publications 147 Bibliography 149
1 Introduction Energy is becoming one of the most, if not the most, expensive resource in computing systems. This trend will continue as the price of energy continues to rise, increasing in recent years by up to 70% in several European countries [28]. •In a large-scale computing facility (LSCF), energy for computing already accounts for 20% of the total cost of ownership [8,39]. In addition, the Power Usage Effectiveness (PUE) is still above 2.0 in most LSCFs in the year 2015 [24,38]. This metric compares the energy used on the computing facilities with the total energy consumed including other facilities such as power delivery and cooling system: PUE =total energy computing energy . Thus, the energy cost doubles if we consider all the facilities in LSCFs, implying that the total energy-related cost is already in the same order of magnitude as the hardware-related cost (servers), which dominates the cost of ownership. Additionally, while server cost has remained almost constant over successive generations, energy cost is expected to rise [8]. In fact, in terms of power, current facilities consume several megawatts, enough to power small towns [6]. Meanwhile, in terms of energy, worldwide energy consumption attributable to servers and data centers is estimated to be above 200 billion kWh annually in 2010 [63]. •Energy demand is also an issue for home computers. A typical desktop computer may use in the order of 100–200 Watts (the particular figure depends on the type of computer and peripherals) whereas laptops fit in a lower range (60–100 Watts). The energy cost of running a computer can be computed as W atts×Hours Of Use 1000 × Cost per kWh. Assuming that a computer runs for 15,000 hours during its lifetime 1
8CHAPTER 1. INTRODUCTION Our view is that, the energy metered to a given task should be proportional to its resource usage. This includes the number and type of accesses to the different resources and, for stateful resources (e.g., Branch Target Buffer, caches and Translation Look aside Buffer (TLB)) the fraction of the space occupied by the task. The accuracy of per-task energy metering depends on the characteristics of the hardware resources used and the hardware support enabled for energy metering. Note that when we have per thread energy metering, energy for multi-threaded applications simply consists in adding up the energy consumed by each of its constituent threads. 1.1.2 Sensible Energy Accounting (SEA) PTEM provides a way to measure the real energy a task consumes in the computer. However, the energy metered to a task in a given system, despite it has the same input set, varies depending on other tasks that are running at the same time (co-runners). Apart from being able to measure the energy consumed by a task, we also aim at maintaining the same Principle of Accounting that holds for execution time (a.k.a. CPU accounting) [76]: the energy accounted to a task should be independent from the workload in which this task runs. Several runs of the same task with the same input should – theoretically – result in the same energy consumption and hence the same charge in a data center. Therefore, we propose Sensible Energy Accounting (SEA) to fairly account a task a constant amount of energy as if it has been assigned a fraction of resources to use in the computer, regardless of the concurrently running tasks. We define SEA formally as follows: Let us assume a workload composed of ntasks T1, T2, . . . , Tnrunning on a processor with mhardware threads (e.g., msingle-threaded cores), SEA consists of estimating, for a given task Ti, the energy that it would have consumed if it had run in isolation with a given fraction of the hardware resources denoted fhr. Thus, SEA does not give the actual energy consumption of a task, but rather an abstraction of the energy consumption that the end-user can rely on to be fair and consistent. The main challenge for SEA is how to compute the energy for any task and any valid fraction of the resources, despite the fact that a particular task may incur different activities in different workloads due to interactions with co-runners, and such variation makes its performance fluctuate. This effect makes energy consumption hard to account since it cannot be extracted directly from the energy measured. Our view is that, accurately accounting the energy to a task for a particular fraction of resources depends on precise estimation of activities and execution time this task should have incurred.
1.2. THESIS STRUCTURE 9 1.1.3 Future Impact of PTEM and SEA We consider both concepts are key to provide clarifications on the per-task energy usage, from the perspective of actual workloads and feasible allocations of resources. We consider that PTEM and SEA can be separately used or combined, but in any case they will have several important applications across different computing domains. We show some cases where PTEM and SEA can apply to: •Selection of appropriate co-runners. Task interaction in hardware shared resources may negatively affect tasks hurting performance and increasing energy requirements. PTEM and SEA can help the OS scheduler or a runtime-based scheduler to decide which tasks must be run and when, thus reducing the total energy profile. •Energy/Performance optimization. While allocating more resources to a program may make it runs faster, it could also increase its power consumption, and vice versa. Thus, the net effect on how the total energy profile relates to the resource allocation is unclear. Accurately measuring the energy consumed in different processor (e.g. number of cores) and software (e.g. scheduling) setups will justify their effectiveness in energy-saving. Sensibly accounting the energy consumed per task would allow finding the optimal setup that leads to the lowest per task energy consumption, and thus the lowest system energy consumption (shown in Section 6.6.2). •Billing in data centers. Data centers charge users for the use of their resources. The fact that costs will be dominated by energy, makes billing systems more and more energy-centric, so that part of the bill is directly dependent on the energy consumed by users’ running jobs. Measuring the energy each task consumes, rather than evenly dividing the cost of energy among running tasks, would allow data centers to accurately account the energy cost. Sensibly accounting the energy each task consumes under a given fraction of resources would give a fair billing upon their energy profile. Such methods can facilitate the energy cost integration in different service models, even with higher abstraction levels such as SaaS and PaaS. Since the execution of each virtual machine instance can be tracked, the energy in that physical node can be metered and accounted using PTEM and SEA. 1.2 Thesis Structure The structure of this thesis is organized as follows:
10 CHAPTER 1. INTRODUCTION •Chapter 2 introduces the state of art of energy/power measuring and profiling techniques in computing systems. We abstract several important concepts to show how our work is different from them, and how we advance this topic from a new perspective. •Chapter 3 introduces the simulation framework we used in this thesis. We give a detailed description of our architecture and power simulator. Also, we have also introduced the benchmark suite and metrics to evaluate our proposals. •Chapter 4 has made a case of accurate PTEM for on-chip resources. We propose an idealized reference model to perform accurate PTEM based on the resource utilization of each task. A simple, yet accurate, implementation of such approach is also proposed. The focus is the main shared hardware resources in current multicore processors, including SMT core and LLC. •Chapter 5 introduces the PTEM model in DRAM memory system and an efficient implementation of such method. A case study, in which the SPEC CPU 2006 benchmarks have been characterized using the proposals is also presented. •Chapter 6 develops the concept of SEA from a theoretical point of view and discusses how it can contribute to different computing domains. Then, a low-overhead hardware mechanism to obtain SEA for on-chip resources in a multicore architecture is presented. •Chapter 7 makes a case of SEA model in the DRAM memory system when one task has been assigned different fraction of resources on the chip. The interactions of memory requests in the memory controller and DRAM devices have been analyzed. A practical and low-overhead implementation is also proposed. •Chapter 8 concludes the work in this thesis and shows directions for future work. •Chapter 9 lists the publication related to this thesis and during the PhD study.
2 Related Work Nowadays, modern microprocessors integrate in the order of billions of transistors on chip and operate at a frequency of several gigahertz. The power wall has already become a major obstacle in satisfying the growing computational needs. The multi-core/multithreaded design paradigms have enabled the growth of throughput performance despite the slowdown in clock speed growth. Nevertheless, power dissipation and current delivery limitation make it hard to keep scaling indefinitely along the dimension of on-chip thread count. Therefore, accurate measurement and profiling of the energy/power consumption is needed so that future systems can optimize the power dissipation to better convert the electrical power into computing power. In this chapter, we show the state of the art in the power/energy consumption measurement and profiling in computing systems. First of all, we introduce the energy consumption taxonomy, based on which, we elaborate the classification to better fit our needs. Then, we review several studies on how to abstract the energy of the devices using different means. In the fields of energy or power profiling, we illustrate works on different categories including: power characterization of computing systems, hardware components power consumption breakdown, and software component energy breakdown. In the context of these related works, we can see how our contributions advance the state of the art in this field. 11
12 CHAPTER 2. RELATED WORK 2.1 Energy Consumption in Computing Systems, A Taxonomy Within a given computing system, energy stands for the source which powers the hardware devices to operate. The standard measurement of energy is Joules, directly reflecting the electricity cost. And power is the rate at which the energy is consumed, and is measured in Watts which corresponds to Joules per second. The distinction between energy and power is key to understand per-task energy measurement in multi-core architectures. For instance, when several tasks run concurrently in a multi-core system with abundant shared resources, the power dissipation of one task is most probably reduced compared with the case when it runs alone in the system. However, the energy consumption incurred by its execution is undetermined because of the – likely – prolonged execution time. In this thesis, we study the energy consumed by tasks when running in resource-sharing multi-core systems, by analyzing the power each task dissipated in time intervals during their execution. In digital Complementary Metal-Oxide-Semiconductor (CMOS) technology, the energy consumption mainly comes from three resources: a) The logic transition that makes the current flow through the transistors. This occurs when the circuit transitions back and forth between the two logic levels. The electrical energy is consumed by the parasitic capacitances and resistance of transistors. b) The short circuit current that flows directly from supply to ground when the n-subnetwork and the p-subnetwork of a CMOS gate both conduct simultaneously. c) The leakage current between the source and drain of transistors. In former studies, they have been commonly categorized into dynamic power and static power [73, 113]. Specifically, dynamic power includes power dissipated by the logic transition and short circuit current, and static power refers to the power dissipated by leakage current. However, such classification, although has been conventionally used to study circuit and system power consumption, does not fit our need to attribute the energy consumption to tasks since we need more precise categories. Therefore, for the sake of clarity, we break down the energy consumed in a computing system into three main components: dynamic active energy,dynamic maintenance energy and leakage energy. These terms are consistently used in this thesis. •Dynamic active energy corresponds to the energy consumed performing those actions needed by the instructions executed, such as the energy used to read a register or to issue an instruction. When considering the energy consumed during a given time interval, we can also express as the dynamic active power, which may vary along
2.1. ENERGY CONSUMPTION IN COMPUTING SYSTEMS, A TAXONOMY 13 time. •Dynamic maintenance energy corresponds to the energy wasted in useless activities not triggered by any particular instruction, for instance, the significant clocking power that is consumed in idle blocks. Similarly, many SRAM arrays such as cache memories precharge some bitlines every cycle in order to speed up accesses. However, such activity is useless if no access occurs [16]. Note that the energy consumed due to an access corresponding to a useless instruction (e.g., a misspeculated instruction) is considered as dynamic active energy despite such activity is useless because the action has been triggered by the instruction under execution. Due to the fact that these useless activities constantly consume energy during the whole system active period, dynamic maintenance energy can also be expressed as dynamic maintenance power in most cases. •Leakage energy corresponds to the energy wasted due to imperfections of the technology used to implement the circuit. Thus, it includes all energy wasted due to undesired leakage current and parasitic current from supply to ground. Leakage energy persists whether a computer is active or idle, since the leakage and parasitic current flow through transistors even when the transistors are turned off as long as they are powered up. Thus, leakage energy consumed in a given time interval can also be expressed as leakage power. Bear in mind that dynamic active and maintenance power are both derived as a superset of logic transition and short circuit current in the CMOS circuit, and they can be summed up to dynamic power. In this sense, our study can be easily aligned with former studies. Breaking down dynamic active and maintenance energy is useful in our context since it avoids mixing the energy consumed due to the activity triggered by the instructions executed and the energy that cannot be attributed to any task, especially if several of them are running. Dynamic maintenance power has been recognized as platform power in some other works [102]. For the studies related to hardware analysis, the focus is mainly on power consumption since it is a direct reflection of the device computation power and sensitive to the thermal capacity. In contrast, for software related studies, the focus is instead on the total energy consumed by the piece of software that is executed. In the following sections, these terminologies are carefully distinguished.
14 CHAPTER 2. RELATED WORK 2.2 Computing System Power Measurement Obtaining power figures of complex, highly-threaded multi-core system is a difficult challenge. The effort invested on this task is large. The most common approaches can be classified as either direct power measurement or indirect power measurement, although some studies have considered a hybrid approach to obtain improved results [43,48]. 2.2.1 Direct Power Measurement Direct hardware-based power measurement consists of measuring the current and supply voltage level on a particular component, for instance, the processor and the memory system. Then the measured values are used to compute the power. Such measurement requires different types of meters, some specifically designed circuits embedded in the platform, and power sensors inside the device. Meters measure the power dissipation of the device in a straightforward way by connecting them between the power supply and the measured component. However, the widely used digital multimeter [55] or AC power meter [109], sample the measured device at a coarse granularity, normally at around 1 Hz. Direct power measurement typically needs specialized device support, as explained in [105]. Nowadays, most of the servers have the service processor designed inside, which is a hardware and software integrated platform that works independently from the processor and the operating system. The service processor uses the power sensors to monitor the power, and voltage and temperature sensors to refine the measurements [43, 48]. The monitored results are read through an interface by the controller to provide the data to the operating system. The information can be used by the software to optimize the performance, power and energy efficiency. Furthermore, such hardware/software support also allows promoting the sampling frequency up to 3kHz [27]. 2.2.2 Indirect Power Measurement Indirect power measurement can be performed on a simulation platform or at runtime inside the operating system. Thus, measurements are less accurate. However indirect power measurement does not need specific hardware support such as the service processor, and can better correlate the power with the performance of the device. Hardware-level power model. In the case of microarchitecture simulation, normally a hardware-level power model is used [65, 91]. As described in section 2.1, the classical
2.2. COMPUTING SYSTEM POWER MEASUREMENT 15 breakdown of energy in CMOS circuits includes dynamic power and static power. For a particular hardware device, or a component in the processor, the power can be derived with the following two formulas: Pdynamic =C·V2 dd ·α·f(2.1) Pstatic =Ileakage ·Vdd (2.2) where Cstands for the load capacitance, Vdd stands for the supply voltage, αrepresents the activity ratio on the hardware device, fis the clock frequency and Ileakage stands for the leakage current of the circuit. Such low level models are arduous to use in architectural studies since the low level details are hard to derive for all components, thus making the estimation inefficient and costly. Wattch and CACTI tradeoff the estimation accuracy with simulation time by flexibly modeling the structure of each component with a general purpose model [16,87]. Such characteristic helps them being pervasively used in research studies. In many cases, these models are compared against approaches using circuit-based mechanisms. Software-based power model. Although the hardware-level models can provide very accurate but time-consuming power information, the online power estimation often relies on the software-based models. Such models use performance statistics supplied by the operating system, where multiple indicators are used to reflect the hardware states and task execution. The selection of indicators is normally based on tuning the estimation by comparing with real system power and the result of hardware-level models [7,11,12,14,36]. In general, these models rely on collecting data from a set of events counters, voltage and temperature sensors, with coefficients derived from an empirical linear regression model. Depending on the system under study and the purpose of the power estimation (e.g., analyzing a hardware component, a process in the operating system or a program phase) different sets of events may be chosen. Note that in the software-based models, the term event may not directly map to the Performance Monitoring Counters (PMCs), but may also be a calculated metric, such as the Instruction Per Cycle (IPC). Power model abstraction. In both cases, when estimating the runtime energy consumption, the power models can be generalized as analytic functions of a set of parameters, where the power consumption incurred by the execution of a program is derived based on their correlations. Therefore, in a system with Jmajor components, each with Ievents count, the runtime power is computed as follows:
16 CHAPTER 2. RELATED WORK Power = J X j=1 βj× SPj×Tj+DPj× Ij X i=1 αi j×ei j (2.3) where SPjand DPjstand for the pre-calculated static power and dynamic power of component j.Tjis the activated time of component jand ei jis the event count obtained for j.αi jand βjstand for a set of coefficients derived through a linear regression model. The same formula can be applied to software-based models, the difference is that, J refers to a set of selected indicators in any particular use case, each with Ias event count. SPj,DPjare derived through a linear regression model as well as αi jand βj. Note that we have used the approach based on the hardware-level power model in our simulation framework. 2.3 Energy and Power Profiling 2.3.1 Processor power consumption characterization The power and thermal characteristics of a processor are essential for designing its power delivery system, packaging, cooling, and power/thermal management schemes. For such purposes, the maximum power and thermal profile of a processor need to be studied. In the following works, a set of micro-benchmarks – known as power virus – are designed to stress the processor to its peak power. In [56], the concept of maximum power consumption has been refined into maximum sustainable power and maximum single cycle power. The maximum sustainable power is the maximum power of the processor that lasts for a time interval that is adequately long. Accurately characterizing it is important as it guides the design of the power delivery system and the packaging requirements for the microprocessor. Similarly, the maximum single-cycle power is the maximum power that can be consumed by the processor during one processor cycle. It holds an important key to estimate the maximum transient current that can be drawn by the microprocessor. By taking into account the information on instructions, input data and architecture details, this study generates micro-benchmarks and tests the above characteristics of a particular processor setup with simulation. In [10], Bertran et al. present a tool to generate micro-benchmarks to explore the maximum power consumption of a real machine. With configurable low-level micro-architecture semantics knowledge of the machine, a taxonomy in terms of energy per instruction (EPI) and processor activity characteristics has been developed. Using such information, authors
2.3. ENERGY AND POWER PROFILING 17 use a compiler-like pass-based code generator to provide flexibility and full control of the micro-benchmarks generation. Using the same methodology, Kestor et al. [61] characterize the on-chip memory hierarchy by designing a set of micro-benchmarks that move data through different levels of cache. 2.3.2 Hardware component level power consumption breakdown In recent years, there has been an increasing interest in breaking down the power consumption to different hardware component levels in different environments from data centers [9,59] to smartphones [17,20,90,92]. Those detailed power measurements improve the characterization of the hardware device, and thus the future designs and implementations can improve the power/performance characteristics of the system. Many proposals [14,17,82,90, 92, 95] estimate the overall system energy consumption within the software using similar PMC-based approaches as introduced in 2.2.2, and then break it down across the different hardware components at a coarse-granularity, such as the processor, memory and screen. POWER7 processor uses power proxy [32,48] where the monitored power estimations divided among each core. Such model uses as a proxy around 50 dedicated hardware counters, along with voltage, frequency and temperature sensors. Similar firmware is also implemented in Intel Sandy Bridge architectures power management module to break down the power consumption of the system [99]. That firmware uses 100 PMCs for active power distribution, and voltage and temperature sensors for static power distribution. 2.3.3 Software component energy consumption breakdown From the software side, refining the runtime energy measurement during program’s execution in a given platform is also a research hotspot. Several studies focus on attributing energy to the execution phases or blocks of a running program. Performance and power vary through the execution of a program. To better analyze the program power behavior and optimize power usage, timing-based power behavior profile is required. Similar to Simpoint [103], techniques based on the basic block vector compare the similarities between different time intervals, to find the representative ones [44]. Based on this, Hu et al. [45] proposed a technique to find the representative phases in a given time interval by incorporating the control flow and runtime events profiles. Systematic profiling tools characterize the program runtime behavior in different ways [54, 67, 70, 75, 97] (e.g., sampling events like stack traces, hardware events, etc.). By cross-
24 CHAPTER 3. EXPERIMENTAL FRAMEWORK Table 3.1: Summary of some DRAM device timing parameters used in DRAMSim2 Parameter Description Cycles tRAS Time interval between a row access command and data restoration in a DRAM array 24 tCAS Time interval between a column access command and the start of data return from the DRAM devices 10 tRCD Time interval between row access and data ready in the sense amplifiers 10 tRT P Time interval between a read and a precharge command 5 tRP Time interval that it takes for a DRAM array to be prepared for another row access 18 tRRD Minimum time interval between two row-activation commands to the same DRAM device 4 tRC Time interval between accesses to different rows in a bank 34 tW R Minimum time interval between the end of a write data burst and the start of a precharge command 10 tWTR Minimum time interval between the end of a write data burst and the start of a column read command 5 tRF C Time interval between refresh and activation commands 107 wrong path instructions by using a separated dictionary to provide information on all static instructions to avoid compromising the accuracy of the simulation results. In addition, we add several enhancements to it in this work to make it better fit with the memory system simulator and power models. For instance, we have added an exact read/write port model for each components to ensure the activities incurred on each component in every cycle can be simulated precisely and power can be accounted conveniently. For the memory system, we use DRAMSim2 [98], also a cycle-accurate simulator to emulate the DDR2/3 memory system with a set of DRAM devices, a memory controller and a standard memory bus. This simulator is either driven by a trace of memory requests with their timing information, or connected to a processor simulator through a robust interface. On the arrival of a memory request, the memory controller decomposes it into the corresponding DRAM device internal commands and schedules them to perform operations in the DRAM devices. And after the memory request finishes, DRAMSim2 returns the data to the processor. These internal procedures are modeled with circuit-level details, such as memory bank activating, data read/write and precharge, etc. The latency of each command follows a strict timing model, which is a generic abstraction of modern DDR2/3 memory systems. It enables convenient configuration in the simulator, since parameters from different technologies and designs of DRAM devices are largely different. A brief description of some parameters used in this model is shown in Table 3.1, along with example values obtained from the specification on DDR3 64B SG15 with 0.68nm technology. A more detailed description of how DDR2/3 DRAM memory works can be found in Section 5.2.1.
3.2. PERFORMANCE SIMULATORS 25 Table 3.2: Configuration Summary Parameter Description Chip details Cluster count 1, 2, 4 and 8 Core count 4 cores per cluster; 1-, 2-thread SMT Supply voltage 1.0V Technology 65nm Core details Core type out-of-order Fetch, decode, issue, 2/4 instr/cycle commit bandwidth Branch Predictor Hybrid 256B Gshare Branch target buffer 32 entries, 4-way Return address stack 32 entries Reorder buffer size 96 entries Issue queues size 48/48/48 entries for INT/FP/Load-store queues Register file 164 INT, 164 FP Functional Units 2 INT ALU (1 cyc), 1 mult (4 cyc), 1 div (7 cyc) 1 FP ALU (6 cyc), 1 mult (6 cyc), 1 div (17 cyc) Instruction L1 32KB, 4-way, 32B/line (2 cycles hit) Data L1 32KB, 4-way, 32B/line (2 cycles hit) Instruction TLB 256 entries fully-associative (1 cycle hit) Data TLB 256 entries fully-associative (1 cycle hit) Shared L2 Cache Unified L2 2MB, 16-way, 64B/line (3 cycles hit, 300 cycles miss) Main Memory Size 8GB Frequency 1000MHz Row-buffer policy Close-page or open-page Address mapping scheme Shared bank Power-down mode Fast Supply voltage 1.35V Technology 65nm During the integration of two simulators, the synchronization was relatively straightforward since both simulators are cycle-based. In modern computers, processors normally work at a higher clock frequency than memory, commonly ranging from 1.5 GHz to 3 GHz. The frequency of DRAM DDR2/3 memory normally ranges from 667 MHz to 1666 MHz. In this thesis, as we assume a general purpose architecture, the processor frequency has been set to 2 GHz, and the memory frequency to 1000 MHz, although our findings are not specific to any particular clock frequencies. This particular setup has been chosen to avoid extra synchronization complexity. Although the memory requests generated from the processor in 2 cycles are dispatched together to the memory system, their order is maintained by the memory controller. Keeping track of instructions in the two simulators is also trivial. As for a load/store
26 CHAPTER 3. EXPERIMENTAL FRAMEWORK instruction, its memory address is used to search through the on-chip cache-hierarchy in MPsim. If it incurs a Last Level Cache (LLC) miss, the same address is used for addressing in the memory system after its execution stalls in the pipeline. Also, the information of this LLC miss is stored in a Last Level Miss Status Handling Register (LLMSHR) to allow other concurrent misses. DRAMSim2 memory controller also preserves the information of each memory request. When one request completes its operations, the memory controller uses a callback mechanism to notify the processor of the returning data and the information related to the memory request. After receiving the information and data, the LLMSHR is iterated to find the matched entry. This entry points to the stalled instruction which generated the memory request, and upon the reception of the memory answer, such instruction is resumed to complete its execution. Note that from the memory side, there is no hard limitation on the number of co-running tasks in the system, which simplifies the integration process to connect DRAMSim2 with a regular multi-core architecture. Instead, the only limit is the number of pending memory requests that can be processed in parallel, which in turn is limited by the number of commands that can be stored in the memory controller command queue (128 entries in our case). An overview of the configuration of the performance simulator used across this thesis can be found in Table 3.2. 3.3 Power Simulators To simulate the energy consumption of a program during its execution, with the runtime information provided by the performance simulators, an infrastructure is needed to analyze and quantify the power dissipation of the program on the hardware components. In this thesis, we have used parameterized power modeling infrastructures on the processor and memory system components of different hardware structures. A tradeoff is needed between the low-level details of the hardware designs, the model accuracy and the simulation speed, so that diverse configuration setups and workloads can be experimented efficiently. The power models for the processor we used in this thesis are analogous to those of Wattch [16]. Wattch-like power models provide a framework where the activity- and time-based power consumption of the major units in the processor are parameterized and quantified, which makes it suitable to be integrated into our performance simulator of the processor. As the technology and configuration continuously change, the power of cache and SRAM-based components in our setup are modeled on top of CACTI 6.5 simulation tool [87]. CACTI is a flexible tool to model delay, energy (dynamic and leakage) and area of cache memories and SRAM-based arrays. Power models for functional units have been
3.3. POWER SIMULATORS 27 Table 3.3: Summary of the power models on Major On-chip Components Unit Parameters Energy Consumption Size (B) R/W Ports Block (B) Type Per Access (nJ) Leakage (mW) IALU 0.024 1.92 FALU 0.05 4.02 BTB 8192 2 8 cache 0.033 20.94 RAS 2048 2 8 cache 0.019 6.33 DCache 32768 2 64 cache 0.072 59.77 ICache 32768 2 64 cache 0.072 59.77 DTLB 2048 2 8 cache 0.013 5.74 ITLB 2048 2 8 cache 0.013 5.74 INT Register 1312 10/6 8 SRAM 0.016 5.06 FP Register 1312 6/4 8 SRAM 0.012 2.66 INT Issue queue 384 4/2 8 cache 0.013 1.01 FP Issue queue 384 2/2 8 cache 0.012 0.71 LS Issue queue 384 2/2 8 cache 0.012 0.71 Bus 0.004 0.21 ROB 2048 2/2 8 cache 0.021 8.35 LLC 2097152 1 64 cache 1.76 224.75 updated to use modern designs. Although in recent studies the power estimations made from McPAT, a CACTI based power model, show a big gap with the real computer [117], we still use it as our platform. On the one hand, McPAT/CACTI power models are the current de facto standard in the computer architecture community, being extensively used in research works for design space exploration. On the other hand, this thesis is neither improving nor covering the gap of such models, but exploring the per-task energy distribution mechanisms based on the estimates made by such models. Therefore, even if power estimates cannot perfectly match with the real system, such analytical model helps us to reveal the interaction between hardware resources and tasks in an analyzable way. In this perspective, McPAT/CACTI power models provide the capabilities for analysis and fast simulation speed to make our research feasible. In Table 3.3, we show an example of the CACTI configurations and output that we have used for some major components on-chip. Unlike on-chip resources, the memory power is more sensitive to the timing and addresses of memory requests. Although CACTi can provide accurate estimation on the memory power based on a given activity factor, which requires deep understanding of the memory structure, the estimation is rather static and so misses important details. Micron has published a set of data sheet specifications for system designers to estimate the power consumption of DDR2/3 DRAM memory. We derive the power model from the data sheet and integrate it to DRAMSim2 seamlessly since they come from the same source. The power model provides the current profiles, which correspond to the state of the DRAM
28 CHAPTER 3. EXPERIMENTAL FRAMEWORK Table 3.4: Summary of DRAM device current parameters used in DRAMSim2 power model Current Description Value (mA) IDD0Operate one bank active-precharge current 100 IDD1Operate one bank active-read-precharge current 130 IDD2PPrecharge power-down current 10 IDD2QPrecharge quite standby current 70 IDD2NPrecharge standby current 70 IDD3NActive standby current 90 IDD4WOperating burst write current 255 IDD4ROperating burst read current 230 IDD5Burst auto refresh current 305 IDD6Self refresh current 9 IDD7Operating bank interleave read current 415 devices and actions performed by those DRAM devices. The current profiles are monitored on the real devices when memory requests are processed in the memory system. In Table 3.4 we list some relevant current profiles in this power model. A detailed description of this model can be found in Section 5.2.2. 3.4 Benchmarks 3.4.1 SPEC CPU 2006 Benchmarks Most of the experiments in this thesis are performed with the SPEC CPU 2006 benchmark [108] suite. This suite is designed and released by The Standard Performance Evaluation Corporation, and aims to provide a standard of measurement or evaluation on the speed and throughput of computer systems. The diverse benchmarks are developed from real user applications, and include compute-intensive and memory-intensive ones. They have been designed, therefore, to stress the processor and memory subsystems. Based on the components they stress the most in the processor, these benchmarks have been categorized as SPECint for integer components and SPECfp for floating point components. We have used traces from these benchmarks which have been obtained from their execution on an AlphaServer DS25 with two Alpha 21264C processors running at 1 GHz with the operating system Tru64 5.1b. As for the compiler, we have used DEC Alpha AXP- 21264 C/C++ compiler for the for those benchmarks programmed in C/C++, compiled with the -O2 -non shared options, and the DIGITAL Fortran 90/Fortran 77 compilers for the remaining benchmarks. All benchmarks have been compiled with the reference input set. Although Alpha processors are not the state of the art processor nowadays, its Reduced Instruction Set Computing (RISC) instruction set has been widely adopted
3.4. BENCHMARKS 29 Table 3.5: SPEC CPU INT 2006 benchmark description Benchmark Description Language 400.perlbench Devired from Perl V5.8.7. The workload includes SpamAssassin, MHonArc (an email indexer), and specdiff (SPEC’s tool that checks benchmark outputs). C 401.bzip2 Julian Seward’s bzip2 version 1.0.3, modified to do most work in memory, rather than doing I/O C 403.gcc Based on gcc Version 3.2, generates code for Opteron C 429.mcf Vehicle scheduling. Uses a network simplex algorithm (which is also used in commercial products) to schedule public transport C 445.gobmk Plays the game of Go, a simply described but deeply complex game C 456.hmmer Protein sequence analysis using profile hidden Markov models C 458.sjeng A highly-ranked chess program that also plays several chess variants C 462.libquantum Simulates a quantum computer, running Shor’s polynomialtime factorization algorithm C 464.h264ref A reference implementation of H.264/AVC, encodes a videostream using 2 parameter sets. The H.264/AVC standard is expected to replace MPEG2 C 471.omnetpp Uses the OMNet++ discrete event simulator to model a large Ethernet campus network C++ 473.astar Pathfinding library for 2D maps, including the well known A* algorithm C++ 483.xalancbmk Transforms XML documents to other docs using a modified Xalan-C++ C++ and developed in the community. Thus, its microarchitecture is still fairly similar to other RISC chips. Furthermore, we have simulated instruction traces obtained from this platform, but we have implemented new features in our simulation framework based on state of the art multi-core processors. As a result, we strongly believe that the conclusions obtained in this thesis are valuable across different platforms, since we study the activities triggered by the instructions, not the instruction set itself. In Tables 3.5 and 3.6, we give a short description of each benchmark in SPECint and SPECfp together with the language in which the source codes were written. In the case of SPECint benchmarks, all the applications are written in C or C++, whereas in the case of SPECfp benchmarks, some of them are written in Fortran, C, C++, or a combination of C and Fortran codes. For example, in 435.gromacs the only Fortran code is the inner loops (innerf.f) which typically account for more than 95% of the runtime.
30 CHAPTER 3. EXPERIMENTAL FRAMEWORK Table 3.6: SPEC CPU FP 2006 benchmark description Benchmark Description Language 410.bwaves Computes 3D transonic transient laminar viscous flow Fortran 416.gamess Gamess implements a wide range of quantum chemical computations. For the SPEC workload, self-consistent field calculations are performed using the Restricted Hartree Fock method, Restricted open-shell Hartree-Fock, and Multi-Configuration Self-Consistent Field Fortran 433.milc A gauge filed program: lattice gauge theory with dynamical quarks C 434.zeusmp ZEUS-MP is a computational fluid dynamics code developed at the Laboratory for Computational Astrophysics for the simulation of astrophysical phenomena Fortran 435.gromacs Molecular dynamics: simulate Newtonian equations of motion for hundreds to millions of particles. The test case simulates protein Lysozyme in a solution C, Fortran 436.cactusADM Solves the Einstein evolution equations using a staggeredleapfrog numerical method C, Fortran 437.leslie3d Computational Fluid Dynamics (CFD) using Large-Eddy Simulations with Linear-Eddy Model in 3D. Uses the Mac- Cormack Predictor-Corrector time integration scheme Fortran 444.namd Simulates large biomolecular systems. The test case has 92,224 atoms of apolipoprotein A-I C++ 447.dealII deal.II is a C++ program library targeted at adaptive finite elements and error estimation. The testcase solves a Helmholtz-type equation with non-constant coefficients C++ 450.soplex Solves a linear program using a simplex algorithm and sparse linear algebra. Test cases include railroad planning and military airlift models C++ 453.povray Image rendering. The testcase is a 1280x1024 anti-aliased image of a landscape with some abstract objects with textures using a Perlin noise function C++ 454.calculix Finite element code for linear and nonlinear 3D structural applications. Uses the SPOOLES solver library C, Fortran 459.GemsFDTD Solves the Maxwell equations in 3D using the finitedifference time-domain (FDTD) method Fortran 465.tonto An open source quantum chemistry package, using an object-oriented design in Fortran 95. The test case places a constraint on a molecular Hartree-Fock wavefunction calculation to better match experimental X-ray diffraction data Fortran 470.lbm Implements the ”Lattice-Boltzmann Method” to simulate incompressible fluids in 3D C 481.wrf Weather modeling. The test case is from a 30km area over 2 days C, Fortran 482.sphinx3 A widely-known speech recognition system from Carnegie Mellon University C 3.4.1.1 Trace Extraction In order to perform efficient simulations, we have to perform several optimizations on the simulation time which is sensitive to the size of trace.
3.4. BENCHMARKS 31 Table 3.7: The input sets for SPEC CPU 2006 benchmarks and their simulation starting point (in millions of instructions) using the SimPoint methodology [103] SPECint Benchmark Input Fast Forward 400.perlbench -I./lib checkspam.pl 2500 5 25 11 150 1 1 1 1 1439900 401.bzip2 input.program 280 107000 403.gcc 166.i -o 166.s 25500 429.mcf inp.in 90700 445.gobmk –quiet –mode gtp -i trevord.tst 50300 456.hmmer –fixed 0 –mean 500 –num 500000 –sd 350 –seed 0 retro.hmm 14900 458.sjeng ref.txt 822100 462.libquantum 1397 8 237000 464.h264ref -d foreman ref encoder main.cfg 382800 471.omnetpp omnetpp.ini 683400 473.astar rivers.cfg 220700 483.xalancbmk − − SPECfp Benchmark Input Fast Forward 410.bwaves −1668800 416.gamess -i triazolium.config 2980700 433.milc −897600 434.zeusmp −17939 435.gromacs -silent -deffnm gromacs -nice 0 588700 436.cactusADM −18497 437.leslie3d -i leslie3d.in 637200 444.namd –input namd.input –iterations 38 –output namd.out 1200 447.dealII 23 41900 450.soplex -m3500 ref.mps 67400 453.povray SPEC-benchmark-ref.ini 168600 454.calculix -i hyperviscoplastic 1099500 459.GemsFDTD −31713 465.tonto −11500 470.lbm 3000 reference.dat 0 0 100 100 130 ldc.of 17900 481.wrf 2749700 482.sphinx3 ctlfile . args.an4 1740400 Some SPEC CPU 2006 benchmarks execute multiple times with different inputs for the reference test. Those benchmarks are not convenient for us since they lead to an increased simulation time cost. In the study in [94], authors have pointed out that not all input sets are necessary for SPEC CPU 2006 benchmarks. That work shows, for those benchmarks that have multiple input sets, that running a subset of the input sets already provides similar timing behavior to that of all the remaining input sets. In the process of obtaining instruction traces from benchmarks, we use this approach, by executing these benchmarks with the input sets indicated in [94]. This optimization is applied for the SPECint benchmarks, including 400.perlbench,401.bzip2,403.gcc,445.gobmk, 456.hmmer,464.h264ref and 473.astar, as well as for 416.gamess and 450.soplex from the SPECfp benchmarks.
32 CHAPTER 3. EXPERIMENTAL FRAMEWORK Still, simulating the whole instruction trace of a benchmark in a cycle-accurate simulator is unaffordably time consuming. To reduce simulation time, the most commonly used approach is to select representative samples [116]. Random samples appear to be inadequate, while just choosing the beginning of a program could be incorrect due to initialization code. SimPoint methodology is proposed by Sherwood et al. [103], which detects program’s phases by using the Basic Block Vector (BBV), which counts how many times each basic block appears. Two phases are considered the same if Mannheim’s distance between their BBV is small. At the beginning, the execution of the program is split into a set of intervals of fixed size (e.g., 10 million instructions). Using clustering algorithms, such as random linear projection or k-means, the samples are joined. The first algorithm is used to reduce the dimension of the BBV and, in that way, accelerate the k-means algorithm. This last algorithm is run for values of kbetween 1 and M (M is the maximum number of phases to use) and the intervals are grouped into phases. SimPoint chooses the representative of each phase that is closest to its centroid. Our collection of instruction traces follows the same methodology, as a result, we take 100 million instructions from each benchmark. We list the fast forwards to apply to each benchmark and its used input sets in table 3.7, respectively. Due to limitations of our simulation infrastructure, we were not able to create the traces from three benchmarks: 459.GermsFTDT,483.xalancbmk, and 481.wrf from SPEC CPU 2006. 3.4.2 High-Performance Computing Benchmarks We have also used real traces from a parallel HPC application running on an actual supercomputer: wrf. The Weather Research and Forecasting (wrf) model [83] is a mesoscale numerical weather prediction system designed to serve both operational forecasting and atmospheric research needs. In this experiment, we use the non-hydrostatic mesoscale model dynamical core. Simulating all threads of the parallel MPI application implies a significant amount of simulation time as these applications usually run for days or weeks on a supercomputer. We use an automatic mechanism to choose the most representative computation regions to be traced and simulated with a cycle-accurate simulator [37]. This simulation methodology uses non-linear filtering and spectral analysis techniques to determine the internal structure of the trace and detect periodicity of applications. Afterwards, we use a clustering algorithm to determine the most representative computation bursts inside an iteration of the application.
3.4. BENCHMARKS 33 Traces are obtained when wrf runs on the MareNostrum supercomputer at the Barcelona Supercomputing Center (BSC-CNS). We obtain four representatives for the five computation phases that compose the 64-thread MPI application. We have used these reduced trace files to feed the performance simulator. We simulate all threads sharing the LLC cache (four threads in this case study) in a CMP architecture (single-threaded cores). When a thread finishes executing, it waits until all other threads have also finished. 3.4.3 Workload Selection In the experiments we perform in this thesis, the number of benchmarks in the workloads is identical to the thread count of the processor. For example, in a 4-core CMP architecture, we run four benchmarks in a workload; for a 4-core 2-way SMT architecture, we run eight benchmarks workloads. For a wide variety of configurations, as shown in Section 3.2, we need to generate workloads for each appropriately. Several issues have been taken into account for the generation of the workloads: the characteristics of benchmark behavior, the number of generated workloads and the type of the workloads. As benchmarks with diverse characteristics co-running in a workload will generate very different behaviors, a certain amount of workloads are needed to come up with comprehensive conclusions for our studies. However, given that we have generated traces for 26 benchmarks, to generate the N-task workloads, we could have N26 possibilities, which is way too much. Thus, we randomly picked benchmarks to generate a fixed set of workloads. In order to facilitate the interpretation of results and understanding of the features proposed, an appropriate way to generate the workloads is needed. Since the most relevant parameter affecting the timing and power behavior in our environment is the time spent accessing memory, we classify SPEC CPU 2006 benchmarks into two groups. Based on metric Misses Per thousand Cycle (MPKC) in the LLC, we include in the MEM group those benchmarks presenting a MPKC value higher than 3 under a 2MB 16-way LLC setup when each benchmark runs alone. The remaining benchmarks fall in the ILP group. Although the threshold to classify benchmarks can only be arbitrary, as shown later, it was appropriate to segregate distinct timing and power behaviors. In Table 3.8 we show the benchmarks we categorize into each group. Note that some benchmarks are very sensitive to the LLC size, so they could be classified into the other under a different LLC configuration. Especially when we study SEA, where we consider different LLC sizes, this might be a concern. However, we stick to this classification along all the thesis for the sake of consistency. Then, from these two groups, we generate three workload types denoted as I,Mand
40 CHAPTER 4. PER-TASK ENERGY METERING FOR THE PROCESSOR Figure 4.1: Diagram of high core-count cluster architecture 4.2.1 Shared Cache The active energy consumption in the shared LLC for a given task iis proportional to the number of accesses. It can be computed as follows: ELLC act,total(tki) = K X k=1 #actionLLC k(tki)×ELLC actionLLC k(4.1) where ELLC actionLLC k stands for the energy per LLC access of type k, which is assumed to be available in this idealized model. #actionLLC k(tki) stands for the number of LLC accesses of type kperformed by the task i. Three main factors determine the access types we consider: whether an access reads or writes; hits or misses in LLC; and in the latter case whether it evicts a dirty line. The possible combinations are: read hit, write hit, read miss replacing a dirty line, read miss replacing a non-dirty line, write miss replacing a dirty line, and write miss replacing a non-dirty line. Under each combination of these factors, the energy consumption of an access can change. Extending the model to consider other access types (e.g., invalidations) is trivial since we only need to multiply the energy consumed by each access type by the number of those accesses. Maintenance energy is consumed when resources are idle. We use cache occupancy as a proxy to measure maintenance energy: We assume that those cache regions (lines) not occupied by a given task could be turned off so that they would not incur any energy
4.2. IDEAL PTEM FOR THE MULTICORE: LLC AND CORE 41 consumption [2]. The total maintenance LLC energy consumption for a task is obtained as follows: ELLC main, total(tki) = OccLLC(tki)×IdleTime(LLC)×ELLC main (4.2) where OccLLC (tki) stands for the average fraction of cache lines owned by task i,ELLC main corresponds to the maintenance energy per cycle consumed by the LLC when no access is performed, and IdleTime(LLC) stands for the number of idle cycles for the LLC (no access to LLC). ELLC main is assumed to be provided under the ideal model. Leakage energy is proportional to the cache occupancy and can be easily computed as follows: ELLC leak,total(tki) = OccLLC(tki)×ExecTime(tki)×ELLC leak (4.3) where ELLC leak stands for the leakage energy per cycle consumed by the LLC. This value is also an input parameter for the idealized model. 4.2.2 Core Slice Ideal per-task core energy metering requires tracking per-task activity in all core hardware blocks (e.g. Reorder Buffer, Issue Queues, etc) to count the number of accesses of each type. This would provide detailed information to accurately compute active energy by multiplying the per-type access counts by the active energy for each particular type of access (action): Ecore act, total(tki) = J X j=1 K X k=1 Eblockj actionk×#actionblockj k(tki) (4.4) Eblockj actionkis the energy per action of type k(e.g., read) in block j(e.g., register file), which is assumed to be known. #actionblockj k(tki) stands for the number of such actions on such block performed by task i. This applies to both single- and a multi-threaded (e.g., SMT) cores. Jand Kstand for the total number of blocks in the core and types of actions (e.g., read, write, flush) respectively. Maintenance energy is measured in all those blocks having non-negligible energy consumption when no action is performed. Blocks can be classified into two categories depending on whether they allocate entries to tasks. Occupancy Blocks or oblocks allocate entries to tasks and hence their maintenance energy can be split based on the occupancy (e.g., precharge energy of first level caches). Conversely, in resources without memory or
42 CHAPTER 4. PER-TASK ENERGY METERING FOR THE PROCESSOR eblocks no entries are allocated, and hence maintenance energy can be evenly distributed (e.g., issue queue selection when there are no ready instructions). Maintenance energy is then computed as follows: Ecore main, total(tki) = ExecT ime(tki) X x=1 J X j=1 Eeblock main (x) #Tk(Ck)+ L X l=1 Occoblock(tki)×Eblockl main (x) (4.5) where Lstands for the number of oblocks,Jfor the eblocks, and Occblockl(tki) for the average occupancy of block lby each task. Eblockl main (x) stands for the maintenance energy consumed by idle ports or in idle cycles of block lin cycle x. #T k(Ck) stands for the number of tasks in core Ck. Leakage energy can be easily tracked because it will be roughly constant throughout all the execution. If the core is single-threaded, then it is trivial to identify the owner of such energy. However, if the core is multi-threaded the occupancy per task in each of the blocks must be tracked to properly distribute leakage energy, as shown in the following equation: Ecore leak, total(tki) = J X j=1 Occblockj(tki)×Eblockj leak ×ExecTime(tki) (4.6) where Occblockj(tki) stands for the average occupancy of block jby task iand Eblockj leak stands for the leakage per cycle of block j, which is assumed to be available. 4.2.3 Shared Bus Ideal per-task bus energy metering requires tracking per-task accesses. Analogously to the case of the LLC, there are different types of accesses with different active energy consumption. For instance, if a cache line is sent over the bus, the energy consumed is higher than if just an address is sent, either because the cache line communication sends more bits simultaneously or because it requires several consecutive transactions to send all data over a bus narrower than a cache line. This would provide detailed information to accurately compute active energy by multiplying the per-type access counts by the active energy for each particular type of access (action): Ebus act, total(tki) = K X k=1 Eactionk×#actionk(tki) (4.7)
4.3. AN IMPLEMENTABLE PTEM APPROACH 43 Eactionkis the energy per action of type k(e.g., cache line communication), which is assumed to be known. #actionk(tki) stands for the number of such actions performed by task i.Kstands for the types of actions. Note that different actions and energy per action values may be used for different buses such as the intra-cluster bus connecting cores to their LLC and the inter-cluster bus connecting cores to memory. Nevertheless, the same principle applies to compute active energy. Leakage energy cannot be attributed to any particular task in the cores (tasks do not have any type of bus occupancy), so we evenly distribute it across all those tasks that could use the particular bus: tasks in the cluster for intra-cluster buses and tasks in the whole chip for the inter-cluster bus: Ebus leak, total(tki) = Ebus leak ×ExecTime(tki) #Tk(BUSk)(4.8) where Ebus leak is the leakage energy per cycle of the bus, which is assumed to be known and #Tk(BUSk) stands for the number of tasks in using bus BUSk. Note that, bus energy is dominated by active and leakage energy [66] due to wiring, repeaters and latches while maintenance energy is negligible. We evenly distribute maintenance energy over tasks. 4.3 An Implementable PTEM Approach 4.3.1 PTEM with Practical Approaches for the LLC The ideal model for the LLC tracks two main per-task parameters: access (activity) counts per access type and cache occupancy. Our simplified PTEM model for the LLC relies on the fact that LLC accesses are not frequent, so they can be tracked with full accuracy. Conversely, tracking cache occupancy, which is required for maintenance and leakage energy estimation, would require counting how many cache lines each task owns every cycle, which is expensive. Tracking the ownership of cache lines requires: (1) tagging each cache line with a task id, (2) keeping a counter per task with the number of owned cache lines (instant counter), and (3) updating such counters on a replacement based on the ownership of the evicted and fetched cache lines, increasing the counter of the owner of the fetched line and decreasing the one of the owner of the evicted cache line. In general, LLC access patterns and occupancy do not change abruptly. Similarly, the occupancy per set is quite homogeneous for any particular program [86]. Therefore, we propose sampling the LLC occupancy in two different ‘directions’. First, only some cache
44 CHAPTER 4. PER-TASK ENERGY METERING FOR THE PROCESSOR sets will be monitored, so they will be the only ones for whom cache line ownership will be tracked. In order to avoid clustering effects due to contiguous allocation of data in memory for any particular task, sampled sets are located at a particular stride (e.g. only those sets whose xlowermost index bits are zero are monitored). How many xlowermost bits are considered depends on the desired sampling granularity. Second, the counters accumulating instant occupancy are not updated every cycle, but at a lower frequency. For instance, for a LLC with 1,024 cache sets, 8 ways per set and a processor with 8 cores, cache sets can be sampled at a granularity of 1 out of 16, and time sampling occurs once every 256 cycles. In this case, the overhead of the LLC mechanism would be as follows: •8 instant counters (OccLLC inst ) of 10 bits each for tracking instant occupancy (1,024 sets x 8 ways / 16 sample granularity = 512 lines sampled, so 10 bits are needed). •512 3-bit owner identifiers for the 512 tracked cache lines. Note that all cache lines in the sampled sets always have an owner for energy metering purposes. Thus, on a context switch, the task being scheduled in becomes the owner of the cache lines used by the task being scheduled out (using the same hardware context, or CPU index). •8 cumulated occupancy counters (OccLLC cum ) of 48 bits able to track the occupancy during 248 ×28= 256 cycles (48-bit counters and 256 cycles sampling frequency). We assume that the number of cycles that a program takes to run is measured by an existing performance monitoring counter of the processor. Based on this hardware support LLC occupancy is obtained as follows: OccLLC (tki) = OccLLC cum (tki)×SmpFreq ×SmpSets #SetsLLC ×ExecTime(tki)(4.9) where SmpFreq is the sampling frequency (256 cycles in the example), SmpSets is the set sample granularity (16 in the example) and #SetsLLC is the number of total cache sets (1,024 in the example). The impact of sampling in both time and sets is later analyzed in the evaluation section. 4.3.2 PTEM with Practical Approaches for the Core Current processors, e.g. the IBM POWER7 [32, 48], can estimate the energy consumed by each core (even for SMT cores) based on a model that uses as proxy different performance monitoring counters, voltage, frequency and temperature. However, solutions
4.3. AN IMPLEMENTABLE PTEM APPROACH 45 to accurately distribute core energy across tasks in SMT cores have not been developed, while, in fact, multicores with SMT cores are becoming quite common [32,104]. A real per-task core energy metering, cannot be done with the ideal model presented before since this models tracks too many events and the occupancy of many blocks. Instead of such a bottom-up model, PTEM builds a top-down model. Under this top-down model, during the execution of a workload we first breakdown the energy consumed into its main components, active,maintenance and leakage energy; and in a second step, we breakdown the energy of each component per task. Step 1: Deriving active, maintenance and leakage energy components. We start determining the maximum power (Pcore max) and minimum power (Pcore min ) dissipation in a given time interval. The core maximum power dissipation, Pcore max, can be determined by running a highpower benchmark, a.k.a. power virus [88]. Pcore max can be decomposed as follows: Pcore max =MaxDynPcore +LeaPcore (4.10) MaxDynPcore is the maximum dynamic power of the core and LeaP core the leakage power of the core that can be obtained by measuring core power when the core is in halt mode. In this formula, we assume that all blocks are fully used so no maintenance power is dissipated. In reality, there will be still some maintenance power, but its relative weight with respect to active power is negligible in a maximum power scenario, so the loss of accuracy introduced by such an assumption is rather low. The core minimum power dissipation, Pcore min , can be obtained running a low-power benchmark comprised, for instance of no-ops.Pcore min can be decomposed as follows, where MaxMainPcore is the maximum maintenance power of the core: Pcore min =MaxMainPcore +LeaPcore (4.11) In this formula we assume that all blocks are idle so that no active power is dissipated. Under that scenario, all activity in the core incurred maintenance power dissipation as these activities are not produced by tasks’ execution. This is the scenario in which the maintenance power is the highest, MaxMainP core. From Equations 4.10 and 4.11, we can derive MaxDynPcore and MaxMainPcore. Let’s assume that the energy consumed by a workload during an interval Tis Ecore = (LeaPcore+DynPcore+MainPcore)×T. In order to determine which fraction of Ecore(T) is active,maintenance and leakage we proceed as follows. Leakage power is roughly constant in all runs, so we take the value derived above, LeaPcore ×T.
46 CHAPTER 4. PER-TASK ENERGY METERING FOR THE PROCESSOR We assume that all idle blocks have the same maintenance energy consumption when idle w.r.t. their active energy consumption. That is, for all blocks the relation between active and maintenance power is obtained as MainDynRatio =MaxMainPcore MaxDynP core . Hence, the maintenance energy for each block during a time interval is MainDynRatio of its active energy. During the execution of a workload in a given interval, a fraction of the resources will perform useful activity, thus consuming active energy in the interval (DynEcore j). The remaining resources do not perform any useful activity consuming maintenance energy. The difference (MaxDynPcore −DynP core j)×Tprovides the amount of active energy not consumed in the execution of the workload with respect to the scenario in which the active energy is maximum. The maintenance energy MainEcore jis a fraction of that difference: MainEcore j= (MaxDynPcore −DynPcore j)×MainDynRatio ×T. Overall, Ecore jcan be derived as follows: Ecore j=LeaEcore +DynEcore j+MainEcore j(4.12) =LeaEcore +DynEcore j+ (MaxDynEcore −DynEcore j)×MainDynRatio where only DynEcore jis unknown and can, therefore, be derived. Step 2: Breaking down active, maintenance and leakage energy components per task. Per-task energy distribution is done as follows: •Dynamic active energy. Since tracking all events in the core is unaffordable, we use a simplified model based on the number of instructions fetched per task. •Dynamic maintenance energy. Most maintenance energy in the core comes from register files and issue queues due to their large number of ports and high maintenance energy consumption per port. Such energy cannot be attributed to any particular task, so we evenly split maintenance energy across tasks. •Leakage energy. Leakage energy mainly comes from first level (L1) caches and their occupancy correlates quite well with the occupancy of some other blocks (e.g., branch predictor tables, translation lookaside buffers). Thus, we track task occupancy in L1 caches. We need the same hardware support as in the LLC. We consider that L1 data and instruction cache occupancies have the same weight. Therefore, task energy in the core is measured as follows for interval j: DynEcore j(tki) = DynEcore j×InstFetchj(tki)/InstF etchj(4.13)
4.3. AN IMPLEMENTABLE PTEM APPROACH 47 Table 4.1: PTEM hardware requirements Block Energy figures Extra Logic ELLC action, #actionLLC k(tki), OccLLC inst (tki), LLC OccLLC cum (tki), IdleT ime(LLC), ELLC main,ELLC leak , LLC Cache line owner’s table InstF etch,InstF etch(tki), Ecore max,Ecore min ,OccIC inst(tki), OccIC cum(tki), Core OccDC inst(tki), OccDC cum(tki), LeakEcore IC Cache line owner’s table, DC Cache line owner’s table, Ecore total(tki) intra-cluster bus Einbus action,Einbus leak #actioninbus k(tki) inter-cluster bus Eoutbus action ,Eoutbus leak #actionoutbus k(tki) MainEcore j(tki) = MainEcore j/#Tk (4.14) LeaEcore j(tki) = LeaEcore j×OccIC(tki) + OccDC(tki) 2(4.15) where InstFetchjand InstF etchj(tki) are the total and task ifetched instructions in interval jrespectively. OccIC(tki) and OccDC(tki) stand for the task ioccupancy in the data and instruction caches. Then, we only need to cumulate the energy of the task across all intervals: Ecore total(tki) = ExecT ime(tki) SmpF req X j=0 (DynEcore j(tki) + MainEcore j(tki) + LeaEcore j(tki)) (4.16) 4.3.3 PTEM with Practical Approaches for the Buses The ideal model for the buses only needs to track access (activity) counts per access type per task. Our simplified PTEM model for the buses relies on the fact that, analogously as for the LLC, bus accesses are not frequent, so they can be tracked with full accuracy. Also, leakage energy is tracked trivially by considering how many cycles each thread runs and how many threads share each bus. 4.3.4 Putting It All Together The practical PTEM approaches require reduced hardware overhead. PTEM mostly requires setting up some counters similar to the PMCs currently available in most highperformance processors. PTEM support, analogously to PMCs, does not interfere the execution of programs since it is not in any critical path.
48 CHAPTER 4. PER-TASK ENERGY METERING FOR THE PROCESSOR Table 4.1 summarizes those parameters required from the chip vendor and the extra logic (counters, tables) that must be set up. The chip vendor is required to provide only few parameters that can be either obtained by running appropriate benchmarks or estimated using test chips or power models. Note that counters with the (tki) suffix must be replicated for each task. Analogously, action in the case of the LLC stands for the 6 different LLC actions considered in this work: read/write hit, read/write miss (no dirty line replaced), read/write miss (dirty line replaced), and for the 2 different bus actions considered in this work in the case of the buses: address communication and cache line communication. Inbus and outbus refer to the intra-cluster and inter-cluster buses respectively in the table. Regarding the interface with the software, the OS is responsible for keeping track of the energy consumed by every task running in the system. PTEM exports a special register, called Energy Metering Register (EMR), that acts as the interface between PTEM and the OS. The OS can access that register for collecting the energy estimates made by PTEM. This typically will happen when a context switch takes place. At that moment, the OS will read the EMR using the hardware-thread index (or CPU index) for the task that is being scheduled out (Tout). Then, the OS will aggregate the energy consumption value received in the task struct for Tout. Right after the new task (Tin) is scheduled in, the LLC and L1 caches will continue to contain some lines belonging to Tout. These lines will be tagged with the same identifier as the one Tin is using. Although, PTEM will attribute maintenance and leakage energy consumption to Tin, we have empirically observed, that this occurs during less than 1 million cycles, since cache lines belonging to Tout will be quickly replaced and thus, evicted from LLC. Under a processor frequency of 2GHz, 1 million cycles are equivalent to 0.5µs, while context switches occur at much higher granularity, every 10-100µs. 4.4 Evaluation 4.4.1 Experimental Setup The general experimental setup used in this chapter is as introduced in Section 3.2, except that we have also taken into account large core-count scenarios. For these setups, we assume a clustered multicore architecture, as shown in Figure 4.1, where each cluster consists of a set of cores, having each core private data and instruction first level caches, plus a shared on-chip second level cache accessed through a shared bus. We refer to such cache as LLC. All clusters are connected to memory through a shared bus. Several studies
4.4. EVALUATION 49 show that hierarchical bus configurations scale quite easily to large systems and provide a good area-performance trade-off, while retaining many of the advantageous features of simpler bus arrangements [100]. In the same line, other studies show that bus-based networks can significantly lower energy consumption and simplify network protocol design and verification, with no loss in performance [111]. In order to evaluate the accuracy of PTEM, we make use of the benchmark suite and workload generation strategy introduced in Section 3.4. We also consider an HPC application, wrf, as described in Section 3.4.2. To measure accuracy, the make use of the metric described in Equation 3.1. 4.4.2 Intra-cluster evaluation We evaluate the accuracy of our hardware support for per-task energy metering incrementally by analyzing the accuracy at intra-cluster level. Once we analyze the accuracy of the PTEM models for the cache and SMT core, in next section we show the results when we scale the number of cluster to sum up a total of 16/32 cores (32/64 threads). Due to the relatively low energy contribution of buses, intra-cluster bus energy is reported as part of the LLC energy. The key idea of our per-task energy metering approach is to make the energy attributed to a task proportional to each resource utilization. In particular, to its activity and the occupancy of a given resource. If both activity and occupancy are accurately measured, the energy consumption can be accurately attributed to each running task. Figure 4.2 shows the fraction of LLC energy consumption attributed to each benchmark in a 2-core workload (gcc+mcf ), by using our ideal model presented in Section 4.2. We observe that the activity does not necessarily reflect the occupancy of the LLC. In the figure, we can see that gcc, with 63.5% accesses, occupies less than 46.2% of LLC lines. That shows that a given workload may have very different consumption profiles in terms of active energy versus maintenance and leakage energy. Therefore, it is important to measure both activity and occupancy in order to improve the estimation accuracy. For instance, let us look again at the gcc case. If we estimate the energy only proportionally to the activity, LLC energy will be significantly overestimated for gcc and underestimated for mcf. 4.4.3 PTEM Energy Estimation In this section we show the accuracy of the models presented in Section 4.2 for the core and the LLC at cluster level. In particular we measure the off estimation of each model
56 CHAPTER 4. PER-TASK ENERGY METERING FOR THE PROCESSOR Figure 4.7: Core per-task energy prediction (C4S2) with ES, PTA and PTEM model, including the average error and maximum error. on accesses. 4.4.6 PTEM for High Core-Counts In this section we evaluate the accuracy of our PTEM model for large multicores with 4 and 8 clusters, counting 16 and 32 2-way SMT cores respectively. For that purpose, we have run experiments with 4 different types of workloads: pure Iworkloads, pure M workloads, Xworkloads (with 4 Iand 4 Mtasks per cluster) and hybrid workloads where half of the clusters run pure Iworkloads and the other half runs pure Mworkloads. Memory bandwidth for the 8-cluster configuration has been increased by setting up 2 memory controllers instead of one able to issue memory commands in parallel as long as they do not conflict in any particular bank. This has been done in order not to overdesign memory bandwidth for the 4-core setup and not to underdesign memory bandwidth for the 8-core setup. The behavior of the different workloads is such that the relative execution time increase is low with respect to the single cluster setup since little memory contention is suffered in Itasks, and the higher contention paid by Mtasks is still low in relative numbers. Results in Figure 4.8 show that PTEM achieves higher accuracy for pure Iworkloads and hybrid I-Mworkloads. This is so because, as shown before, PTEM achieves higher
4.5. CASE STUDY 57 Figure 4.8: System per-task energy prediction error accuracy for pure Iclusters than for Xor Mones. Instead, pure Mand Xconfigurations show slightly higher prediction error. Nevertheless, the average error is low and, in the case with the largest core count (8 clusters), the average error is below 3.5% regardless of the workload type. In the case of the ES model, prediction error is significantly higher than that of PTEM, being above 12% on average for Xworkloads. Other configurations show lower error since they mitigate the per-core prediction error. Nevertheless, PTEM largely improves accuracy with respect to the ES model across cluster counts and workload types, and opposed to the ES model, PTEM error decreases as the cluster count increases. 4.5 Case Study 4.5.1 Characterization of Energy and Performance Variation Interferences among co-running tasks when accessing shared hardware resources in a multicore (a.k.a. inter-task interferences) result in different per-task performance depending on its co-runners [31]. In this section, we use our proposed PTEM model to show how the energy consumption of each task also significantly varies due to inter-task interferences, and prove that such energy consumption variation cannot be directly inferred from performance variation.
58 CHAPTER 4. PER-TASK ENERGY METERING FOR THE PROCESSOR We focus on 2-task workloads, which we run in a 2-way SMT core setup of our baseline configuration. We construct all possible pairs of benchmarks from SPEC CPU 2006 suite, recording for each benchmark its energy consumption in each of the 2-task workloads in which it runs. The variation that each benchmark suffers across each 2-task workload is illustrated in terms of Cycles Per Instruction (CPI) in Figure 4.9 and in terms of Energy Per Instruction (EPI) in Figure 4.10. Results have been normalized with respect to the average CP I and EPI respectively for the sake of readability since CPI ranges between 1.03 and 11.36 cycles/instr, and EP I between 0.29 and 2.99 nJ/instr. Benchmarks are sorted from lowest to highest CPI. We observe that CPI variation mostly concentrates in the range [+20%,-40%] w.r.t. their average for most of the benchmarks, whereas EP I concentrates in the range [+30%,- 20%]. Hence, in both cases variations are significant and, therefore, we can conclude that performance and energy consumption strongly depends on the co-runners. In terms of performance variation, MEM benchmarks (mcf,milc,lbm,libquantum,soplex,gcc,bwaves and omnetpp) are among those with the lowest performance variation. For instance, lbm and omnetpp, both in MEM category, are the ones exhibiting the lowest performance variation across all benchmarks. However, in terms of EPI this is not the case: Typically, EPI variation for ILP benchmarks decreases while MEM benchmarks have higher EPI variation than CPI variation. For instance, libquantum, which falls in the MEM category, is the benchmark exhibiting highest EPI variation. Analogously, mcf,soplex,gcc and omnetpp also experience a significantly higher variation increase in terms of EPI than CPI. In contrast, astar has a a significant variation in CPI, but reduced variation in EPI. Thus, the relation between performance and energy variation is non-obvious. We note that the two benchmarks in the middle of x-axis, astar and perlbench, both of them being ILP, have opposite trends across metrics: EPI variation for astar is much lower than its CPI variation. Conversely, EPI variation for perlbench is much higher than its CPI variation We have also studied absolute EPI and CPI values, shown in Table 4.3. Values are sorted based on their CP I. We observe that MEM benchmarks have higher CPI than ILP ones, since they access memory more often and thus, experience higher latencies. Few ILP benchmarks have higher CPI than some of the MEM ones. Such higher CPI for MEM benchmarks translates into higher average EPI. In fact, only zeusmp (ILP) has slightly higher EPI than one of the MEM benchmarks (bwaves). The main reason for the increased EPI of MEM programs is the fact that they execute longer and occupy more resource space, which translates into higher static and leakage energy. However,
4.5. CASE STUDY 59 Figure 4.9: Per-benchmark CPI variation across all 2-task workloads in which the benchmark runs. Benchmarks sorted in increasing average CPI. Chart shows max, min, higherquartile and lower-quartile values. Figure 4.10: Per-benchmark EPI variation across all 2-task workloads in which the benchmark runs. the particular interaction across different programs in shared resources leads to different behavior in terms of performance and energy, as it has been shown in Figures 4.9 and 4.10 in terms of CP I and EPI variability. Therefore, performance cannot be used as a suitable metric to derive per-task energy consumption, quite the opposite, these results confirm that our proposed energy metering technique, PTEM, is required to achieve accurate per-task energy metering.
60 CHAPTER 4. PER-TASK ENERGY METERING FOR THE PROCESSOR Table 4.3: Average CP I (cycles/instr) and EPI (nJ/instr) for all benchmarks, sorted from lowest to highest average CP I from left to right and from top to bottom. MEM benchmarks in bold font. 416.gamess 444.namd 436.cactusADM 447.dealll 454.calculix CPI 1.03 1.03 1.05 1.05 1.10 EP I 0.35 0.29 0.40 0.36 0.32 456.hmmer 464.h264ref 458.sjeng 401.bzip2 435.gromacs CPI 1.22 1.23 1.24 1.28 1.30 EP I 0.40 0.48 0.37 0.46 0.41 453.povray 473.astar 400.perlbench 437.leslie3d 410.bwaves CPI 1.34 1.34 1.41 1.42 1.46 EP I 0.41 0.50 0.44 0.50 0.55 445.gobmk 482.sphinx3 434.zeusmp 470.lbm 403.gcc CPI 1.51 1.51 1.60 2.19 2.58 EP I 0.49 0.50 0.56 0.92 0.89 471.omnetpp 433.milc 450.soplex 462.libquantum 429.mcf CPI 2.83 3.22 3.88 4.90 11.36 EP I 0.95 0.89 1.14 1.26 2.99 4.5.2 Large-Scale Parallel Applications 4.5.2.1 Adapting PTEM to Multithreaded Applications In our per-task energy measuring approach, the energy accounted to each thread is saved into a special purpose register per thread, denoted EMR. Section 4.3.4 shows how the OS handles the EMR of each task. The support required for PTEM in the case of multithreaded applications is simple. In fact, no hardware changes in the PTEM logic are actually required, but only on how the OS handles the EMR: The OS or the parallel runtime, simply needs to aggregate the energy consumption estimates stored for all the threads belonging to the same multithreaded application. EmeterApp =PN i=1 EMRiwhere N is the number of threads of the application. When a cache line is shared in the LLC across different threads, its energy (static and leakage) must be accounted once, either by splitting it across the threads sharing it or by attributing it to one of those threads. In particular, we identify as owner the thread fetching the cache line to the LLC. Whether this energy is attributed to one thread or another of the parallel application is irrelevant since the energy of all threads will be finally aggregated to provide a single figure for the whole application. However, per-task energy can also be monitored individually and periodically during the execution, so that such information can be later used to optimize the energy profile of the application. This is better illustrated in the next subsection through a particular example. The information provided helps understanding the effects in terms of energy of unbalanced thread execution times.
4.5. CASE STUDY 61 Figure 4.11: Stacked power consumption evolution for wrf between two barriers 4.5.2.2 WRF In this section, we evaluate our energy metering mechanism with real traces from a parallel HPC application running on an actual supercomputer: wrf, as introduced in Section 3.4.2 Figure 4.11 shows the evolution of the per-task energy breakdown in the multicore between two barrier communications. Note that energy components are stacked in the plot. At the beginning thread 0 (Th0) consumes more energy than the other threads due to its higher activity (it behaves as an Itask). Conversely, Th1, Th2 and Th3 behave as M tasks and therefore, their energy consumption is dominated by static and leakage energy. Eventually, Th3 reaches the barrier and stops consuming dynamic energy. Th3 quickly loses its LLC lines, which decreases its leakage energy. Hence, Th3 energy consumption from this point onwards corresponds to its core static and leakage energy. Behavior for Th1 and Th2 is analogous to that of Th3, but it takes longer for them to lose their LLC cache lines since they reach the barrier before 40ms and lose their LLC cache lines after 50ms. Th0, however, behaves as a Itask for 52ms. Then it enters into an Mphase, thus decreasing its dynamic energy. At this point Th0 starts increasing its LLC occupancy evicting Th1 and Th2 lines until it occupies the whole LLC after 57ms. This makes leakage energy contribution of Th0 to grow noticeably. Notice that our energy metering mechanism does not need to be aware of the synchronization among threads of a multithreaded task. For example, if a thread is busy waiting on a lock, even if it is not progressing during that time, the thread is using the processor and it will be metered accordingly. In contrast, if the thread goes to sleep until the lock is released, the core will go to low power mode and less energy will be metered to the thread.
62 CHAPTER 4. PER-TASK ENERGY METERING FOR THE PROCESSOR 4.5.3 Voltage and Temperature Aware Energy Metering Voltage and temperature influence energy consumption so they cannot be neglected in general. IBM POWER7 [32,48] power proxy is already aware of voltage and temperature, which are obtained through sensors. The power proxy scales dynamic, static and leakage energy with constant factors associated to different voltage/temperature combinations. However, such proxy does not discriminate energy in a per-task basis, so it cannot be directly used for PTEM. Instead, a potential implementation for PTEM could track activities in a per-voltage and per-temperature basis, in such a way that the number of counters required matches the number of combinations of voltage and temperature ranges. For instance, if our chip can operate at 0.8V, 0.9V and 1.0V, and temperature ranges considered are 320K-330K, 330K-340K and 340K-350K degrees, then 9 counters are required for each event to consider all combinations. Owner id tags in caches and occupancy counters will not need to be replicated (note that those arrays are responsible for most of the PTEM overheads). While voltage and temperature parameters may impact energy consumption of PTEM, their variability is expected to decrease with technology scaling and the increasing number of cores per chip. In particular, smaller geometries suffer from process variations, which limit the minimum voltage that can be used [13]. On the other hand, power efficiency and heat dissipation push for lower operating voltages. Thus, although dynamic voltage scaling techniques may still exist in the future, the range of voltages is expected to decrease, thus leading to fewer voltage levels. Temperature variation may be significant across the chip, but cores will become smaller with technology scaling, thus exhibiting lower in-core temperature variation due to the fact that meaningful temperature gradients occur at a nearly-constant minimum distance [25]. For instance, a difference of 1 degree can only be observed at distances above 0.2mm and cores may occupy less than 1mm2in the near future. Similarly, LLC will remain in a narrow range of temperatures due to its relatively low activity. Moreover, maximum allowed temperature decreases due to technology scaling because smaller devices age faster and aging has an exponential dependence on temperature. 4.6 Summary In this chapter we have addressed the main challenges and opportunities associated with accurate per-task energy metering. As shown in this chapter, existing approaches based on an even distribution of energy across tasks are highly inaccurate. Therefore, we pro-
4.6. SUMMARY 63 pose (i) a fair reference approach to distribute energy across tasks and (ii) an affordable implementation, PTEM, that tracks task activity and resource utilization at very low cost (below 0.3% energy overhead and 0.85% area overhead). PTEM is shown to provide highly accurate per-task energy estimates with an average error of 3.1% for SMT multicore configurations and 2.1% for single-threaded multicore ones. We further discuss the required changes, both at hardware and software level, to provide such an accurate, yet implementable, per-task energy metering mechanism. Finally, we show how to use PTEM in the context of parallel applications and a use case where PTEM provides per-task energy measurement in a multicore system showing that the energy consumed by a task when it runs with different co-runners could be huge.
5 Per-task Energy Metering for the DRAM Memory System 5.1 Introduction The energy demand and cost of computing systems have grown during the last years, and the trend is expected to hold in the coming future [8]. Conversely, computing hardwarerelated costs (e.g., servers) remain constant or even lower in data centers, desktops and laptops. This leads to scenarios where energy costs are as significant as hardware-related costs. In that respect, despite memory power keeps increasing, reaching 30–50W in highperformance computers [14], there is a lack of understanding on per-task energy consumption in memory. This is aggravated by the fact that memory power profiles across tasks may vary significantly. For instance, a variation of up to 36% in memory power consumption is observed across different SPEC CPU 2000 workloads (from 33.9W to 46.4W) when running four instances of the same benchmark in each workload [14]. As we have seen in Figure 1.2, the average memory power consumption of each benchmark when executing in isolation on the system significantly varies. Different tasks incur different power consumption, with the maximum variation being 57%, between 482.sphinx3 and 462.libquantum (from 25.7W to 40.4W). Hence, libquantum-like and sphinx3-like workloads executing for the same amount of time would incur significantly different energy consumption. However, to the best of our knowledge, no mechanism has been proposed to measure accurately the memory energy consumed by each task in multicore architectures. 65
72 CHAPTER 5. PER-TASK ENERGY METERING FOR THE DRAM MEMORY SYSTEM PA, with PA> PS. Once the only command being processed is the PRE command, the device and accessed banks transition to Sstate. When no command is executed and no memory access request exists in the memory controller buffer for a certain time interval, the memory controller returns the device to PD state. Most modern memory controllers implement open-page and/or close-page policies. They differ on how the data array row-buffer is managed (for how long the row-buffer keeps open). Next, we present how per-task energy is metered under both policies. 5.3.2 Per-Task Energy Metering for Close-Page Our idealized model relies on the fact that background energy consumption of a device depends solely on its current state, which can be induced by different, concurrent accesses. Therefore, our model attributes background energy to each task based on the state it imposes on memory. Memory occupancy is discarded as input for the model since background energy does not depend on it. As reported in [22] background energy accounts for over 50% of the memory energy consumed by programs. Memory occupancy is discarded as input for the model since background energy does not depend on it. Thus, distributing background energy according to resource utilization is crucial to meter per-task memory energy accurately. 1. During PD, only background power is consumed. Such energy cannot be attributed to any task since no task has any memory activity during PD. Hence, we divide background power evenly across all tasks running in the system. 2. Whenever a DRAM device switches from PD to Sstate, the extra background power incurred due to Sstate, i.e. PS−PP D is distributed uniformly across all tasks with inflight commands that force the DRAM devices to stay in Sstate. 3. When a DRAM device is in Astate (active), the extra power incurred (i.e. PA−PS) is distributed evenly across all tasks enforcing Astate. For instance, Table 5.1 shows the case where one task, T0, issues a read command (first row) while another task, T1, issues no command. Next, let us assume that those are the only tasks using the memory system. During the whole period, T1is responsible only for half of the PPD power (last row), while T0is responsible for half of the PP D and all PS and PAextra power (penultimate row). When multiple commands are processed in parallel, we follow the same principle of attributing power to those tasks that impose the memory chip to be on a given state. In
5.3. IDEALIZED PTEM FOR DRAM MEMORY 73 Table 5.2: Memory commands, timing, device states and background energy breakdown for several operations in close-page mode. Comm. T0−ACT READ PRE − T1−ACT READ PRE − Timing T0−tXP tRCD tRTP tRP − T1−tRRD tRCD tRTP tRP . . . State Bank0 PD S A S S PD Bank1 S A Bank2S Bank3 Rank EPD ESEAESEPD Power T0EP D 2ES−EP D 2EA−ES 2 EA 2 ES 2 EP D 2 T1EP D 2 ES 2 EA 2EA−ES 2 ES 2ES−EP D 2 EP D 2 the example in Table 5.2, we show a particular case where both T0and T1issue commands in parallel. First, the device is in PD state. Eventually, T0makes the device transition to S, so T0is responsible for the extra background power. Then, devices transition to Astate and T1starts its activate command. Both tasks are equally responsible for PP D and PS power, but only T0is responsible for PApower. Later, T1also enforces memory to be in A state so that the total power must be uniformly distributed across both tasks. Finally, as commands finish, tasks T0and T1stop enforcing high-power states and power dissipation is attributed only to those tasks imposing each particular state. Regarding the refresh operations, according to the JEDEC standard of DDR2/3 SDRAM memory [52], it is required to issue eight refresh commands during a given time window. Thus, the memory controller has some flexibility to schedule those refresh commands, so that the execution of commands from tasks can avoid interruption. The refresh energy is guaranteed to be constant in the memory system during a given period of time, regardless of the activities of running tasks. Given that refresh commands occur in all banks simultaneously, they cannot happen in parallel with any other command. Thus, both dynamic and background energy incurred during refresh is accounted as refresh energy. Although refresh energy is not triggered by the execution of tasks, it is consumed as long as the system is powered up. Thus, tasks running in the system are assumed to be responsible for the system being up, and so refresh energy is evenly split across those tasks. 5.3.3 Per-Task Energy Metering for Open-Page As opposed to the close-page policy, in open-page, ACT/PRE commands may not be needed by a memory access, since banks remain open after being accessed. However,
74 CHAPTER 5. PER-TASK ENERGY METERING FOR THE DRAM MEMORY SYSTEM Table 5.3: Memory commands, timing, power states and background energy breakdown when hit in row buffer in open-page mode. Comm. T0−ACT READ − − T1− − READ − Timing T0−tXP tRCD tRTP − T1−tRT P − State Bank0 PD S A Bank1 S Bank2 Bank3 Rank PPD PSPA Power T0PP D 2PS−PP D 2PA−PP D 2 PP D 2 T1PP D 2PA−PP D 2 energy consumed by open banks is still attributed to those tasks that opened the banks. Regarding background energy, the same principle as for close-page is followed: attributing the energy to tasks based on the state they impose to memory. As in the close-page policy, devices are powered up and activated (A state) to execute commands. However, once the corresponding read/write operation finishes, those devices remain open in A state. This is illustrated in the example in Table 5.3 that reflects the case of a row-buffer hit. The task that opened the bank (T0in the example) is responsible for the extra background energy of the activated devices (after the first tRT P ). Eventually, another access to the open banks can occur. If this is the case, no precharge command is needed. Since T1read access is a row-buffer hit, it can directly read data from the row buffer. Consequently, T1becomes responsible for the extra background energy, while T0 is only responsible for half of the PD energy. Analogously, the same principle also applies when multiple accesses are interleaved, as shown in Table 5.4. In this particular case, T0has already opened one bank (Bank0), which imposes the A state to the rank and the corresponding bank. Eventually, T1accesses the same rows which incurs a row-buffer hit. During this process, the extra background energy attribution switches like in the previous example. Then, after T1finishes its operation, T0accesses the same rows which incurs another row-buffer hit. Thus, the attribution of extra background energy switches back to T0again. Whenever the page is closed, T0is also responsible for the precharging dynamic energy, which should have been attributed to T1if T0had not accessed the open bank. The main reason why we distribute the extra background energy this way is that, when the bank is firstly opened, it is impossible
5.3. IDEALIZED PTEM FOR DRAM MEMORY 75 Table 5.4: Memory commands, timing, power states and background energy breakdown when multiple interleaved accesses from two tasks accessing the same bank in open-page mode. Comm. T0READ −READ −PRE T1−READ − Timing T0tRT P −tRT P −tRP T1−tRT P − State Bank0A S Bank1S Bank2S Bank3S Rank PAPS Power T0PA−PP D 2 PP D 2PA−PP D 2PS−PP D 2 T1PP D 2PA−PP D 2 PP D 2 to predict its future accesses, thus the activation energy is attributed to the first user. Similarly, the precharging energy is attributed to the last user, who triggered the PRE command. Regarding background energy, we also assume that the last task imposing a particular device state accounts for the extra energy. Although our choice is, to some extent, arbitrary, we regard it as fair. In summary, activate and read/write dynamic energy is attributed to the task performing the access, whereas precharge energy is attributed to the last task accessing such row. Note that on a refresh command all banks need to be closed, and so precharge energy for open pages is attributed to the last task accessing each of them. Other than that, energy distribution is analogous for close-page and open-page policies. 5.3.4 Ideally Formalized Per-Task Energy Metering in Memory We generalize the memory energy consumed by each task as follows. 1) The background (bg) energy attributed to a task can be generalized as follows for both open- and close-page policies: Emem bg (Ti) = EPD ×ExecTime(Ti)/NT + ExecT ime(Ti) P j=0 (ES−EPD)×δS i,j NT S,j + ExecT ime(Ti) P j=0 (EA−ES)×δA i,j NT A,j (5.9)
76 CHAPTER 5. PER-TASK ENERGY METERING FOR THE DRAM MEMORY SYSTEM In the first addend each running task is metered an even part of EP D, where ExecTime(Ti) stands for the execution time of task iin cycles and NTfor the number of tasks running in the processor – not necessarily the maximum number of tasks allowed in the processor. The second and third addends meter ES−EPD and EA−ESfor tasks enforcing those states. NT S,j and NT A,j correspond to the number of tasks imposing Sand Astates respectively in cycle j; and δS i,j and δA i,j indicate if the task imakes memory be in Sand Astate respectively, in cycle j. In other words, δA i,j is 1 if task iis executing a read,write or activate (last tRCD cycles) command in cycle j, and 0 otherwise; and δS i,j is 1 if task iis executing a precharge or activate (first tXP cycles) command or if it has pending commands in the memory controller while all banks are idle in cycle j, and 0 otherwise. Note that, as stated before, memory occupancy is not considered for metering energy to tasks since the memory regions not used by the task under consideration cannot be turned off when idle. Hence, background energy remains the same regardless of the memory space used. 2) Active energy for a task depends on the number of commands it performs, as shown in the following equation: Emem dyn (Ti) = Emem read ×NRD(Ti) + Emem write ×NW R(Ti) +Emem ACT ×NACT (Ti) + Emem PRE ×NP RE(Ti) (5.10) where Emem read ,Emem write,Emem ACT and Emem PRE stand for the energy of each command, and NRD(Ti), NW R(Ti), NACT (Ti) and NPRE(Ti) stand for the number of memory internal commands executed by task i. 3) Refresh operations may have some side effects such as delaying some commands issued by running tasks. However, this fact does not alter the energy model. Also, refresh commands consume some energy to access the corresponding rows. Since refresh operations are distributed evenly over time at a fixed rate and they are not originated by any particular task, their energy is split evenly across all running tasks. Thus, refresh energy per task is as follows: Emem refr (Ti) = Emem refr ×NRef ×ExecTime(Ti)/NT(5.11) Emem refr corresponds to the active energy of a refresh command. NRef corresponds to the average number of refresh operations performed per cycle.
5.4. DREAM, AN IMPLEMENTABLE APPROACH 77 5.4 DReAM, an Implementable Approach Implementing the exact computation of the idealized energy model is expensive — if at all feasible — due to the large number of events to be tracked, the frequency at which they must be tracked, and the lack of information that the processor has about the memory state. On the other end, metering memory energy evenly among running tasks or proportionally to the number of accesses that they perform requires minor changes to current architectures. However, these approaches exhibit low estimation accuracy as shown later in Section 5.5.2. Therefore, we propose DReAM, our per-task energy metering approach that trades off energy metering accuracy and implementation complexity. In DReAM memory model, active and refresh energy can be easily tracked as in the idealized model. This requires the memory vendor to provide the active energy per access type, namely Emem read ,Emem write,Emem ACT and Emem PRE for tracking active energy and Emem refr for tracking refresh energy, as well as the average number of refresh operations per cycle (NRef ). These parameters are already provided by chip vendors like Micron for DDR2/3 memories [84], so our model imposes no change to current DDR2/3 memories. In the memory controller, we only require per-task activity counters, namely NRD(Ti), NWR(Ti), NACT (Ti) and NPRE(Ti). Total background energy, Emem bg,total can be obtained by metering memory energy consumption [43] and subtracting active and refresh energy. The PD background energy is constant and hence easy to track. Meanwhile, the remaining background energy, Emem rem , is due to active and standby periods (i.e. Emem bg,total =Emem PD +Emem rem ). Our model distributes Emem PD uniformly across all tasks, while Emem rem is distributed based on access frequencies per task. To that end, we divide the execution into intervals of IntMem processor cycles and track the number of memory accesses sent to the memory controller (in a per-task basis) in the current interval. Thus, background energy is obtained as follows: Emem bg, total(Ti) = Pmem PD ×ExecTime(Ti) NT + ExecT ime(Ti) IntMem X j=0 NTi acc,j NTOT acc j ×Emem rem,j (5.12) where Pmem PD is the PD background energy, NTi acc,j tracks the number of memory accesses of task iduring interval j, and NT OT acc jtracks the total number of memory accesses in interval j.Emem rem,j is the non-power-down background energy in interval j, obtained by subtracting all other sources of energy consumption from the total energy measured in the interval. Sensitivity to the sampling interval (IntMem) is studied in the evaluation section.
78 CHAPTER 5. PER-TASK ENERGY METERING FOR THE DRAM MEMORY SYSTEM Table 5.5: DReAM hardware requirements. Block Memory Vendor Extra Logic Memory Emem read ,Emem write,NRD,NW R,NACT ,NP RE, Emem ACT ,Emem P RE ,NRD (Ti), NW R(Ti), Emem P D ,Emem refr ,NACT (Ti), NP RE (Ti), NRef IntMem cycle counter Putting it All Together DReAM requires little hardware overhead. DReAM mostly requires setting up some counters similar to the PMCs currently available in most high-performance processors. DReAM support does not interfere the execution of programs since it is not in any critical path. Table 5.5 summarizes those parameters required from the memory vendor and the extra logic (i.e. counters) that must be set up. Counters with the “(Ti)” suffix must be replicated for each task. Thus, how many of them are needed is dictated by the number of tasks that may run simultaneously in the chip. Regarding the interface with the software, the OS is responsible for keeping track of the energy consumed by every task running in the system. DReAM exports a special register, called Memory Energy Metering Register (MEMR), that acts as the interface between DReAM and the OS. The OS can access that register to collect the energy estimates made by DReAM. This typically will happen when a context switch takes place. At that moment, the OS reads the MEMR using the hardware-thread index (or CPU index) for the task that is being scheduled out (Tout). Then, the OS aggregates the energy consumption value read in the task struct for Tout. Right after the new task (Tin) is scheduled in, the memory state may remain at a particular state due to an access triggered by the task that has been scheduled out. Although, DReAM attributes background energy consumption to Tin, this occurs during few cycles (in the order of tens or hundreds of cycles). Under a processor frequency of 2GHz, 500 cycles are equivalent to 0.25µs, while context switches occur at much higher granularity, every 10-100ms. As in chapter 4, the time the OS spends working on behalf of a given task is attributed to the calling task. The remaining energy consumed by the OS can be evenly attributed to all running tasks. In any case, DReAM provides the hardware support needed to attribute OS energy to tasks as required.
5.5. EVALUATION 79 5.5 Evaluation 5.5.1 Experimental Setup The main experimental setup is introduced in Section 3.4. In particular in this chapter, we consider three CMP processor configurations with 1, 4 and 16 single-threaded cores. The LLC is partitioned with 256KB 16-way per core. Therefore, the LLC size is 256KB, 1MB, and 4MB for 1, 4, and 16 cores, respectively. These configurations have been chosen to discount the effect of on-chip inter-task interferences due to shared resources (e.g., shared LLC cache), thus allowing to consider memory effects only. For the DRAM memory we model an 8GB memory as it is large enough to support the workloads used in this work. DRAM memory is single-rank with 8 devices per rank, 8 banks per device and 8 arrays per bank. We evaluate close-page and open-page DRAM memory row-buffer management policies, but differences were negligible: Since many current DRAM memories have a low-power mode, the open banks under open-page policy quickly transition to power down state when there is no incoming request. In this case, open-page policy performs similarly to close-page in most of the cases. Thus, we only report results for one of the policies: close-page. Average power consumption for the 8GB setup is 5.4W, 8.6W and 18.8W for 1-thread, 4-thread and 16-thread workloads respectively. For a setup of 64GB (results not shown in this work) power increases by a 2x-3x factor (e.g., 14.7W for 1-thread workloads). Note that this is around half the power consumption reported in Section 5.1, which is consistent since our setup is less aggressive than that of the particular server used in the real experiment. In particular, we assume a processor operating at 2GHz and DRAM operating at 1GHz, whereas the CPU of the server used operates at 3.2GHz and its memory at 1.6GHz. Nevertheless, our proposal is orthogonal to those parameters. The benchmarks and workload generation strategy are introduced in Section 3.4.3. To measure accuracy in the energy estimations, we make use of the metrics in Equations 3.1 and 3.2. 5.5.2 DReAM Energy Estimation In this section we show the accuracy of DReAM with respect to the ideal model presented in Section 5.3. We also include the ES model that uniformly splits energy across all running tasks regardless of their activity and memory behavior, together with a simple PTA model that splits energy across tasks proportionally to their memory accesses.
80 CHAPTER 5. PER-TASK ENERGY METERING FOR THE DRAM MEMORY SYSTEM Figure 5.1: Per-task DRAM memory energy prediction of a 4-core workload soplex+sjeng+gcc+namd with different sampling intervals. 5.5.2.1 DReAM Sampling Interval (IntMem) The memory energy consumption prediction of DReAM varies with different sample period (interval) lengths. When choosing the interval length, we seek for a reasonable tradeoff between accuracy and hardware cost. Figure 5.1 shows the average WldPredError for each task in a particular workload. This workload belongs to group Xand runs in a 4-core configuration. We explore sampling periods from 128 to 500K processor cycles. Trends for most workloads are similar, so we have used this particular one to illustrate the sensitivity of DReAM to the particular sampling period. As expected, higher sampling frequency increases accuracy. However, discrepancy between short and long sampling periods is not huge (from 4.6% to 7.4% average Wld- PredError). Some meaningful average WldPredError increase is observed when moving from a 512-cycles sampling interval to a 1024-cycles interval. Further increasing the interval size until reaching half million cycles has little impact on accuracy since deviation from the ideal model quickly flattens1. Thus, we have chosen two different interval sizes with different accuracy/cost tradeoff: 512 and 500K cycles sampling intervals. 1Longer sampling period is also applicable, however, DReAM aims to provide the estimation in a finer granularity than the operating system quantum to be of more flexible use.
5.5. EVALUATION 81 5.5.3 DReAM Energy Consumption Prediction Next we evaluate the off estimation for 4-core and 16-core processor setups with respect to the ideal model. Note that the ideal model is the only reference model as no existing hardware provides accurate per-task DRAM energy metering. Figure 5.2 shows the result for the 24 workloads (8 of each type) for the 4-core setup. We observe that, in general, the ES model is highly inaccurate averaging over 45% prediction error across all workloads. Prediction is more accurate for Land Hworkloads than for Xones. This is expected since benchmarks in Land Hworkloads are more homogeneous, so their individual power consumption is also more homogeneous than in Xworkloads. In some particular workloads, the prediction error is even below 10%. Nevertheless, ES model prediction error is very high in general, ranging from 30% to 85% for most workloads. For Xworkloads, the prediction error is always above 58%. PTA model improves the estimation accuracy, with an average prediction error around 23%. PTA accuracy is high for Hworkloads (the errors are all under 10%) since the large number of accesses of Hbenchmarks makes energy more proportional to the number of accesses (dynamic energy becomes dominant). However, benchmarks in Lgroup infrequently access memory, so their memory energy is mainly background energy, which PTA fails to predict accurately. This fact is particularly noticeable for workload w4 where, although all tasks have few memory accesses and so, their energy is dominated by PD background energy, the fact that one task has a number of access relatively much higher than the others makes it account for most of the energy, thus producing very high error prediction. Conversely, in this workload the ES model is far more accurate than PTA since energy is quite homogeneous across tasks in the workload. Our DReAM model improves prediction accuracy significantly over both ES and PTA. When the sample period granularity is 512 cycles, the prediction error is always below 10%, and 3.9% on average. If the sampling period increases to 500K cycles, the prediction error may reach 14.0% at most for one particular workload, and 6.1% on average. As shown, DReAM successfully predicts the energy consumed by each task consistently across workloads. In particular, this holds (i) when PTA works well and ES not (e.g., workload w12), (ii) when ES works well and PTA not (e.g., workload w4), and (iii) when both PTA and ES work badly (e.g., workload w5). Figure 5.3 shows results for the 16-core setup. First, we observe that ES and DReAM accuracy remains similar to that of the 4-core setup. In contrast, PTA accuracy slightly improves. The average prediction error across all workloads for the ES model rises to 53%. The increase is particularly noticeable for Lworkloads. Since total energy for Lworkloads
88 CHAPTER 5. PER-TASK ENERGY METERING FOR THE DRAM MEMORY SYSTEM Figure 5.8: Ltype workload power consumption comparison in a 4-core setup. Figure 5.9: Ltype workload power consumption comparison in a 16-core setup. LType Workloads Figure 5.8 shows the power consumption in an Ltype workload with 4 cores. As shown before, power is reduced to less than half on average for Lworkloads in comparison with the ISO case. However, when we analyze benchmarks individually, we observe that those benchmarks with higher memory access frequency (gromacs and dealII ) have higher WL case power consumption. This is so because workloads are not fully homogeneous and discrepancies in the memory access frequency lead to higher background power for those programs keeping the memory in a higher power consuming state longer.
5.6. CASE STUDY 89 Figure 5.10: Htype workload power consumption comparison in a 4-core setup. The fact that PD state background power is very low makes programs with a relatively higher memory accessing frequency increase their background power noticeably in relative numbers. Therefore, they are responsible for a larger fraction of the total energy consumption (and so of the power consumption). Active power remains basically the same for ISO and WL since energy per access is constant and execution time barely changes. Results for an Lworkload in a 16-core setup are shown in Figure 5.9. Trends are analogous to those reported for the 4-core setup with the only difference that power reductions are larger as already pointed out for the average results across all workloads. HType Workloads Figure 5.10 shows the power consumption in an Htype workload on a 4-core setup. We can observe that, as on average, power decreases moderately in the WL case with respect to the ISO case. Analogously to the trends in Lworkloads, the higher the memory access frequency, the lower the power reduction in the WL case since access frequency strongly correlates with background power. This is the case for benchmark lbm, whose power consumption decreases only by around 40% instead of the average 55% for the whole workload. In a 16-core workload in Figure 5.11 we also observe similar trends as those in the average case. This is expected because Hworkloads are much more homogeneous than the others (Land X) since relative variations in accessing frequency across benchmarks is low (all of them access memory at least 5 times every 1000 cycles in isolation). Again, we observe that power in WL is much lower than in ISO, and such power decrease is much higher than for the 4-core case.
90 CHAPTER 5. PER-TASK ENERGY METERING FOR THE DRAM MEMORY SYSTEM Figure 5.11: Htype workload power consumption comparison in a 16-core setup. XType Workloads Figure 5.12 shows a 4-core Xworkload. In this workload, bzip and soplex are Hprograms whereas gromacs and gamess are Lprograms. Notably, the same trends observed in pure Hand Lworkloads still hold for each Hand Lbenchmark in Xworkloads. As expected, soplex is the program experiencing a lower power reduction when moving from ISO to WL due to its high access frequency. In the 16-core setup (see Figure 5.13), those trends still hold. Only T11 behaves differently since its power reduction in WL is not as significant as for the other benchmarks with similar access frequency. The reason is that this program accesses memory frequently (therefore its active power is high), but it does it in bursts, so that the amount of time that DRAM devices are imposed to be at high power states (active or standby) is relatively low, and it makes its ISO background power low (e.g., compared to that of T10 or T12). Therefore, its relative background power reduction in the WL case cannot be as significant as for other benchmarks with similar average access frequency but with different access patterns. We do not further discuss the MEPI for those particular workloads since the conclusions are similar as those for the power. We have shown that multicore architectures help reducing per-task memory power and energy. Energy savings are more significant for those programs with lower memory access frequency on higher core count setups, and trends do not change across workloads. Furthermore, exceptions do not deviate much from the average case, and when they do, it is because of their access patterns (burst versus scattered). We have also shown that the impact of memory contention highly correlates with the
5.6. CASE STUDY 91 Figure 5.12: Xtype workload power consumption comparison in a 4-core setup. Figure 5.13: Xtype workload power consumption comparison in a 16-core setup. accessing frequency of benchmarks. Our results show that high-access-frequency programs decrease their power at the expense of increasing the energy. Our study proves that memory energy profiles are quite stable for applications despite the programs running simultaneously. Besides, it is preferable to run Hprograms with Lprograms to reduce the negative impact of memory contention in terms of energy consumption (once discounted LLC interferences). This information is very useful to perform task scheduling on multicore setups.
92 CHAPTER 5. PER-TASK ENERGY METERING FOR THE DRAM MEMORY SYSTEM 5.7 Summary Per-task energy metering is needed in multicores to enable a number of performance/energy optimizations. In this chapter, we propose the PTEM models in DRAM memory system. Including ideal models for both close-page and open-page policies and devise DReAM, an efficient and accurate implementation of such ideal model. We show how DReAM achieves a prediction error between 3.9% and 4.7% with respect to the ideal model with negligible overhead for 4- and 16-core setups respectively. The error is largely below the error introduced by approaches such as distributing energy evenly or proportionally to memory accesses. Next, we have shown that multicore architectures help reducing per-task memory power and energy. Energy savings are more significant for those programs with lower memory access frequency on higher core count setups, and trends do not change across workloads. Furthermore, exceptions do not deviate much from the average case, and when they do, it is because of their access patterns (burst versus scattered). Finally, we have proved that the impact of memory contention highly correlates with the accessing frequency of benchmarks. Our results show that high-access-frequency programs decrease their power at the expense of increasing the energy. Our case study proves that memory energy profiles are quite stable for applications despite the programs running simultaneously. Besides, it is preferable to run Hprograms with Lprograms to reduce the negative impact of memory contention in terms of energy consumption (once discounted LLC interferences). This information can be very useful to perform energy-efficient task scheduling on multicore setups.
6 Sensible Energy Accounting for the Processor 6.1 Introduction Energy is becoming the most expensive resource in computing systems and this trend will continue as the price of energy continues to rise (increasing in recent years by up to 70% in several European countries [28]). Under these circumstances, metering energy consumption of a computing system enables energy optimizations and hence ultimately helps to reduce system operation costs. In a datacenter or supercomputing setting, charging users for energy rather than time makes sense because energy usage is more proportional to the cost of operations. The establishment of multicore and manycore as the de facto hardware paradigm across most computing domains, together with increasing core counts in each new generation, highlights the need for energy metering. Furthermore, applications are increasingly diverse, with many different providers and quite different energy profiles. Thus, accurate energy metering and optimization techniques are essential. In this chapter, we make the case for Sensible Energy Accounting(SEA), as introduced in Section 1.1.2. In contrast to PTEM, SEA does not give the actual energy consumption of a task, but rather an abstraction of the energy consumption that the end-user can rely on to be fair and consistent. Let us illustrate the concept of SEA and how it differs from PTEM with an example. We simulate several SPEC CPU 2006 benchmarks on a 4-core multicore architecture com- 93
94 CHAPTER 6. SENSIBLE ENERGY ACCOUNTING FOR THE PROCESSOR Figure 6.1: Energy usage of namd,astar, and libquantum in different workloads w.r.t their energy usage when executed in isolation with a fair share of resources. prising a shared last-level cache1and the PTEM technique is introduced in chapter 4. We choose namd,astar and libquantum benchmarks since they have different LLC utilization levels. We run each benchmark as part of 4 different 4-task workloads. The other 3 tasks in the workloads are only considered as co-runners, affecting the LLC behavior of the target benchmark. For instance, workload 1 comprises 3 copies of namd, which will cause almost no conflict to the target benchmark in the LLC. In contrast, workload 4 comprises 3 copies of libquantum, which makes the most intensive LLC use across those benchmarks. Workloads 2 and 3 have a mix of benchmarks to show some intermediate points in terms of LLC contention. Figure 6.1 shows the energy metered to the target benchmark in the workload, which is normalized to the energy the benchmark consumes when it runs in isolation with a fair-share of the cache (i.e. 1/4 in our case). We observe that, despite the fact that each benchmark executes exactly the same instructions in each run, the energy it consumes significantly varies depending on the co-running applications. Sometimes the benchmark consumes much more energy, up to 2.2x, than when it runs in isolation with 1/4 of the cache, and other times it consumes as little as 11% of that. This inconsistency is particularly problematic in environments where users are charged for the usage of resources including energy. Users running the same applications with the same inputs would observe different energy profiles for their applications and hence would 1The experimental setup is described in Section 3.2.
6.2. BACKGROUND 95 unfairly receive different amounts billed. SEA helps by providing, for every task in a workload, the energy it would have consumed if run in isolation with a fair share of the shared resources. The energy charged is not exactly the energy consumed, but it is far more fair for end users (their billing solely depends on their own tasks) and still appropriate for the data center operator since typically actual energy consumed is lower than energy accounted due to using non-partitioned shared resources. Note that those energy savings for the operator can be shared with end users by applying discounts for a mutual benefit. In this case, we assume that fhr = 1/N, where Nis the number of hardware threads (cores in this case) in the system. The best value of fhr may vary across domains as shown in the following sections. In this chapter, we develop the concept of SEA from a theoretical point of view and discuss how it can contribute to different computing domains. Secondly, focusing on the on-chip resources, we present a low-overhead hardware mechanism to obtain SEA for a shared last-level cache in a multicore architecture. Our results show that SEA allows saving up to 39% of energy if used for scheduling purposes. Finally, we present a SEA mechanism for on-core resources taking into account SMT. Our results show that prediction error is only 5% on average for the core and between 4% and 8% on average for the whole chip when using SMT cores and a shared last-level cache. We also show how SEA attains much higher accuracy than other state-of-the-art mechanisms such as evenly splitting the energy across tasks or distributing it based on several metrics (number and type of instructions, etc.). The rest of this chapter is organized as follows. Section 6.2 provides background on performance accounting and reconfigurable computing. Section 6.3 explains our theoretical approach towards SEA. Section 6.4 presents SEA for a shared on-chip cache and the core resources, while Section 6.5 presents an evaluation of SEA shared cache and cores resources and integrates them to cover the whole chip. Section 6.6 describes a case study and, finally, Section 6.7 draws the main conclusions of this chapter. 6.2 Background SEA comprises two main building blocks: PTEM techniques and performance (CPU) accounting techniques. In this section we elaborate on the state of the art for both.
96 CHAPTER 6. SENSIBLE ENERGY ACCOUNTING FOR THE PROCESSOR Table 6.1: PTEM and performance accounting in two workloads h264ref calculix povray namd PTEM, EPI(nJ) 0.41 0.25 0.39 0.27 CPU utilization 68% 83% 75% 64% h264ref milc sjeng gcc PTEM, EPI(nJ) 0.73 0.70 0.43 0.82 CPU utilization 24% 86% 45% 75% 6.2.1 Per-Task Energy Metering As energy costs rise, interest in energy metering continues to increase in different computing domains from datacenters to smartphones [17, 90, 92]. PCEM techniques that we introduced in section 2 focus on single-core architectures or multicores in which only one application is executed at one time and provide per-component energy estimations. However, processors incorporate an increasing numbers of cores, each implementing SMT, and running several applications with different energy profiles. In this scenario it is essential to determine energy consumption for each task. Shen et al. [102] proposed a request-level OS mechanism to meter power consumption of each server request based on PMCs [7]. The authors consider both active and maintenance power and attribute it to the responsible server requests. However, per-task energy estimates obtained with this approach cannot be validated since, as stated by the authors, “Request executions in a concurrent, multi-stage server contain fine-grained activities with frequent context switches, and direct power measurements on such spatial and temporal granularities are not available in today’s systems”. PTEM cover this gap by proposing new hardware support to measure the real per-task energy in multicores systems by tracking utilization of hardware resources for each task, including activities they have incurred and the fraction of resources they have used, to determine their fraction of energy used. Results show that under different workloads, the variation of metered energy to some particular tasks can vary up [−25%,40%] with respect to their average energy. 6.2.2 Performance Accounting in Multicores The concept of SEA is inspired by CPU accounting [76] developed for multicores [77] and for SMT cores [29,30,78]. CPU accounting measures the CPU utilization of a given task during a period of time when it runs on a multithreaded processor. CPU utilization depends on both the time the task is scheduled on the CPU and the progress (or slowdown)
6.3. THEORETICAL SEA 97 the task experiences with the multicore. The latter is computed by determining which accesses to shared resources of a given task are delayed due to conflicts with other running tasks. For instance, if a task runs for a period of 1,000 cycles in which it suffers a slowdown of 30%, its progress is 70% of what it would be w.r.t. its execution with a fair share of the resources. Thus, it is only accounted 1,000 ×0.7 = 700 cycles. Performance accounting has been shown to be a powerful tool for performance optimization. For instance, it can be used to predict the performance with different degrees of contention to co-locate applications within the system. Results show that individual application’s performance can be improved by up to 22% and system utilization can be increased by 50% to 90% [80,81,107]. Using CPU accounting to scale energy estimated by PTEM as a way to achieve sensible energy accounting leads to inaccurate results. For instance, instruction mix and data locality have large impact on energy that cannot be distinguished with CPU utilization. To illustrate this point consider the execution of benchmark h264ref under two different 4-task workloads as shown in Table 6.1. In the first workload h264ref incurs an Energy- Per-Instruction (EPI) of 0.41 nanojoules (nJ) and it is accounted 68% of CPU utilization, while in the second workload, h264ref incurs 0.73 nJ EPI and accounts for 24% CPU utilization. One intuitive way to scale energy is to map CPU utilization to resource utilization. In this case, this method estimates that under any resource utilization ru and EPI h264ref would incur SEAru =Nins ∗ru ∗EPI (where Nins stands for the instruction count). So in the first workload SEA0.68 =Nins ∗0.279 (0.41 ∗0.68) and in the second SEA0.24 =Nins ∗0.175 (0.73 ∗0.24). As shown, the discrepancy across energy estimates in different workloads is huge across workloads (around 60%) if only CPU accounting is used and thus, sensible energy accounting is needed. 6.3 Theoretical SEA In this section we introduce our theoretical approach towards SEA showing some crossdomain applications of SEA and present the scenario considered in the rest of the chapter. 6.3.1 Theoretical Approach to SEA SEA estimates an accounting for each task Tiwhile it runs with other tasks (i.e. as a part of a workload), the energy it would have consumed, Efhr Ti, if it had run in isolation with a certain fraction of hardware resources, fhr. Note that, in this abstract model,
104 CHAPTER 6. SENSIBLE ENERGY ACCOUNTING FOR THE PROCESSOR 6.4.3 Implementation of SEA for the LLC The accounting mechanism introduced in Section 6.4.1 is based on the estimation of the number of LLC accesses of each type (for active and maintenance energy accounting) and execution time task of Ti(for maintenance and leakage energy accounting) with M Nways of the LLC. Next we describe affordable ways to approximate accurately those values. Estimating access counts. Our approach to estimate the number of LLC accesses of each type when M Nways of the LLC are used relies on the Auxiliary Tag Directory (ATD) proposed by Qureshi and Patt [96], which focuses on a least recently used (LRU) replacement policy. The LLC is shared among all tasks each of which keep a local copy of the tag directory, the ATD, that is only updated with the accesses of the owner task. If the LLC implements LRU, one can predict whether an access would hit in the LLC for any number of cache ways Mlower or equal to the actual number of LLC ways (N). This is so because LRU keeps in each set the position in the LRU stack of each address, and so the order in which they will be evicted if they are not reused. For instance, if in a 4-way LLC we access addresses A, B, C, D such that they are placed into the same set, the LRU stack, from the most recently used (MRU) entry to the LRU entry is as follows: < D, C, B, A >, thus meaning that if a new cache line is fetched into this set Awill be evicted. Based on the LRU stack one can determine whether a given access would hit or miss with Mways (where M≤N) by simply checking if it hits any of the MMRU entries. For instance, in our example, if we want to know whether accesses would hit in a 2-way cache given the LRU stack of the 4-way cache, we only need to check whether it hits in the 2 most recently accessed entries. In our example, only accesses to Dand Cwould be hits. In general, we can set up N+ 1 counters, C1, ...CN+1 so that Ciwhere 1 ≤i≤Nis incremented every time there is a hit in the wayiof any cache set, and CN+1 is incremented if Xmisses in all cache ways. Then, the number of hits and misses for M Nways of the LLC is obtained as: Num M NLLC hit (Ti) = M X j=1 Cj(6.7) Num M NLLC miss (Ti) = N+1 X j=M+1 Cj(6.8) If different types of accesses have different energy consumptions (e.g., read and write operations), then N+1 counters need to be kept by each operation type so that each access updates the counter corresponding to its type. In practice, pseudo-LRU replacement is
6.4. SEA FOR MULTICORES: LLC AND CORE 105 commonly used for LLCs. Although the ATD has been devised originally for LRU caches, it has been shown to be highly accurate if pseudo-LRU is used instead [60]. Adapting the ATD to other replacement policies is left as future work and beyond the scope of this work. Therefore, the ATD allows computing the number of accesses of each type (Num M NLLC actionj(Ti)). However, keeping one ATD per thread may be over costly. Thus, the authors in [96] propose the Sampled ATD (SATD), which relies on keeping the tags only for a reduced number of the cache sets. For those sets it is also computed the overall hit probability for the different number of ways, h1, ..., hN, so that on an access to a set not present in the SATD, which will likely be the case of most accesses, can be predicted to be a hit or a miss. For that purpose, we use a Monte Carlo approach, that offers a high degree of accuracy and can be applied to each access at runtime. In particular, a random number RN is generated in the range [0,1]. This random number, RN and the actual hit probabilities for each number of ways, h1, ..., hN, are used to decide whether the current access should be a hit or a miss under each number of ways. Given that increasing the number of cache ways can only increase the hit rate4, we have that hi≤hi+1 for 1 ≤i<N. In order to mimic a given hit probability h(e.g., h= 0.7), we use RN such that the access is a hit if RN ≤hand a miss otherwise. Thus, we have to find the value of kwhere 1 ≤k≤N+ 1 so that hk−1< RN ≤hk. Such kvalue indicates that the access is a hit for caches with M≥k. For instance, in our example of a 4-way cache we could have hit probabilities 0.2,0.3,0.7,0.9. If RN = 0.6 then k= 3 as RN is between h2and h3, thus meaning that the access is assumed to be a hit if M≥3, so if the thread is given 3 or 4 LLC ways. Similarly, if RN = 0.95 then k= 5, thus meaning that the access is a miss for any number of ways in the LLC. The SATD trades hardware cost for accuracy: the lower the number of sets sampled, the lower the cost but the lower the accuracy. The particular degree of sampling used for the SATD is indicated later in the results section. Estimating the execution time with a given cache fraction. CPU accounting for multicores, introduced in [76], relies on using the ATD to decide whether each cache miss for a task Tiwould hit or miss with a given fraction of the cache (typically a fair share of the cache space). A miss is caused by inter-task interferences if the access hits in the task’s local ATD and misses in the LLC. In that case, if the processor stalls, the cycles 4Given a cache with Xways, increasing its size by any number of ways (Y) so that its total number of ways becomes X+Y, can only have a hit rate higher or equal than with Xways only. This is so because the LRU stack for the Xways closer to the MRU position in the X+Ycache is identical to the LRU stack of the X-way cache. Thus, all accesses hitting in the X-way cache will hit in the Xways closer to the MRU position in the X+Y-way cache. Then, the remaining Yways may provide some more hits.
106 CHAPTER 6. SENSIBLE ENERGY ACCOUNTING FOR THE PROCESSOR needed to serve the miss are not ‘accounted’ to the task, meaning that the task would not suffer that miss, and hence the associated penalty, if it had run a given share of the cache. Similarly, this CPU accounting mechanism accounts extra cycles to Tiin case of an LLC hit that would have been a miss if Tihad run with a given fraction of the cache space . This CPU accounting mechanism can be used to estimate the execution time that a task would have used to run with a given fraction of the resources, ExecTimeM NLLC(Ti). This helps estimating the maintenance and leakage energy for a task since they are affected by the time the task would run with a given fraction of the resources. Hence, we extend the CPU accounting mechanism for an N-way LLC to estimates the execution time of the task under any fraction of cache ways (M Nwhere 1 ≤M≤N). CPU accounting uses the ATD as if the full cache is allocated to the task Ti. Cache accesses are considered to hit if they hit in the ATD, and to miss otherwise. In our case, we want to retrieve such information for different numbers of cache ways. The ATD provides such information by considering only those Mentries closer to the MRU position. Thus, given a cache access we can determine whether it would hit in any cache with 1 ≤M≤Ncache ways by checking the MATD entries closer to the MRU position. Then, we can use such information to perform CPU accounting simultaneously for all different cache sizes. For each task we need Ncycle accounting (CA) registers, CA1, ..., CAN, which are updated as described in [77], but where the decision on whether an access should be a hit or a miss – and so how CPU cycles need to be accounted – for CAMis done assuming M Ncache ways. Finally, note that CPU accounting can be implemented on top of the SATD with the same pros and cons as for counting the number of events of each type. Overall, hardware requirements of the SEA for the LLC approach include a SATD for each task, the minimal logic and registers for accounting the CPU cycles per task introduced by Luque et al. [77], and N+1 counters per task to obtain access counts for different numbers of LLC ways at once. 6.4.4 Implementation of SEA for an SMT Core Tracking the activities of a given task Tiin all resources in the core is unaffordable. Instead, we propose periodically running a task Tiin isolation with a given fraction of the core resources and directly measure the energy, based on which we account the energy sensibly. Thus, we make use of the Micro Interval Based Time Accounting (MIBTA) approach introduced in [77], which has been used for performance accounting, and PTEM for pertask energy measuring to derive the accounting energy to Ti. MIBTA divides execution time into time intervals in which the execution of running tasks are sampled alone in turn.
6.4. SEA FOR MULTICORES: LLC AND CORE 107 During these sample phases, while one task has been granted the use of all resources in the core, the other running tasks are stalled temporarily. In our case, we need to carry out such sampling, but only allowing Tito use M Nof the core resources. The purpose of using these approaches is to sample Ti’s energy consumption periodically when it uses M Nof the core resources alone. During the sampling phases, PTEM can be used to measure Ti’s actual energy consumed in the core. PTEM provides accurate measurements of the active, maintenance and leakage energy consumption in the core, so their addition during the sampling intervals provides an accurate estimate of the energy accounting to Ti. In the case to account active energy, the metered energy is nearly the energy that needs to be accounted. However, maintenance and leakage energy to account are corresponded to the fraction of maintenance and leakage energy of the whole core. Thus, SEAcore is estimated as follows: E M Ncore act (Ti) = P M Ncore act,PTEM (Ti)×ExecTime M Ncore MIBT A(Ti) (6.9) E M Ncore main (Ti) =M N×P M Ncore main,PTEM (Ti)×ExecTime M Ncore MIBT A(Ti) (6.10) E M Ncore leak (Ti) = M N×P M Ncore leak,P TEM (Ti)×ExecTime M Ncore MIBT A(Ti) (6.11) P M Ncore act,PTEM (Ti), P M Ncore main,PTEM (Ti) and P M Ncore leak,P TEM (Ti) stand for the active, maintenance and leakage power respectively estimated by PTEM mechanism when running Tiduring sampling periods. ExecTime M Ncore MIBT A(Ti) stands for the execution time predicted during the MIBTA phases when Tiis running with M Nof the core resources. Before entering the MIBTA phases (every 2.6 million cycles [78]), the execution of all tasks is stalled. Then, a controller restores the execution of a particular task to allow it run alone in the core for 50,000 cycles to warm up. When time is up, controller grants it another 50,000 cycles, during which some specified events are monitored to predict its execution time and energy consumed in such condition. The state of the other tasks is stored in the LLC when they get stalled, and their execution is restored after each MIBTA phase. In order to provide SEAcore capability, right after stalling the execution of the other tasks, the core is reconfigured to use M Nresources. Adaptive processors (or reconfigurable processors) have already been studied in the past to reduce power consumption [4,23,47]. In each component, such as the branch predictors and the buffers [46], register files [1,42], issue queues [18, 33, 93], caches [4, 96, 106], functional units, and fetch, decode and issue bandwidth [4,23,47], power gating techniques have also been proposed with minimal area and energy overheads to power down different sections, with negligible impact on the delay.
108 CHAPTER 6. SENSIBLE ENERGY ACCOUNTING FOR THE PROCESSOR With these techniques that are already in place, in the cache-like blocks, SEAcore can assign M Nof the ways to Tiduring the MIBTA phases with the remaining ways power gated. Similarly, during the sample phases, Tiis only allowed to use M Nentries in the SRAM-like components, such as the issue queues and renaming registers, etc. In contrast, non-occupancy-based blocks are reconfigured in a way that M Nof the bandwidth and the resources can be used in every cycle. If this fraction cannot be applied exactly, it is enforced the closest value while still allowing Tito progress. For instance, if Tiis entitled to use 1 2of the resources and there are 3 adders, it will be allowed to use either 1 or 2. In this case we break the tie providing the lowest value (1 adder) given that for some resource fractions can only be rounded up (e.g., if there is just 1 integer multiplier). SEAcore has considered ALUs, on-chip network bandwidth, as well as fetch, decode, issue and commit bandwidth. Note that during each MIBTA phase, some instructions may be squashed (i.e. when tasks are stalled to run one of them in isolation). They are reexecuted when the corresponding task is resumed since the program state (register contents) has been saved. In addition, the stalled task may have their used cache lines evicted by the running task, and thus incur extra cache misses. The result performance loss is detailed in [78] and described in later sections. 6.4.5 Putting It All Together We have introduced the SEA proposals in LLC and SMT core separately, the correlation must be taken into account when integrate them. In general, there is no conflict on the configurations of SEALLC and SEAcore, in the sense that one can use any fraction of its resource. Note that SEAcore needs to account energy of each task in the core sequentially by sampling them one after another in a particular order. However, the SEALLC does not impose any constraint on how tasks must run to account their energy. Therefore, while MIBTA, needed by SEAcore, sample one task at a time in any particular core, this can occur while other tasks run in other cores. Thus, the overhead of serializing tasks execution for sampling is limited by the degree of multi-threading in one core, but not by the number of tasks in the whole processor chip. Therefore, one can sample tasks in different cores simultaneously in a way that scalability is not challenged when a large number of cores is in place. Tasks interacting in the L1 cache have an impact on the number of LLC accesses, potentially causing inaccuracy in SEAchip. To eliminate this effect, we monitor the number of LLC accesses per instruction during MIBTA phases when tasks run in isolation and thus have exclusive access to the L1 cache. The resulting LLC access frequency is assumed
6.4. SEA FOR MULTICORES: LLC AND CORE 109 Table 6.3: SEA hardware requirements Description HW overhead (8 core) (S)ATD ATD with sampled sets Total of 1920B per task, e.g. LRU stack distance counter 0.7% of the LLC space ITCA logic to determine IT misses Negligible logic to account CPU cycles Reconfig. core Branch predictor and buffers [46], register file [42], issue queue [18, 33, 93], ALU, and fetch, decode and issue bandwidth [4]. Negligible MIBTA CycleAccountMIBT A 2B per task InstCommitMIBT A 2B per task PTEM Energy Metering Registers 0.63% chip area overhead, Occupancy Counters 0.3% energy overhead [72] SEA Energy Accounting Registers 2 counters of 4B per task Target core and LLC resources 2 counters of 4B per task constant until the next MIBTA phase. SEA hardware support and overhead. Regarding the hardware support incurred overheads, SEA mostly inherits them from PTEM and MIBTA, as shown in Table 6.3. Such overhead has been proved low, as can be seen in the same table with a 8-core configuration. Both PTEM and MIBTA require the SATD, whose area overhead is around 0.7% of the LLC [77,78,96]. Few extra registers are needed by PTEM and MIBTA with negligible area overhead. In terms of energy, overheads are largely below 1%, which have been reported for PTEM in Section 4.4.4, and they have been shown not to grow with the number of cores. MIBTA also introduces some performance overhead, which ranges between 1.0% and 3.2% [78]. Given that we have enhanced the MIBTA approach by allowing sampling tasks in all cores simultaneously instead of serializing task samplings across cores, the overhead is mildly reduced and does not grow with the number of cores. Our results show that MIBTA performance overhead remains around 2% on average regardless of the number of cores. In terms of energy, reconfiguring components in the core needs little extra logic to perform clock (or power) gating of unused parts during MIBTA monitoring periods. Such logic has been proven to have negligible area and power overhead and, in fact, it has been used to implement low power mechanisms sharing the costs [4, 18, 33, 42, 46, 93]. Finally, SEA incurs very low overhead on its own due to those registers to store the accounted energy per task for the target core and LLC resources. Which we call Energy Accounting Register (EAR), that acts as the interface between PTEM and the OS.
110 CHAPTER 6. SENSIBLE ENERGY ACCOUNTING FOR THE PROCESSOR Other considerations SEA may require considering temperature and voltage changes due to DVFS. We note that the LLC typically operates in a separate voltage domain as its voltage cannot be easily decreased. Memory cells are sized to maximize integration, thus small transistors are used which are highly susceptible to process variations requiring high voltage operation to read/write cells. Still, this is not a concern given that LLC active energy is low and idle banks are typically kept at lower voltages. Temperature variation is negligible in the LLC as its low activity keeps it at a mostly constant temperature. Regarding the core, we note that DVFS becomes harder to use due to the need for decreased voltage for energy savings and increased minimum operating voltage to tolerate process variations [13]. As a consequence, the acceptable voltage range narrows down in each technology generation. On the other hand, temperature variations in the core can occur. SEA can deal with voltage and temperature variations in both the core and the LLC by having as many energy constants (those that need to be provided by the chip vendor) as valid combinations of voltage and temperature ranges are allowed for the corresponding hardware block. For instance, if the processor can operate at 0.8V, 0.9V and 1.0V, and temperature ranges are discretized as 320K-330K, 330K-340K and 340K-350K degrees, then 9 sets of constants are required to update the energy accounted to the tasks depending on the current voltage and temperature. Conversely, the ATD (or SATD) and the logic to predict whether accesses would hit in cache do not need to be changed given that such information is voltage and temperature independent. Overall, the overhead of this approach is low as few hardwired constants need to be replicated. Some Operating System (OS) support is needed to read energy accounting registers on a context switch. This issue is analogous to the case of PTEM. In particular, we must expose to software the EARs for each hardware thread so that on a context switch the OS can reset it when a task is scheduled in and read it when it is switched out, its value is aggregated to the corresponding task. On a context switch, the contents of the ATD (or SATD) will likely differ from those that would be had if the task was run to completion without being scheduled out. This might have some impact on SEA accuracy. However, we have verified empirically that tasks typically fetch their working set to different cache levels in less than 200,000 cycles, which is less than 0.1 ms in a processor operating at 2GHz. On the other hand, OS quanta vary from 4ms to 100ms for common Linux and Windows implementations, thus making context switch inaccuracy negligible – such inaccuracy falls below the inaccuracy of SEA method itself –. Moreover, many tasks are not scheduled out on a context switch, thus further reducing such inaccuracy.
6.5. EVALUATION 111 The actions performed by the OS working on behalf of a given task (e.g., on a system call) are assumed to be part of such task, so the OS accounts such energy to that task. The energy accounted to other OS activities (i.e. ‘housekeeping’ activities) can be evenly distributed across all running tasks, although any other policy can be followed to distribute OS energy based on the EAR registers exported by SEA. With such OS support, applying SEA to multi-threaded applications is simple since no additional hardware change is required. In fact, the OS can implement different mechanisms to account the energy to multi-threaded applications by reading EARs and interpret the values in different ways. We illustrate some of these choices with a simple example: let us assume a N-thread multi-threaded application running on a N-core CMP, where only the LLC is shared. In this case, we account each thread E 1 N LLC(ti) as if the LLC is fairly shared across threads (cores) so that each one is given 1 Nof the LLC. Upon the completion of one thread, the OS can choose to read EAR of that thread and add its value to the total energy accounted to the application. Then, the OS can keep accounting the remaining threads in the same way until they all finish. Alternatively, the OS can read the EAR values of all active threads upon the completion of one thread, and add those values to the application’s accounted energy. Then, the OS can account the remaining threads until another one finishes by assuming that they have extra LLC space to use. For instance, when the first thread finishes each of the remaining threads will be accounted for E 1 N−1 LLC (ti) of the LLC space until another one finishes. The later approach is feasible as long as the thread completion and populating frequency do not exceed the OS quanta. 6.5 Evaluation In this section we assess the accuracy of SEA estimations for the shared LLC and SMT cores. We also compare SEA with other intuitive methods that could be used to account LLC energy consumption, such as ES and PTA as introduced in Section 2.4, and PTEM in Chapter 4. The experimental setup is introduced in Section 3.4, while the benchmark suite and workload generation strategy is introduced in Section 3.4.3. Metrics In order to evaluate the accuracy of SEA, we use as a reference the actual energy consumption of a benchmark when it runs alone with the corresponding resource fraction. For instance, if we aim to estimate the LLC energy of a benchmark when it has only half of the LLC ways, the reference is a single-core processor setup with an LLC with half of the cache ways where the benchmark runs alone. Hence, in each experiment, we measure the prediction error of each model with respect to the actual energy consumed
112 CHAPTER 6. SENSIBLE ENERGY ACCOUNTING FOR THE PROCESSOR Figure 6.2: SEALLC prediction error for a workload consisting of benchmarks astar, libquantum,namd, and sphinx3 in a 16-way associative LLC when one task runs with the specified fraction(M N) of resources alone, which is computed with Equation 3.1. 6.5.1 SEALLC Accuracy Evaluation In our multicore architecture with single-threaded cores the main sources of inter-task interferences are the LLC and the shared bus. Our results show that the latter has negligible consumption in our architecture so we do not consider it for SEA as it does not pay off the extra hardware requirements. We start analyzing SEA results for a given 4-task workload consisting of the following benchmarks: namd that has few LLC accesses regardless of the space available; astar that accesses LLC often and whose LLC misses increase sharply when LLC space is decreased; sphinx3 that also has frequent accesses to LLC, but its LLC misses mildly increase when LLC space decreases; and libquantum has large amount of LLC accesses but barely reuses the data in LLC , so it is highly insensitive to the available LLC space and produces constant evictions. From a single run of these benchmarks, SEA is able to obtain predictions of the energy that each benchmark would consume running in isolation under any partition of the cache.
6.5. EVALUATION 113 Figure 6.3: LLC energy accounting accuracy, under CMP 4, 8 cores setup, using I, X, M types workloads Table 6.4: LLC SEA-SATD prediction error standard deviation. I X M 4 cores 3.5% 4.3% 3.7% 8 cores 4.8% 4.2% 6.1% We evaluate SEA accuracy by comparing those predictions with the actual consumption each task has under each cache partition setup, see Figure 6.2. We can see that the error of SEA, which is computed as shown in Equation 3.1, is low for all cache partitions with a deviation of up to 4% and an average error always below 1.8%. In general, the prediction inaccuracy of SEA mainly comes from two sources: the estimation of the number of cache accesses by sampling the ATD and performance accounting based on estimating the number of extra cache misses with a given cache size and conflict misses incurred by co-runners. Some benchmarks show higher accuracy for a different cache partition. For instance, namd and libquantum, whose miss counts barely change with their varied given cache size, obtain highly accurate estimations across all cache sizes. Somewhat, higher variations are observed for those benchmarks that are more sensitive to the space available, such as astar and sphinx3 with no particular trend w.r.t. the number of cache ways. Oscillations for different numbers of cache ways are mainly caused due to the fact that active, maintenance and leakage energy are estimated separately, which may compensate or aggregate estimation errors depending on whether each source of energy consumption is overestimated or underestimated for a given number of cache ways. Still,
120 CHAPTER 6. SENSIBLE ENERGY ACCOUNTING FOR THE PROCESSOR show the maximum savings. Workloads are built by combining half of the benchmarks of one type and half of them of another type. As shown, the lowest average energy savings correspond to the cases where all benchmarks are of type i(ii case) or of type u(uu case). This is expected as itype benchmarks have a near constant active energy consumption, and the optimal maintenance and leakage energy remain roughly constant regardless of how space is split. In the case of uu workloads, the baseline space distribution is already close to the optimal one as each program needs a fraction of cache space somehow in the central part of the distribution. In other cases it is easy to find some benchmarks with different sensitivities to the amount of cache space, so there are workloads with energy savings between 10% and 40%. This results confirm how SEA can be used to enable other energy saving techniques. 6.7 Summary The advent of CMPs allows running many tasks simultaneously, thus allowing resources to be shared and, generally, optimizing energy efficiency. Unfortunately, the energy consumed by a given task strongly depends on the set of co-runners, which create different inter-task interferences. Therefore, energy consumption of a given task with a given set of inputs can change noticeably across different executions. If energy is used for billing, it is hard to defend charging end users largely different energy costs for the very same service. This chapter develops the concept of Sensible Energy Accounting (SEA) from theoretical point of view. SEA allows accurate estimation of the energy that would be consumed by a given task if it was running with a given fraction of the resources, despite the fact that the task shares resources in a multi-task workload. SEA, thus, opens the door to stable billing as well as energy optimizations in CMPs. Our results show that SEA provides highly accurate estimations for on-chip resources – as needed for billing – and can be used for scheduling purposes achieving up to 39% energy savings.
7 Sensible Energy Accounting for the DRAM Memory System 7.1 Introduction The memory wall still limits performance, so many techniques have been devised to hide the long memory latency by allowing multiple memory requests access the memory system in parallel, such as the non-blocking cache, out-of-order instruction issue, speculative execution, etc. Furthermore, the pervasive use of the multi-core and many-core design paradigms puts more pressure on the memory system because multiple tasks can send in parallel their memory requests. In this scenario, the execution of one task can be severely interfered by other co-running tasks due to memory access contention. Thus, in order to efficiently use memory resources, modern DRAM controllers implement complicated scheduling policies to issue the memory requests from the processor to the memory system. However, while the overall performance has been generally improved, the energy usage of each task in memory has not been deeply analyzed. This fact is highly relevant given that in modern computing systems the power of the memory system is already as significant as the processor socket [14]. In Chapter 5, we have introduced our techniques to meter the memory energy that is actually consumed by each task during their execution in a workload running in a multicore system. However, that mechanism cannot tackle the issue of sensibly accounting for a task the energy it would consume in the DRAM DDR2/3 memory system when it has an arbitrary fraction of processor resources to use alone, as formalized in Section 1.1.2. 121
122 CHAPTER 7. SENSIBLE ENERGY ACCOUNTING FOR THE DRAM MEMORY SYSTEM (a) 453.povray (b) 473.astar (c) 433.milc Figure 7.1: The number of memory requests, the average latency of these requests and the incurred energy of SPEC CPU 2006 benchmarks 453.povray,473.astar and 433.milc, when they run alone with different LLC ways and in the workload, are shown respectively in 7.1a, 7.1b and 7.1c This is a difficult challenge since heterogeneous applications nowadays run simultaneously in the same computing system, and their consumed energy varies when they run with different co-runners. In order to fairly account for their energy usage, it is needed to have a consistent energy profile. The outcome of this work will be beneficial for several applications, such as datacenter billing, scheduling policy, resource partitioning, tasks co-location, etc. To elaborate on this need, we ran three SPEC CPU 2006 benchmarks 453.povray,
7.1. INTRODUCTION 123 473.astar and 433.milc, alone in a single core system, connected to 16-way 4MB LLC and 8GB DRAM memory system, the detailed setup can be found in Section 3.2. Each benchmark has been run for 16 times, each time with a different number of LLC cache ways (from 1 to 16), while the rest of resources remain the same. During the execution, we monitor the number of memory requests generated, the average latency of the memory requests from their generation till their completion, and the memory energy consumed by the task. In addition, we ran each of these three benchmarks individually in 4 different 4-task workloads that have been randomly generated. Each workload has other three benchmarks, running on a 4-core multicore system with the same but shared 16-way LLC and memory setup, during which, we obtain the same runtime statistics. In particular, the energy of each task is derived through the ideal model we have introduced in 5, known as the actual energy. The results are shown in Figure 7.1 for the 3 benchmarks respectively. For the sake of clarity, we consider the case when only 1-way of LLC is used as the baseline and all results are normalized w.r.t. this case. We observe that the 3 benchmarks exhibit heterogeneous behavior. In 7.1a, we can see for 453.povray, which is an ILP bound benchmark, its generated memory requests are few and stable as long as it has at least 4 LLC ways. With just 1 way its data do not fit in the LLC and the number of memory requests is much higher. On the other hand, the average latency of each request and the energy consumed only decrease slightly. For 4 or more ways the number of memory requests decreases down to 1% of those with 1 way, the average latency is 90%, and the energy around 75%. Conversely, when this benchmark runs with other tasks in the workloads, the average request latency increases to 140% due to the contention in accessing memory resources, but the energy drops to 20% because the (high) background energy is shared with other benchmarks. In the case of 473.astar in Figure 7.1b, its number of memory requests is more sensitive to different number of LLC ways allocated. When it has 4 ways, its generated memory requests decrease to 50% compared to the 1 way baseline. After further increase to 8 ways, the number drops to around 8%. Its average memory latency and energy variation follow the same but decreasing less. When this benchmark runs in the workloads, although it only generates 10% of the memory requests, the average latency stays over 75%, but the energy is around 15%. Benchmark 433.milc has a completely different behavior since its generated memory requests remains roughly constant across all scenarios. Due to contention, its average memory latency rises to almost 180% in the workloads. However, its metered energy is around 90% that of the cases when it uses the memory system alone. From these results, we can conclude that neither the number of accesses nor access
124 CHAPTER 7. SENSIBLE ENERGY ACCOUNTING FOR THE DRAM MEMORY SYSTEM latency directly reflect the energy consumption. In order to sensibly account the energy a task would have consumed in a particular configuration, some specific information needs to be correlated to deliver accurate estimates. In this chapter, we introduce our approach for SEA in the memory system. Our proposed techniques accurately estimate, during runtime, the energy consumption each task would have in the DRAM DDR2/3 memory system when they run alone with an arbitrary fraction of resources on the processor, with efficient implementations. The energy is accounted sensibly to tasks with their predicted behavior depending on the particular fraction of the resources allocated. This is done by analyzing their runtime behavior when they run within an arbitrary workload. Overall, the contributions of this work are as follows: •We propose an ideal sensible energy accounting model for DRAM memories, based on the assumption that the memory behavior a task has when it run with a particular fraction of resources in isolation can be fully known during the runtime in a workload. To the best of our knowledge, it is the first reference model against which energy accounting mechanisms in the DRAM memories can be compared to. •We propose techniques to predict for the task the activities, the time invoking the memory system and execution time when it runs with a fraction of the processor resources in isolation. Based on which, we devise SADEA, a practical implementation of the ideal model. •We compare SADEA with existing energy measurement techniques, such as ES, PTA and DReAM. We show that SADEA extends the concept of energy accounting in computing systems, in which SADEA provides consistent and accurate estimates for the fraction of processor resources allocated. The rest of this chapter is organized as follows. Section 7.2 provides background on memory controller scheduling policies and memory interference delay analysis. Section 7.3 presents our approach to perform ideal SEA in DRAM memory systems. SADEA, our efficient hardware implementation of the ideal model, is described in Section 7.4. SADEA accuracy is evaluated in Section 7.5. Section 7.6 draws the main conclusions of this chapter.
7.2. BACKGROUND 125 7.2 Background 7.2.1 Performance Accounting As introduced in Section 6.2, SEA comprises two main blocks: PTEM techniques and performance accounting techniques. In this respect, in order to build the SEA for the memory system, we need a PTEM for the DRAM memory system, such as DReAM – see Chapter 5 – and a mechanism for performance accounting in the memory system. Due to the significant amount of techniques used to hide memory latency, the latency of memory requests will impact the execution of the task in a non-obvious way. For example, let us assume a scenario where a task has many memory requests during a particular time interval when running in isolation. If it runs as part of a workload and due to LLC interferences it has an extra LLC miss, such extra memory request may be overlapped with other requests, thus leading to null or negligible performance impact. However, if the task performs roughly no requests during such time interval, the extra request is unlikely to be overlapped and it may easily impact performance. Therefore, in order to sensibly account the memory energy, we need to accurately account performance based on the varying memory behavior. However, it is difficult to do it in today’s sophisticated memory controllers and DRAM devices. 7.2.2 DRAM Memory Controller Scheduling Policies In a modern DRAM memory system, operations strictly follow the JEDEC DDR standard [52]. In the DRAM memory organization that has been detailed in Section 5.2.2, memory requests from the chip are dispatched to the memory system by the memory controller. During this process, several specifications have been considered, such as the I/O timing parameters of the DRAM devices, address mapping scheme, row-buffer management policies, etc. Therefore, the memory controller needs the scheduler issuing the internal commands according to their time constraints, so that each operation can be performed correctly. In addition, different policies can be used to optimize the performance and energy efficiency of the memory system. We have inherited the memory controller model from DRAMsim2, which uses a typical scheduling policy, known as first-ready firstcome-first-serve (FR-FCFS), which prioritizes the ready commands over the non-ready commands, the old commands over the newly arrived commands, and the column access commands over the row access commands when open-page buffer management policy is used. Note that the ready commands can be sent to the DRAM devices immediately with no constraint. By applying such policy, the commands issuing order will not follow their
126 CHAPTER 7. SENSIBLE ENERGY ACCOUNTING FOR THE DRAM MEMORY SYSTEM arriving order exactly. 7.2.3 Memory Interference Delay Analysis Recently, there has been an increasing interest in analyzing the delay caused by memory interferences, mainly in real-time system domain [62,118]. These works focus on estimating the Worst Case Execution Time (WCET) of a task, which is an upper-bound of the memory interferences that come from the other co-running tasks. For this purpose, based on the memory behavior a task has during a single run, authors create high synthetic interference by generating memory requests from the other cores, and estimate the WCET each task has under such extreme conditions. In that respect, authors have made several simplifications, such as: any increase in memory latency is additive to the task’s execution time; all the commands generated from a memory request suffer contention due to interference disregarding the bank-level accessing parallelism in DRAM devices. Conversely, in our work we cannot follow these principles. Instead, we monitor the memory behavior of a task during runtime when it co-runs with many other arbitrary tasks, based on which we analyze the memory behavior each task should have when it runs alone with an arbitrary fraction of the processor resources. As far as we know of, such a model does not exist. 7.3 Ideal SEA for DRAM Memory System In this section, first of all, based on the SEA definition we have in Section 1.1.2, we introduce how SEA can be ideally applied in a DRAM DDR2/3 memory system. Although the core resource partition cause variations in terms of LLC accesses, and in turn LLC misses, its influence does not fall outside the scope of LLC space variation. Thus, in the main line of this work we ignore the different core resources allocation, since memory behavior mainly depends on the LLC space allocated. Nevertheless, we comment how to extend the proposal to cover core resources variation in Section 7.4.1. Our target is to account to a given task Ti, when running in a workload in a multicore, the energy it would consume with a given (arbitrary) fraction of the LLC space. Given that the LLC has Nways, the possible number of ways of the LLC that Ticould use ranges from 1 . . . N, and we use nto refer to the particular number of ways in the LLC used by Tifor its accounting. Following the classifications we have introduced in Section 5.2.2, the energy consumption in the DRAM memory system is broken down into three components: active, refresh
7.3. IDEAL SEA FOR DRAM MEMORY SYSTEM 127 and background. We show how different components of the energy should be ideally accounted to a task. Active Energy Active energy in the DRAM memory system corresponds to the energy spent to perform task activities, such as the energy incurred by the commands that relate to the memory request sent by a task. Therefore, in order to account the active energy in the memory to a task for a particular LLC allocation, nways, it is needed to account the activities it would have incurred under that condition. When the bank buffer management chooses close-page policy, this is relatively easy because every request will have the following activities: first, a row activate command (ACT) is sent from the memory controller to load a specific row of data in the data arrays to the row-buffer sense amplifiers; upon its completion, a column read/write (READ/WRITE) command arrives to read/write the data from/to the row-buffer; finally, a precharge (PRE) command is triggered to restore the data from the row-buffer to the arrays on the row where they were stored. In this case, the activities performed by a task are directly correlated to its generated memory requests. For the open-page policy, the activities cannot be directly mapped to the memory requests, since ACT and PRE commands are not always needed for memory requests in this case. When this policy applies, the row-buffer will remain open after the former READ/WRITE command is done, without sending a PRE command to restore the data. This occurs because, if there are pending requests on the row that is already in the rowbuffer, the memory controller can send them immediately. Therefore, the response speed of the row-buffer hit requests is increased, since they only have to pay the READ/WRITE latency, thus avoiding the delay due to the PRE command of the former request and the ACT command of its own request. The selection of the row-buffer management policy is beyond the scope of this thesis. For both policies, the active energy should account following the same principle: to account Tithe useful activities it would incur with its own generated memory request. Thereby, in this ideal model, we assume that the number of internal commands from each task is known, so that we can directly account the active energy based on the command counts. Thus, given a task Tithat uses nways in the LLC, the active energy accounted to it is calculated as follows:
128 CHAPTER 7. SENSIBLE ENERGY ACCOUNTING FOR THE DRAM MEMORY SYSTEM EAdyn n(Ti) = NumACT n(Ti)×EACT +NumREAD n(Ti)×EREAD +NumWRITE n(Ti)×EWRITE +NumPRE n(Ti)×EPRE (7.1) where NumACT n(Ti), NumREAD n(Ti), NumWRITE n(Ti) and NumPRE n(Ti) stand for the number of commands of each type that belong to task Tiwhen it uses nLLC ways. EACT , EREAD,EWRITE and EPRE stand for the energy consumed by each command. Background Energy Background energy includes the maintenance and leakage energy, which correspond to the energy consumed due to useless activities not triggered by the programs being run and the energy wasted due to the imperfection of the technology used to implement the circuit that is detailed in Section 2.1. Note that the background power of the memory system has different levels corresponding to different states of the DRAM device: power down (P), standby (S) and active (A). The power in P state is the lowest across all states and it is incurred when the memory system clock is disabled. After enabling clocking, the DRAM device enters S state, which largely rises the background power but can quickly respond to the requests. When executing the ACT command, the background power rises to A state. Such A state is also needed to perform READ/WRITE commands. After the PRE command precharging the open row in the DRAM device, the background power returns to S state. Therefore, the background energy that should be accounted to task Tiwhen it uses nways in LLC, is determined by the time DRAM devices spend in each state. Given that in an ideal model the time information can be known, we can calculate the background energy to account to task Tias follows: EABG n(Ti) = TA n(Ti)×PA+TS n(Ti)×PS+TP n(Ti)×PP(7.2) where TA n(Ti), TS n(Ti) and TP n(Ti) stand for the time task Tiinduced the DRAM device to remain in A, S and P states respectively when it has been allocated nways in LLC. PA,PSand PPstand for the background power under A, S and P states respectively. Refresh Energy Refresh energy corresponds to the energy consumed to refresh periodically all memory contents, which is consistent in a time interval that is adequately long according to the JEDEC standard [52], for example, 40 µs in our used configuration. Therefore, accounting
7.4. SADEA, AN IMPLEMENTABLE APPROACH OF SEA 129 refresh energy to one task based on its execution time with nways of the LLC, is done as follows: EAREF n(Ti) = TExe n(Ti)×PREF (7.3) where TExe n(Ti) stands for the execution time of Tiwith nways LLC and PREF stands for the refresh power. 7.4 SADEA, an Implementable Approach of SEA Due to the increasing core count and the sophisticated modern memory controller design, tracking all the profiles that are needed by the ideal SEA is virtually impossible. Therefore, we propose SADEA, a simple to implement yet accurate model that follows the same methodology of the ideal model. Tihas different behaviors in the DRAM memory system when it runs alone with a fixed number of LLC ways, and when it runs as part of a workload with several co-runners. This occurs because in the workload: 1) other tasks may evict some cache lines of Ti, which will probably cause Tisuffering from extra cache misses, known as inter-task misses; 2) in a particular nway configuration where n<N,Timay suffer some cache misses due to the limited capacity, but those accesses may be hits when running as part of a workload; 3) the memory controller receives more memory requests due to co-runners, and they have to be scheduled, thus causing potentially significant delays on Timemory requests. Active Energy In order to account the active energy, the main difficulty lies in estimating the number of memory requests for task Tirunning in isolation with nLLC ways. Therefore, accurately estimating the inter-task misses and the capacity misses due to using nways in LLC holds the key. To this end, we use a similar technique to those used by SEA in the LLC as detailed in Section 6.4.3. In SEA we have used the Auxiliary Tag Directory (ATD) proposed by Qureshi and Patt [96], which focuses on a least recently used (LRU) replacement policy, and it is used to estimate the LLC accesses for Tiwhen nways of LLC are allocated. The ATD is used to keep a local copy of the tag directory for each task, which keeps track of what would be the LLC contents of a task with any arbitrary number of LLC ways in the case of LRU. In this way, if the LLC implements LRU, one can predict whether an
136 CHAPTER 7. SENSIBLE ENERGY ACCOUNTING FOR THE DRAM MEMORY SYSTEM Figure 7.3: Prediction error to account DRAM memory energy to benchmarks for different LLC ways allocated running in 4-core CMP system. marks: astar,namd,milc and leslie3d. The prediction error is mainly generated from (1) the prediction of the activities, (2) the execution time and (3) the time a task uses the memory system. Thus, as benchmark astar is sensitive to the LLC space, the number of its memory requests varies significantly with different LLC ways allocated. In particular, as the number of LLC ways allocated decreases, the prediction error increases due to the pathological combination of the 3 sources of error indicated before. The prediction error can be up to 15.7% since its memory behavior is hard to predict with the discrepancy between the actual number of memory requests and the number of accounted ones. The prediction is, instead, very accurate for the cases when it has more than 8 ways to use, since its behavior in the workload is not that different to the behavior that needs to be accounted for. Still, the average prediction error for astar is low (4.1%). Conversely, the number of memory requests barely changes with different LLC ways allocated for namd. Thus, prediction accuracy is stable across all configurations. Benchmark milc has highly frequent memory request in all scenarios, so its prediction accuracy depends on the interferences it suffers from its co-runners and the speed at which memory requests are dispatched when it uses different number of LLC ways. On average, the prediction error is low (3.2%). For leslie3d with moderate number of memory request and moderate variation across different LLC way allocations, the prediction error is within 3-7%, and on average is 4.2%.
7.5. EVALUATION 137 Figure 7.4: Prediction error to account DRAM memory energy for workloads running in a 4-core CMP system using models: ES, PTA, DReAM and SADEA. SADEA evaluation in CMP systems Next, we evaluate SADEA in a 4-core CMP architecture, with 24 randomly composed workloads using benchmarks of different LLC miss frequency level as classified in Table 3.8. We can observe in Figure 7.3 that SADEA delivers stable prediction across all 1-16 ways of the LLC. The average prediction error across all benchmarks is relatively low, generally under 7%, with their standard deviation under 13%, except for the case of 1-way. The reason that the deviation for 1-way is higher than others is because many benchmarks experience a drastically different number of LLC misses when only 1 LLC way is allocated. This huge variation in the number of LLC misses translates into a significantly different memory energy profile that is, in turn, very hard to predict. Nevertheless, the overall prediction is sufficiently accurate, 6.5% on average. Still, we believe there is room for improvement in the future. Then, we compare SADEA in 4-core and 8-core scenarios, with ES,PTA and DReAM. The results are shown in Figure 7.4, where workloads are categorized into I,Xand M, as described in 3.4.3. Note that in this figure, the outcome of ES,PTA and DReAM are compared with the cases where a task runs in isolation with a given fair share of the LLC, and this is the only case they can be compared with. For example, for Ntasks running in a Mways LLC, each task is given M Nways of cache. We can observe from the figure that ES,PTA and DReAM fail for the purpose to sensibly account the memory energy to a task. This is expected since, at first, they lack of support for capturing inter-task
138 CHAPTER 7. SENSIBLE ENERGY ACCOUNTING FOR THE DRAM MEMORY SYSTEM Figure 7.5: Prediction error to account DRAM memory energy to benchmarks for different LLC ways allocated running in a 2-way 2-core SMT/CMP system. interferences, and secondly, lack of support for acknowledging the deviations of behaviors a task has in different scenarios. On average, ES,PTA and DReAM have prediction error over 38% across all workloads and setups. On the other hand, SADEA achieves an average 7.8% prediction error. In general, the predictions for Mworkloads and higher core-count scenarios are less accurate due to the higher interferences from co-running tasks, which are harder to eliminate in terms of energy accounting. In general, SADEA, while not being ideal, keeps inaccuracy low enough to make it usable in practice. SADEA evaluation in SMT/CMP systems In the CMP architecture, SADEA collects statistics during the whole execution time. Conversely, applying SADEA for a given fraction of processor resources including the core, one can only use the information collected from the separated MIBTA phases. Thus, we show the SADEA prediction error for a 2-way 2-core SMT architecture case in Figure 7.5, for configurations where each task has exactly 1 2of the core resources and in the range 1−16 ways of the LLC. We observe that the prediction error in such scenario is higher than in CMP architectures. The average error exceeds 10% and the standard deviation reaches 15%. As for the CMP case, the prediction error for the 1-way LLC case is higher than for other LLC way allocations. Still, the average prediction error remains under 12%, making SADEA still a reasonable choice.
7.6. SUMMARY 139 7.6 Summary A number of mechanisms are in place to hide the (long) memory latency. Thus, when multiple tasks share the memory system, interferences can impact significantly their memory behavior, and in turn their performance and energy consumption. In this chapter we focus on sensibly accounting the memory energy to a task, which corresponds to the energy it consumes when it runs with a fraction of the processor resources in isolation. This requires discounting the effect of interference from co-runners and its own when it generates a different number of memory requests when its given resources vary. As part of SADEA we have devised several mechanisms to predict the number of memory request, the execution time and the time using the memory system that a task should have when running in isolation with a given fraction of the processor resources. Our results show that SEA provides sufficiently accurate estimates for memory energy, yet with low-cost. Still, we see room for improvement given that SADEA accuracy is not as high as for the other mechanisms proposed in this thesis.
8 Conclusion and Future Directions 8.1 Thesis Conclusion With the price keep growing, energy has arguably became the most expensive resource in computing systems across different computing domains. In the meantime, with processor chip integrating billions of transistors, providing several gigaflop computing power and several gigabytes of memory capacity to use, power wall has became a major stumbling block for the performance growth of computing systems. The establishment of multicore architectures offers improved performance per Watt, by allowing many tasks to run simultaneously sharing the resources in the system. Unfortunately, in this scenario, the energy consumed by a given task becomes non-obvious, since it strongly depends on the set of co-runners which create inter-task interferences. Obtaining the power profiles of such a complex, highly-threaded system is a difficult challenge. There has already been large efforts invested on this topic. Different directions have been explored, such as refining the power measurement of the system, energy and power profiling in hardware and software, energy breakdown in hardware components and software blocks, etc.. However, these studies have all consider the hardware resources as a whole. Ignoring the fact that in current reference platform, the multicore processors, most of the hardware resource are shared by multiple tasks running in parallel. As far as we know of, no study or proposals have been made to support per-task energy measurement in the multicores. In this Thesis, for the first time, we formalize the need for per-task energy measurement in multi-core systems by establishing a two-fold concept: per-task energy metering(PTEM) and sensible energy accounting(SEA). In the scenario where many tasks running in parallel 141
142 CHAPTER 8. CONCLUSION AND FUTURE DIRECTIONS in a multicore system. For each task, the target of PTEM is to provide estimate of the actual energy consumption at runtime based on its resource usage during execution; and SEA aims at providing estimates on the energy it would have consumed when running in isolation with a particular fraction of system’s resources. The differences between the technology and design of different components in the computer are large. For this reason, we separately apply PTEM and SEA to two main functional components of a computing system: the processor and memory system. In summary, the main contributions of this thesis are listed following: PTEM for the Processor First we make a case of PTEM for the processor. The model distributes the energy of the chip to the running tasks in an arbitrary workload based on the utilization of the on-chip components (e.g., cores, caches, etc.). By analyzing the impact of resources utilization on active,maintenance and leakage energy, we first propose an ideal PTEM model in the processor by means of tracking the activity and occupancy of all the resources in a per-task basis. This ideal model is complex and too expensive to implement. Thus, we propose an implementable and efficient design to perform PTEM in multicore processors by trading off the cost with accuracy. We illustrate how this method can accurately approach the ideal model, and thus obtain estimates of the actual energy each task consumes in the chip. State of the art models, such as Evenly Split (ES) and Proportional To Accesses (PTA) detailed in Section 2.3.4, are also evaluated and compared against the ideal model. PTEM achieves highly accurate estimates that greatly improve the state of the art. In this thesis, we have shown how to apply PTEM to sequential and parallel applications. By deploying the proposed PTEM technique in a 2-way SMT core processor, we have seen that the metered energy for any SPEC CPU 2006 benchmark within different workloads can vary in the range of [−25%,40%], which sets the motivation for SEA. PTEM for the DRAM Memory System Similarly in the memory system, the energy used by a task is correlated with its utilization of the DRAM devices. This includes the memory activities, the states of the memory banks, the execution time of the task, and in particular, the interaction with other tasks. We propose an ideal PTEM model for the DRAM memory system that tracks all the memory resources utilized by a task in every cycle. Based on such an ideal but complex model, we have proposed a practical model with low-cost, which relies on few counters and registers to be set up in the memory controller to estimate the memory energy. Such
8.1. THESIS CONCLUSION 143 implementation can achieve accurate predictions with respect to the ideal model, largely improving the estimations obtained with ES and PTA models. Next, we have shown that PTEM can help significantly improving the power efficiency in a multicore processor. Energy savings may depend on the tasks’ memory access frequency and access patterns (i.e. bursty versus scattered behaviors). Also, we have proven that the energy impact of memory contention highly depends on the frequency of memory accesses: programs with frequent memory accesses decrease their power at the expense of increasing their energy. SEA for the Processor From the PTEM outcomes, we observe that the actual energy consumed by a task heavily depends on its co-running tasks due to their interaction in shared resources. The energy variation is huge for most benchmarks, even though the same benchmark always runs with the same input in the very same platform. Then, the principle of energy accounting suggests to consistently account a fixed amount of energy to a task independently of its dynamic behavior in the workload. This principle is inherited from the performance accounting principle defined by Luque et al. [76]. Thus, the energy consumed by a task depends on itself and the resources it uses to execute. In this thesis, we propose Sensible Energy Accounting (SEA), which accounts a task the energy it would consume when it runs in isolation with a certain fraction of the resources. To make SEA feasible, we devise a low-cost hardware mechanism to obtain at runtime an estimate of the processor energy to account to a task when it co-runs with several other tasks in a multicore system. Our proposal achieves high prediction accuracy with regards to the reference model. When compared with other state of the art models such as ES, PTA and PTEM, SEA accounts a much more consistent and fair energy cost to a task. We have also proven that, by using SEA for scheduling purposes, significant energy savings can be obtained. SEA for the DRAM Memory System In this thesis, the concepts introduced by SEA are also applied to the DRAM memory system using SADEA. Thus, we propose to account the memory energy a task would consume when it runs in isolation with a certain fraction of processor resources. Since various techniques have been used to hide long memory latencies, the interferences from co-running tasks in the DRAM memory system are not obvious to identify. The key to achieve SADEA consists in predicting the memory behavior a task would have in isolation.
144 CHAPTER 8. CONCLUSION AND FUTURE DIRECTIONS To attain this goal, we have to separately analyze several key metrics, such as the amount of activities, the time invoking the memory system and execution time. We have shown that, with few extra registers and logic to detect the bank level accessing parallelism, SADEA provides tight estimates on the memory energy to account. Finally, we have also shown that SADEA can be combined with SEA in the processor to build an integral energy accounting system for multicore processors. 8.2 Future Works and Impact This thesis is the first attempt showing that per-task energy in resource-sharing multicore system can be quantified in an exact way. The work done in this thesis can become fundamental for several research lines, and they can impact different computing domains where multicores are used as the reference computing platform. Based on the proposals in this thesis, it is possible to enhance the understanding of energy savings in multicore system, and therefore, inspiring energy efficient studies from different perspectives. Implementation in Real Systems The fact that this thesis has been performed on simulators infers a long way for it to impact real systems available in the market. Therefore, implementing PTEM and SEA proposals in real systems would be the primary focus of the future work. Although the lack of hardware support in existing computing systems limits the applicability of PTEM and SEA, these proposals have shown that a reasonable tradeoff between predictions accuracy and hardware cost can be reached. Furthermore, the implementation of such models in existing systems can directly lead to energy-aware computing, so shifting processor designs towards energy-aware architectures. Multicore Architecture Design Current multicore processors are usually designed to have high throughput, with good tradeoff with per-task performance degradation. PTEM and SEA proposals not only can quantify the net effect on energy consumption of a particular design, but also can enable optional energy efficient designs to better deploy the multicore processors in energy sensitive environments.
8.2. FUTURE WORKS AND IMPACT 145 Datacenter Billing Nowadays, cloud-computing providers tend to provide services of virtualization, such as IaaS, PaaS and SaaS. As depicted in Section 6.3.1, SEA can be used by the datacenter owner to optimize the task co-location in order to reduce the operationl cost of their infrastructure. And clients can also benefit from the consistent and fair billing. That is, when they request the same computing power to run the same tasks with the same input, the same energy cost is accounted. Of course, in addition to the energy cost, the hardware and operational cost are also needed to be correlated. Nonetheless, maintaining this principle for billing is key to keep the bills consistent. Energy Aware Scheduling Linux kernel developers already start to research the appropriate scheduler for heterogeneous architectures, such as the big.LITTLE architecture by ARM [64]. In such scenario, scheduler is the best place to collect information on the past, current and future information on the energy profile of a task since it controls where to place various tasks. In this line, authors in [102] present a request-level OS mechanism to meter power consumption of requests in the servers. However, in this work, per-task energy estimates cannot be accurately obtained, this is why authors of this work call for finer hardware support. PTEM and SEA cover this gap, as PTEM provides information of the past and current information on the actual energy consumed by a task, and SEA predicts the future energy consumption of a task with different resources allocation(for example, running in big and LITTLE cores). The use of PTEM and SEA can enhance the energy aware scheduler designs, instead of using current limited information obtained from CPU frequency and idle state. Resource Allocation As we have illustrated in Chapters 6 and 7, when different fractions of resources are allocated to a task, the impact on its energy consumption could be huge. Thus, with the outcome of PTEM and SEA, one can choose for a task an optimal viable allocation of resources to minimize its energy usage. For this purpose, we have illustrated with a simple example in Section 6.6.2. Of course, to apply this in real systems it is needed more dedicated studies.