Core Clusters: Instruction Issue and the Choice of a Core
Your camera preview has a deadline for every frame, and a cluster can offer two kinds of core. One is wide and hungry, the other narrow and frugal. Which one should run the job?
You Will Be Able To
- Follow five instructions through a wide out-of-order core and a narrow in-order core, cycle by cycle.
- Choose a core using the frame deadline and the energy for one completed frame.
- Tell a pair of cores that share work from a pair that checks itself.
- Lesson
- S10.13
- Time
- 30 min
- Runs on
- Your browser
- Check
- 5 questions
The job for one camera frame loads a header, and a pointer to the next buffer. Each load takes six cycles.
A wide core has two slots in every cycle. Does it fill them while a load is out?
Before You Start
You need Beyond Five Stages: issue width, a superscalar core, a dependency, in order.
You need Out-of-Order Execution: an out-of-order core starts an instruction when its inputs are ready.
You need The Reorder Buffer: results retire in program order.
You need The Cache Hierarchy of a Core Cluster: private caches, and what a moved job finds there.
You need Power Modes and the Energy of a Sleep: 1 mW for 1 microsecond is 1 nJ.
| Question | |
|---|---|
| 1 | What does a two-wide core do when its oldest instruction waits? |
| 2 | What does out-of-order issue gain, and what must it keep? |
| 3 | Why would one cluster hold two kinds of core? |
| 4 | A job has a deadline. How do you pick the core that runs it? |
| 5 | Why is a lockstep pair not two workers? |
The Idea: Fill the Slots, Meet the Deadline, Count One Worker
A core of a cluster can be built in two ways. A performance core is wide and out of order. It can start two or more instructions in a cycle. When the oldest one waits, younger ready ones go first.
An efficiency core is narrow and in order. It starts one instruction in a cycle, and it stops at every wait. It is smaller, and it draws less power while it runs.
Both kinds still make results final in program order. Software never sees the younger instruction go first.
A cluster that holds both kinds is a mixed cluster. Textbooks call it heterogeneous.
Which core should run a job? Speed alone does not decide, and power alone does not either. Each frame has a frame deadline: the time by which its job must be done.
A core that would finish late is out. Among the cores that are left, the one that spends the least energy on the whole job wins.
There is a third way to use two cores. Both run the same job at the same time, and every result is compared. That is a lockstep pair. It finds a circuit that gives a wrong bit, but it does one job, not two.
One word on the chip. The two kinds of core on this page are a teaching pair. ap_phone, the exercise chip of this module, has 8 equal cores.
New Words
| Word | Meaning |
|---|---|
| Issue of an instruction | To send an instruction to the unit that does its work. From then on it runs. Issue width caps how many issue in a cycle. |
| Issue slot | One place for an instruction in the issue of one cycle. A two-wide core has two slots. |
| Ready instruction | An instruction whose input has arrived: the result it needs exists. |
| Performance core | A wide out-of-order core. It finishes a job sooner and draws more power while it runs. |
| Efficiency core | A narrow in-order core. It takes longer and draws less power while it runs. |
| Mixed cluster | A cluster with more than one kind of core. |
| Frame job | The work that software hands to one core for one frame of the camera. |
| Frame deadline | The time by which a frame job must be done, counted from its start. |
| Active power | The power a core draws while it runs the job. |
| Energy of a frame | Active power times the time that the frame job runs. |
| Lockstep pair | Two cores that run the same job at the same time, with every result compared. |
Units on this page: milliwatts (mW), microseconds and nanojoules (nJ). 1 mW for 1 microsecond is 1 nJ.
One Picture: One Wide Core, Cycle by Cycle
The picture and the lab use five instructions from a frame job. Two of them load from memory, and each load takes 6 cycles.
| Number | Instruction | Needs the result of | Result after |
|---|---|---|---|
| 1 | load header | nothing | 6 cycles |
| 2 | test header | instruction 1 | 1 cycle |
| 3 | load pointer | nothing | 6 cycles |
| 4 | add address | instruction 3 | 1 cycle |
| 5 | store address | instruction 4 | 1 cycle |
Program order is 1 to 5. Instruction 1 is the oldest.
- Memory
- Control / FSM
- Processor
- Bus
- Cycle 0: the first slot
Instruction 1 loads the header. It issues at once. Instruction 2 tests the header, so it must wait for that load.
- Cycle 0: the second slot
An in-order core would leave this slot empty. This core passes instruction 2 and issues 3, the load of the next pointer.
- Cycles 1 to 5: two waits at once
Nothing is ready, so nothing issues. But both loads are on their way, and they wait at the same time.
- Cycle 6: both loads answer
Instruction 2 can test the header, and 4 can add to the pointer. Both issue. Instruction 1 retires.
- Cycles 7 and 8: order is kept
Instruction 3 had its result at cycle 6. It retires at 7, together with 2, which is older. Then 4 and 5 retire.
Read the diagram as text
- Waiting instructions: fetched, not yet issued, oldest first
- Issue: two slots in each cycle
- Load unit: a result after 6 cycles
- Adder: a result after 1 cycle
- Reorder buffer: keeps program order: S2.32
- Retire: up to two final results a cycle, oldest first
- Waiting instructions → Issue: ready ones
- Issue → Load unit: loads
- Issue → Adder: sums and tests
- Load unit → Reorder buffer: result
- Adder → Reorder buffer: result
- Reorder buffer → Retire: in program order
The performance core of the lab. The waits of 6 and 1 cycles are lab choices.
The Smallest Example, Worked by Hand
No simulator yet. The lab has three model cores. Two of them are the kinds of the cluster. The third is there to separate width from order.
| Core | Width | Order | Stands for |
|---|---|---|---|
| P | 2 | out of order | the performance core |
| W | 2 | in order | a thought experiment: width without out-of-order issue |
| E | 1 | in order | the efficiency core |
All three retire in program order, as many in a cycle as they can issue.
Follow P, the performance core. In each cycle, list the instructions that are ready, and issue up to two of them, oldest first.
| Cycle | Ready to issue | Issues | Results that arrive | Retires |
|---|---|---|---|---|
| 0 | 1 and 3 | 1 and 3 | ||
| 1 to 5 | none | none | ||
| 6 | 2 and 4 | 2 and 4 | 1 and 3 | 1 |
| 7 | 5 | 5 | 2 and 4 | 2 and 3 |
| 8 | 5 | 4 and 5 |
Retiring at cycle 8 means the job takes cycles 0 to 8: nine cycles.
Look at cycle 0. Instruction 2 waits for the header. P passes it and issues 3, so the two loads wait together. That overlap is the whole gain.
Look at cycle 7. Instruction 3 has had its result since cycle 6. It still retires after 2, because 2 is older.
Now the frame as a whole. These times and powers are exercise values for one complete frame, memory waits included.
| Core | Active power | Time | Energy | On time for 5 µs? |
|---|---|---|---|---|
| Performance | 9 mW | 4 µs | 9 × 4 = 36 nJ | yes |
| Efficiency | 4 mW | 7 µs | 4 × 7 = 28 nJ | no: 2 µs late |
The efficiency core uses less energy, but it is late. So the performance core runs the frame.
The Rules
Rule 1: A core issues at most its width in a cycle.
P and W have two slots. E has one.
Rule 2: An instruction may issue once the result it needs has arrived.
In this lab a load gives its result 6 cycles after it issues, and a sum or a test 1 cycle after.
Rule 3: An in-order core stops at the first instruction that is not ready.
Younger ones wait behind it, even when they are ready and a slot is free.
Rule 4: An out-of-order core passes a waiting instruction.
It issues younger ready ones in the free slots. Two slow loads can then wait at the same time.
Rule 5: Every core retires in program order.
A result becomes final only after every older one. The reorder buffer of S2.32 keeps that order.
Rule 6: The deadline chooses first, and energy second.
A core that would be late is out. Among the rest, take the least energy for the whole job.
Rule 7: A lockstep pair is one worker.
It runs one job twice and compares. A difference means a fault.
Sources for These Rules
Rules 1 to 5: Patterson and Hennessy, Computer Organization and Design, ARM edition, section 4.10. It covers multiple issue, dynamic scheduling and in-order commit. Also Harris and Harris, Digital Design and Computer Architecture, ARM edition, sections 7.7.4 and 7.7.5.
A mixed cluster: Harris and Harris, Digital Design and Computer Architecture, ARM edition, section 7.7.8. It describes chips that pair energy-efficient in-order cores with complex out-of-order ones.
Rule 6 is arithmetic on exercise values. Energy as power times time is the rule of S5.13.
Rule 7: Weste and Harris, CMOS VLSI Design, fourth edition, section 7.6.2. It describes copies of hardware that run in lockstep and are compared.
The waits of 6 and 1 cycles, the powers, the times and the deadline are lab choices.
Now Run It
The lab at the end of this page is test code. It holds the five instructions and the rules for one core. It runs them on P, W and E.
P | 1 load header | issue 0 | result 6 | retire 6
P | 2 test header | issue 6 | result 7 | retire 7
P | 3 load pointer | issue 0 | result 6 | retire 7
P | 4 add address | issue 6 | result 7 | retire 8
P | 5 store address | issue 7 | result 8 | retire 8
P | width 2, out of order | done in 9 cyclesThese are the rows of the hand table, rule 4 at work. Rows 1 and 3 both issue at 0. Row 3 retires at 7, after row 2, as rule 5 says.
W | 1 load header | issue 0 | result 6 | retire 6
W | 2 test header | issue 6 | result 7 | retire 7
W | 3 load pointer | issue 6 | result 12 | retire 12
W | 4 add address | issue 12 | result 13 | retire 13
W | 5 store address | issue 13 | result 14 | retire 14
W | width 2, in order | done in 15 cycles
E | 1 load header | issue 0 | result 6 | retire 6
E | 2 test header | issue 6 | result 7 | retire 7
E | 3 load pointer | issue 7 | result 13 | retire 13
E | 4 add address | issue 13 | result 14 | retire 14
E | 5 store address | issue 14 | result 15 | retire 15
E | width 1, in order | done in 16 cyclesRule 3, in row 3 of W: issue 6. Instruction 3 needed nothing, yet it waited behind instruction 2. For five cycles W had two free slots and issued nothing.
So width alone saved one cycle: W is done in 15, E in 16. Passing the wait saved six more: P is done in 9.
lockstep | copy A 1040 | copy B 1040 | same: go on
lockstep | copy A 1040 | copy B 1050 | differ: report a faultRule 7. Both copies compute 1040 in hex. Then one bit of copy B is flipped, as a fault would do. It says 1050, and the pair reports the fault.
performance active_mW=9 time_us=4 energy_nJ=36
efficiency active_mW=4 time_us=7 energy_nJ=28
deadline_us=5 performance=on_time efficiency=late choice=performance
deadline_us=7 performance=on_time efficiency=on_time choice=efficiencyRule 6. The performance core draws 9 mW for 4 µs: 36 nJ. The efficiency core draws 4 mW for 7 µs: 28 nJ.
With a deadline of 5 µs the efficiency core is late, so the choice is performance. With 7 µs both are on time, and the efficiency core wins by 8 nJ.
The frame times are exercise values, not sums of the five instructions. Those are one small piece of such a frame.
Why It Is Built This Way
| Choice | The alternative | Its cost |
|---|---|---|
| Out-of-order issue in the performance core | In-order issue only | Each wait for memory stops all younger work. In the lab, W needs 15 cycles where P needs 9. |
| A narrow in-order efficiency core | Wide out-of-order cores only | Passing needs a rename table and a reorder buffer (S2.31, S2.32). They cost area and power on every job, even an easy one. |
| Two kinds of core in one cluster | One kind only | Software must now choose a core for each job, and test that choice. |
| Retire in program order | Make each result final as soon as it is ready | A trap or a wrong guess could not be undone cleanly. S2.32 shows the recovery. |
| A lockstep pair for safety work | Two cores that share the work | Half the throughput. The pair buys a check, not speed. |
The second row is why a phone does not run every job on its biggest core. Many jobs have slack, and slack is cheaper on a small core.
This page holds power and time fixed for each core. Power at Scale, later in this module, shows how both change with voltage and clock.
The Trap: Choosing by Watts
A colleague suggests the efficiency core because its active power is lower. At a deadline of 5 µs it finishes at 7, two microseconds late. A frame that misses its slot is lost, whatever it saved.
The second trap is starting the meter after the move. A job that moves finds cold private caches, as S10.2 showed. Charge for the wake and the refills too. The practice problem does exactly that.
The third trap is counting a lockstep pair as two workers. It looks like two cores on the diagram. It finishes one frame, not two.
At Scale
A large imaging chip meets its frame deadline until a second stream starts. Which measurements do you ask for?
Keep the same frame
Pin the job to one core and replay the same work. First establish whether the time on that core changed.
Price the move
Repeat the frame after a move to the other kind of core. Measure the whole frame interval, including the handoff.
Compare equal work
Then decide whether the quieter core really saves energy for one completed frame, idle time included.
Real cores
Real out-of-order cores keep far more than five instructions in flight. Widths, waits and powers differ from design to design. None is checked here.
Try It
Run the lab. It prints the three cores, then the lockstep pair, then the bill of one frame.
Make instruction 3 need instruction 2: change its need from 0 to 2. Predict how many cycles P now needs, and say why passing no longer helps.
Keep the active powers fixed and change the efficiency time, e_us. At what whole number of microseconds does its energy first equal the performance row?
Names Printed by the Lab
| Name | Meaning |
|---|---|
| P, W, E | The model core: performance, wide in order, efficiency. |
| issue, result, retire | The cycle in which the instruction starts, its result arrives, and it becomes final. |
| done in | The cycles from cycle 0 to the last retire, both counted. |
| copy A, copy B | The address that each core of the lockstep pair computed, in hex. |
| active_mW, time_us, energy_nJ | Power while the core runs the frame, the time it runs, and their product. |
| deadline_us, choice | The deadline of the frame, and the core that the rule picks. |
P | 1 load header | issue 0 | result 6 | retire 6 P | 2 test header | issue 6 | result 7 | retire 7 P | 3 load pointer | issue 0 | result 6 | retire 7 P | 4 add address | issue 6 | result 7 | retire 8 P | 5 store address | issue 7 | result 8 | retire 8 P | width 2, out of order | done in 9 cycles W | 1 load header | issue 0 | result 6 | retire 6 W | 2 test header | issue 6 | result 7 | retire 7 W | 3 load pointer | issue 6 | result 12 | retire 12 W | 4 add address | issue 12 | result 13 | retire 13 W | 5 store address | issue 13 | result 14 | retire 14 W | width 2, in order | done in 15 cycles E | 1 load header | issue 0 | result 6 | retire 6 E | 2 test header | issue 6 | result 7 | retire 7 E | 3 load pointer | issue 7 | result 13 | retire 13 E | 4 add address | issue 13 | result 14 | retire 14 E | 5 store address | issue 14 | result 15 | retire 15 E | width 1, in order | done in 16 cycles lockstep | copy A 1040 | copy B 1040 | same: go on lockstep | copy A 1040 | copy B 1050 | differ: report a fault performance active_mW=9 time_us=4 energy_nJ=36 efficiency active_mW=4 time_us=7 energy_nJ=28 deadline_us=5 performance=on_time efficiency=late choice=performance deadline_us=7 performance=on_time efficiency=on_time choice=efficiencyCheck Yourself
Common Mistakes
Wrong Choose a core by watts alone.
A job also keeps the core busy for a time.
Fix Check the deadline, then compare energy over equal work.
Wrong Expect a wider core to fill its slots while the oldest instruction waits.
An in-order core stops there. In the lab, W saved only one cycle over E.
Fix Ask whether the core issues out of order.
Wrong Let a younger instruction change what software sees.
Results still retire in program order.
Fix Issue out of order, retire in order.
Wrong Count a lockstep pair as two workers.
Both cores do the same work, and the results are compared.
Fix Count it as one worker that checks itself.
Remember
- Issue width says how many instructions can start in a cycle. Out-of-order issue decides whether a waiting one blocks the rest.
- An out-of-order core still retires in program order.
- Filter cores by the deadline, then compare the energy of the whole job.
- A lockstep pair is one worker that checks itself.
- The pair of core types here is a teaching model. ap_phone has 8 equal cores.