feat: add GPU time-slicing support via virtual devices#189
Open
andrei-indreies wants to merge 1 commit into
Open
feat: add GPU time-slicing support via virtual devices#189andrei-indreies wants to merge 1 commit into
andrei-indreies wants to merge 1 commit into
Conversation
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.
Motivation
Add GPU time-slicing support to the ROCm Kubernetes Device Plugin.
I have an r5 4650g node inside my k3s on which I am want to run both Jellyfin and tdarr, but with the current state of the plugin is not doable because the plugin strictly registers each physical AMD GPU exactly once, providing no built-in way for multiple low-resource pods to share a single GPU. This PR introduces Kubernetes-level overcommit (time-slicing).
Technical Details
Added
--replicasinteger flag tocmd/k8s-device-plugin/main.go(defaults to1, preserving existing behavior).internal/pkg/plugin/timeslice.gowith helpers to build and resolve virtual device IDs (appending and stripping-slice-<n>suffixes).ListAndWatch: Now multiplies discovered physical GPUs byreplicas, advertising virtual IDs like0000:03:00.0-slice-0to Kubernetes.Allocate: Resolves virtual device IDs back to their parent physical IDs to correctly assign hardware topology and/dev/dri/*device paths.PopulatePerGPUDHealthinexporter/health.goto optionally accept a physical ID resolver so virtual slices inherit their parent GPU's health status.timeslice_test.gocovering edge cases.README.mdto document the time-slicing feature, how to configure it, and its hardware isolation caveats.Test Plan
go testforinternal/pkg/plugin/to verify virtual device creation and physical ID resolution logic.--replicas=4.kubectl get nodereports4foramd.com/gpucapacity.amd.com/gpu: 1./dev/kfdand/dev/dri/renderD*are correctly mounted.Test Result
go testpasses successfully for all new time-slicing test cases.Submission Checklist