What this video shows
About this walkthrough
This walkthrough starts from a vector-add kernel that is already correct but launches one thread per block. It changes the block size to 256, checks that the output still passes, and then reads a saved profile: 81.2% achieved occupancy against a 75% target, the warp-stall samples, and the profiling timeline.
Read along
Transcript
Select a time to play the video from that chapter.
0:00Meet GPUFlight
Meet GPUFlight. Let's learn CUDA by fixing it.
0:051. What does the problem ask?
First, read the problem. This kernel already adds two arrays correctly. The inefficient part is the launch: it starts with just one thread per block.
0:162. Understand the goal
Here is the goal: keep the output correct, and reach at least 75% achieved occupancy. We'll change the launch size, then inspect a saved run.
0:283. Why change the launch?
This diagram explains why that matters. A warp has 32 lanes. A one-thread block uses just one lane. With 256 threads, a block contains eight full warps.
0:424. Edit the launch configuration
In the editor, find block = dim3(...). The first number sets threads per block. Select the one, and replace it with 256. The grid expression already adapts to the block size.
0:575. Check correctness and the target
Open Result. This saved L4 run passes the correctness check. Its measured occupancy is 81.2%, above the 75% target. Now let's see the profiling evidence.
1:126. Open the full profile
Click View session details. This opens the full profiling session. Next, choose Kernels.
1:197. Inspect the individual launches
Expand the kernel row. Now inspect the four launches. You can compare their durations and block sizes here.
1:288. Read the occupancy breakdown
Open the first launch and scroll to Occupancy. The theoretical limit is 100%. Achieved occupancy is about 81%, measured during execution. These are different signals.
1:439. Investigate the stall samples
Scroll back to Warp Stalls. The two memory-wait categories account for most of these samples. That's a clue for what to investigate next, not proof of a specific fix.
1:5510. Read the profiling timeline
Finally, open Timeline and select the green kernel bar. The blue and orange bars show memory transfers. This view helps you see when GPU work happens.
2:08Understand. Edit. Analyze.
That's the learning loop: understand the goal, edit the code, and explain the profile. Try it in GPUFlight.
Measure it yourself
Run the same experiment on a real GPU
Edit the kernel in your browser, run it on managed hardware, and read the profile the video walks through.
Run the vector-add occupancy lab