Skip to content

fix: align DRA driver DaemonSet/DeviceClass with AutoPartition (k8s-gpu-dra-driver#88) - #648

Open
yansun1996 wants to merge 3 commits into
ROCm:mainfrom
yansun1996:align-autopartition-pr88
Open

yansun1996 wants to merge 3 commits into
ROCm:mainfrom
yansun1996:align-autopartition-pr88

Conversation

@yansun1996

Copy link
Copy Markdown
Member

Summary

ROCm/k8s-gpu-dra-driver#88 added the AutoPartition feature to the DRA driver (hardware-validated on 8xMI300X, merged as f93028f). The operator vendors its own copies of the DRA driver DaemonSet spec (internal/plugin/plugin.go) and default DeviceClass (helm-charts-k8s/templates/dra-driver-deviceclass.yaml) rather than consuming the upstream chart directly, and those copies predate AutoPartition. This PR brings them into alignment.

  • DeviceClass: split gpu.amd.com into an unconstrained class + a new gpu.amd.com-spx (carrying extendedResourceName, constrained to computePartition == "spx") when draDriver.deviceClass.autoPartition is set — otherwise a classic amd.com/gpu request can resolve to a leftover partition fraction from a released claim (same bug PR Utils Container Openshift Security Context Constraint access #88 fixed upstream, reproduced independently here since the operator's copy never got that fix). Default rendering only gains extendedResourceName support (previously absent), nothing else changes.
  • SetDRADriverAsDesired: sets KMM_DRIVER_ENABLED=true on the DRA driver container when utils.ShouldUseKMM(devConfig), mirroring the existing KMM node-selector wiring. The driver reads this via os.Getenv directly, so the existing cmdLineArguments passthrough (CLI args only) could never set it.
  • SetDRADriverAsDesired: mounts /lib/modules (read-only) unconditionally — both of the driver's amdgpu reload paths shell out to modprobe, which needs it regardless of KMM.

Enabling AutoPartition itself needs no operator code change — --feature-gates/FEATURE_GATES is a real CLI flag with an env alias, so cmdLineArguments: {feature-gates: "AutoPartition=true"} already reaches it through the existing generic passthrough.

Same change as pensando/gpu-operator#1678, raised separately (and labeled No-DoubleCommit there) since that repo has diverged from this one.

Test plan

  • go build ./... clean
  • go vet ./internal/... ./api/... clean
  • go test ./internal/plugin/... — added coverage for /lib/modules mount (always present) and KMM_DRIVER_ENABLED (set iff ShouldUseKMM, including the pf-passthrough exclusion)
  • helm template on dra-driver-deviceclass.yaml verified byte-for-byte with autoPartition: false (aside from the new extendedResourceName field) and verified the two-class split renders correctly with autoPartition: true
  • Not yet re-validated on real hardware through the operator's own DeviceConfig reconciliation path (this closes the gaps found while doing that live validation manually in feat: auto-partition (dynamic GPU repartitioning) — hardware-validated k8s-gpu-dra-driver#88; a follow-up hardware pass through the operator itself is recommended before general release)

🤖 Generated with Claude Code

yansun1996 and others added 2 commits September 22, 2026 11:04
The AMD GPU DRA driver added AutoPartition: it advertises every valid
compute+memory partition configuration as a synthetic device and
dynamically repartitions the GPU via amd-smi when a matching
ResourceClaim is prepared, hardware-validated on 8xMI300X. The
operator vendors its own copies of the DRA driver DaemonSet spec
(internal/plugin/plugin.go) and default DeviceClass
(helm-charts-k8s/templates/dra-driver-deviceclass.yaml) rather than
consuming the upstream chart directly, and those copies had fallen
out of sync:

- DeviceClass: split gpu.amd.com into gpu.amd.com (unconstrained) and
  gpu.amd.com-spx (extendedResourceName, constrained to
  computePartition == spx) when draDriver.deviceClass.autoPartition is
  set, so a classic amd.com/gpu request can't resolve to a leftover
  partition fraction. Default behavior unchanged aside from gaining
  extendedResourceName support. Ported into both the generated chart
  and hack/k8s-patch/template-patch/dra-driver-deviceclass.yaml (the
  true source make helm-k8s copies over it from).
- SetDRADriverAsDesired: set KMM_DRIVER_ENABLED=true when
  utils.ShouldUseKMM(devConfig), mirroring the existing KMM
  node-selector wiring. The driver reads this via os.Getenv directly,
  so cmdLineArguments (which only becomes CLI args) could never set
  it.
- SetDRADriverAsDesired: mount /lib/modules (read-only)
  unconditionally -- both of the driver's amdgpu reload paths shell
  out to modprobe, which needs it regardless of KMM.

Also includes the regenerated helm-docs README table rows for the two
new values, and picks up unrelated pre-existing generated-artifact
drift exposed by re-running the generators (k8s.io/api Toleration
doc-comment wording, an import alias normalization, mockgen method
ordering, and stale timestamps in Chart.lock/the bundle CSV).

Co-Authored-By: Claude <noreply@anthropic.com>
make all re-run on this repo's own Makefile (DOCKER_REGISTRY defaults
to docker.io/rocm here, vs. registry.test.pensando.io upstream). The
prior commit's bundle CSV containerImage field had leaked the
pensando-internal registry (copied verbatim from the upstream repo's
already-regenerated tree); this run corrects it to
docker.io/rocm/amd-gpu-operator:dev via this repo's own generators,
plus its accompanying createdAt bump.

Also commits the other artifacts a full generate/manifests/helm-k8s
pass produces on top of the prior commit: mockgen/controller-gen
tool-version output (method ordering, copyright header handling),
gofmt struct-literal realignment in upgrademgr.go, and the
Chart.lock timestamp bump from the redone helm dependency update.

Co-Authored-By: Claude <noreply@anthropic.com>
@yansun1996
yansun1996 force-pushed the align-autopartition-pr88 branch from 5cb801f to 45e40b4 Compare September 22, 2026 11:12
…en regen

make copyrights (a required check) failed on the previous commit: the
pinned mockgen@v0.3.0/controller-gen@v0.17.0 versions strip the header
on regeneration instead of preserving it. Re-run make copyrights && make
fmt and commit the restored headers so the check passes.

Co-Authored-By: Claude <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant