Flag CUDA Kernels Launched With Inconsistent Grid Configurations
Last updated: November 29, 2026
Quick Overview
Given a trace of kernel launches, each with a kernel name, grid dimensions and block dimensions, return the names of kernels that were launched with more than one distinct (grid, block) configuration, sorted alphabetically.
NVIDIA
November 29, 20260
0
0 solved
Given a trace of kernel launches, each with a kernel name, grid dimensions and block dimensions, return the names of kernels that were launched with more than one distinct (grid, block) configuration, sorted alphabetically.
A warm-up in NVIDIA phone screens for CUDA library and profiler-tooling teams, framed around Nsight-style trace data. The interviewer checks that you reach for a hash map of sets immediately, handle tuple keys correctly, and talk about why inconsistent launch shapes matter (autotuning drift, recompilation, occupancy changes).
What the Interviewer Expects
- Groups launches by kernel name using a dictionary of sets in a single pass
- Uses hashable tuples so (grid, block) pairs compare by value
- Returns a deterministic, sorted result
- States O(n) time and memory proportional to distinct configs
- Mentions how this would run over a very large trace file streamed line by line
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you also report how many launches used each configuration, sorted by frequency?
- If the trace is 50 GB, how do you process it without loading it into memory?
- How would you treat grid (8, 8) and (8, 8, 1) as the same configuration?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: a list of (name, grid, block) where grid and block are tuples like (128, 1, 1). Output: sorted list of names seen with at least two distinct (grid, block) pairs. A kernel launched a milli...
High-Level Design
Keep name -> set of (grid, block). Every launch inserts its configuration into its kernel's set; duplicates are absorbed for free. At the end, keep the names whose set has size above one. Because th...