Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Build a recovery plan from GPU error events

Hardware interview practice

Build a recovery plan from GPU error events

HardFirmware & ValidationC++

For this exercise, firmware applies a simplified policy to NVIDIA-style Xid events: 94 is treated as contained, 95 as uncontained, and 79 as a lost-bus event. Write the C++ function that validates the batch and produces one deterministic recovery plan.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

struct GpuEvent { uint16_t xid; uint8_t job; };
struct Plan { uint64_t kill_jobs; bool reset_gpu, service_host; };
int make_plan(const GpuEvent *e, size_t n, Plan *out);
Reviewed example

Work through one case

Input
Events are (xid94,job2) and (xid95,job255).
Expected output
kill_jobs=0x4, reset_gpu=true, service_host=false, and make_plan returns 0.

The contained event marks job 2 while the uncontained event independently escalates the plan to a GPU reset.

What to cover

Requirements

  1. Require out; e may be NULL only when n=0. Accept only Xid 79, 94, or 95; Xid 94 requires job<64. Invalid input returns -1 and preserves *out.
  2. For every Xid 94, set that job bit in kill_jobs; duplicate job events set the bit only once.
  3. Any Xid 95 sets reset_gpu=true; any Xid 79 sets both reset_gpu=true and service_host=true.
  4. On success initialize all Plan fields, process the whole batch, write *out once, and return 0.
asic.fyi · Learn silicon end to end.info@asic.fyi