lockstep

Everything here works on a phone, although writing kernels is much easier with a keyboard and a wider screen.

kernel.cu cycles per line show up in the left margin after a run

Levels

The first three levels open one at a time, and after that you can play the rest in any order.

    How it works

    Your kernel runs on a simulated GPU, where each warp of 32 threads executes one instruction at a time for all of its active lanes. When the lanes disagree at a branch, the warp runs both sides one after the other and joins them again where the paths meet, which is why divergent code costs more. Step through a run, or press Play to watch it, and click a lane to see its variables.

    A solved level gets three scores: cycles adds up the time of every warp, including memory traffic, bank conflicts and waiting at barriers, sectors counts the 32-byte pieces of global memory moved, and lines counts lines of code. Par is the score of a reference solution, and the numbers come from a small cost model rather than a real GPU, which one page in the repository describes in full.

    Keys

    Ctrl/⌘ Enter
    Run
    Alt → / ←
    Step forward / back
    → ← PgUp PgDn Home End
    Move through the timeline when it has focus
    Esc then Tab
    Leave the editor (Tab indents inside it)
    ?
    This help