Skip to content

install.sh: say what the xdna2 npu still needs on amd - #97

Merged
IsuraManchanayake merged 1 commit into
mainfrom
feat/install-npu-check
Nov 19, 2026
Merged

IsuraManchanayake merged 1 commit into
mainfrom
feat/install-npu-check

Conversation

@IsuraManchanayake

@IsuraManchanayake IsuraManchanayake commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

From 0.5.3 the Linux x86-64 (ROCm) engine uses the machine's XDNA2 NPU beside the GPU while it reads a prompt. The bundle carries the engine's own parts; the machine has to bring three things, and without any of them the engine prints one [npu_ffn] the prefill stays on the GPU alone: ... line and runs on the GPU as before. The installer already checks for the ROCm runtime and prints the apt lines. This does the same for the NPU, so nobody has to find the steps in a release note.

What the installer does now

On Linux x86-64, after the GPU and ROCm checks:

  • Is there an NPU? /dev/accel/accel0, or without it a PCI device 1022:17f0. With neither it says nothing.
  • The device node. Missing with the hardware present, it tells three cases apart: the amdxdna driver is not loaded, the driver is loaded but the firmware folder (amdnpu/17f0_<revision>) is missing, or both are there and the kernel log has the reason. A node the user cannot open gets the render group line.
  • XRT. libxrt_coreutil.so.2 (what the engine's NPU module loads) and libxrt_driver_xdna.so.2 (the NPU plugin, from libxrt-npu2), looked for in LD_LIBRARY_PATH, the folders /etc/ld.so.conf and ld.so.conf.d name, and the loader's own. The fix is sudo apt install libxrt2 libxrt-npu2, or libxrt-npu2 alone when only the plugin is missing; off Ubuntu 26.04 the line says that is where those packages are.
  • The locked-memory limit of the shell the installer runs in, read from /proc/self/limits. Below 64 MiB (the engine's own threshold: XRT locks a 64 MiB heap) it prints the limits.d line and LimitMEMLOCK=infinity for a systemd service.

Each missing piece is one entry in the closing notes, under a heading that says BaseRT works without the NPU, on the GPU alone:

  Optional: this machine has an XDNA2 NPU, which the engine uses beside the GPU to read
  prompts faster. BaseRT works without it, on the GPU alone. To use the NPU:
    - XRT, the runtime the engine reaches the NPU through, is not installed (libxrt_coreutil.so.2).
        sudo apt install libxrt2 libxrt-npu2
    - the locked-memory limit here is 8192 KiB, and XRT locks a 64 MiB heap for the NPU. For
      logins, add this file and log in again:
        echo '* - memlock unlimited' | sudo tee /etc/security/limits.d/99-basert-npu.conf
      For a systemd service, in its [Service] section:
        LimitMEMLOCK=infinity

It never runs apt, sudo or modprobe, never writes outside the install directory, and never fails the install because of the NPU: the check's errors are discarded and its result is only printed.

Two choices worth a look in review:

  • The notes appear only for a release that uses the NPU, which the installer tells by baseRT_rocm_npu.so in the bundle (or in the install directory, on a run that finds the release already installed). So BASERT_VERSION=v0.5.2 on a machine without XRT stays quiet. This ties the installer to that file name: if the module is renamed before 0.5.3 ships, NPU_MODULE in install.sh has to follow, or the notes never show.
  • The README and the installation page say "From 0.5.3". This should merge when 0.5.3 is out, not before.

The checks look under BASERT_INSTALL_TEST_ROOT, like the ROCm ones, so the tests build each machine as a folder.

Tested

python3 tests/scripts/test_packaging.py passes (69 tests, 13 of them new) on macOS with sh and with dash, and shellcheck install.sh is clean. Against the installer before this change 9 of the 13 fail; the other 4 are the ones that expect silence. Fake machines covered:

Machine Result
No NPU (no node, no 1022:17f0), XRT missing, 8 MiB limit nothing about the NPU
NPU with everything (revisions 10 and 11; unlimited and exactly 64 MiB) nothing
NPU without XRT, Ubuntu 26.04 sudo apt install libxrt2 libxrt-npu2
NPU without XRT, Ubuntu 24.04 or no os-release the same line, after "Ubuntu 26.04 has it as:"
XRT without the NPU plugin sudo apt install libxrt-npu2
XRT outside the loader's folders missing, until LD_LIBRARY_PATH or ld.so.conf.d names the folder
NPU with an 8 MiB limit the limits.d line and LimitMEMLOCK=infinity
NPU hardware without the node: no driver / no firmware / both present sudo modprobe amdxdna / the firmware folder / sudo dmesg | grep amdxdna
Node the user cannot open the render group line
Everything missing at once three entries, in order
NPU with missing pieces, release without the NPU module nothing
Second run, release already installed the same entries again
macOS the NPU is not looked for

On real hardware: one Strix Point machine (Ryzen AI 300, Ubuntu 26.04, kernel 7.0, amdxdna bound to 1022:17f0 revision 10, XRT 2.21.75 from apt, unlimited locked memory). The installer ran against its real /sys, /proc and library folders with a stand-in for the download (a bundle holding the NPU module, installed into a temporary folder):

  • as the machine is: nothing about the NPU, exit 0;
  • from a shell with ulimit -l 8192: the locked-memory entry alone, with "8192 KiB";
  • the same shell, a bundle without the NPU module: nothing.

The installer tests also pass there (Linux, dash, GNU tools). The PCI id, the firmware folder names (17f0_10, 17f0_11), the two library names and the device node's render group were read from that machine.

Not tested on real hardware: a machine whose NPU has no driver or no firmware, a machine without XRT or without the plugin, a device node the user cannot open, a Strix Halo (revision 11; its firmware folder was seen, the machine was not run), and any distribution other than Ubuntu 26.04. Those cases are covered by the fake machines only. "Linux 6.14 and later have the driver" is from the kernel's history, not from a run. The printed fixes (apt install, the limits.d file, modprobe) were not executed anywhere as part of this change. No real 0.5.3 bundle was installed, since none is published yet.

From 0.5.3 the Linux/x86_64 engine uses the machine's XDNA2 NPU beside the
GPU while it reads a prompt, when the NPU's driver and firmware
(/dev/accel/accel0), XRT with its NPU plugin and a locked-memory limit of
64 MiB or more are there. Without them it runs on the GPU alone.

On a machine with an NPU (the device node, or PCI 1022:17f0 without one) the
installer now names each missing piece in its closing notes, with the command
or file that adds it. It says nothing on a machine without an NPU, with
everything there, or for a release whose bundle has no NPU module, and it
never stops because of the NPU. The checks look under
BASERT_INSTALL_TEST_ROOT, as the ROCm ones do.
@IsuraManchanayake
IsuraManchanayake merged commit 0d50da3 into main Nov 19, 2026
11 checks passed
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