Report Enabled Compute Unit Ranges From a Fuse Bitmask

Last updated: November 29, 2026

Quick Overview

A GPU die exposes an integer fuse mask where bit i is 1 if compute unit i is enabled. Given the mask and the number of compute units, return the enabled units as a list of inclusive (start, end) ranges in ascending order.

AMD
Coding & Algorithms
Software Engineer
AMD
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


A GPU die exposes an integer fuse mask where bit i is 1 if compute unit i is enabled. Given the mask and the number of compute units, return the enabled units as a list of inclusive (start, end) ranges in ascending order.

A warm-up in the style of AMD driver and firmware phone screens, where harvested dies ship with some compute units fused off and tools must report the live topology. The interviewer checks comfortable bit manipulation and clean handling of runs that touch either end of the mask.

What the Interviewer Expects
  • Extract bit i with a shift and mask rather than string conversion
  • Track the start of the current run and close it on a 0 bit
  • Close a run that extends to the last bit
  • Return an empty list for an all-zero mask
  • State O(width) time and O(1) extra space beyond the output
Key Topics to Cover
bit manipulation
run-length grouping
hardware topology
edge cases
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you count enabled units in O(number of set bits) using x & (x - 1)?
  • The mask is split across several 32-bit registers read from MMIO; how does the code change?
  • How would you also report which shader engine each range belongs to if each engine owns 10 consecutive units?
Sharpen Your Skills on Codemia

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

Practice DSA Problems
Sample Answer
Requirements

Input: a non-negative integer mask and width, the number of compute units. Bit 0 is CU 0. Output: list of (start, end) tuples of consecutive enabled units, inclusive, sorted ascending. Bits abov...

High-Level Design

Walk bits from 0 to width - 1. Keep start, the index where the current run of 1 bits began, or None. On a 1 with no open run, open one. On a 0 with an open run, close it at i - 1. After the lo...


Submit Your Answer
Markdown supported

Related Questions