Design a Kernel Autotuner That Caches the Best Config Per Shape

Last updated: November 29, 2026

Quick Overview

Design and implement a small autotuner class that, given candidate launch configurations and a benchmark function, finds the fastest valid configuration for a problem shape, caches the winner, and can save and load its cache.

NVIDIA
Software Engineering Fundamentals
Software Engineer
NVIDIA
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Medium

0

0

0 solved


Design and implement a small autotuner class that, given candidate launch configurations and a benchmark function, finds the fastest valid configuration for a problem shape, caches the winner, and can save and load its cache.

An object-oriented low-level design question in the style of NVIDIA teams building cuBLAS and cuDNN heuristics, TensorRT tactic selection and Triton-style autotuning. The interviewer looks at the class boundaries, how benchmarking noise and invalid configurations are handled, and whether the cache key and persistence are sound.

What the Interviewer Expects
  • Separates config space, benchmarking, and caching responsibilities
  • Uses warmup runs and a robust statistic (median) for timing
  • Skips configurations that are invalid for a given shape instead of crashing
  • Caches by a normalized shape key and supports serialization
  • Discusses cache invalidation across GPU model, driver and library versions
Key Topics to Cover
object-oriented design
autotuning
benchmarking
caching
dependency injection
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • What should be part of the cache key besides the shape?
  • How would you cut tuning time when the config space has thousands of entries?
  • How do you test this class without a GPU?
  • How would you share tuned results across a fleet of identical machines safely?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Autotuner(configs, benchmark, warmup, reps). best(shape) returns the fastest config for that shape, benchmarking only on a cache miss. Invalid configs (say, a tile larger than the problem, or too ...

High-Level Design

Inject the benchmark as a callable: in production it launches the kernel and times it with CUDA events, and in tests it is a fake, which makes the class testable on a laptop. Timing does warmup runs f...


Submit Your Answer
Markdown supported