Verified Instruction-Level Energy Consumption Measurement for NVIDIA GPUs
Paper · 2020 · Yehia Arafa; Ammar ElWazir; Abdelrahman ElKanishy; Youssef Aly; Ayatelrahman Elsayed; Abdel-Hameed Badawy; Gopinath Chennupati; Stephan Eidenbenz; and Nandakishore Santhi
Summary
How much energy does a graphics processor spend on an addition, a division, or a square root? Software can ask an NVIDIA graphics processing unit, or GPU, how much power the board is drawing. That reading covers the whole device, while the question concerns an operation that may finish before the sensor changes its reported value. Arafa and colleagues make the operation measurable by repeating it in a small, tightly controlled program. They compare the energy of that program with the energy of a companion run that omits the operations under study. The difference, divided by the number of repetitions, gives an energy estimate for the instruction under those test conditions.
The authors write their tests in Parallel Thread Execution, or PTX, the virtual assembly language used by CUDA. A PTX instruction expresses the same operation across the cards in the study, while the compiler can translate it into different sequences of native instructions. The paper compares more than 40 PTX instructions on the Maxwell GTX TITAN X, Pascal GTX 1080 Ti, Volta TITAN V, and Turing TITAN RTX. It also compares builds using O0 and O3 compiler optimization. Volta generally has the lowest measured energy per instruction, with exceptions among special mathematical operations and integer intrinsics. Turing and Volta both fare better than Pascal on the tested half-precision arithmetic. The compiler comparison shows that optimization can substantially change the cost of a PTX operation.
The other question is how to turn onboard power readings into a reliable energy estimate. The authors compare background sampling, a PAPI measurement that reads power at the end of a kernel, and their own Multi-Threaded Synchronized Monitoring method, or MTSM. MTSM uses a separate host thread to collect readings during the kernel’s execution and combines those readings with the elapsed time. Background sampling illustrates how much the apparent duration can depend on where an observer places the boundaries in a power trace. The end-of-kernel measurement has a defined endpoint, but its accuracy depends on how well that final reading represents power throughout the run.
To check the software estimates, the authors independently measure the electricity entering the TITAN V through the motherboard slot and the card’s direct supply. Against that hardware reference, MTSM has an average mean absolute percentage error of 6.39, compared with 10.24 for PAPI. The result supports synchronized sampling over the particular end-of-kernel measurement tested. The instruction figures describe what a card spent on repeated, dependent operations under specific compiler settings. The direct hardware check establishes how closely the software procedures tracked board-level energy on the Volta card.
Deep dive: Verified Instruction-Level Energy Consumption Measurement for NVIDIA GPUs
Arafa and colleagues measure the energy cost of NVIDIA GPU instructions and check onboard power readings against direct electrical measurements. · about 33 minutes to read
The problem and its context
From board power to the cost of an operation
A GPU power sensor answers a question about the board at a moment in time. A programmer considering an instruction substitution wants a different quantity, namely the energy attributable to an operation as it executes. Power is the rate at which energy is used. A program can draw more power while it runs and still use less energy if it finishes sufficiently sooner. Conversely, an operation whose power trace looks modest can be energetically expensive if it keeps the device active for longer. Estimating instruction energy therefore requires both a defined execution interval and a way to assign part of the board’s consumption to the instruction.
The authors place this problem in the context of changing GPU hardware and expanding uses for it. They describe accelerators serving scientific computing and search as well as embedded and mobile systems, where power and energy become important properties of execution. They also cite earlier research connecting high power consumption with GPU reliability. Vendors expose ways to monitor the device, but, as the paper explains, the energy costs of individual internal operations are generally unavailable from them. Changes in architecture make it difficult to carry a measurement from one generation directly to another. This combination motivates a repeatable measurement at an instruction boundary familiar to programmers working in GPU parallel computing.
The board-wide scope of the measurement follows from the way a GPU is organized. Its streaming multiprocessors contain resources for integer arithmetic, floating-point arithmetic, address calculation, and special functions. Scheduling and dispatch hardware issue work to those resources. Each multiprocessor has its own first-level cache, and the multiprocessors share access to a second-level cache. The sensor observes the resulting consumption at the board. Its reading can reflect execution, instruction handling, and other activity during the same interval. The experimental challenge is to change the operation of interest while keeping enough of the surrounding activity comparable for subtraction to be informative.
CUDA’s execution hierarchy gives the authors control over the work they submit. A kernel is a program launched on the GPU by host software. The threads of a kernel form a grid composed of blocks. The hardware organizes threads within blocks into groups called warps, which the paper describes as groups of 32 threads executing an instruction together. The paper uses one block and one thread for its instruction tests. A long chain of operations in that single thread serves a different purpose from a typical parallel workload. Here the design emphasizes a traceable sequence of operations whose results feed into each other. The resulting energy is a property of that experimental execution on the device.
An instruction name also needs a level of description. CUDA turns device code into hardware-specific instructions, and the compiler can implement a single source-level operation through a series of lower-level ones. The paper measures PTX instructions because PTX lets the authors specify the operation and surrounding sequence directly while preserving a common description across cards. The resulting quantity includes the native implementation of the PTX instruction on each card. A division entry therefore answers a question about running that division through the tested compilation path. Its meaning remains tied to the instruction variant and optimization setting even when the PTX mnemonic is the same.
The evidence available before the study
The paper describes earlier work with several goals. Some studies obtained power traces directly from instruments or onboard telemetry. Others sought to estimate device-wide energy from workload properties or from the behavior of hardware units. In the related work discussed by the authors, measurements of instruction or component costs sometimes supplied inputs to such estimates. Arafa and colleagues take the instruction measurement itself as the primary result. They compare several instruction families across card generations and test the measurement procedure as well as the instructions.
An example on the software side is earlier work that examined NVML readings from a Tesla K20. NVML, the NVIDIA Management Library, exposes board telemetry to software. Another study used background sampling with microbenchmarks on a Tesla K40 to characterize basic compute and memory operations for energy estimation. The paper also discusses work that inferred energy for GPU units from NVML and checked its estimates with a Kill-A-Watt meter. These studies illustrate how readily software can obtain a device-level reading. They also leave room to ask how much the procedure for placing and collecting samples affects the estimate of a short or irregular computation.
Earlier hardware studies described in the paper used external measurements for different purposes. A study on a GeForce GTX 470 used microbenchmarks to estimate the costs of some PTX instructions and used those costs in a scheme for predicting program energy. Another measured instantaneous power on a GTX 580 with PowerMon 2 and a custom adapter between the card and its motherboard connection. The authors also discuss a comparison of PowerInsight hardware with NVML software readings on a CUDA matrix multiplication benchmark. Each approach supplies evidence at a different scale, from particular operations to a benchmark taken as a whole.
The authors’ own earlier latency work supplied part of the experimental design. It timed a single operation by reading a GPU clock register around it. That strategy can reveal how long a dependent operation takes to complete. The energy experiment uses the same interest in a controlled instruction sequence, but board power responds on a different measurement scale. The authors therefore extend the instruction’s presence in the workload until it can affect a trace of board power. They then use that trace to estimate energy and divide the attributable amount across the executed repetitions. The prior timing work also gives them a point of comparison when checking the behavior of their compiled microbenchmarks.
The compiler occupies a central place in this setup. The paper treats its optimization level as an experimental factor because it can change the work the card does for the same PTX instruction. The measurement technique occupies a similar place. Two programs can query the same onboard sensor and produce different energy estimates because they observe it at different points in the execution. The study compares both of those choices while keeping the measured operation identifiable. That makes a reported energy value meaningful as a combination of instruction, compilation setting, device, and measurement method.
The method, step by step
Make the instruction visible to the sensor
The authors begin with a microbenchmark, a small program whose main purpose is to exercise a target operation under controlled conditions. A single execution changes the board’s energy by too little for the procedure in this paper to resolve directly. The target instruction is therefore inserted repeatedly into a loop. The body already contains several copies of the instruction, a form of loop unrolling that lets each iteration execute multiple target operations before the loop returns to its beginning. Repeating that body gives the measurement system an extended period over which the target can contribute to power draw.
Unsigned integer division provides the worked example. The kernel initializes its registers and sets the loop to run for 1M iterations. Its body has 5 divisions, with each division using a value produced by an earlier one in the chain. The dependencies tie the work together. Removing an intermediate result could change a later result, which gives the compiler a reason to preserve the computation. The division example also uses a load, an addition, and a store after the last division. The loop begins each new iteration with changed values, helping to prevent the repeated work from being reduced to a calculation whose result stays the same.
The result of the loop is stored where the host can read it. The authors use that output to check correctness, particularly for the optimized build. Their check matters because a small energy estimate could otherwise reflect a benchmark that compiled away some of the intended computation. They also check the clock-register behavior against their previous instruction-latency work. These checks serve different purposes. The final value tests the produced answer, while the clock information helps assess the timing of the executed work. The distinction matters whenever an optimizing compiler can produce the same result with a shorter native sequence.
The study aims to carry the same microbenchmark structure from one operation to another. In the paper’s description, the target instruction changes while the overall kernel scheme is retained. The instruction receives the same kind of repeated exposure, and the benchmark still has supporting work for maintaining and observing the loop. That supporting work is part of the measured board draw in the full run. The method accounts for it by running a companion benchmark as well.
Compile the PTX into executable code
PTX is a virtual instruction set. The authors can specify operations and dependencies there without committing the benchmark to a single card’s native encoding. The device executes SASS, the hardware-specific assembly representation. CUDA’s optimizing assembler, ptxas, translates the instrumented PTX into native instructions and produces a .cubin device binary. The binary is packaged into a fat binary, the container embedded in the host program. The authors arrange for the instrumented PTX kernel to take the place of an empty kernel with the same name and declaration. The host program can then launch the intended device code through the ordinary CUDA execution path.
This workflow offers control at the level where the authors write the benchmark and portability at the level where they compare devices. The same PTX operation can be sent through the compilation path for each card. The assembler still chooses how to realize it. The paper points to CUDA’s cuobjdump utility for reading the resulting native instructions and discusses earlier efforts to work directly with the native format. In this study, the PTX operation is the unit named in the result because that is the level at which the authors can maintain a common experimental definition across architectures.
Native register allocation is one reason the distinction matters. PTX gives the programmer virtual registers to express intermediate values. The physical register capacity will differ with the hardware. The paper explains that when values exceed the available registers, they may spill to memory, which changes execution behavior. The unsigned division chain keeps the intended dependencies explicit in PTX, while the compilation and correctness checks help the authors interpret what happens once that chain becomes a native executable. The resulting energy estimate therefore covers an actual execution of a compiled benchmark, including whatever work its native realization requires.
The authors compile the kernels with O3 and O0. They call the former optimized and the latter non-optimized in the results. These labels identify the compiler settings used. The optimization comparison retains the source operation and changes how the compiler may arrange and translate it. In the optimized build, the output and timing checks are especially important because the goal is to observe energy changes from compiling the target work differently while retaining the computation the benchmark is meant to exercise.
From a repeated PTX operation to an energy estimate
The steps in order.
Measure the full run and the overhead run
The full benchmark draws energy for the target instructions, for maintaining the loop, and for the rest of the board’s activity during the measured interval. The authors distinguish the board’s static consumption, which they describe as the power needed to keep the device operating, from dynamic consumption associated with activity. The control run omits the back-to-back target instructions from the loop body. The authors measure that run to estimate the energy used by the benchmark’s remaining work and the board consumption accompanying it.
The paper calculates the instruction estimate as follows.
Eᵢₙₛₜᵣᵤ꜀ₜᵢₒₙ = (Eₜₒₜₐₗ − Eₒᵥₑᵣₕₑₐ𝒹) / n
Here Eᵢₙₛₜᵣᵤ꜀ₜᵢₒₙ is the estimated energy attributed to an execution of the target PTX instruction. Eₜₒₜₐₗ is the measured energy for the full benchmark, and Eₒᵥₑᵣₕₑₐ𝒹 is the measured energy for the companion run that omits the target chain. The symbol n denotes the number of target instruction executions in the full benchmark. The subtraction takes place at the level of energy for the entire run. Division then spreads that attributable energy over the repetitions.
The estimate is an average over the particular run. The experiment does not require the sensor to register each individual operation. It relies on the target work contributing enough, in aggregate, to distinguish the full run from the overhead run. The overhead run defines the comparison condition for this attribution. For instance, its own duration and board draw contribute to the amount subtracted. This is why the experiment measures the energy of both runs, including the elapsed time appropriate to each.
The data procedure consists of compiling, executing, timing, and measuring these pairs of benchmarks. For each covered instruction and compiler setting, the resulting energy estimate can be compared with the corresponding estimate from another card or another monitoring method. Meaningful comparisons preserve the operation’s type and precision. Signed division and unsigned division have their own rows, and single- and double-precision division are distinct cases. For some operations the appendix reports a shared row for several mnemonics, which sets the granularity at which those particular results can be read.
Compare the ways of reading board power
NVML exposes the device’s power reading to code running on the host CPU. In the paper’s software methods, the query is nvmlDeviceGetPowerUsage(), which returns a power value in milliwatts. All of the software measurements considered here ultimately rely on the GPU’s onboard power telemetry. They differ in when the host calls the query, how it relates those calls to kernel execution, and how it converts the readings to energy.
The Sampling Monitoring Approach, or SMA, queries power at a fixed interval while the benchmark runs. The authors configure it for 66.7 Hz, corresponding to a 15 ms window between calls. The resulting trace shows a steady state, a rise in draw near the launch, and a stepwise return towards the original level after the computation. If the observer has only the trace, the onset and decline can look like natural markers for execution. The examples in the paper show that markers based on the shape of the curve can give an interval quite different from the measured kernel duration. A peak reading is another possible way to summarize the trace, but it gives particular weight to a moment that may represent a small share of the work.
The second approach uses the NVML component of PAPI, the Performance Application Programming Interface. PAPI provides a common interface for collecting performance measurements and can call component-specific facilities underneath it. The version of the interface discussed in the paper places the target kernel between the start and end calls. For the event used in the study, the end call retrieves a single power value through NVML. The authors estimate energy from that power value and the kernel’s elapsed time. Synchronizing the measurement with completion gives the reading a clear location in the execution. Its value as an energy estimate depends on how representative that location is of the entire interval.
MTSM preserves the synchronization while collecting a series of values. The host creates a monitoring thread using Pthreads, a threading interface. The launch thread controls a shared atomic flag that marks the recording interval. An atomic flag is a variable that the threads can read or change as a whole while coordinating their work. The launch thread sets the flag around the start of timing and dispatch of the kernel. It uses CUDA synchronization so that the end of timing follows the kernel’s completion on the GPU. The monitoring thread queries NVML during the marked period and stores the returned power values. When the launch thread closes the interval, the monitoring thread can finish its calculation and the launch thread waits for it to complete.
The CUDA synchronization call is important because a host can issue a kernel launch before the device has finished executing the submitted work. For energy measurement, the time until control returns from the launch call alone would give the wrong endpoint. The synchronized procedure uses completion of the GPU work as the endpoint that matters. It also provides a trigger independent of the observable decline in power. The device can remain at an elevated reading after execution ends, and the decline can occur in stages. MTSM uses the runtime event to bound the sample collection.
The authors let the monitoring thread issue queries without a preset pause between them. They observe a reading rate of nearly 2kHz and acknowledge that the sequence can include repeated values. That rate characterizes calls returning values to the software. The sample stream can contain several returns of a value that the sensor is still reporting. Its role is to follow the reported power during the synchronized interval, so the distinction between the frequency of queries and the frequency of new sensor information matters when interpreting the trace.
Convert the synchronized readings into energy
The paper describes the energy calculation as finding the area beneath the power curve for the kernel’s execution. In its numerical procedure, the authors take the arithmetic mean of the collected power values and scale it by the elapsed time.
E = (t / N) × ∑ᵢ Pᵢ
Here E is the estimated kernel energy in millijoules. The symbol t represents elapsed execution time in seconds. N is the number of stored power readings. The index i identifies an individual reading, Pᵢ is that reading in milliwatts, and ∑ᵢ denotes addition over the collected readings. Multiplication by t converts the average power for the interval into energy. The expression uses the recorded sample count as the denominator, so each collected value receives equal weight in that average.
This gives a different quantity from the PAPI estimate even when the two procedures have the same measured runtime and use the same sensor. A higher reading at completion can lift the PAPI estimate above the one obtained by averaging throughout the run. A lower final reading can pull the estimate in the other direction. If the reported power is steady, a single reading from that interval can adequately represent it. The reason to record a sequence is that the benchmarks can have changing profiles, and a series allows power across the interval to contribute to the estimate.
The implementation can be loaded as a shared library at runtime. In the paper’s design, it intercepts CUDA runtime calls to start and end the timing procedure. That arrangement makes the measurement routine usable around an application’s kernel without having to write a new benchmark merely to start the monitor. The authors make the implementation available as GPUs-Energy. Applying the runtime monitor to a kernel gives an estimate for that kernel’s execution interval. Obtaining a per-instruction value additionally requires the paired benchmark and known repetition count described above.
Measure the same board from its power inputs
The hardware setup gives the study a reference that is independent of the onboard sensor and the host’s NVML queries. The authors account for power delivered directly to the card and power delivered through the PCI-E slot. The direct connection supplies 12 V. The motherboard slot provides 3.3 V and 12 V rails, where a rail is a supply line at a specified voltage. Measuring both routes is necessary for a board-level comparison because the onboard and external methods are meant to account for the same device.
On the direct supply, the authors use a current clamp and acquire the voltage with an oscilloscope probe. On the motherboard side, they build a PCI-E riser board that sits between the card and its slot. The board puts a series shunt resistor in each of the two supply lines. The current passing through a shunt is the current delivered along that line. Measuring the voltage on both ends of the shunt gives its voltage drop, and dividing that drop by the resistance gives current. The oscilloscope allows the voltage and current information for the supply paths to be acquired simultaneously.
The paper combines these measurements in the following board-power equation.
Pₕᵥ = ((Vₛ₁ − Vᵍ₁) / Rₛ) × Vᵍ₁ + ((Vₛ₂ − Vᵍ₂) / Rₛ) × Vᵍ₂ + I꜀ₗₐₘₚ × Vᴅᴘꜱ
Here Pₕᵥ denotes the total hardware-measured board power. Vₛ₁ and Vₛ₂ are the measured voltages on the supply side of the shunts for the two PCI-E rails. Vᵍ₁ and Vᵍ₂ are the corresponding voltages on the card side. The subscripts ₁ and ₂ distinguish the rails, and Rₛ denotes the shunt resistance used in the current calculations. Each of the first two terms multiplies the inferred rail current by the voltage delivered to the card. I꜀ₗₐₘₚ is the current recorded with the clamp on the direct supply, and Vᴅᴘꜱ is the measured voltage of that supply. The final term gives the direct connection’s contribution, and addition accounts for all the measured paths into the board.
This reference measures electricity going into the card during the experiment. It supplies a separate way to judge the software-derived estimates. The distinction between the electrical measurement and the attribution to an instruction remains in place. The instrument has access to the board’s supply paths, and the benchmark contrast supplies the basis for assigning part of that energy to the repeated operation. Comparing the software and hardware results tests how closely the software procedure reproduces the result obtained with that electrical reference.
Experiments and results
What the authors compare
The experimental data are power readings and elapsed times from generated instruction microbenchmarks. The test suite covers more than 40 instructions from PTX v.6.4, compiled using CUDA NVCC v.10.1. The results include integer arithmetic, bitwise logic and shifts, single- and double-precision floating-point arithmetic, half-precision arithmetic, multiple-precision operations, special mathematical functions, and integer intrinsics. An intrinsic here is a named operation made available for a specific low-level computation. The individual tests make it possible to compare instructions that stress different parts of execution while retaining the same general benchmark procedure.
The architecture comparison uses the GTX TITAN X for Maxwell, the GTX 1080 Ti for Pascal, the TITAN V for Volta, and the TITAN RTX for Turing. Within the available instruction rows, the appendix gives results for the optimized and non-optimized builds on each card. Every reported pair in a result cell puts the PAPI estimate first and the MTSM estimate second. The unit is the microjoule, written µJ, per target PTX instruction. The appendix sometimes collects several operations in a single row, such as the row for addition, subtraction, minimum, and maximum. Its entries should be read at that reported granularity.
SMA provides a comparison of how monitoring procedures locate execution in a power trace. The final instruction results use PAPI and MTSM. The hardware check uses the TITAN V to assess both against the same independent electrical reference. These parts of the experiment answer related questions. The appendix lets a reader compare energy under changes in hardware or compilation. The hardware check lets a reader assess agreement between the measurement procedures. Comparisons of card entries below use the same software procedure within each example so that the interpretation stays tied to the intended experimental change.
Kernel duration and the visible power event
The power traces for integer addition and unsigned integer division on the TITAN V illustrate the problem with inferring execution from telemetry alone. In the SMA discussion, the paper gives observation windows of 22 sec for addition and 33 sec for division. It reports actual kernel durations of 0.28 sec for addition and 13 sec for division. The observation windows include the changing power around execution. The durations used to describe execution come from timing the kernels.
The synchronized traces annotate the start and end of those same workloads. In the addition example, the power rise precedes the annotated start. At the end of a kernel the reported power can remain elevated briefly and then decline in stages. The relationship between the visible event and the timed computation is consequently different at the two edges of the trace. The examples explain why SMA is used to illustrate the problem but omitted from the final instruction-energy reporting. Choosing an execution window by the visible climb and decline would include power from outside the timed kernel. Choosing only the peak would discard information about the lower portions of the power trace during execution.
The two examples also serve different roles as workloads. Addition provides a short timed execution whose surrounding power event occupies much of the larger observation window. Division provides a longer timed run with its own variation in draw. The challenge for a measurement procedure is to use the correct duration in either case and represent the power within it. Aligning the timestamped execution boundaries addresses the first challenge. Using readings throughout the interval addresses the second.
Energy across cards and instruction families
Volta has the lowest measured instruction energy in many of the appendix’s rows. Double-precision division is a clear case. At O3, its MTSM energy on the TITAN V is below the corresponding value from each other card. The spread across devices also makes clear why it matters to name both the operation and its precision. Double-precision division on this benchmark gives a different ordering of the remaining cards from the one a reader might infer from a simpler integer operation.
Optimized double-precision division in the PTX microbenchmark, measured with MTSM
The TITAN V has the lowest measured energy for this operation.
The numbers
| System or setting | µJ per PTX instruction |
|---|---|
| Maxwell GTX TITAN X | 28.8160 |
| Pascal GTX 1080 Ti | 19.2843 |
| Volta TITAN V (this paper) | 3.6828 |
| Turing TITAN RTX | 23.6016 |
The addition, subtraction, minimum, and maximum row for integer arithmetic also favors Volta. With O3, the MTSM entry for that row is 0.0012 µJ per instruction on Volta, 0.0200 µJ on Pascal, 0.0281 µJ on Turing, and 0.0461 µJ on Maxwell. The combined row for the bitwise operations and, or, not, and xor has those same reported entries under the same settings. The shared values describe the resolution at which the authors present these operations. The table gives a common result for each group and leaves variation among the individual members of a group unquantified.
Unsigned integer division is more expensive than the simple integer group in those runs. Its O3 MTSM entries include 3.8706 µJ per instruction on Volta and 4.5889 µJ on Pascal. The corresponding optimized single-precision division results are 5.0355 µJ and 6.8707 µJ. For the Volta card, the optimized double-precision division value in the chart lies below its single-precision division result. On Pascal the double-precision result in the chart lies above the single-precision value. The observed relationship between precisions is thus specific to how a card runs the particular operation.
The half-precision group shows another hardware pattern. On the optimized addition, subtraction, and multiplication benchmark, the MTSM entries are 0.0624 µJ per instruction for Volta, 0.1220 µJ for Turing, and 2.8788 µJ for Pascal. The Maxwell entry is marked unavailable. The authors explain that support for the tested half-precision instructions began with Pascal. The existing measurements are sufficient to show the lower energy of those operations on Volta and Turing in this experiment. The authors connect the result to the use of half precision in approximate or energy-conscious computation.
The multiple-precision results give a more varied picture than a single architecture ranking suggests. These operations include arithmetic that uses carry information across parts of a value. For the optimized add.cc, addc, and sub.cc group, MTSM reports 0.0535 µJ per instruction on Volta, 0.1065 µJ on Turing, 0.1492 µJ on Pascal, and 0.0791 µJ on Maxwell. The authors describe Volta and Pascal favorably in their broader discussion of multiple precision. The individual rows give the more specific evidence needed for a particular operation, and this row places Maxwell ahead of Pascal under the selected setting.
Special mathematical functions and integer intrinsics supply some of the clearest exceptions to Volta’s general lead. For optimized approximate square root, the MTSM result is 0.2345 µJ per instruction on Pascal and 1.2076 µJ on Volta. In the optimized population-count benchmark, which counts set bits, the reported values are 0.057 µJ on Maxwell and 0.3990 µJ on Volta. Turing records 0.0052 µJ for optimized bfind(), a bit-search operation, while Maxwell records 0.0374 µJ under the same settings. The instruction-level reporting makes these cases visible even though Volta performs well across much of the test suite.
Energy across compiler settings
The authors find that the optimized builds generally require less energy per instruction. The division results make this especially clear. For unsigned integer division on the TITAN V, MTSM reports 3.8706 µJ per instruction for O3 and 20.2517 µJ for O0. The same comparison on the GTX 1080 Ti gives 4.5889 µJ at O3 and 36.0963 µJ at O0. These comparisons keep the tested PTX operation and device fixed and change the compilation setting.
For single-precision division on Turing, the MTSM entries give 7.9232 µJ per instruction at O3 and 58.6767 µJ at O0. Operations with lower absolute costs can show an optimization effect as well. The double-precision addition, subtraction, minimum, and maximum group on Volta is reported at 0.3567 µJ with O3 and 0.5114 µJ with O0, again using MTSM. These examples span arithmetic with different native implementations and different amounts of elapsed work. The build setting belongs with the reported instruction cost in each case.
The paper relates the pattern to its earlier evidence that non-optimized instruction execution can take more cycles. It also points to PTX lowering, the process of turning a virtual instruction into the native instructions the GPU actually executes. The same PTX expression can require different amounts of native work depending on the build. A faster completion can reduce measured energy by shortening the period during which the hardware is active. The measurements show the effect on energy of changing the build setting as a whole, including whatever changes it makes to the benchmark’s execution.
Agreement with the electrical reference
For hardware verification, the authors compare the energy results of PAPI and MTSM with readings from their custom measurement system on the TITAN V. They report mean absolute percentage error, or MAPE, which expresses the magnitude of errors relative to the reference in percentage terms. They also report root mean square error, or RMSE, which summarizes the size of errors after squaring them and therefore gives larger deviations more influence. Both measures favor closer agreement at lower values.
Average percentage error against the hardware reference for TITAN V instruction tests
Synchronized sampling agrees more closely with the electrical reference.
The numbers
| System or setting | MAPE % |
|---|---|
| PAPI end-of-kernel measurement | 10.24 |
| MTSM synchronized sampling (this paper) | 6.39 |
The reported mean RMSE is 3.97 for MTSM and 5.04 for PAPI. The verification figure also shows errors relative to hardware for a selection of integer, single-precision, and double-precision instructions. The averages summarize the comparison across the instruction tests, while the selected cases illustrate the variation associated with individual benchmarks. The two aggregate measures agree on the ordering, strengthening the conclusion that the synchronized procedure returned energy values closer to the electrical reference for the Volta tests.
The comparison across the appendix is related but has a different basis. PAPI often yields a higher energy estimate than MTSM, which is consistent with endpoint power sometimes exceeding the average during execution. In their discussion, the authors describe differences up to 1 µJ for larger cases such as floating-point division. The individual entries show that the direction varies with the test. For optimized approximate reciprocal square root on Pascal, listed as rsqrt, PAPI gives 0.2573 µJ per instruction and MTSM gives 0.1163 µJ. For optimized population count on the same card, PAPI gives 0.1347 µJ and MTSM gives 0.2674 µJ. The direct hardware comparison is what allows the paper to judge accuracy, since a difference between two software estimates by itself gives only their disagreement.
What the ablations show
Removing the target work defines the attribution
The most direct removal experiment is the paired benchmark used to estimate every instruction cost. One run includes the target chain. In the other, the authors remove that chain while retaining the surrounding benchmark structure. This produces the overhead measurement that enters the energy calculation. Its role is to answer a concrete counterfactual within the experiment. How much energy does the companion computation use when the targeted repeated operation has been omitted?
The placement of the removal matters. The full benchmark includes supporting operations specifically chosen to keep the chain live through compilation. For instance, the result in the unsigned division benchmark is carried forward through the load, addition, and store scheme. The overhead run gives the study a measure of energy for the remaining execution in the same experimental setting. The resulting difference is defined by the two executable kernels. It includes the consequences of adding the dependent chain to that particular workload, including changes to how long the device remains active. It is the basis for attributing incremental energy at the PTX level.
The design has a useful distinction between retaining the framework of the benchmark and retaining the full run’s timing. A removed instruction stops contributing its execution time. That is part of the change the paired experiment is intended to measure. The paper does not supply a separate calibration that holds total duration constant while switching off target work. The reported overhead subtraction gives one measured contrast, and any interpretation of the estimate should carry that definition with it.
Changing the compiler alters the measured cost
The O0 and O3 measurements change the compiler setting while preserving the device and target PTX operation. They show that the virtual instruction alone is insufficient to specify a per-instruction energy cost. The compiled realization can change the time spent executing the body and the native sequence used to implement the operation. The output validation is part of the control because it establishes that the optimized benchmark still produces the expected result.
The effect differs by instruction and hardware. For the MTSM measurements of approximate square root, Volta has an optimized entry of 1.2076 µJ per instruction and a non-optimized entry of 8.2517 µJ. Pascal has 0.2345 µJ at O3 and 10.6812 µJ at O0. Pascal leads Volta on the optimized benchmark, while Volta leads Pascal on the non-optimized benchmark. The compiler choice therefore affects how the two architectures rank for this operation as well as the cost assigned on either card.
The authors explain the broad optimization trend in terms of differences in cycles and the translation from PTX into native instructions. These are plausible parts of the mechanism and are compatible with their earlier latency work. In the energy study, changing the optimization level changes the compiled kernel as a whole. The controlled result is the energy difference between builds. Isolating the contribution of individual compiler transformations would require a comparison that varied those transformations independently.
Changing the monitor reveals two distinct problems
The software comparisons expose two difficulties that often occur together. The first is placing the measurement interval. Background sampling observes the rise and fall in reported board power, so a procedure based on those transitions can include time around the computation. Synchronizing timing with CUDA gives the start and end events an execution-based definition. Figures for addition and unsigned division illustrate how that changes the interpretation of the same kind of trace.
The second difficulty is summarizing power within that interval. PAPI synchronizes the test and collects the particular event at completion. MTSM collects a series of values while work is in progress. This comparison shows what can be gained by representing the interval with measurements from across it. The relative improvement is supported by the hardware check, where MTSM has lower average MAPE and lower mean RMSE. The individual discrepancies in both directions also show why the effect of using the last sample depends on where that sample falls in the power profile.
The experiments provide evidence for the combined monitoring procedure. The synchronized monitor controls both the interval and the stream of queries used to compute the mean. The paper uses traces to explain the role of timing and the hardware comparison to assess overall accuracy. It leaves open how much of the improvement would come from synchronization alone at a fixed sampling schedule, or how energy estimates would change across several fixed schedules with the same timing. Those questions go beyond the comparisons reported.
Comparing devices reveals interactions with the operation
The tests also make it possible to compare devices while using the same PTX operation, compiler setting, and software measurement procedure. This is a controlled comparison at the level of what the benchmark asks the device to do. The device change brings differences in implementation and native compilation together. As a consequence, the measurements can identify a card that is more economical for a given operation under a selected setting. They cannot assign that difference to an isolated execution unit or scheduler property.
The useful generalization stays close to the data. Volta performs well across several major instruction families. The special-function and intrinsic examples show that its leading position need not carry over to a specific operation. The half-precision measurements add an example where a particular capability changes the useful comparison among devices. An overall tendency is informative about the tested suite, while the relevant row is the evidence for a decision about a specific operation and compilation setting.
Limitations
Boundaries stated by the authors
The authors explicitly place direct hardware verification on the Volta TITAN V. That is the scope of the average percentage error and root mean square error they report for the two software procedures. The other card comparisons use the software methods. Their appendix can show that estimated costs vary across devices and instruction families, while the numerical accuracy observed against the electrical reference belongs to the tested Volta setup.
The paper also identifies limitations in the software measurement procedures themselves. The authors set aside SMA for final energy reporting because a background trace makes the kernel interval hard to infer. They describe the particular PAPI event as a single query at the end, so its estimate can be sensitive to irregular power over the run. They acknowledge redundant NVML returns during fast polling. Each point concerns the actual implementation that produced the results. PAPI can also be used to arrange background readings, a case the paper mentions separately from the PAPI measurement evaluated in its final comparison.
On compilation, the authors emphasize that PTX can expand into several native instructions, and they point out that register availability differs across architectures. A value recorded for one PTX operation consequently applies to the work done by its compiled realization in the experiment. The paper also explicitly records an unavailable part of the test matrix. The half-precision operations were skipped on Maxwell because the support discussed by the authors begins with Pascal. The missing measurements narrow the comparison for that family to the cards on which the benchmark ran.
Finally, the paper discusses instruction costs as possible inputs to future GPU energy estimation and performance work. That is the authors’ proposed use of the measurements. The validation experiment establishes agreement with an electrical reference at the scope of the selected instruction benchmarks. The paper’s own conclusion that a synchronized monitor can be used around a kernel is about the scope of the collection mechanism. Its numerical verification has the more specific scope of the workloads and card actually checked.
Boundaries of the experimental setup
The single-thread dependent chain gives a precise interpretation of the microbenchmark. Each study kernel repeats a target operation in a constrained sequence and keeps a result that can be verified. A program with many blocks and active warps can issue and overlap work differently. Its memory traffic and mixture of instructions can also alter board draw. Extrapolating from the reported energy per instruction to such a program would require evidence about how those costs transfer. The paper presents the repeated-operation measurements and their verification as the empirical result.
There is also a difference between energy attribution and direct measurement of a hardware component. The reference instrument observes the electrical inputs of the card. The reported instruction energy arises from comparing the full and overhead runs. Those runs can differ in duration, and removing the target work can alter dependencies and surrounding execution. It follows that the subtraction has the meaning of an incremental cost for the benchmark pair. Quantifying energy inside a particular arithmetic unit would require measurements or controls that distinguish the unit’s activity from these other board-level effects.
The timing boundaries narrow the measurement to an interval defined by the host’s launch and synchronization procedure. In the graphs, power begins to rise near execution and can remain elevated afterward. Whether those surrounding periods belong in an energy budget depends on the question. The paper’s MTSM energy calculation concerns the bounded kernel interval. A workload-level accounting exercise that includes the lead-up to launches, intervals between kernels, or the drawn-out return to steady state would use a different scope. The traces show enough to make that distinction consequential, especially for a short kernel.
The arithmetic mean used by MTSM also carries an assumption about time. Each reading gets equal weight, so the procedure represents the interval well to the extent that the returned sequence samples it evenly enough. The kernel duration supplies the overall time scale. The nearly 2kHz polling result describes the monitor’s ability to fetch reported values, and the authors acknowledge repeated values. The experiment leaves the time resolution of independent changes in the sensor output and the effect of possible uneven spacing on particularly brief events less clearly characterized than the overall reading rate.
The error averages give a compact comparison of PAPI and MTSM on the TITAN V. Those aggregates leave several forms of uncertainty open, including variability across repeated runs of the same benchmark and how the relative error behaves for very small instruction-energy estimates. Such estimates are differences between run-level measurements divided over many operations. Even modest uncertainty in either run can matter when their difference is small. The appendix gives detailed point values, and the hardware verification figure shows selected instruction errors. The reported decimal places do not on their own establish the repeatability of each point estimate.
The highest-level architecture comparisons are based on one selected card from each generation. A reported difference can combine the card’s hardware resources, its execution behavior, and the native code selected by the compiler. The paper makes a valuable comparison of those complete configurations. A claim about every device within an architecture, or about the cause of a difference in one isolated microarchitectural feature, would have a broader scope. The instruction results support statements about the cards and builds that were actually measured, including the exceptions in which an operation favors a different device from the one that leads most often.
What came after
The later citing work broadens the scale at which GPU energy is discussed. Arafa and colleagues define a measurement around a repeated instruction or timed kernel and compare onboard estimates with electricity measured at the card. The later titles concern energy at the scale of machine learning experiments and training, where the object of interest is the workload as a whole. Their citations establish a connection to the instruction-level study. The specific measurement procedures they reused, if any, remain unspecified.
The 2020 paper on systematic reporting of energy and carbon footprints in machine learning takes reporting itself as its subject. The link to instruction-level measurement is the need to define what an energy figure covers. A GPU-board reading over a synchronized kernel interval has a precise time window and equipment boundary. Reporting the energy or carbon footprint of a machine learning experiment raises that boundary question at a wider scale. The citing relationship places the GPU measurement study in the background of that reporting problem. It does not, on its own, establish that the reporting paper adopted MTSM or used the instruction values in carbon accounting.
The 2022 Zeus study of GPU energy during deep neural network training addresses both understanding and optimizing training energy. That subject changes the unit of analysis from a benchmarked operation to the training workload. Arafa and colleagues show why elapsed time, changing power, and the scope of the measured activity matter when interpreting energy. At training scale those same measurement questions concern a much larger execution. The citation connects the two problems, while evidence of a particular implementation transfer or use of the instruction table would require details beyond the citing relationship.
Cite
Cite as Yehia Arafa; Ammar ElWazir; Abdelrahman ElKanishy; Youssef Aly; Ayatelrahman Elsayed; Abdel-Hameed Badawy; Gopinath Chennupati; Stephan Eidenbenz; and Nandakishore Santhi. 2020. Verified Instruction-Level Energy Consumption Measurement for NVIDIA GPUs. arXiv:2002.07795.
@misc{eidenbenz2020verified,
title = {{Verified Instruction-Level Energy Consumption Measurement for NVIDIA GPUs}},
author = {Yehia Arafa; Ammar ElWazir; Abdelrahman ElKanishy; Youssef Aly; Ayatelrahman Elsayed; Abdel-Hameed Badawy; Gopinath Chennupati; Stephan Eidenbenz; and Nandakishore Santhi},
year = {2020},
doi = {10.1145/3387902.3392613},
eprint = {2002.07795},
archivePrefix = {arXiv},
url = {https://doi.org/10.1145/3387902.3392613}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/arafa-2020-verified-instruction-level-energy-consumption/