From 7804ff9659e0100beec75a24d507705b59d6cc3c Mon Sep 17 00:00:00 2001 From: Joseph Melber Date: Wed, 5 Mar 2025 11:37:10 -0700 Subject: [PATCH 1/6] Docs cleanup using Ubuntu HWE Support all Ubuntu 24.04 LTS --- README.md | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9e5a9a6847..3f4a2368dc 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,20 @@ This project is primarily intended to support the open-source community, particu # Getting Started for AMD Ryzen™ AI on Linux -These instructions will guide you through everything required for building and executing a program on the Ryzen™ AI NPU, starting from a fresh bare-bones **Ubuntu 24.04.2** or **Ubuntu 24.10** install with included Linux 6.11 kernel. +These instructions will guide you through everything required for building and executing a program on the Ryzen™ AI NPU, starting from a fresh bare-bones **Ubuntu 24.04** or **Ubuntu 24.10** install. ## Initial Setup > Be sure you have the latest BIOS on your laptop or mini-PC that enables the NPU. See [here](#update-bios). +If starting from `Ubuntu 24.04` you may need to update the Linux kernel by installing the Hardware Enablement (HWE) stack: + + ```bash + sudo apt update + sudo apt install --install-recommends linux-generic-hwe-24.04 + sudo reboot + ``` + ## Prerequisites ### BIOS Settings: @@ -61,18 +69,15 @@ Turn off SecureBoot (Allows for unsigned drivers to be installed): ```bash cd $XDNA_SRC_DIR/xrt/build/Release - sudo apt reinstall ./xrt_202510.2.19.0_24.10-amd64-npu.deb + # Ubuntu 24.04 + sudo apt reinstall ./xrt_202510.2.19.0_24.04-amd64-base.deb + sudo apt reinstall ./xrt_202510.2.19.0_24.04-amd64-base-dev.deb + # Ubuntu 24.10 + sudo apt reinstall ./xrt_202510.2.19.0_24.10-amd64-base.deb + sudo apt reinstall ./xrt_202510.2.19.0_24.10-amd64-base-dev.deb ``` - > **An error might occur during this proces.** If so, do the following steps. - - ```bash - cd $XDNA_SRC_DIR/xrt/build/Release - sudo apt remove xrt-npu - sudo dpkg -i --force-overwrite ./xrt_202510.2.19.0_24.10-amd64-npu.deb - sudo apt -f install - sudo apt reinstall ./xrt_202510.2.19.0_24.10-amd64-npu.deb - ``` + > **An error might occur during this proces.** If so, you may have to remove and force-overwrite/reinstall the packages. 1. Build XDNA-Driver. Below steps are adapted from [here](https://github.com/amd/xdna-driver). @@ -86,6 +91,9 @@ Turn off SecureBoot (Allows for unsigned drivers to be installed): ```bash cd $XDNA_SRC_DIR/build/Release + # Ubuntu 24.04 + sudo apt reinstall ./xrt_plugin.2.19.0_ubuntu24.04-x86_64-amdxdna.deb + # Ubuntu 24.10 sudo apt reinstall ./xrt_plugin.2.19.0_ubuntu24.10-x86_64-amdxdna.deb ``` From 922f62de25cf7141e0623a97ed25838ce94aacc4 Mon Sep 17 00:00:00 2001 From: Joseph Melber Date: Wed, 5 Mar 2025 11:38:05 -0700 Subject: [PATCH 2/6] Explicit Linux kernel --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f4a2368dc..64692d66f0 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ These instructions will guide you through everything required for building and e > Be sure you have the latest BIOS on your laptop or mini-PC that enables the NPU. See [here](#update-bios). -If starting from `Ubuntu 24.04` you may need to update the Linux kernel by installing the Hardware Enablement (HWE) stack: +If starting from `Ubuntu 24.04` you may need to update the Linux kernel to 6.11+ by installing the Hardware Enablement (HWE) stack: ```bash sudo apt update From 7dae3a410cb6bae87c2307ec9d4f0afb5a84a469 Mon Sep 17 00:00:00 2001 From: Joseph Melber Date: Wed, 5 Mar 2025 11:41:29 -0700 Subject: [PATCH 3/6] Make copy-paste-able --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 64692d66f0..a65197be16 100644 --- a/README.md +++ b/README.md @@ -68,11 +68,15 @@ Turn off SecureBoot (Allows for unsigned drivers to be installed): 3. Install XRT. ```bash - cd $XDNA_SRC_DIR/xrt/build/Release # Ubuntu 24.04 + cd $XDNA_SRC_DIR/xrt/build/Release sudo apt reinstall ./xrt_202510.2.19.0_24.04-amd64-base.deb sudo apt reinstall ./xrt_202510.2.19.0_24.04-amd64-base-dev.deb + ``` + + ```bash # Ubuntu 24.10 + cd $XDNA_SRC_DIR/xrt/build/Release sudo apt reinstall ./xrt_202510.2.19.0_24.10-amd64-base.deb sudo apt reinstall ./xrt_202510.2.19.0_24.10-amd64-base-dev.deb ``` @@ -90,10 +94,14 @@ Turn off SecureBoot (Allows for unsigned drivers to be installed): 1. Install XDNA™. ```bash - cd $XDNA_SRC_DIR/build/Release # Ubuntu 24.04 + cd $XDNA_SRC_DIR/build/Release sudo apt reinstall ./xrt_plugin.2.19.0_ubuntu24.04-x86_64-amdxdna.deb + ``` + + ```bash # Ubuntu 24.10 + cd $XDNA_SRC_DIR/build/Release sudo apt reinstall ./xrt_plugin.2.19.0_ubuntu24.10-x86_64-amdxdna.deb ``` From 8d1e6873f0164f5fde3d0cbcd2c741ed6254c586 Mon Sep 17 00:00:00 2001 From: Joseph Melber Date: Wed, 5 Mar 2025 11:43:43 -0700 Subject: [PATCH 4/6] Reboot after loading the xdna-driver --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a65197be16..339360641d 100644 --- a/README.md +++ b/README.md @@ -97,12 +97,14 @@ Turn off SecureBoot (Allows for unsigned drivers to be installed): # Ubuntu 24.04 cd $XDNA_SRC_DIR/build/Release sudo apt reinstall ./xrt_plugin.2.19.0_ubuntu24.04-x86_64-amdxdna.deb + sudo reboot ``` ```bash # Ubuntu 24.10 cd $XDNA_SRC_DIR/build/Release sudo apt reinstall ./xrt_plugin.2.19.0_ubuntu24.10-x86_64-amdxdna.deb + sudo reboot ``` 1. Check that the NPU is working if the device appears with xrt-smi: From fcce047f2e90a4ad65c37511d21aadd509562a5d Mon Sep 17 00:00:00 2001 From: Joseph Melber Date: Wed, 5 Mar 2025 11:57:41 -0700 Subject: [PATCH 5/6] Cleanup application building --- README.md | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 339360641d..50258b1b8d 100644 --- a/README.md +++ b/README.md @@ -128,15 +128,12 @@ Turn off SecureBoot (Allows for unsigned drivers to be installed): ```bash sudo apt install \ - build-essential clang clang-14 lld lld-14 cmake python3-venv python3-pip libxrender1 libxtst6 libxi6 + build-essential clang clang-14 lld lld-14 cmake python3-venv python3-pip ``` -1. Install g++13 and opencv which is needed for some programming examples: +1. Install opencv which is needed for some programming examples: ```bash - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt update - sudo apt install gcc-13 g++-13 -y sudo apt install libopencv-dev python3-opencv ``` @@ -148,34 +145,23 @@ Turn off SecureBoot (Allows for unsigned drivers to be installed): cd mlir-aie ``` -1. Source `utils/quick_setup.sh` to setup the prerequisites and - install the mlir-aie compiler tools from whls. +1. Install IRON library, mlir-aie and llvm-aie compilers from whls: + ```bash + source utils/quick_setup.sh + ``` ## Build an IRON Design for AIEs in the AMD Ryzen™ AI NPU -> Remember to set up your environment including IRON, and XRT -> ``` -> source /opt/xilinx/xrt/setup.sh -> source ironenv/bin/activate -> source utils/env_setup.sh -> ``` -> For your design of interest, for instance from [programming_examples](../programming_examples/), 2 steps are needed: (i) build the AIE design and then (ii) build the host code. ### Build Device AIE Part -1. Goto the design of interest and run `make` - -### Build and Run Host Part - -1. Build: Goto the same design of interest folder where the AIE design just was built (see above) - ```bash - make .exe - ``` - > Note that the host code target has a `.exe` file extension even on Linux. Although unusual, this is an easy way for us to distinguish whether we want to compile device code or host code. - +1. Goto the design of interest and run: + ```bash + make + ``` -1. Run (program arguments are just an example for vector_scalar_add design) +1. Build host code and execute the design: ```bash make run ``` From a81e1211c7714b396770d2d39235ae9391a39ef3 Mon Sep 17 00:00:00 2001 From: Joseph Melber Date: Wed, 5 Mar 2025 12:15:03 -0700 Subject: [PATCH 6/6] Update quick_setup.sh --- utils/quick_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/quick_setup.sh b/utils/quick_setup.sh index ad62813841..240d074c63 100755 --- a/utils/quick_setup.sh +++ b/utils/quick_setup.sh @@ -52,7 +52,7 @@ source ironenv/bin/activate python3 -m pip install --upgrade pip python3 -m pip install mlir_aie -f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/latest-wheels/ -MLIR_AIE_DIR="$(pip show mlir_aie | grep ^Location: | awk '{print $2}')/mlir_aie" +export MLIR_AIE_INSTALL_DIR="$(pip show mlir_aie | grep ^Location: | awk '{print $2}')/mlir_aie" python3 -m pip install llvm-aie -f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly export PEANO_INSTALL_DIR="$(pip show llvm-aie | grep ^Location: | awk '{print $2}')/llvm-aie"