13Sum 100 million floats on the GPU as fast as the hardware allows. Write the kernel and justify each step.▼mediumNewNVIDIA4 replies○ sign inA sum reads every byte once and does one add per element, so the only question is whether you reach the bandwidth ceiling. The ceiling in milliseconds, four versions from an atomic per element to warp shuffles with sixteen loads in flight, and the bytes-in-flight math behind the last jump.Open full answer →
19A take-home gives you a working layernorm kernel at a tenth of memory bandwidth. Make it fast and justify every change.▼hard★ EssentialNewAnthropic4 replies○ sign inNormalization reads a row and writes a row, so a copy sets the ceiling and everything else is overhead you can remove. The six changes in the order a reviewer wants them, what each is worth, and the one that is a correctness fix rather than a speed fix, with the measured error that proves it.Open full answer →
25Select the top k logits from a 128,000-token vocabulary on the GPU. What shape does the kernel take and why not just sort?▼mediumNewNVIDIAOpenAI4 replies◆ premiumA row of logits is half a megabyte, so the kernel is not bandwidth-bound and the cost is in how many passes you make over it. Why a full sort does far more work than the question asks, the two shapes that fit small and large k, and the four-pass radix select with a reference that matches a sort exactly.Open full answer →