Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs cleanup using Ubuntu HWE #2101

Merged
merged 6 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 39 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 to 6.11+ 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:
Expand Down Expand Up @@ -60,19 +68,20 @@ Turn off SecureBoot (Allows for unsigned drivers to be installed):
3. Install XRT.

```bash
# Ubuntu 24.04
cd $XDNA_SRC_DIR/xrt/build/Release
sudo apt reinstall ./xrt_202510.2.19.0_24.10-amd64-npu.deb
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
```

> **An error might occur during this proces.** If so, do the following steps.


```bash
# Ubuntu 24.10
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
```
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, 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).

Expand All @@ -85,8 +94,17 @@ Turn off SecureBoot (Allows for unsigned drivers to be installed):
1. Install XDNA™.

```bash
# 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:
Expand All @@ -110,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
```

Expand All @@ -130,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 <testName>.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
```
Expand Down
2 changes: 1 addition & 1 deletion utils/quick_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading