Skip to content

feat(linux): add AMD MI300X ROCm bootstrap#8824

Draft
wenhug wants to merge 4 commits into
mainfrom
wenhug/amd-mi300x-rocm-bootstrap
Draft

feat(linux): add AMD MI300X ROCm bootstrap#8824
wenhug wants to merge 4 commits into
mainfrom
wenhug/amd-mi300x-rocm-bootstrap

Conversation

@wenhug

@wenhug wenhug commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

This draft validates the AgentBaker CSE path for AKS-managed AMD MI300X ROCm bootstrap. It adds the wiring needed for an AKS node to identify itself as an AMD GPU node, install the ROCm host driver/runtime pieces during node provisioning, and expose devices that the AMD device plugin can consume.

The implementation is intentionally scoped to Ubuntu 24.04 amd64 and:

  • Standard_ND96isr_MI300X_v5
  • Standard_ND96is_MI300X_v5

Main changes:

  • Plumbs AMD_GPU_NODE through AgentBaker and aks-node-controller.
  • Routes AMD GPU nodes through ensureAmdGpuDrivers before the NVIDIA path.
  • Installs the pinned minimal ROCm host package set:
    • amdgpu-dkms
    • libdrm-amdgpu-dev
    • rocm-core
    • rocminfo
    • rocm-smi-lib
  • Configures amdgpu module autoload and removes stale blacklist/install-false entries.
  • Validates DKMS state, module loading, /dev/kfd, render devices, gfx942, and the MI300X product name.
  • Cleans only ROCm/AMDGPU apt state after installation.
  • Handles old CustomData safely and returns a clear unsupported-OS error on non-Ubuntu distros.
  • Writes the success marker only after driver validation succeeds.
  • Adds focused ShellSpec coverage for OS/SKU gating, mirror URL validation, cleanup, retry fast-path, successful installation, package failure, and validation failure.

The earlier VHD prebake proof of concept has been removed from this PR so the production CSE path can be reviewed independently.

Validation performed:

  • make generate
  • go test ./pkg/agent
  • (cd aks-node-controller && go test ./parser)
  • Full ShellSpec suite: 828 examples, 0 failures
  • Manual validation on a Standard_ND96isr_MI300X_v5 Ubuntu 24.04 VM joined through AKS Flex Node
  • Confirmed Ready, amd.com/gpu=8, reboot recovery, gfx942, and AMD Instinct MI300X VF

Draft blocker / follow-ups:

  • The CSE prototype still defaults to repo.radeon.com. Before production merge, the GPU/AgentBaker owners need to approve an AKS-controlled mirror/package distribution model and component update ownership.
  • Add a dedicated MI300X automated E2E; the existing generic AgentBaker/GPU E2E jobs do not exercise this AMD path.
  • RP/nodepool product wiring remains out of scope.

Which issue(s) this PR fixes:

Related to https://dev.azure.com/msazure/CloudNativeCompute/_workitems/edit/10382752

Copilot AI review requested due to automatic review settings July 2, 2026 23:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds initial end-to-end wiring for AMD MI300X ROCm enablement on AKS Linux nodes by introducing an AMD_GPU_NODE CSE signal, an AMD driver install/validation path in Ubuntu CSE, and an optional VHD prebake proof-of-concept behind an AMD_ROCM feature flag.

Changes:

  • Plumbs AMD_GPU_NODE from AgentBaker and aks-node-controller into the Linux CSE environment and routes AMD GPU nodes through a new ensureAmdGpuDrivers path.
  • Implements Ubuntu 24.04-specific ROCm/AMDGPU installation + validation logic (DKMS/module/device nodes + rocminfo/rocm-smi checks) and cleans up temporary apt repo configuration afterward.
  • Adds a VHD prebake path gated by AMD_ROCM and extends the Linux VHD content tests to verify the prebaked marker/packages/module config and repo cleanup.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vhdbuilder/scripts/linux/ubuntu/tool_installs_ubuntu.sh Adds ROCm/AMDGPU VHD prebake functions (repo setup/cleanup, module autoload, validation, install).
vhdbuilder/packer/test/linux-vhd-content-test.sh Adds a new testAmdRocmPrebake gated by AMD_ROCM to validate prebaked ROCm state and repo cleanup.
vhdbuilder/packer/install-dependencies.sh Wires the AMD_ROCM feature flag to invoke installAmdRocmPrebake during VHD build and logs the marker.
pkg/agent/variables.go Adds an amdGpuNode CSE variable derived from EnableAMDGPU.
pkg/agent/variables_test.go Adds unit tests asserting amdGpuNode string output.
pkg/agent/baker_test.go Adds a Linux CSE command test asserting AMD_GPU_NODE=true for an MI300X SKU config.
parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh Adds ROCm/AMDGPU install + validation logic for Ubuntu 24.04 amd64, SKU gating, marker writing, and repo cleanup.
parts/linux/cloud-init/artifacts/cse_main.sh Routes AMD_GPU_NODE=true through ensureAmdGpuDrivers before the NVIDIA driver path.
parts/linux/cloud-init/artifacts/cse_helpers.sh Adds AMD ROCm-related error codes for the CSE path.
parts/linux/cloud-init/artifacts/cse_cmd.sh Emits AMD_GPU_NODE into the CSE environment.
aks-node-controller/parser/parser.go Adds AMD_GPU_NODE to the generated CSE environment map.
aks-node-controller/parser/parser_test.go Extends parser tests to validate AMD_GPU_NODE presence/values in env.
aks-node-controller/parser/helper.go Adds getEnableAmdGpu helper for config parsing.

Comment on lines +277 to +280
cat > /etc/apt/sources.list.d/rocm.list <<EOF
deb [arch=amd64 signed-by=${rocm_gpg_keyring_path}] https://repo.radeon.com/rocm/apt/${rocm_version} ${ubuntu_codename} main
deb [arch=amd64 signed-by=${rocm_gpg_keyring_path}] https://repo.radeon.com/graphics/${rocm_version}/ubuntu ${ubuntu_codename} main
EOF
Comment thread parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh
Comment thread vhdbuilder/scripts/linux/ubuntu/tool_installs_ubuntu.sh Outdated
@wenhug
wenhug force-pushed the wenhug/amd-mi300x-rocm-bootstrap branch from 129990c to 03945de Compare July 6, 2026 23:05
Copilot AI review requested due to automatic review settings July 8, 2026 18:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Comment thread vhdbuilder/scripts/linux/ubuntu/tool_installs_ubuntu.sh Outdated
Comment thread vhdbuilder/scripts/linux/ubuntu/tool_installs_ubuntu.sh Outdated
Comment thread vhdbuilder/scripts/linux/ubuntu/tool_installs_ubuntu.sh Outdated
Comment on lines +256 to +260
amdRocmRepoBaseUrl() {
local repo_base_url="${AMD_ROCM_REPO_BASE_URL:-https://repo.radeon.com}"
repo_base_url="${repo_base_url%/}"
case "${repo_base_url}" in
https://*)
Comment thread parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh
Comment thread parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh
Comment thread aks-node-controller/parser/parser_test.go Outdated
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.

2 participants