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

Enable initial executable linking + mlir-air bump #395

Merged
merged 14 commits into from
Jun 8, 2024
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,3 @@ jobs:
run: |
source .venv/bin/activate
bash build_tools/ci/print_ir_aie2xclbin/print_ir_aie2xclbin.sh iree-install/bin print_ir_aie2xclbin_results

- name: Clean up
if: ${{ always() }}
run: |
for kern in /lib/firmware/amdnpu/1502/github.${GITHUB_RUN_ID}.${GITHUB_RUN_ATTEMPT}.*; do sudo /opt/xilinx/xrt/amdxdna/rm_xclbin.sh "$kern"; done
51 changes: 5 additions & 46 deletions build_tools/ci/cpu_comparison/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@

set -euox pipefail

if [ "$#" -lt 2 ] || [ "$#" -gt 7 ]; then
if [ "$#" -lt 2 ] || [ "$#" -gt 6 ]; then

echo -e "Illegal number of parameters: $#, expected 2-7 parameters." \
echo -e "Illegal number of parameters: $#, expected 2-6 parameters." \
"\n The parameters are as follows:" \
"\n 1) <output-dir> (required)" \
"\n 2) <iree-install-dir> (required)" \
"\n 3) <mlir-aie-install-dir> (optional)" \
"\n 4) <peano-install-dir> (optional)" \
"\n 5) <xrt-dir> (optional)" \
"\n 6) <vitis-install-dir> (optional)" \
"\n 7) <do-signing> (optional)" \
"\n Example, dependent on environment variables:" \
"\n ./run_test.sh " \
"results_dir_tmp \$IREE_INSTALL_DIR \$MLIR_AIE_INSTALL_DIR " \
"\$PEANO_INSTALL_DIR /opt/xilinx/xrt \$VITIS_INSTALL_PATH 0"
"\$PEANO_INSTALL_DIR /opt/xilinx/xrt \$VITIS_INSTALL_PATH"
exit 1
fi

Expand Down Expand Up @@ -104,13 +103,6 @@ if [ ! -d "${VITIS}" ]; then
exit 1
fi

# Parameter 7) <do-signing>
if [ -z "${7-}" ]; then
DO_SIGNING=1
else
DO_SIGNING=$7
fi

THIS_DIR="$(cd $(dirname $0) && pwd)"
ROOT_DIR="$(cd $THIS_DIR/../.. && pwd)"

Expand All @@ -130,6 +122,8 @@ fi


source $XRT_DIR/setup.sh
# Circumvent xclbin security (no longer needed as of April 2024 XDNA driver)
nirvedhmeshram marked this conversation as resolved.
Show resolved Hide resolved
export XRT_HACK_UNSECURE_LOADING_XCLBIN=1

cd ${OUTPUT_DIR}

