Power at Scale: Voltage and Frequency Scaling, Energy and Heat

A core that is on can still run fast or slow. The choice is a pair, a voltage and a clock rate. It sets the energy of every task and the heat of the chip.

You Will Be Able To

  • Say what an operating point is, and give the order of a change up and of a change down.
  • Work out the energy of one task at several operating points, with the background power.
  • Keep a balance of heat over a burst, and rate the burst by its peak.
Lesson
S10.9
Time
25 min
Runs on
Your browser
Check
5 questions

A phone warms in your hand while a game loads. Then the picture stutters, although nothing in the game has changed.

The chip slowed itself down. Something inside decided that speed had become too expensive.

Before You Start

You need Power Domains at Scale: the cluster and its eight cores share one supply.

You need Power Modes and the Energy of a Sleep: energy is power multiplied by time, and its units.

You need Clock Sources and the Chip-Level Clock Tree: a PLL makes the fast clock.

Five questions this page answers
Question
1Why are the voltage and the clock rate chosen as a pair?
2A core goes to a faster point. Which changes first, the supply or the clock?
3Why is the slowest point not the cheapest for a task?
4After a burst the sensor reads a safe temperature. Why does that not prove the burst was safe?
5A task of 500 cycles runs at the fast point. Which cap does the lab print for the next task?

The Idea: A Pair, a Bill and a Balance

The last lesson decided which domains are on. This one is about a core that is on and has work. It can still do that work fast or slowly, and the choice costs energy and heat.

First, the choice is a pair. Logic settles more slowly when its supply is lower. So each supply voltage has a fastest clock rate at which the core still works. A voltage with its clock rate is called an operating point, and a chip offers a few of them.

A change from one point to another takes two moves, the supply and the clock. For a moment the core runs on a mixed pair. That mixed pair must be a safe one. So the order of the two moves matters.

Second, a task has a bill. Energy is power multiplied by time. A slow point uses little power, but for a long time. And some power flows for as long as the core is on, whatever it does. The cheapest point is often in the middle.

Third, power becomes heat. A spot of the chip warms when it gets more power than its cooling takes away. A short burst can pass the limit and be cool again before anybody looks. So the chip keeps a balance, and it remembers the peak.

New Words

New words on this page
WordMeaning
Volt (V)The unit of voltage. The supply of a core is around one volt.
Operating pointA supply voltage together with the fastest clock rate that is proven at that voltage.
DVFSChanging the operating point while the chip runs. DVFS is short for dynamic voltage and frequency scaling.
Switching power of a circuitThe power that goes into charging the wires of a circuit each time its signals change. Switching power for short.
Background powerThe power that flows for as long as a block is on, whether it works or not. Leakage is a large part of it.
Energy of a taskThe power of a core multiplied by the time that the task runs.
Stored heatThe heat that a spot of the chip holds above its resting level.
Temperature sensorA small circuit that reports how warm its own spot of the chip is.
Thermal tripThe moment at which a sensor reading reaches a set limit. Trip for short.
ThrottlingLowering the operating point because the chip is too warm.

Units on this page: megahertz (MHz) for a clock rate, milliwatts (mW), microseconds and nanojoules (nJ). 1 mW for 1 microsecond is 1 nJ.

One Picture: The Loop Around a Core

Who Sets the Voltage and the ClockStep through the picture. It starts with the core and its two inputs and ends with the loop that guards the temperature.
  • Processor
  • Power
  • Pads
  • Clock / reset
  • Debug
Who Sets the Voltage and the ClockStep through the picture. It starts with the core and its two inputs and ends with the loop that guards the temperature. component Software asks for an operatingpoint component Power controller keeps the order ofeach change component Power chip on the board; setsthe supply component Clock controller sets the rate of theclock component Cluster eight cores on onesupply component Temperaturesensor beside the cores wanted pointnew voltagesupplynew rateclocktrip
  1. component Power chipon the board; sets the supply
    • supply → Cluster
  2. component Clock controllersets the rate of the clock
    • clock → Cluster
  3. component Clustereight cores on one supply
  4. component Softwareasks for an operating point
    • wanted point → Power controller
  5. component Power controllerkeeps the order of each change
    • new voltage → Power chip
    • new rate → Clock controller
  6. component Temperature sensorbeside the cores
    • trip → Power controller
  1. Two inputs

    A core needs a supply and a clock. How fast it may be clocked depends on how high the supply is.

  2. Software asks

    Software knows how much work waits. It asks for an operating point: a voltage and a clock rate, as one pair.

  3. The supply changes

    The power controller tells the power chip the new voltage. The supply needs time to settle there.

  4. The clock changes

    The clock controller sets the new rate. The power controller decides which of the two changes goes first.

  5. The guard

    A sensor beside the cores watches the temperature. When it trips, the controller lowers the point, whatever software asked for.

