Skip to content

Commit

Permalink
Merge branch 'main' into makslevental/windows-e2e
Browse files Browse the repository at this point in the history
# Conflicts:
#	build_tools/ci/build_test_cpp.sh
  • Loading branch information
makslevental committed Aug 26, 2024
2 parents b517d8a + 9ab9ea0 commit 600781c
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 46 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI MacOS

on:
workflow_call:
workflow_dispatch:
pull_request:
merge_group:
push:
branches:
- main

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit).
group: ci-build-test-cpp-macos-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
build_and_ctest:
name: Build and Test (${{ matrix.runs-on }}, ASSERTIONS)
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [macos-12, macos-14]
env:
CACHE_DIR: ${{ github.workspace }}/.container-cache
steps:
- name: Set unified TZ
uses: szenius/set-timezone@v2.0
with:
# this is an arbitrary choice
timezoneLinux: "Asia/Singapore"
timezoneMacos: "Asia/Singapore"
timezoneWindows: "Singapore Standard Time"

- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
submodules: recursive

- uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install deps
run: |
brew install ccache ninja
- name: Sync source deps
run: |
python ./sync_deps.py
- name: Python deps
run: |
pip install "numpy<2" pyyaml "pybind11[global]==2.10.3" nanobind
- name: Enable cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHE_DIR }}
# without datetime stamps you'll get collisions for the cache warming runs
# ("Failed to save: Unable to reserve cache with key ..., another job may be creating this cache.")
key: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.sha }}-${{ github.event.repository.updated_at }}
restore-keys: ${{ matrix.runs-on }}-build-test-cpp-

- name: Build packages
run: |
export cache_dir="${{ env.CACHE_DIR }}"
bash build_tools/ci/build_test_cpp.sh
- name: Create artifacts
if: ${{ !cancelled() }}
run: |
rm -f iree-install/bin/clang*
rm -f iree-install/bin/llvm-link*
tar cf iree-dist-${{ matrix.runs-on }}.tar -C iree-install . -C ../iree-build tools/testing/e2e/iree-e2e-matmul-test
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: ${{ matrix.runs-on }}_release_packages
path: iree-dist-${{ matrix.runs-on }}.tar
if-no-files-found: warn

- name: Save cache
uses: actions/cache/save@v3
if: ${{ !cancelled() }}
with:
path: ${{ env.CACHE_DIR }}
key: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.sha }}-${{ github.event.repository.updated_at }}
17 changes: 13 additions & 4 deletions build_tools/ci/build_test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ echo '{
}' > $iree_dir/CMakeUserPresets.json

cd $iree_dir
cmake -S "$iree_dir" -B "$build_dir" \
CMAKE_ARGS="\
-S $iree_dir \
-B $build_dir \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$install_dir" \
-DCMAKE_INSTALL_PREFIX=$install_dir \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
Expand All @@ -84,8 +86,13 @@ cmake -S "$iree_dir" -B "$build_dir" \
-DIREE_INPUT_STABLEHLO=OFF \
-DIREE_INPUT_TORCH=OFF \
-DCMAKE_OBJECT_PATH_MAX=4096 \
-DIREE_CMAKE_PLUGIN_PATHS=../iree-amd-aie \
-DIREE_EXTERNAL_HAL_DRIVERS=xrt
-DIREE_CMAKE_PLUGIN_PATHS=$PWD/../iree-amd-aie"

if [[ "$OSTYPE" != "darwin"* ]]; then
CMAKE_ARGS="$CMAKE_ARGS -DIREE_EXTERNAL_HAL_DRIVERS=xrt"
fi

cmake $CMAKE_ARGS

echo "Building all"
echo "------------"
Expand All @@ -100,6 +107,8 @@ echo "CTest"
echo "-----"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
ctest --test-dir "$build_dir" -R amd-aie --output-on-failure -j
elif [[ "$OSTYPE" == "darwin"* ]]; then
ctest --test-dir "$build_dir" -R amd-aie -E "pack_peel_pipeline_matmul|conv_fill_spec_pad" --output-on-failure -j --repeat until-pass:5
elif [[ "$OSTYPE" == "msys"* ]]; then
# hack while windows is flaky to get past failing tests
ctest --test-dir "$build_dir" -R amd-aie --output-on-failure -j --repeat until-pass:5
Expand Down
1 change: 1 addition & 0 deletions compiler/plugins/target/AMD-AIE/aievec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ iree_cc_library(
::AIEVecOpsGen
::AIEVecDialectGen
::AIEVecAttrsGen
::AIEVecXLLVMOpsGen
MLIRIR
)