Expand Down Expand Up @@ -229,41 +223,6 @@ function run_test() {
# Extract function names from the mlir file
function_names=$(grep -oP '@\K\S+(?=\()' ${test_file})


# Behavior of <do-signing> depends on if the script for
# signing xclbins is found:
#
# do-signing | setup_xclbin_firmware.sh found | Behavior
# -------------- | ------------------------------- | -------------
# 1 | yes | Sign XCLBIN
# 1 | no | Error
# 0 | no/yes | Skip signing
# -------------- | ------------------------------- | -------------

if [ $DO_SIGNING -eq 0 ]; then
echo "**** Skipping XCLBIN signing: DO_SIGNING set to 0 ****"
else
# Informed guess where the signing script is.TODO: make this a script param.
SIGNER=${XRT_DIR}/amdxdna/setup_xclbin_firmware.sh
if [ ! -f "$SIGNER" ]; then
echo "**** With DO_SIGNING=1, the script for signing xclbins was not found at $SIGNER ****"
exit 1
fi
# Iterate over each function name and sign the corresponding XCLBIN
for func_name in $function_names; do
# Location of XCLBIN files
XCLBIN_DIR="module_${func_name}_dispatch_0_amdaie_xclbin_fb"
# Define the XCLBIN variable
XCLBIN="module_${func_name}_dispatch_0_amdaie_xclbin_fb.xclbin"
# Ensure unique file name
echo "**** Getting unique id for XCLBIN ****"
XCLBIN_UNIQ="github.${GITHUB_RUN_ID}.${GITHUB_RUN_ATTEMPT}.${XCLBIN}"
cp "${XCLBIN_DIR}/${XCLBIN}" "${XCLBIN_DIR}/${XCLBIN_UNIQ}"
# Deploy firmware
sudo $SIGNER -dev Phoenix -xclbin "${XCLBIN_DIR}/${XCLBIN_UNIQ}"
done
fi

# Running 'python3 ${INPUT_GENERATOR} ${test_file} ${OUTPUT_DIR}' does 2 things.
# 1) it creates binary files with the data that will be consumed as inputs
# by iree-run-module
Expand Down
13 changes: 0 additions & 13 deletions build_tools/ci/rm_xclbin.sh

This file was deleted.

54 changes: 5 additions & 49 deletions build_tools/ci/run_matmul_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

set -euox pipefail

if [ "$#" -lt 2 ] || [ "$#" -gt 7 ]; then
if [ "$#" -lt 2 ] || [ "$#" -gt 6 ]; then

# The expected parameters are
# 1) <output-dir> (required)
Expand All @@ -32,20 +32,18 @@ if [ "$#" -lt 2 ] || [ "$#" -gt 7 ]; then
# 4) <peano-install-dir> (optional)
# 5) <xrt-dir> (optional)
# 6) <vitis-install-dir> (optional)
# 7) <do-signing> (optional)
echo -e "Illegal number of parameters: $#, expected 2-7 parameters." \
echo -e "Illegal number of parameters: $#, expected 2-6 parameters." \
"\n The parameters are as follows:" \
"\n 1) <output-dir> (required)" \
"\n 2) <iree-install-dir> (required)" \
"\n 3) <mlir-aie-install-dir> (optional)" \
"\n 4) <peano-install-dir> (optional)" \
"\n 5) <xrt-dir> (optional)" \
"\n 6) <vitis-install-dir> (optional)" \
"\n 7) <do-signing> (optional)" \
"\n Example, dependent on environment variables:" \
"\n ./run_matmul_test.sh " \
"results_dir_tmp \$IREE_INSTALL_DIR \$MLIR_AIE_INSTALL_DIR " \
"\$PEANO_INSTALL_DIR /opt/xilinx/xrt \$VITIS_INSTALL_PATH 0"
"\$PEANO_INSTALL_DIR /opt/xilinx/xrt \$VITIS_INSTALL_PATH"
exit 1
fi

Expand Down Expand Up @@ -133,13 +131,6 @@ if [ ! -d "${VITIS}" ]; then
exit 1
fi

# Parameter 7) <do-signing>
if [ -z "${7-}" ]; then
DO_SIGNING=1
else
DO_SIGNING=$7
fi

THIS_DIR="$(cd $(dirname $0) && pwd)"
ROOT_DIR="$(cd $THIS_DIR/../.. && pwd)"

Expand All @@ -159,6 +150,8 @@ else
fi

source $XRT_DIR/setup.sh
# Circumvent xclbin security (no longer needed as of April 2024 XDNA driver)
export XRT_HACK_UNSECURE_LOADING_XCLBIN=1

cd ${OUTPUT_DIR}

Expand Down Expand Up @@ -437,46 +430,9 @@ function run_matmul_test() {
--iree-hal-target-backends=${target_backend} \
-o "${calls_vmfb}"

# Extract function names from the mlir file
function_names=$(grep -oP '@\K\S+(?=\()' ${matmul_ir})

compiled_time=$(date +%s%3N)


# Behavior of <do-signing> depends on if the script for
# signing xclbins is found:
#
# do-signing | setup_xclbin_firmware.sh found | Behavior
# -------------- | ------------------------------- | -------------
# 1 | yes | Sign XCLBIN
# 1 | no | Error
# 0 | no/yes | Skip signing
# -------------- | ------------------------------- | -------------

if [ $DO_SIGNING -eq 0 ]; then
echo "**** Skipping XCLBIN signing: DO_SIGNING set to 0 ****"
else
# Informed guess where the signing script is.TODO: make this a script param.
SIGNER=${XRT_DIR}/amdxdna/setup_xclbin_firmware.sh
if [ ! -f "$SIGNER" ]; then
echo "**** With DO_SIGNING=1, the script for signing xclbins was not found at $SIGNER ****"
exit 1
fi
# Iterate over each function name and sign the corresponding XCLBIN
for func_name in $function_names; do
# Location of XCLBIN files
XCLBIN_DIR="module_${func_name}_dispatch_0_amdaie_xclbin_fb"
# Define the XCLBIN variable
XCLBIN="module_${func_name}_dispatch_0_amdaie_xclbin_fb.xclbin"
# Ensure unique file name
echo "**** Getting unique id for XCLBIN ****"
XCLBIN_UNIQ="github.${GITHUB_RUN_ID}.${GITHUB_RUN_ATTEMPT}.${XCLBIN}"
cp "${XCLBIN_DIR}/${XCLBIN}" "${XCLBIN_DIR}/${XCLBIN_UNIQ}"
# Deploy firmware
sudo $SIGNER -dev Phoenix -xclbin "${XCLBIN_DIR}/${XCLBIN_UNIQ}"
done
fi

echo "**** Running '${name}' matmul tests ****"

COMMAND="${TEST_RUNNER} \
Expand Down
Loading
Loading