Repository navigation
[GPU Reset 3/3] Add in-process graceful GPU reset (--enable-gpu-reset) - #644
Open
ankitjoju-google wants to merge 5 commits into
Open
ankitjoju-google wants to merge 5 commits into
ankitjoju-google wants to merge 5 commits into
Conversation
Replaced the deprecated gpu-monitoring-tools library with the official go-nvml library. Updated method signatures to use raw types for easier testability and mocking, avoiding issues with non-mockable nvml.Device struct. Updated test cases to match new signatures and smaller mock instance IDs.
- Make Stop() idempotent, synchronize Start()/Stop() with a mutex, and wait for background goroutines (listenToEvents, setXIDheartbeat, resetXIDConditionWithBackoff) via sync.WaitGroup before freeing the NVML event set. - Keep a single long-lived EventBroadcaster across Stop()/Start() cycles instead of attempting an invalid interface assertion in Stop() or leaking broadcasters on restart. - Spawn background goroutines only after NVML device registration succeeds, and clean up the allocated eventSet on early Start() failure. - Restore upstream/master MIG behavior: treat nvml.ERROR_NOT_SUPPORTED from GetMigMode() as MIG disabled, verify currentMode == pendingMode, and resolve MIG parent UUID and GI/CI IDs via go-nvml handles for modern R470+ MIG-<uuid> format with fallback to legacy regex parsing. - Add unit tests covering idempotent Stop(), Stop()/Start() restart without broadcaster leaks, Start() error cleanup, and modern/legacy MIG UUID handling.
…el and optimize MIG - Select on hc.stop when sending to hc.health in catchError so Stop() cannot deadlock if the health channel is full or unconsumed during teardown. - Deduplicate physDevice.RegisterEvents calls per physical GPU UUID when multiple MIG instances share a parent GPU. - Skip MIG NVML handle lookups in resolveMigDeviceInfo and GPUDevice.parseMigDeviceUUID when the device UUID does not start with "MIG-". - Add TestStopUnderHealthChannelBackpressure and verify single RegisterEvents per physical GPU in TestMIGSupportModernAndLegacyUUIDs.
- Extract shared per-GPU MIG partitioning helpers (BuildPartitionStr, IsGPUPartitioned, DestroyPartitions, CreatePartitions, DiscoverGPU, PartitionIDs) into pkg/gpu/nvidia/mig and update partition_gpu. - Add PhysicalGPUIDs, MIGDeviceManager, DeviceHealth, UpdateGPUHealth, and exported IsMPSHealthy helpers on nvidiaGPUManager. - Add RefreshDevices on GPUHealthChecker to re-discover MIG instances across resets. - Add Stop/Start/Registerer lifecycle methods on MetricServer and ListPodGPUDevices for kubelet PodResources attribution. BUG=581484470
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GPU Reset, PR 3/3. Depends on PR 1/3 (#642) and PR 2/3 (#643); only the last commit is new here.
Why
Recovering a GPU from a recoverable fault (for example some Xids or a wedged context) currently means rebooting the whole node, which disrupts every workload on it. A GPU reset fixes many of these faults in about a minute and only affects the target GPUs, so it can be tried first, before a reboot.
What
New
pkg/gpu/nvidia/reset, enabled with--enable-gpu-reset(default off):cloud.google.com/perform-gpu-reset=<all|N|N-M-...>.cloud.google.com/gpu-reset-status=<code>, JSON details in the annotationcloud.google.com/gpu-reset-status-details, plus node events. The trigger label is cleared when the run ends.Error-GPU-Busy(naming PIDs/pods) if they don't. Each step is undone on abort.nvidia-smi --gpu-reset -i <bdf,...>for all targets, then waits for NVLink fabric, rebuilds MIG/time-sharing state, and restores persistence mode only where it was on.Error-Unsupported-Mode).Error-Interrupted). Per-phase metrics and logs.Testing
go vet ./...,go test -race ./pkg/gpu/nvidia/... ./cmd/... ./partition_gpu/...allin ~56s, GPU subset, busy-GPU abort, MIG rebuild, persistence restore, MPS rejection.allin ~34s; NVLink fabric and multi-node NCCL work after reset; peer node unaffected.