Power Aware CompilationNadgauda Rajeev Ajit, Vinay Kulkarni,email@example.com firstname.lastname@example.org semester, ISE, 8th semester, ISE,Basaveshwar Engineering College, Basaveshwar EngineeringCollege,Bagalkot. Bagalkot. Abstract computers), designing alternatives that reduce heat dissipation (in internal circuits “Every joule is precious” – in today’s or overall heat dissipation), Registerworld every aspect of system is bound by assisted techniques, Low Power cache,energy consumption.. Energy is an essential Partitioned Data Cache. Other techniquesasset because the factors that generate it are include Register spilling, Memory accessmainly depleting resources. Hence it becomes due to cache misses. Apart from the abovean implicit requirement to conserve energy, be mentioned methods obvious methodsit in any form i.e. computing systems, which involve replacing hardware i.e. processorsmay be either battery driven or driven by AC with higher frequency etc.power supply. Power consumption can bereduced by having efficient operating systems o Software approach: This approach focusesthat consume lesser power. The same can be on optimizing code from an energyapplied while compiling programs on systems consumption perspective which iswhere we can produce energy efficient achieved by analyzing the input code andmachine codes. We propose a technique called replacing redundant instructions. This maypower aware compilation which is a software involve internal manipulation of the inputapproach to power aware computing. Using code (software package), which could be athis technique, each and every developer or high level language (HLL) or an assemblyuser could know the amount of energy level language (ALL). This internalconsumed by their code; further, if feasible our manipulation is done by reducing thesystem optimizes the energy consumption. The computational time required by the set ofdescribed methodology leads to producing instructions to execute completely. Theenergy efficient software modules which would processor consumes a large part of thesave a few joules on every machine so imagine input power hence there is a need to relatethe energy conserved for such software the execution of a program which is a setrunning on trillions of computing systems. of instructions to the time required to execute the program. The processorKEYWORDS: Power aware compilation, circuits are controlled by a timing signalefficient machine codes. called clock. The clock defines regular clock intervals called clock cycle. Hence1. Introduction the execution of program is related to the number of clock cycles. The figure below Most system design today shows the levels of energy consumption inconcentrates on producing energy aware a computing system.systems. Any software package i.e. codedesigned for a specific set of operationsconsume some energy to compute and toperform the desired operations. This leads to arequirement which intends to optimize codefrom an energy consumption perspective.There are two principal methods to reduceenergy consumption on computing systemso Hardware approach: This involves different methods: The basic method involves checking on current leaks in the internal circuitry (mother board in case of
Figure 1.0: Percentage of EnergyConsumption.2. Power aware system2.1 Proposed Method to identify theAssembly level executables. A path is needed to access theassembly level code of the high-level code.This may involve accessing the intermediatetarget code produced by the languageprocessing system (Gcc compiler). Thisassembly level code would then be directlycompared to the database. We convert the highlevel input code into Linux Intel assemblyusing the powerful GCC compiler. Figure 2.0is a sample extracted for a simple c program. Figure 2.0:Sample Linux Intel Assembly Code For C program. 2.2 Design principle Any instruction that is compiled onto a machine requires certain number of clock cycles to execute. We know that Energy (Joules) =Power (Watts)*Time (Seconds). [Ref Milliwatt Project, Carla, Duke University] Where Power is a factor that varies based on the hardware used in the computing system. It is important to note that we focus on the software approach to reducing energy
consumption. The essence is to reduce thenumber of clock cycles a program takes tocompletely execute on a given system(Processor).i.e. we can conclude EαtWhere E=Energy in joules, t = total time inseconds. Therefore in the event of calculationof the Energy for a program to completelyexecute, power can be considered as constant.This results in the proof for a totally softwareoriented approach to reduce energyconsumption. And hence provides a degree ofrelaxation on the need to input highly accuratesystem variables (hardware). Figure 2.1:Sample output for (Fig 2.0). t=n*T assembly function of the language processing system (.S file incase of Linux Intel Assembly)Where n = number of clock cycles required for and scanning each instruction which would bethe input program to execute. compared to the information in the database which contains the registers used in an 8086T=time period =>inverse of frequency of the Intel processor and the Clocks required byprocessor in Hertz (Hz) . each Intel 8086 instruction. The clock cycles required by each instruction results in the total T=1/f number of clock cycles by the program to execute completely i.e. ‘n’. This computed T varies based on the system on which the total of all clock cycles can be used to furtherapplication is run. compute ’t’. For Example considering the instruction on line number 11 The sample extracted in Figure (2.1) is afiltered version using shell scripts on Linux 83 andl $-16, %esp.platform to enable the file to be processed byour energy computing program. It depicts the For the above instruction, we first analyze theline numbers of the ALL code in the first type of operands i.e. if it is a memory, registercolumn, Opcode in the second, instruction or an immediate value based on which wemnemonic in the third and the operands in the calculate or set the relative EA (Effectiverest of the columns. The sample output is address) & relatively on comparison with theshown below in Figure 2.1. database which stores clocks and Opcode we assign the clocks required by that instruction.2.2Clock Cycle Calculation 3. Language Processing Concepts This computation plays a pivotal role in theentire analysis of energy consumption by a A compiler is a program that can readprogram. This includes accessing the file program in one language (a source language)containing the assembly code produced by and translate it into an equivalent program inthe another language (a target language). Figure 3.0: Compiler function.
code, registers or memory locations are selected for each Figure 3.1: Steps of processing. of the variables used by the program. Then, the intermediate instruction is translated into sequence of machine instructions that performFigure 2.2: Sample clock cycle calculation for the same task. A crucial aspect of code(Fig2.0). generation is the judicious assignment of registers to hold variables. For example, usingAn important role of the compiler is to report registers R1 and R2, the intermediateany errors in the source program that it detects optimized code might get translated into theduring the translation process. If the target machine codeprogram is an executable machine-languageprogram, it can then be called by the user to LDF R2, id3process inputs and produce outputs.Intermediate Code Generation: In the processof translating a source program into a target MULF R2, R2, #60.0code, a compiler may construct one or more LDF R1, id2intermediate representation, which can have avariety of forms. Syntax trees are a form of ADDF R1, R1, R2intermediate representation; they arecommonly used during syntax and semantic STF id1, R1analysis. Code Generation: The code generatortakes as input an intermediate representation of 4. The New Systemthe source program and maps it into the targetlanguage. If the target language is machine
The proposed system intends to beeither as a standalone application or as astructured parameter to the compiler. Oursystem focuses on optimizing input programs(HLL or ALL) intended to be compiled onmachines, to produce energy efficient softwarethat are architecture specific machine code.Below is an overall architectural prospective ofthe system. It has been split into two sectionsfor convenient depiction. The figure 4.0 is the system thatprocesses the HLL and produces the formattedALL precisely the Linux Intel Assembly codefor further processing by the system of figure4.1. The database consists of theinstructions and the corresponding clockswhich have been extracted from various bookson microprocessors. In case of optimization of the inputcode we adopt a new approach based on theclock value weight of each instruction. Oncejudged, that instruction would be replaced by asimilar instruction performing the same task. Itis but obvious that a lot of dependency issueswould have to be addressed to undertake sucha task. Figure 4.0: Architectural view part1
and clock calculation .i.e. we find the energy hungry instructions and try to replace them by lesser energy consuming instructions. Here we consider an example: Assume the compiler generates: addl $1, -32(%ebp) This instruction solely consumes 17+EA clock cycles. Now a suggested replacement on analysis shows a movl instruction that moves immediate to a register. Generally the register “%ebx “ is not used hence using that register : movl $1, %ebx addl %ebx, -32(%ebp) Now adding the memory content to this register content, we get only 13 clocks and the effective address, hence saving 4 clocks. We replaced such instructions to reduce the clocks and hence correspondingly reducing the energy. But later it was discovered that there were certain syntactic problems with the above assumptions, hence we overruled the use of the above models. We started working on the “pushl” instruction generated by the compiler in the .s file and we made observations that if the “memory push“ instructions were removed we would still have an executable .s file. In this .s file the programmer’s original intention is maintained. This model saves up to 20 clocks because every memory push requires 16+EA clocks. If the percentage of reduction is feasible then the .s file is produced for the user or the developer. This file is the newly optimized file. 6. Conclusion: The Power Aware Compilation techniques do far more than just saving a few joules i.e. this technique intends to make the programmer or developer aware about the programs efficiency. This relatively has an effect on the prototype of development withFigure 4.1: Architectural view part2 (Ref fig respect to software development. If the4.0). application were to be fine-tuned and structured as a parameter to the compiler this would add capabilities to the compiler from a energy aware prospective and hence casting an5.Optimization Methodology: impact on Energy aware computing systems. We design models, known as 6. References:optimization models. These models areidentified through a combination of analysis
 Hongbo Yang,”Power-Aware CompilationTechniques for High PerformanceProcessors”,University Of Delaware,2004.Jose.L.Ayala,Alexander Veiden Bawn,andMarisa Lopez-Vallejo,Power-AwareCompilation For Register File EnergyReduction,”International Journal Of ParallelProgramming,vol 31 No 6”,December 2003. Carla Schlatter Ellis, “Milly Watt Project”,Duke University, Indiana, February 2005. Leland L.Beck , D.Manjula ,SystemSoftware , Pearson Education,3rd Edition. Alfred v.aho, Monica s. Lam, Ravi Sethi ,Jeffery d. Ullman ,Compilers , PearsonEducation, 2nd Edition. Douglas V Hall,Microprocessors andInterfacing , TATA McGRAW HILL,2ndEdition.Carl Hamacher , Computer Organization,4thedition.Norman Matloff ”Introduction To LinuxIntel Assembly” ,2001.7. Credits: Project Guide: PROF.P.V.KULKARNI[HOD,ISE,BEC,BGK]. Valuable Assistance: PROF.RAMESH KOTI [E&C Dept.BEC,BGK].Project Associates:[ i ].NADGAUDA RAJEEV AJIT [ISE].[ ii].VINAY S KULKARNI [ISE].[iii].NIKHILPRATEEK KULKARNI [ISE].[iv].NIRANJAN D KUMAR [ISE].