Read the diagram as text
  • Software: asks for an operating point
  • Power controller: keeps the order of each change
  • Power chip: on the board; sets the supply
  • Clock controller: sets the rate of the clock
  • Cluster: eight cores on one supply
  • Temperature sensor: beside the cores
  • Software → Power controller: wanted point
  • Power controller → Power chip: new voltage
  • Power chip → Cluster: supply
  • Power controller → Clock controller: new rate
  • Clock controller → Cluster: clock
  • Temperature sensor → Power controller: trip

The blocks of the exercise chip ap_phone. The lab of this page is a sheet of sums: it has none of these blocks as a circuit.

The Smallest Example, Worked by Hand

No simulator yet. The cluster of the exercise chip has three operating points. One task needs 1000 clock cycles. Which point finishes it for the least energy?

Two kinds of power add up. The switching power is capacitance times voltage times voltage times clock rate. Here the capacitance is 100 picofarads, so at 0.70 volts and 100 MHz it is 4.9 mW. The background power is 8 mW at every point.

One task of 1000 cycles, by hand
PointSwitching powerWith 8 mW of backgroundTime for 1000 cyclesEnergy
0.70 V, 100 MHz4.9 mW12.9 mW10 microseconds129 nJ
0.80 V, 200 MHz12.8 mW20.8 mW5 microseconds104 nJ
1.00 V, 400 MHz40 mW48 mW2.5 microseconds120 nJ

The slow point has the lowest power and the highest bill. It keeps the 8 mW of background power flowing for 10 microseconds. The fast point is done first, but its voltage is squared in the sum. The middle point wins.

Now the heat of the fast point. One spot of the chip loses 16 mW to its cooling. Whatever it gets above that is stored. Halfway through the task a neighbour core starts, and adds 8 mW to the same spot.

The heat of one spot, by hand
StretchPower inAbove the coolingLastsStored at its endSensor
The task alone48 mW32 mW1.25 microseconds40 nJ44 degrees
With the neighbour56 mW40 mW1.25 microseconds90 nJ49 degrees
After the task8 mW8 mW below5 microseconds50 nJ45 degrees

The sensor of this exercise rests at 40 degrees and rises one degree for each 10 nJ stored. Its limit is 48 degrees. The middle row passed it. The last row is back below it.

The Rules

  1. Rule 1: An operating point is a supply voltage and the fastest clock rate proven at it.

    A slower clock at that voltage is safe. A faster one is not.

  2. Rule 2: On the way up, the supply rises first. On the way down, the clock slows first.

    Either way the pair in between is the high voltage with the slow clock.

  3. Rule 3: Switching power is capacitance times voltage squared times clock rate.

    Half the voltage would cut it to a quarter. Half the clock rate cuts it to a half.

  4. Rule 4: The energy of a task is its whole power times its whole time.

    Background power counts for every microsecond that the task runs.

  5. Rule 5: Stored heat grows by the power above the cooling, times the time.

    It shrinks the same way when the power is below the cooling, but not below zero.

  6. Rule 6: A burst is rated by its peak, not by its last reading.

    So a trip is remembered until the controller has acted on it.

Sources for These Rules

Rule 3: Patterson and Hennessy, Computer Organization and Design, ARM edition, section 1.7. Also Weste and Harris, CMOS VLSI Design, fourth edition, section 5.1.

Rule 1, and a controller that picks a clock rate and then the lowest voltage for it from a table: Weste and Harris, section 5.2.3.2.

Rule 2 is common practice. It follows from rule 1, and none of our reference books states the order.

Rule 4 is arithmetic on the definition of energy.

Rules 5 and 6 describe the heat model of our lab, which is a simple one. Heat flow and temperature sensors on a chip: Weste and Harris, sections 13.2.4 and 13.2.5.

Now Run It

The lab at the end of this page is the two hand tables as a program. Before them it checks the pair that each order of a change passes through.

Printed by the lab on Icarus. Every number is an exercise value.
up, supply first: 1.00 V 200 MHz safe=1
up, clock first: 0.80 V 400 MHz safe=0
down, clock first: 1.00 V 200 MHz safe=1
down, supply first: 0.80 V 400 MHz safe=0
task=1000 cycles
0.70 V 100 MHz | 12.9 mW x 10.00 us = 129.0 nJ
0.80 V 200 MHz | 20.8 mW x 5.00 us = 104.0 nJ
1.00 V 400 MHz | 48.0 mW x 2.50 us = 120.0 nJ
heat alone: 48.0 mW x 1.250 us | stored=40.0 nJ | sensor=44.0 C
heat with neighbour: 56.0 mW x 1.250 us | stored=90.0 nJ | sensor=49.0 C
heat after the task: 8.0 mW x 5.000 us | stored=50.0 nJ | sensor=45.0 C
next task: cap=200 MHz

