← Microsoft Interview Insights
Demonstrate a structured workflow: start by clarifying the kernel's requirements and constraints, then craft precise prompts to the AI assistant, critically evaluate the generated code for correctness and performance, and iteratively refine through testing and profiling. Emphasize that AI is a tool to accelerate development, not a replacement for deep understanding of CUDA and parallel computing.
Pro tip: Always verify AI-generated CUDA code with a reference implementation and use profiling tools like Nsight Compute to identify bottlenecks; AI often misses subtle issues like bank conflicts or insufficient occupancy.
Define the kernel's purpose, input/output shapes, performance targets, and hardware constraints (e.g., GPU architecture, memory limits). This guides both your prompting and evaluation.
Write specific prompts that include the kernel type, desired optimizations (e.g., tiling, shared memory usage), and any constraints. Ask the AI to explain its reasoning and provide multiple versions if possible.
Review the generated code for correctness (e.g., race conditions, boundary handling), performance (e.g., memory access patterns, occupancy), and adherence to CUDA best practices. Compare with known optimal implementations.
Compile and run the kernel with test cases, validate against a reference, and profile using tools like Nsight Compute or nvprof to identify bottlenecks and measure performance.
Based on profiling results, manually optimize or prompt the AI for specific improvements (e.g., reduce shared memory bank conflicts, increase ILP). Repeat until performance goals are met.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.