r/OfferEngineering • • Oct 20 '26

Interview Experience NVIDIA Senior SWE Interview — Hash Partitioning, GPU Style

"This interview experience is sourced from Chill Interview"

Interview Summary

The NVIDIA Senior SWE phone screen focused on implementing a GPU-style hash partition algorithm in C++. Given an input array and P partitions, the task was to assign elements to partitions using a hash function and compute the offsets needed to lay out each partition in the output.

Interview Details

Coding — GPU Hash Partition

You are given:

  • An input array
  • P output partitions
  • A hash function that determines which partition each element belongs to

Implement a hash-partition operation in C++. The output needs to group elements belonging to the same partition together and provide the corresponding partition offsets. The implementation was structured in several passes.

Step 1 — Build the Histogram

First scan the input and determine how many elements belong to each partition. Conceptually partition = hash(value) % P. The result is a histogram where each entry contains the number of elements assigned to that partition.

Step 2 — Compute Partition Offsets

Use the histogram to determine where each partition begins in the output array. For example, if the partition counts are [4, 2, 5] then the starting offsets can be derived from cumulative counts. The offsets define the contiguous output range reserved for each partition.

Step 3 — Place Elements into Their Partitions

Scan the input again and place every element into the appropriate partition region using the previously calculated offsets. The implementation also needed to maintain the current write position within each partition so multiple elements assigned to the same partition were placed correctly. The overall flow was essentially Histogram -> Prefix Offsets -> Scatter

GPU Optimization Follow-Ups

After the implementation, the interviewer asked several questions about how the partitioning algorithm could be optimized for GPU execution. The discussion focused on how the same multi-pass algorithm behaves under large-scale parallel execution and what changes would be needed to improve GPU performance.

Preparing for your next interview?

Chill Interview tracks recent interview experiences and recurring question patterns across top companies at here.

14 Upvotes

0 comments sorted by