Skip to content

npu: fix xdna/iron build on ROCm 7.2.2 base image#84

Open
poad42 wants to merge 4 commits into
AMDResearch:mainfrom
poad42:xdna-iron-build-rocm722
Open

npu: fix xdna/iron build on ROCm 7.2.2 base image#84
poad42 wants to merge 4 commits into
AMDResearch:mainfrom
poad42:xdna-iron-build-rocm722

Conversation

@poad42

@poad42 poad42 commented Jun 5, 2026

Copy link
Copy Markdown
Member

The base image bump to the ROCm 7.2.2 PyTorch image broke the xdna and iron builds. This adapts them to the new toolchain and XRT:

  • xdna: install cmake/ninja-build/build-essential (no longer in base)
  • xdna: call xrtdeps.sh -docker directly instead of amdxdna_deps.sh, which does not forward -docker and so fails installing host kernel headers
  • xdna: build the userspace with -nokmod; the amdxdna kernel module is built and loaded on the host, not inside the container (host kernel != container)
  • iron/setup.sh: detect the NPU by AIE architecture (aie2/aie2p) since newer xrt-smi reports a generic device name instead of the marketing name
  • iron: drop the -l login-shell flag (consistency after conda removal)
  • xdna/ryzenai_cvml: drop hardcoded HSA_OVERRIDE_GFX_VERSION; ROCm 7.2.2 detects the Ryzen AI iGPUs natively (documented per-silicon in the README)
  • add .gitattributes to force LF on *.sh (CRLF breaks shebangs in containers)

poad42 and others added 4 commits June 5, 2026 16:30
The base image bump to the ROCm 7.2.2 PyTorch image broke the xdna and
iron builds. This adapts them to the new toolchain and XRT:

- xdna: install cmake/ninja-build/build-essential (no longer in base)
- xdna: call xrtdeps.sh -docker directly instead of amdxdna_deps.sh, which
  does not forward -docker and so fails installing host kernel headers
- xdna: build the userspace with -nokmod; the amdxdna kernel module is built
  and loaded on the host, not inside the container (host kernel != container)
- iron/setup.sh: detect the NPU by AIE architecture (aie2/aie2p) since newer
  xrt-smi reports a generic device name instead of the marketing name
- iron: drop the -l login-shell flag (consistency after conda removal)
- xdna/ryzenai_cvml: drop hardcoded HSA_OVERRIDE_GFX_VERSION; ROCm 7.2.2
  detects the Ryzen AI iGPUs natively (documented per-silicon in the README)
- add .gitattributes to force LF on *.sh (CRLF breaks shebangs in containers)

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the inline comments to short descriptions of the lines and move the
rationale here.

Build dependencies: amdxdna_deps.sh does not forward -docker to xrtdeps.sh, so
xrtdeps tries to install linux-headers-$(uname -r) (the host kernel) and the
whole apt batch fails, taking Boost and friends with it. We call xrtdeps.sh
directly with -docker so kernel headers are skipped, and install jq (the only
extra package amdxdna_deps.sh would add) ourselves.

Userspace build (-nokmod): inside a container uname -r is the host kernel, so
linux-headers are unavailable on non-Ubuntu hosts (Arch, Fedora, custom
kernels) and the amdxdna module cannot be loaded from a container anyway. The
kernel driver is installed and loaded on the host instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the inline comment short and move the rationale here.

Newer xrt-smi (XRT >= 2.20, shipped with ROCm 7.2.x) reports the part by
architecture and a generic device name (e.g. "RyzenAI-npu4", "aie2p") instead
of the marketing name, so we match on the AIE architecture as the stable
signal: aie2 -> Phoenix/Hawk Point -> npu1, aie2p -> Strix/Strix Halo/Krackan
-> npu2. aie2p is checked first since "aie2p" also contains "aie2".

Co-authored-by: Cursor <cursoragent@cursor.com>
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