A Group That Is Waiting Does Not Need the Arithmetic Units, So Another Takes Them
Last timeWorkers That Step Together
Groups take turns on one set of arithmetic units. A group waiting for memory gives way to a ready one, and the fraction of time the units are busy can be computed.
More groups than the units can run
The last lesson followed one group. A core of the device holds many groups at once, far more than it has arithmetic units to run in a single step. So the groups take turns.
The vendor's guide describes the rule in one sentence: on each cycle a scheduler selects a group that is ready to execute its next instruction, and issues the instruction to it. The word that matters is ready. A group is not always ready, and the reason is nearly always memory.
Why a GPU Is Built This Way made the case that memory answers slowly compared with arithmetic. A group that reads an element has to send the request and then do nothing until the data returns. For those steps it has no use for the arithmetic units at all.
To make that countable, take an illustrative function. Every group runs for 1 step, waits 4 steps for memory, and repeats, three runs in all. The numbers are made up to keep the pictures small. Take the simplest model of a core: one set of units, serving one group per step.
Two groups, and the units mostly idle
Start with only two groups on the core.
| step | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| the unit | group A | group B | idle | idle | idle | group A | group B | idle | idle | idle | group A | group B |
| group A | running | waiting | waiting | waiting | waiting | running | waiting | waiting | waiting | waiting | running | finished |
| group B | ready, no unit free | running | waiting | waiting | waiting | waiting | running | waiting | waiting | waiting | waiting | running |
Busy for 6 of 12 unit steps, 50 per cent. A free unit goes to the first ready task, top to bottom.
Two things are visible. The first is the giving way: A does not sit on the units through its wait. The second is that two groups are not enough. Between them they want the units for 2 steps in every 5, and for the other 3 steps both are waiting and the arithmetic units stand idle.
The lesson stops here
7 more paragraphs to go
You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.
The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.
See the planThe contentsThis is the reading half
Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.
The contents