Skip to content

feat(gpu): add guarded Linux AMD RDNA3/RDNA4 support - #132

Closed
jenerestain wants to merge 2 commits into
T-Crypt:mainfrom
jenerestain:wnzn/feat/amd-support
Closed

jenerestain wants to merge 2 commits into
T-Crypt:mainfrom
jenerestain:wnzn/feat/amd-support

Conversation

@jenerestain

@jenerestain jenerestain commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add experimental Linux discrete AMD RDNA3/RDNA4 support using the existing gpu.Probe contract. APUs/UMA, other AMD generations, and AMD Windows are explicitly excluded.

  • Add an amdgpu sysfs/DRM adapter without ROCm, amd-smi, CGO, inference contexts, or new module dependencies.
  • Join card/process observations by normalized PCI identity, retain DRM card numbering, support legacy/modern resident counters, deduplicate clients, and conservatively leave shared/unobservable bytes in the driver baseline.
  • Add --gpu-backend auto|nvidia|amd to daemon/service selection and the swap benchmark. Preserve NVIDIA's existing probes and optional streaming; refuse ambiguous automatic selection.
  • Guard AMD admissions against stale/failed samples and insufficient driver free bytes. Keep unreadable PIDs explicit, preserve sampled process identity, and require driver baseline confirmation before release/park completion.
  • Add fixture/broker/service regressions, a repeatable opt-in bounded allocation/handoff check, and milestone/scope documentation in contrib/amd/README.md.

Validation

The unchanged starting tree passed the same baseline checks. Final implementation checked with Go 1.27.1 and the repository's exact linter version:

  • go build ./... && test -z "$(gofmt -l .)" && go vet ./... && go test ./...
  • go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0 run ./... — 0 issues
  • GOOS=windows go build ./... && GOOS=windows go vet ./...
  • go test -race ./internal/gpu ./internal/broker ./internal/cli
  • Opt-in read-only probe against a W7900, kernel 6.12.107+deb13-amd64, including existing ROCm and Vulkan clients
  • Isolated W7900 GEM allocation -> measured PID attribution -> higher-priority drain -> driver-confirmed release -> next allocation, repeated after final changes

The live test used sequential 64 MiB buffers, its own daemon/socket/config, and no installed service. Initial and final driver usage matched exactly at 41,657,159,680 bytes. Existing workload process identities and measured memory were unchanged; the 780M was excluded. The event trace confirmed lease.freed for the first child before lease.granted for the second.

Explicit limits / follow-up gates

Integration with current main

Merged upstream main through edc6cd9 without rebasing/force-pushing. Preserved its documentation split and VFIO hold/probe-suppression behavior, and added a guarded-AMD VFIO recovery regression. The combined tree passed the isolated W7900 allocation/drain/handoff check again. In this later run, existing workloads continued with the same process identities while one workload's allocations changed; the unattributed driver baseline returned to its original value and both test children exited. The unchanged-total figure above refers to the earlier stable-background runs, not a promise that other workloads stop allocating.

The existing VFIO command remains NVIDIA-specific; AMD VFIO CLI support and physical passthrough validation are not included.

All local checks above passed again on the integrated tree. GitHub's CI and docs workflows currently report action_required with no jobs started for this fork PR; maintainer approval is needed before upstream CI, including native Windows tests, can be confirmed green. No merge is requested until that gate passes.

  • RDNA4 GC 12.0.0/12.0.1 is fixture-tested, not physically tested here. Run the documented read-only and opt-in allocation checks on a real RDNA4 card before claiming hardware validation.
  • No NVIDIA GPU was available for live regression testing; NVIDIA tests and Windows build/vet pass. Native Windows execution remains a CI gate.
  • The live allocation test validates the driver/lease path, not model correctness or engine-specific ROCm park/resume support. Park safety has broker regression coverage; actual engine/runtime capabilities still matter.
  • Shared/unobservable background allocations can conservatively delay release confirmation. Whole-card leases retain report-only contested-grant semantics; no reservations or engine device isolation are claimed.
  • No unrelated fixes, package/version changes, production workload restarts, or APU/UMA scheduling changes.

@jenerestain

Copy link
Copy Markdown
Contributor Author

Closing at the author's request so APU support and validation on a Radeon 780M can be completed before resubmitting AMD support.

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