Skip to content

Commit

Permalink
Fixing build-mlir-air.sh to point to hsa.h and adding some clarificat…
Browse files Browse the repository at this point in the history
…ions to the documentation (#377)
  • Loading branch information
eddierichter-amd authored Jan 8, 2024
1 parent 763c580 commit 4237857
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
10 changes: 6 additions & 4 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,20 @@ Next, clone and build MLIR-AIE with paths to llvm, aienginev2, and cmakeModules
./utils/build-mlir-aie-local.sh llvm mlir-aie/cmake/modulesXilinx /opt/xaiengine mlir-aie
```

Use the following command to build the AIR tools to compile on x86 for PCIe cards (VCK5000). Make sure that ${ROCM\_ROOT} is pointing to your local ROCm install:
Next, we must install our experimental ROCm runtime (ROCr) which allows us to communicate with the AIEs. The [ROCm-air-platforms](https://github.com/Xilinx/ROCm-air-platforms) repository contains documentation on how to install ROCr. Run the following script to clone the ROCm-air-platforms repository:

```
./utils/build-mlir-air-pcie.sh llvm/ mlir-aie/cmake/modulesXilinx/ mlir-aie/ /opt/xaiengine ${ROCM_ROOT}/lib/cmake/hsa-runtime64/ ${ROCM_ROOT}/lib/cmake/hsakmt/
./utils/clone-rocm-air-platforms.sh
```

The PCIe AIR runtime requires the use of the [AIR PCIe kernel driver](https://github.com/Xilinx/ROCm-air-platforms/tree/main/driver). The driver directory in the [ROCm-air-platforms](https://github.com/Xilinx/ROCm-air-platforms) repository contains documentation on how to compile and load the AIR PCIe kernel driver. Run the following script to clone the ROCm-air-platforms repository:
Use the following command to build the AIR tools to compile on x86 for PCIe cards (VCK5000). Make sure that ${ROCM\_ROOT} is pointing to your local ROCm install:

```
./utils/clone-rocm-air-platforms.sh
./utils/build-mlir-air-pcie.sh llvm/ mlir-aie/cmake/modulesXilinx/ mlir-aie/ /opt/xaiengine ${ROCM_ROOT}/lib/cmake/hsa-runtime64/ ${ROCM_ROOT}/lib/cmake/hsakmt/
```

The PCIe AIR runtime requires the use of the [AIR PCIe kernel driver](https://github.com/Xilinx/ROCm-air-platforms/tree/main/driver). The driver directory in the [ROCm-air-platforms](https://github.com/Xilinx/ROCm-air-platforms) repository contains documentation on how to compile and load the AIR PCIe kernel driver.

## Environment setup

Set up your environment to use the tools you just built with the following commands:
Expand Down
4 changes: 2 additions & 2 deletions utils/build-mlir-air-pcie.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ LibXAIE_DIR=`realpath $4`
HSA_DIR=`realpath $5`
HSAKMT_DIR=`realpath $6`

BUILD_DIR=${8:-"build-pcie"}
INSTALL_DIR=${9:-"install-pcie"}
BUILD_DIR=${7:-"build-pcie"}
INSTALL_DIR=${8:-"install-pcie"}

mkdir -p $BUILD_DIR
mkdir -p $INSTALL_DIR
Expand Down
10 changes: 8 additions & 2 deletions utils/build-mlir-air.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
# <llvm dir> - llvm
# <cmakeModules dir> - cmakeModules
# <mlir-aie dir> - mlir-aie
# <HSA dir> - HSA to build runtime
# <HSA kmt dir> - HSA to build runtime
#
# <build dir> - optional, build dir name, default is 'build'
# <install dir> - optional, install dir name, default is 'install'
Expand All @@ -38,9 +40,11 @@ SYSROOT_DIR=`realpath $1`
LLVM_DIR=`realpath $2`
CMAKEMODULES_DIR=`realpath $3`
MLIR_AIE_DIR=`realpath $4`
HSA_DIR=`realpath $5`
HSAKMT_DIR=`realpath $6`

BUILD_DIR=${5:-"build"}
INSTALL_DIR=${6:-"install"}
BUILD_DIR=${7:-"build"}
INSTALL_DIR=$86:-"install"}

mkdir -p $BUILD_DIR
mkdir -p $INSTALL_DIR
Expand All @@ -60,6 +64,8 @@ cmake .. \
-DLLVM_DIR=${LLVM_DIR}/build/lib/cmake/llvm \
-DMLIR_DIR=${LLVM_DIR}/build/lib/cmake/mlir \
-DAIE_DIR=${MLIR_AIE_DIR}/build/lib/cmake/aie \
-Dhsa-runtime64_DIR=${HSA_DIR} \
-Dhsakmt_DIR=${HSAKMT_DIR} \
-Dpybind11_DIR=${PYTHON_ROOT}/pybind11/share/cmake/pybind11 \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_USE_LINKER=lld \
Expand Down

0 comments on commit 4237857

Please sign in to comment.