Skip to content

[CP 222] fix(gpu): wait for GPU device release before partitioning (GPUOP-909) - #38

Merged
spraveenio merged 2 commits into
ROCm:mainfrom
ci-penbot-01:CP.O2O.pensando.device-config-manager.222.rocm.device-config-manager.main
Jul 10, 2026
Merged

[CP 222] fix(gpu): wait for GPU device release before partitioning (GPUOP-909)#38
spraveenio merged 2 commits into
ROCm:mainfrom
ci-penbot-01:CP.O2O.pensando.device-config-manager.222.rocm.device-config-manager.main

Conversation

@ci-penbot-01

Copy link
Copy Markdown
Contributor

cp of pensando/device-config-manager#222


Source PR Description (pensando/device-config-manager#222):

Summary

Fixes GPUOP-909: CPX/compute partition failed with Device busy (AMDSMI_STATUS_BUSY) when a user GPU workload pod was still holding the device during eviction. DCM issued the AMD SMI partition command before the kernel finished releasing the GPU, and prematurely marked the node state=failure.

Changes

  • Best-effort device-release gate (waitForGPUIdle): before issuing a partition command, poll amdsmi_get_gpu_process_list and wait up to GPUIdleWaitTimeout (60s) for the GPU process count to drain to zero. On API error / under-report / timeout it proceeds anyway, so the existing 30-min retry loop remains the backstop and behavior never regresses.
  • Label semantics fixed: retryable busy errors now leave the node label at in-progress instead of writing failure on the first busy error; the authoritative failure write moves to the 30-min retry-loop expiry. Non-retryable errors (invalid/unsupported profile) still fail immediately.
  • Event detail: "Device busy" is surfaced via the existing PartitionRetrying event, not a new label value — the gpu-config-profile-state label contract keeps its three values (in-progress / success / failure).

Design doc: docs-internal/plans/2026-07-08-gpuop909-cpx-device-busy-design.md.

Chose the SMI process-list API over the ticket's /proc/*/fd scan on /dev/kfd, which would require hostPID: true on the DaemonSet (a privilege escalation) and cannot see other pods' PIDs from DCM's namespace. The SMI API queries the driver directly and works from inside the pod as-is.

Dependency

Important

Depends on #221 (build-infra split). Please merge #221 first, then merge this. The two changesets are independent (verified this builds on the current main base), but this branch is cut from main and should land after the infra PR to avoid churn.

Test plan

Verified on MI350P hardware (amdgpu driver 6.19.4, GPU Operator v1.5.0):

  • Process-list API reports the user workload holding /dev/kfd (core premise of the fix)
  • Busy path: real "Device busy" reproduced; label held at in-progress across retries (previously flipped to failure)
  • Happy path: releasing the workload → gate proceeds → partition succeeds → state=success; HW confirmed current_compute_partition=CPX
  • Expiry path (temporary 2-min window): retry loop expired → authoritative failure label + PartitionFailure event
  • Fast path (no workload): gate is a silent no-op, immediate success
  • Non-retryable failure: invalid profile → immediate failure, no retry churn
  • Temporary short-timeout reverted; shipped code retains the 30-min window

Cherrypick triggered by: ACP-Automation

… (#222)

* fix(gpu): wait for GPU device release before partitioning (GPUOP-909)

CPX/compute partition failed with "Device busy" (AMDSMI_STATUS_BUSY) when a
user GPU workload pod was still holding the device during eviction. DCM issued
the AMD SMI partition command before the kernel finished releasing the GPU.

Add a best-effort gate (waitForGPUIdle) that polls amdsmi_get_gpu_process_list
and waits up to GPUIdleWaitTimeout for the process count to drain to zero before
partitioning. On API error, under-report, or timeout it proceeds, so the
existing 30-min retry loop remains the backstop and behavior never regresses.

Also fix state-label semantics: retryable busy errors now leave the node label
at "in-progress" instead of prematurely writing "failure"; the authoritative
"failure" write moves to the 30-min retry-loop expiry. Non-retryable errors
(invalid/unsupported profile) still fail immediately.

Verified on MI350P hardware: process-list API reports the workload, busy path
holds in-progress and recovers to success on release, expiry writes failure,
and no-workload fast path partitions immediately.

* docs(gpuop909): add design doc for CPX device-busy fix

(cherry picked from commit d1648bb4263bc71b7b43ba35c74596c0d42e5673)
spraveenio
spraveenio previously approved these changes Jul 10, 2026

@spraveenio spraveenio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@spraveenio
spraveenio merged commit 8a24d0a into ROCm:main Jul 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants