KatInterview

Build a GPU-Accelerated Graphics Test Pipeline in Docker

System DesignModel answer
HardModel answerSystem Designdockergpuci-cd

Last updated

Design a containerized CI pipeline that runs automated Vulkan/OpenGL render-and-compare tests on a mixed NVIDIA/AMD GPU fleet with reproducibility, security, and fast feedback.

The Problem

Your team maintains a cross-platform graphics engine. Hundreds of automated tests render frames with Vulkan and OpenGL, compare the output pixel-by-pixel against golden images, and run a handful of performance smoke checks. Right now everything runs on bare-metal machines with ad-hoc shell scripts. Tests fail for environmental reasons more than correctness reasons, results are hard to reproduce, and the fleet is a mix of NVIDIA and AMD cards with different driver generations.

You have been asked to redesign the test infrastructure around Docker containers.

What to cover

A strong answer addresses each of the following areas:

Requirements and scale — State your assumptions explicitly. How many runners, how many tests, what throughput do you need, and what does "done" look like in terms of runtime targets?

Architecture — Describe the end-to-end flow from a git push to a stored test result. Which stages run on GPU runners versus ordinary CPU runners?

Base images and GPU runtime integration — What base images do you choose for NVIDIA versus AMD? How does the container access the GPU without bundling a kernel driver? What capability or device flags matter for graphics (not just compute)?

Image layering and caching — How do you order layers to maximize cache reuse? How do you handle large binary assets like golden images?

Reproducibility — What does it mean for a result to be reproducible? What do you pin, and what metadata do you record alongside each result?

Security — How do you run containers with least privilege while still reaching GPU hardware? How do secrets flow into build and test jobs? What changes when a pull request comes from a fork?

Debugging — What artifacts does a failed test produce? How can an engineer reproduce a failure locally from a single command?

Flaky tests — What are the common causes of non-deterministic results in GPU rendering tests, and how do you detect, quarantine, and fix them?

CI runtime — What concrete strategies reduce end-to-end wall time? What metrics would you track to know whether an optimization actually helped?

What the interviewer is looking for

  • You understand that the kernel driver lives on the host and cannot go in the image, and you know the mechanism by which user-space libraries are injected.
  • You distinguish graphics workloads (Vulkan, OpenGL, EGL) from compute-only workloads (CUDA), and know where that distinction shows up in container configuration.
  • Your security model does not rely on --privileged.
  • Your reproducibility story is concrete: specific things you pin, a specific result key, not just "we use Docker so it's reproducible."
  • Your flakiness strategy is more than "retry three times."

Hints

Hint 1

The single most common 'CUDA works but Vulkan is black' bug comes down to one missing environment variable that controls which GPU capabilities and ICD files the container runtime injects — think about what capabilities a graphics workload needs beyond the default compute/utility set.

Hint 2

GPU runners are your scarcest resource. Think about where in the pipeline you can shift work to cheaper CPU runners, and what that implies about how you split your Docker stages.

Hint 3

'Reproducible' needs an operational definition, not a vibe. Try defining a result as a tuple of specific versioned inputs, and ask yourself which of those inputs you are currently not recording.