CUDA & GPU Programming for Engineers: Interview Guide Interview Prep

CUDA & GPU programming for engineers — threads/warps/blocks and SIMT, the memory hierarchy, coalescing, occupancy, host-device transfer, and when GPU acceleration actually helps.

Quick answer

CUDA and GPU programming for engineers is the subset of GPU computing that AI-hardware and systems interviews actually test: how the GPU executes parallel work and moves data — the execution model (threads, warps, blocks, and SIMT), the memory hierarchy (registers, shared memory, global memory), kernels, occupancy, memory coalescing, and host–device transfer — plus the judgment of when GPU acceleration helps and when it does not.

AI-hardware, ML-infrastructure, and HPC roles ask CUDA and GPU questions to verify that a candidate can reason about a throughput machine, not just call a library.

Editorial review

Written by

CompoundLearn editorial team

Wireless / RF / hardware engineering

Reviewed by

CompoundLearn editorial team

Wireless / RF / hardware engineering

Last reviewed

Built from curated topic maps, editorial validation, and subject-matter review so the page stays aligned with the interview intent and the current content pipeline.

Key points

  • CUDA’s execution hierarchy is threads → blocks → grid; the hardware schedules warps of 32 threads that execute one instruction together (SIMT). A block maps to one streaming multiprocessor.
  • Warp divergence (threads in a warp taking different branches) serializes the paths and wastes throughput — structure conditionals so a warp stays on one path.
  • Memory coalescing is critical: a warp should access consecutive, aligned addresses so the hardware merges them into a few wide transactions; strided/transposed access is the classic slowdown.
  • The memory hierarchy is registers (per-thread, fastest) → shared memory (per-block on-chip scratchpad) → global DRAM (large, high-latency); tiling stages data through shared memory to cut global traffic.
  • Occupancy (active warps vs hardware max) hides latency but is not a metric to maximize — register and shared-memory pressure cap it, and pushing it too far can hurt throughput.
  • GPUs win on massively parallel, compute-bound work (dense linear algebra, deep learning, large FFTs); they lose on serial, branchy, small, or host-device-transfer-dominated workloads.
  • Reason with arithmetic intensity (FLOPs/byte) and the roofline model, and count PCIe transfer cost — a fast kernel can still lose to the CPU once you include the copy.

What it is

CUDA and GPU programming for engineers is the subset of GPU computing that AI-hardware and systems interviews actually test: how the GPU executes parallel work and moves data — the execution model (threads, warps, blocks, and SIMT), the memory hierarchy (registers, shared memory, global memory), kernels, occupancy, memory coalescing, and host–device transfer — plus the judgment of when GPU acceleration helps and when it does not. It is a conceptual, machine-level view rather than a step-by-step coding tutorial. Interviewers assume you can write a loop; what they probe is whether you understand the throughput-oriented machine underneath. The defining ideas are massive data parallelism and bandwidth. A kernel launches thousands of threads grouped into blocks; the hardware runs them as warps of 32 threads in lockstep, so divergent branches and scattered memory access waste the wide datapath. Performance is usually bound by global-memory bandwidth, which makes coalesced access and shared-memory tiling central. Occupancy keeps the streaming multiprocessors busy by hiding latency with many resident warps, and host–device transfer over PCIe often decides whether offloading to the GPU pays off at all. These concepts connect directly to the workloads driving demand — neural-network training and inference and quantized edge deployment — and to the silicon beneath them (see /topics/neural-networks-explained-for-engineers, /topics/edge-ai-and-model-quantization, /topics/computer-architecture).

Why interviewers ask

AI-hardware, ML-infrastructure, and HPC roles ask CUDA and GPU questions to verify that a candidate can reason about a throughput machine, not just call a library. Most teams do not write raw kernels every day, but they must decide what to put on the GPU, why a kernel is slow, and whether an accelerator is worth the transfer cost. Those decisions come straight from the execution and memory models, so asking about warps, coalescing, shared memory, or occupancy is concrete and hard to bluff. The questions also probe systems judgment. Strong candidates explain why a non-coalesced or transposed access pattern is slow, why warp divergence serializes a branch, and why higher occupancy is not automatically better. They frame a kernel’s bottleneck with arithmetic intensity and the roofline model rather than guessing, and they know that PCIe transfer can erase a kernel’s speedup (see /topics/computer-architecture). Above all, they can argue when a GPU is the wrong tool — small, serial, branch-heavy, or latency-bound work. With NVIDIA-heavy demand across AI and HPC hiring, this fluency is exactly what separates an engineer who can profile and accelerate a real workload from one who has only read the marketing (see /topics/machine-learning-fundamentals-for-engineers, /topics/semiconductor-devices).