Expand Down
62 changes: 33 additions & 29 deletions compiler/plugins/target/AMD-AIE/air/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@ iree_cc_library(
# AIR Dialect
###############################################################################

iree_cc_library(
NAME
AIRDialectIR
SRCS
${IREE_MLIR_AIR_SOURCE_DIR}/lib/Dialect/AIR/IR/AIRDialect.cpp
DEPS
::defs
::AIRDialectGen
::AIRInterfaceGen
::AIRTransformOpsGen
MLIRIR
)

iree_tablegen_library(
NAME
AIRDialectGen
Expand All @@ -60,6 +47,26 @@ iree_tablegen_library(
-gen-op-interface-defs Dialect/AIR/AIROpInterfaces.cpp.inc
)


iree_tablegen_library(
NAME
AIRConversionPassesIncGen
TD_FILE
"${IREE_MLIR_AIR_SOURCE_DIR}/include/air/Conversion/Passes.td"
OUTS
-gen-pass-decls Conversion/Passes.h.inc
)

iree_tablegen_library(
NAME
AIRTransformOpsGen
TD_FILE
"${IREE_MLIR_AIR_SOURCE_DIR}/include/air/Dialect/AIR/AIRTransformOps.td"
OUTS
-gen-op-decls Dialect/AIR/AIRTransformOps.h.inc
-gen-op-defs Dialect/AIR/AIRTransformOps.cpp.inc
)

iree_cc_library(
NAME
AIRTransformOps
Expand All @@ -70,19 +77,24 @@ iree_cc_library(
::AIRDialectIR
::AIRTransformOpsGen
::AIRTransformPasses
::AIRConversionPassesIncGen
iree::target::amd-aie::aie::AIEDialectIR
MLIRIR
MLIRLinalgTransformOps
)

iree_tablegen_library(
iree_cc_library(
NAME
AIRTransformOpsGen
TD_FILE
"${IREE_MLIR_AIR_SOURCE_DIR}/include/air/Dialect/AIR/AIRTransformOps.td"
OUTS
-gen-op-decls Dialect/AIR/AIRTransformOps.h.inc
-gen-op-defs Dialect/AIR/AIRTransformOps.cpp.inc
AIRDialectIR
SRCS
${IREE_MLIR_AIR_SOURCE_DIR}/lib/Dialect/AIR/IR/AIRDialect.cpp
DEPS
::defs
::AIRDialectGen
::AIRInterfaceGen
::AIRTransformOpsGen
::AIRConversionPassesIncGen
MLIRIR
)

###############################################################################
Expand Down Expand Up @@ -121,15 +133,6 @@ iree_tablegen_library(
# AIR Conversion Passes
###############################################################################

iree_tablegen_library(
NAME
AIRConversionPassesIncGen
TD_FILE
"${IREE_MLIR_AIR_SOURCE_DIR}/include/air/Conversion/Passes.td"
OUTS
-gen-pass-decls Conversion/Passes.h.inc
)

iree_cc_library(
NAME
AIRConversionPassHeaders
Expand Down Expand Up @@ -164,6 +167,7 @@ iree_cc_library(
MLIRTransforms
)

include(iree_aie_utils)
replace_string_in_file(
${IREE_MLIR_AIR_SOURCE_DIR}/include/air/Conversion/PassDetail.h
"aie/Dialect/AIEX/IR" "aie")
Expand Down
2 changes: 1 addition & 1 deletion iree_compiler_plugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ endif()

if(IREE_AMD_AIE_ENABLE_XRT_DRIVER)
include(iree_aie_xrt)
include(iree_aie_bootgen)
endif()
include(iree_aie_bootgen)

add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/compiler/plugins/target/AMD-AIE target/AMD-AIE)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/tests/samples AMD-AIE/tests/samples)
Expand Down
16 changes: 8 additions & 8 deletions runtime/src/iree-amd-aie/aie_runtime/iree_aie_configure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ LogicalResult configureDMABD(
if (deviceModel.isShimNOCTile(tileLoc.col, tileLoc.row)) {
// TODO(max): revisit these values
// write them out like this so they show up with names in debug prints
size_t smid = 0;
size_t burstLen = 16; // (10):BLEN=16 (256Byte) (corresponds to
// 0x800000000 from target)
size_t qOs = 0;
size_t cache = 0;
size_t secure = 0;
uint8_t smid = 0;
uint8_t burstLen = 16; // (10):BLEN=16 (256Byte) (corresponds to
// 0x800000000 from target)
uint8_t qOs = 0;
uint8_t cache = 0;
uint8_t secure = 0;
TRY_XAIE_API_LOGICAL_RESULT(XAie_DmaSetAxi, &dmaDesc, smid, burstLen, qOs,
cache, secure);
}
Expand Down Expand Up @@ -351,8 +351,8 @@ LogicalResult coreEnable(const AMDAIEDeviceModel &deviceModel,
return success();
}

void dmaUpdateBdAddr(const AMDAIEDeviceModel &deviceModel, int col, int row,
size_t addr, size_t bdId) {
void dmaUpdateBdAddr(const AMDAIEDeviceModel &deviceModel, uint8_t col,
uint8_t row, uint8_t addr, uint8_t bdId) {
auto tileLoc = XAie_TileLoc(col, row);
auto devInst = const_cast<XAie_DevInst *>(&deviceModel.devInst);
TRY_XAIE_API_FATAL_ERROR(XAie_DmaUpdateBdAddr, devInst, tileLoc, addr, bdId);
Expand Down
20 changes: 16 additions & 4 deletions runtime/src/iree-amd-aie/aie_runtime/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ iree_cc_test(
NAME
test_0335_aie_dma_tile_dma_packet_switch_mode
SRCS
test_packet_switch_mode.cc
test_packet_switch_mode.cc
COPTS
$<$<PLATFORM_ID:Linux>:-Wno-format>
$<$<PLATFORM_ID:Darwin>:-Wno-format>
$<$<PLATFORM_ID:Windows>:/wd4777>
DEPS
iree-amd-aie::aie_runtime::iree_aie_runtime_static
)
Expand All @@ -44,7 +48,7 @@ iree_lit_test(
NAME
test_0335_aie_dma_tile_dma_packet_switch_mode_lit_test
TEST_FILE
test_packet_switch_mode.cc
test_packet_switch_mode.cc
TOOLS
::test_0335_aie_dma_tile_dma_packet_switch_mode
FileCheck
Expand All @@ -56,7 +60,11 @@ iree_cc_test(
NAME
test_1114_aie_stream_switch_packet_switch_control_packets
SRCS
test_control_packets.cc
test_control_packets.cc
COPTS
$<$<PLATFORM_ID:Linux>:-Wno-format>
$<$<PLATFORM_ID:Darwin>:-Wno-format>
$<$<PLATFORM_ID:Windows>:/wd4777>
DEPS
iree-amd-aie::aie_runtime::iree_aie_runtime_static
)
Expand All @@ -65,7 +73,7 @@ iree_lit_test(
NAME
test_1114_aie_stream_switch_packet_switch_control_packets_lit_test
TEST_FILE
test_control_packets.cc
test_control_packets.cc
TOOLS
::test_1114_aie_stream_switch_packet_switch_control_packets
FileCheck
Expand All @@ -78,6 +86,10 @@ iree_cc_test(
test_transaction
SRCS
test_transaction.cc
COPTS
$<$<PLATFORM_ID:Linux>:-Wno-format>
$<$<PLATFORM_ID:Darwin>:-Wno-format>
$<$<PLATFORM_ID:Windows>:/wd4777>
DEPS
iree-amd-aie::aie_runtime::iree_aie_runtime_static
)
Expand Down

0 comments on commit 600781c

Please sign in to comment.