Basis Lab

How a Program Runs on a GPU

One Worker Disagrees and Thirty-One Others Stand and Wait

Last timeWorkers, Blocks and the Grid

The device runs workers in fixed groups that execute one instruction at a time. When members disagree at a decision, both sides are run and part of the group idles on each.

The groups you did not ask for

The launch names two things, the number of blocks and the workers in each. There is a third level that it never mentions. Inside a block, the device runs workers in fixed groups.

On NVIDIA devices a group is 32 workers. The 2026 edition of the vendor's programming guide gives that size for every architecture in its table, and calls the group a warp. The guide also says how the cut is made: each group holds consecutive workers, and the first group starts at worker 0. So in a block of 256, workers 0 to 31 are one group, 32 to 63 the next, and there are 8 groups in all.

FIG 1
Workers in the blockGroupsMembers of the last groupEmpty places in it
2568320
1284320
1004428
332131

A block whose size is not a multiple of 32 leaves places in its last group empty for the whole run, which is why the guide advises multiples of 32.

One instruction for the whole group

A group executes one instruction at a time, for all of its members together. The vendor's name for this is SIMT, single instruction, multiple threads. The instruction is fetched once and decoded once, and then carried out 32 times on 32 workers' own data.

This is the bargain described in Why a GPU Is Built This Way, seen from the inside. The machinery that works out what to do next is shared among 32 workers, which is how so many arithmetic units fit on the chip. The condition is that all 32 want the same instruction next. For the array addition of the first lesson they always do.

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 contents

This 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

The rest of this course

  1. 01The Loop Had an Order and the Sum Never Needed It
  2. 02Nobody Hands a Worker Its Index, So It Works It Out from Where It Sitsopening only
  3. 03One Worker Disagrees and Thirty-One Others Stand and Waityou are here
  4. 04A Group That Is Waiting Does Not Need the Arithmetic Units, So Another Takes Themopening only
  5. 05The Function Asked for a Little More Storage and Half Its Groups Had to Leaveopening only
  6. 06Adding 256 Numbers in Eight Stages, with Everyone Waiting at the End of Eachopening only
  7. 07Two Workers Added One to the Same Cell and It Went Up by Oneopening only
  8. 08The Timer Said the Function Took No Time, Because It Had Not Run Yetopening only

Read alongside