Skip to content
Open
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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Shell scripts must use LF line endings; CRLF breaks the shebang
# (e.g. `/usr/bin/env: 'bash\r'`) when COPYed into and executed in containers.
*.sh text eol=lf
9 changes: 3 additions & 6 deletions packages/npu/iron/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
ARG BASE_IMAGE=xdna
FROM ${BASE_IMAGE}

# Where we'll install the build backend
WORKDIR /ryzers
COPY setup.sh /ryzers/setup.sh
COPY entrypoint.sh /ryzers/entrypoint.sh

# Set environment variable to suppress prompts in scripts
ENV DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-l", "-c"]
SHELL ["/bin/bash", "-c"]

# IRON requires python venv
RUN apt-get -y install python3.12-venv
Expand All @@ -33,7 +31,7 @@ RUN cd /ryzers/mlir-aie && \
source /opt/xilinx/xrt/setup.sh && \
source /ryzers/mlir-aie/utils/quick_setup.sh

# Copy the new AIE pragma utils.h to mlir_aie/include/ so it's picked up when doing #include "aie_kernel_utils.h"
# Make AIE kernel utils visible to mlir_aie include path
RUN cp /ryzers/mlir-aie/aie_kernels/aie_kernel_utils.h /ryzers/mlir-aie/ironenv/lib/python3.12/site-packages/mlir_aie/include/

# Install jupyter for notebooks
Expand All @@ -43,8 +41,7 @@ RUN source /ryzers/setup.sh && \
# Cleanup
ENV SHELL=/bin/bash

# Make sure to source the setup script on docker start
ENTRYPOINT ["/ryzers/entrypoint.sh"]

COPY test.sh /ryzers/test.sh
CMD ["/ryzers/test.sh"]
CMD ["/ryzers/test.sh"]
8 changes: 5 additions & 3 deletions packages/npu/iron/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ export PEANOWRAP2_FLAGS="-O2 -std=c++20 --target=aie2-none-unknown-elf ${WARNING
export PEANOWRAP2P_FLAGS="-O2 -std=c++20 --target=aie2p-none-unknown-elf ${WARNING_FLAGS} -DNDEBUG -I ${MLIR_AIE_INSTALL_DIR}/include "

examine_output=$(xrt-smi examine)
if echo $examine_output | grep -E "Phoenix|Hawk" > /dev/null; then
export NPU=npu1
elif echo $examine_output | grep -E "Strix|Krackan" > /dev/null; then
# Match on AIE architecture (aie2p=npu2, aie2=npu1); check aie2p first since
# "aie2p" contains the substring "aie2".
if echo "$examine_output" | grep -Eiq "Strix|Krackan|aie2p"; then
export NPU=npu2
elif echo "$examine_output" | grep -Eiq "Phoenix|Hawk|aie2"; then
export NPU=npu1
else
echo "No recognized NPU found"
fi
3 changes: 2 additions & 1 deletion packages/npu/ryzenai_cvml/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# SPDX-License-Identifier: MIT

environment_variables:
- "HSA_OVERRIDE_GFX_VERSION=11.0.0" # Required for HIP to write kernels
# HSA_OVERRIDE_GFX_VERSION is not set: ROCm 7.2.2 detects the iGPUs natively.
# On older ROCm, set it per silicon (see README "Supported silicon").
- "RYZEN_AI_DIR=/ryzers/RyzenAI-SW/Ryzen-AI-CVML-Library"
- "LD_LIBRARY_PATH=/ryzers/RyzenAI-SW/Ryzen-AI-CVML-Library/linux:/opt/xilinx/xrt/lib"

Expand Down
18 changes: 12 additions & 6 deletions packages/npu/xdna/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,31 @@ RUN apt-get update && apt-get install -y \
git \
curl \
bash \
wget
wget \
cmake \
ninja-build \
build-essential

RUN git clone https://github.com/amd/xdna-driver && \
cd xdna-driver && \
git checkout $DRIVER_VERSION && \
git submodule update --init --recursive

# Install build dependencies
RUN cd /ryzers/xdna-driver/tools && \
# Install build dependencies (xrtdeps.sh -docker skips host kernel headers; jq
# is the only extra package amdxdna_deps.sh would add)
RUN cd /ryzers/xdna-driver && \
apt-get update && \
./amdxdna_deps.sh -docker
apt-get install -y jq && \
./xrt/src/runtime_src/tools/scripts/xrtdeps.sh -docker

# Build XRT
RUN cd /ryzers/xdna-driver/xrt/build/ && \
./build.sh -npu -opt -noctest

# Build XDNA driver (-release also generates the .deb package)
# Build the XDNA userspace (-release generates the xrt_plugin .deb); -nokmod
# skips the kernel module, which is built and loaded on the host (see README)
RUN cd /ryzers/xdna-driver/build && \
./build.sh -release
./build.sh -release -nokmod

# Finally, save and install the XRT/XDNA debian packages
# these will also need to be installed on the host system
Expand Down
15 changes: 15 additions & 0 deletions packages/npu/xdna/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,19 @@ Validation completed

---

## Supported silicon

What differs per platform is the NPU generation (used by IRON) and the iGPU ISA (relevant only if you must set `HSA_OVERRIDE_GFX_VERSION` on an older ROCm stack). On ROCm 7.2.2 the iGPUs are detected natively, so the override is left unset by default (see [config.yaml](config.yaml)).

| Silicon | NPU gen | iGPU ISA | `HSA_OVERRIDE_GFX_VERSION` (only if needed) |
| --- | --- | --- | --- |
| Phoenix / Hawk Point | `npu1` | gfx1103 | `11.0.0` |
| Strix Point | `npu2` | gfx1150 | `11.5.0` |
| Strix Halo | `npu2` | gfx1151 | `11.5.1` |
| Krackan Point | `npu2` | gfx1152 | `11.5.2` |

The NPU generation is auto-detected from `xrt-smi examine` output by AIE architecture (`aie2` -> `npu1`, `aie2p` -> `npu2`; the marketing names `Phoenix`/`Hawk` and `Strix`/`Krackan` are also matched as a fallback), see [../iron/setup.sh](../iron/setup.sh). Newer `xrt-smi` (XRT >= 2.20, shipped with ROCm 7.2.x) reports a generic device name, so the architecture string is the stable signal. To force a GPU override on an older ROCm release, add it back to `config.yaml` (`environment_variables`) or pass it at runtime.

---

For further details, refer to the official [xdna-driver](https://github.com/amd/xdna-driver) repository.
4 changes: 2 additions & 2 deletions packages/npu/xdna/config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright(C) 2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

environment_variables:
- "HSA_OVERRIDE_GFX_VERSION=11.0.0" # Required for HIP to write kernels
# HSA_OVERRIDE_GFX_VERSION is not set: ROCm 7.2.2 detects the iGPUs natively.
# On older ROCm, set it per silicon (see README "Supported silicon").

docker_extra_run_flags:
- "--device=/dev/accel/accel0:/dev/accel/accel0"
Expand Down