Rule 2 at work, in the first four rows. The change goes between 0.80 V with 200 MHz and 1.00 V with 400 MHz. Both right orders pass through 1.00 V with 200 MHz, and safe=1. Both wrong orders pass through 0.80 V with 400 MHz, and safe=0.

Rules 3 and 4, in the three rows with a bar. The power grows from 12.9 to 48.0 mW. The energy does not follow it: 129.0, then 104.0, then 120.0 nJ.

Rule 5, in the heat rows. The stored heat climbs to 40.0 and to 90.0 nJ. It falls to 50.0 while the spot gets less than its cooling removes.

Rule 6, in the last two rows. The last sensor reading is 45.0, below the limit of 48. The cap is 200 MHz all the same, because the row before it read 49.0.

This lab leaves things out. It is a sheet of sums with no circuit. A change of point costs it no time and no energy, and its spot cools at a fixed rate.

Why It Is Built This Way

ChoiceThe alternativeIts cost
A few proven pointsAny voltage with any clock rateEvery pair on offer must be tested on real chips. A pair that nobody tested fails in the field.
One supply for the clusterA supply for each coreEach supply needs its own part of the power chip, its own pins and its own wires on the board.
A trip that hardware remembersSoftware reads the sensor from time to timeA burst is shorter than the gap between two readings. The peak is gone before software looks.
Finish fast, then switch offStretch the work over the whole timeIt depends on the background power. With none of it, the slowest point of our lab would win, with 49 nJ.

The second row has a price of its own. All eight cores sit on one supply, so all eight run at one voltage. One core that needs the fast point makes every awake core pay the squared voltage.

The Trap: The Test That Read the Sensor Once

A team tunes a camera feature. Their test runs the burst, waits for it to end and reads the temperature sensor. The reading is always safe, so they let the feature use the fast point.

In the field the phones throttle in the middle of a recording. The test had read the last row of our table: 45 degrees. The chip had lived through the middle row: 49 degrees. Its hardware remembered the trip, and capped the next task.

The second trap is the chart of power. Draw the three points by their power and the slow one looks best. The battery pays for energy, and by energy it is the worst of the three.

The third trap is the order of a change. Raise the clock first, and for a moment the core runs at 400 MHz on 0.80 volts. Nothing reports an error. Some path is too slow, and one wrong value is stored.

At Scale

This lab3 points, 1 spot
A phonemany points, many sensors

This section looks ahead, to what the Low Power track and the people who tune a phone do with these three ideas.

  1. The full story of scaling

    The Low Power track shows how the voltage for a clock rate is found. Start at the lesson on voltage scaling.

  2. Fast and then off

    Finishing early pays only if the idle time after it is cheap. The trade is worked through in Race-to-Idle.

  3. A change is not free

    The supply needs time to settle, and the PLL needs time to lock again. Both cost energy. For a short task the change can cost more than it saves.

  4. Many spots

    A large chip has a sensor near every block that gets hot. The cap follows the hottest one, and a neighbour can be the cause.

Try It

Run the lab. Find the cheapest of the three points for this task, and the hottest moment.

Change TASK_CYCLES to 2000. Predict the three energies, and whether the cap changes.

Set BASE_MW to 0.0. Predict which point is the cheapest now, and say why the order changed.

Names Printed by the Lab
NameMeaning
V, MHzThe supply in volts and the clock rate in megahertz.
safe1 if that clock rate is proven at that supply.
mW, us, nJPower in milliwatts, time in microseconds, energy in nanojoules. 1 mW for 1 microsecond is 1 nJ.
C_PFThe capacitance that one cycle charges, in picofarads. A picofarad is a very small unit of capacitance.
BASE_MWThe background power in milliwatts.
storedThe heat that the spot holds above its resting level.
sensorWhat the temperature sensor reads, in degrees Celsius.
capThe fastest clock rate that the controller allows for the next task.
Sources and What the Lab Leaves Out

The lab is a sheet of sums in test code. It has no supply, no PLL and no sensor as a circuit.

It starts each row at a settled point. The time and the energy of a change are left out. The first practice problem counts both.

Its heat model is one spot that cools at a fixed rate. Real heat flows through the package, and real cooling grows with the temperature.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: up, supply first: 1.00 V 200 MHz safe=1 up, clock first: 0.80 V 400 MHz safe=0 down, clock first: 1.00 V 200 MHz safe=1 down, supply first: 0.80 V 400 MHz safe=0 task=1000 cycles 0.70 V 100 MHz | 12.9 mW x 10.00 us = 129.0 nJ 0.80 V 200 MHz | 20.8 mW x 5.00 us = 104.0 nJ 1.00 V 400 MHz | 48.0 mW x 2.50 us = 120.0 nJ heat alone: 48.0 mW x 1.250 us | stored=40.0 nJ | sensor=44.0 C heat with neighbour: 56.0 mW x 1.250 us | stored=90.0 nJ | sensor=49.0 C heat after the task: 8.0 mW x 5.000 us | stored=50.0 nJ | sensor=45.0 C next task: cap=200 MHz

Check Yourself

Predict the outputIn this run the task has 500 cycles, not 1000. Work out the heat of the two stretches at the fast point. What is the last line? Its form is: next task: cap=.. MHz
module tb;
  // One task on one core of ap_phone. Change these and run again.
  localparam int TASK_CYCLES = 500;
  parameter real C_PF = 100.0;     // capacitance charged in each cycle, with the activity folded in
  parameter real BASE_MW = 8.0;     // background power: it flows for as long as the task runs

  // The three operating points: a supply in millivolts and the fastest clock that is proven at it.
  function automatic int max_mhz(input int mv);
    return mv >= 1000 ? 400 : mv >= 800 ? 200 : mv >= 700 ? 100 : 0;
  endfunction

  // Halfway through a change, the core runs for a moment on a mixed pair. Is that pair safe?
  task automatic halfway(input string label, input int mv, mhz);
    $display("%s: %0.2f V %0d MHz safe=%0d", label, mv / 1000.0, mhz, mhz <= max_mhz(mv));
  endtask

  function automatic real task_power(input real volts, mhz);
    return BASE_MW + C_PF * volts * volts * mhz / 1000.0;
  endfunction

  task automatic point(input int mv);
    real volts, mhz, us, mw;
    volts = mv / 1000.0;
    mhz = max_mhz(mv);
    us = TASK_CYCLES / mhz;
    mw = task_power(volts, mhz);
    $display("%0.2f V %0.0f MHz | %0.1f mW x %0.2f us = %0.1f nJ", volts, mhz, mw, us, mw * us);
  endtask

  // A balance of heat for one spot of the chip. Cooling removes 16 mW: an exercise value.
  real stored_nj = 0;
  bit tripped = 0;
  task automatic interval(input string label, input real mw, us);
    real sensor_c;
    stored_nj = stored_nj + (mw - 16.0) * us;
    if (stored_nj < 0) stored_nj = 0;
    sensor_c = 40.0 + stored_nj / 10.0;      // an ideal sensor: one degree for each 10 nJ stored
    if (sensor_c >= 48.0) tripped = 1;       // the trip is remembered
    $display("heat %s: %0.1f mW x %0.3f us | stored=%0.1f nJ | sensor=%0.1f C", label, mw, us, stored_nj, sensor_c);
  endtask

  initial begin
    real fast_us;
    // From 0.80 V and 200 MHz up to 1.00 V and 400 MHz, and back. Two orders for each way.
    halfway("up, supply first", 1000, 200);
    halfway("up, clock first", 800, 400);
    halfway("down, clock first", 1000, 200);
    halfway("down, supply first", 800, 400);
    $display("task=%0d cycles", TASK_CYCLES);
    point(700);
    point(800);
    point(1000);
    // The fast point. A neighbour core adds 8 mW to the same spot during the second half.
    fast_us = TASK_CYCLES / 400.0;
    interval("alone", task_power(1.0, 400), fast_us / 2);
    interval("with neighbour", task_power(1.0, 400) + 8.0, fast_us / 2);
    interval("after the task", BASE_MW, 5.0);
    $display("next task: cap=%0d MHz", tripped ? 200 : 400);
  end
endmodule
ConceptWhy are the voltage and the clock rate chosen as a pair?
ConceptA core goes to a faster operating point. Which changes first?
ConceptWhy is the slowest point not the cheapest for a task?
ConceptAfter a burst the sensor reads a safe temperature. Why is that no proof?

Common Mistakes

Wrong Pick the point with the lowest power to save the battery.

It runs longer, and the background power flows all that time.

Fix Multiply the whole power by the whole time, for each point.

Wrong Raise the clock first on the way to a faster point.

For a moment the fast clock runs on the low supply.

Fix Raise the supply, wait until it has settled, then raise the clock.

Wrong Read the sensor after a burst to prove that the burst was safe.

The spot may have passed the limit and cooled again.

Fix Use the remembered trip, or keep the peak of the balance.

Remember

  • An operating point is a voltage with the fastest clock rate proven at it.
  • Up: supply first. Down: clock first. The pair in between is always the high voltage with the slow clock.
  • The energy of a task is its whole power times its whole time, with the background power.
  • Heat is a balance. Rate a burst by its peak, and remember a trip.

Practice

Report a problem with this page