Common mistakes

A frequent mistake is treating GPU threads like CPU threads — forgetting that 32 of them run as a warp in lockstep — and then writing branch-heavy kernels whose divergence serializes execution. A second is ignoring memory coalescing: using a strided or transposed access pattern so each thread triggers its own transaction and most fetched bytes are wasted, when a different data layout or a shared-memory tile would merge the accesses. A third is misusing the memory hierarchy — hammering global memory instead of staging reused data through shared memory, or quietly spilling registers to slow local memory. A fourth is chasing occupancy as a goal in itself, maximizing resident warps even when latency is already hidden and the extra register or shared-memory pressure forces smaller tiles and lower throughput. A fifth is forgetting host–device transfer: benchmarking a kernel in isolation, ignoring the PCIe copy in and out, and concluding the GPU wins when the CPU was actually faster end-to-end. Finally, candidates reach for the GPU on the wrong workloads — small, serial, pointer-chasing, or latency-bound problems — instead of reasoning with arithmetic intensity and the roofline model about whether the work is parallel and compute-bound enough to benefit.

Frequently asked questions

What is the difference between a thread, a warp, and a block in CUDA?
These are the three levels of CUDA’s execution hierarchy. A thread is the smallest unit of work and runs one instance of the kernel. Threads are grouped into a block, and threads within a block can cooperate through fast shared memory and barrier synchronization (__syncthreads). Blocks are organized into a grid, which covers the whole problem. The hardware schedules execution in warps — a fixed group of 32 threads on NVIDIA GPUs that execute the same instruction together (SIMT). A block is assigned to one streaming multiprocessor and split into warps; the warp, not the block, is what the scheduler actually issues. Interviewers expect you to know the warp size is 32, that blocks map to an SM, and that cross-block communication is limited — it usually means a separate kernel launch (see /topics/computer-architecture).
What is SIMT and how does warp divergence hurt performance?
SIMT — Single Instruction, Multiple Threads — is the execution model where the 32 threads of a warp share one program counter and execute the same instruction in lockstep, each on its own data. It looks like independent threads to the programmer but runs like a wide vector unit underneath. Warp divergence happens when threads in the same warp take different branches of an if/else: the hardware must serialize the paths, executing the taken branch with the other threads masked off, then the other branch. A fully divergent warp can lose much of its throughput. The fix is to structure data and conditionals so threads in a warp follow the same path — sorting work, masking arithmetic instead of branching, or aligning branch boundaries to warp size. This connects to how vector and parallel hardware actually executes (see /topics/computer-architecture).
Why does memory coalescing matter so much for GPU kernels?
Global memory bandwidth, not compute, limits most real kernels, so how a warp accesses memory dominates performance. Coalescing means the 32 threads of a warp access consecutive, aligned addresses so the hardware merges them into a few wide memory transactions instead of many small ones. A coalesced load can be an order of magnitude faster than a scattered one. The classic mistake is a strided or transposed access pattern — for example, threads walking down a column of a row-major matrix — which forces one transaction per thread and wastes most of the fetched bytes. Common fixes are restructuring the data layout, having each thread read adjacent elements, or staging a tile through shared memory so the global access is coalesced and the awkward pattern happens in fast on-chip memory. Recognizing a non-coalesced pattern is a core GPU interview signal.
What is the GPU memory hierarchy and how do you use shared memory?
A CUDA kernel sees several memory spaces with very different speed and scope. Registers are per-thread and fastest but limited; spilling to local memory (actually in global) is slow. Shared memory is on-chip, per-block, and roughly as fast as an L1 cache — threads in a block use it as a software-managed scratchpad to share data and avoid repeated global loads. Global memory (device DRAM) is large but high-latency and bandwidth-bound. There are also read-only constant and texture caches. The standard optimization pattern is tiling: cooperatively load a block of data from global memory into shared memory once (coalesced), synchronize with __syncthreads, then have all threads reuse it from shared memory — as in tiled matrix multiply. Knowing this hierarchy and the tiling pattern is what separates someone who has written real kernels from someone who has only read about them (see /topics/computer-architecture).
What is occupancy and is higher always better?
Occupancy is the ratio of active warps on a streaming multiprocessor to the hardware maximum. The GPU hides memory and instruction latency by switching among many resident warps, so enough occupancy is needed to keep the SM busy while some warps wait on memory. Occupancy is capped by per-thread register usage, per-block shared-memory usage, and block size — a kernel that uses many registers or lots of shared memory fits fewer warps. But higher occupancy is not always better: beyond the point where latency is hidden, more occupancy gives nothing, and pushing it can force register spills or smaller tiles that hurt overall throughput. Strong candidates treat occupancy as one lever among many — enough to hide latency — rather than a metric to maximize blindly. This is a frequent trap in GPU optimization interviews.
When does GPU acceleration actually help, and when does it not?
GPUs win when the work is massively data-parallel, arithmetically heavy relative to the data it moves, and large enough to amortize launch and transfer overhead — dense linear algebra, deep-learning training and inference, large FFTs and convolutions, and Monte Carlo. They are a poor fit for serial, branch-heavy, or pointer-chasing work, for small problems where kernel-launch and PCIe transfer dominate, and for memory-latency-bound tasks with irregular access. A decisive factor is host–device transfer: moving data over PCIe between CPU and GPU is slow, so a kernel that is fast in isolation can lose to the CPU once you count the copy in and out. The right framing is arithmetic intensity (FLOPs per byte) and the roofline model: compute-bound, parallel workloads benefit; latency-bound or transfer-dominated ones often do not. This judgment matters for AI and edge deployment (see /topics/edge-ai-and-model-quantization, /topics/machine-learning-fundamentals-for-engineers).
How should an engineer prepare CUDA and GPU topics for interviews?
Anchor on the execution and memory models, not API trivia. Be able to explain the thread/warp/block hierarchy, that a warp is 32 threads executing SIMT, and why divergence and non-coalesced access destroy throughput. Know the memory hierarchy — registers, shared memory, global — and the tiling pattern that stages data through shared memory. Understand occupancy as latency-hiding, not a number to maximize, and be ready to reason about a kernel’s bottleneck with arithmetic intensity and the roofline model. Above all, be able to argue when a GPU is the wrong tool: small, serial, branchy, or transfer-dominated work. Tie GPU concepts to the ML workloads that drive the demand — training, inference, and quantized deployment — and to the underlying hardware (see /topics/neural-networks-explained-for-engineers, /topics/edge-ai-and-model-quantization, /topics/semiconductor-devices). Reasoning about the machine beats reciting CUDA syntax.

Related topics

Essential AI-Native Skills for CUDA & GPU Programming for Engineers: Interview Guide

Modern engineering work increasingly uses AI tools for design and code review, debugging, documentation, test and testbench generation, and workflow automation. The goal is not to let AI replace engineering judgment — it is to move faster while keeping verification discipline.

  • Use AI to explain unfamiliar code, logs, waveforms, datasheets, or test failures.
  • Break large problems into small, reviewable steps you can verify independently.
  • Ask AI for hypotheses, then validate them against tests, measurements, simulations, or lab data.
  • Version-control your analysis scripts, testbenches, and configs — keep changes small and reviewable.
  • Document your assumptions, design tradeoffs, and debugging decisions.
  • Verify AI output before trusting it: run the checks that fit the domain — unit tests, linters, simulations, or bench/lab measurements.
  • Review AI output for correctness, edge cases, and real-world consequences.

CUDA & GPU Programming for Engineers: Interview Guide — coming to the question bank

The adaptive practice engine is already live for core wireless, RF, and ML systems. CUDA & GPU Programming for Engineers: Interview Guide isn't covered in the question bank yet — get notified when it's added.

One email when this topic launches. Nothing else. Unsubscribe in one click.