diff --git a/.github/workflows/ci-win.yml b/.github/workflows/ci-win.yml new file mode 100644 index 000000000..56e9b94bc --- /dev/null +++ b/.github/workflows/ci-win.yml @@ -0,0 +1,103 @@ +name: CI Windows + +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-windows-${{ github.event.number || github.sha }} + cancel-in-progress: true + +defaults: + run: + # force bash for windows + shell: bash + +jobs: + build_test_windows: + name: Build and Test (Windows, ASSERTIONS) + runs-on: windows-2019 + strategy: + fail-fast: true + env: + CACHE_DIR: ${{ github.workspace }}/.container-cache + steps: + - name: "Checking out repository" + uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + with: + submodules: recursive + + - name: Setup Cpp + uses: aminya/setup-cpp@v1 + with: + compiler: msvc + vcvarsall: true + cmake: true + ninja: true + cppcheck: false + clangtidy: false + clangformat: false + + - name: Install boost + uses: MarkusJx/install-boost@v2.4.5 + id: install-boost + with: + boost_install_dir: ${{ github.workspace }} + boost_version: 1.78.0 + platform_version: 2019 + toolset: msvc + + - name: Sync source deps + run: | + pip install numpy pyyaml + python ./sync_deps.py + + - name: Enable cache + uses: actions/cache/restore@v3 + with: + path: "${{ github.workspace }}/.ccache" + key: windows-build-test-cpp-asserts-v1-${{ github.sha }} + restore-keys: | + windows-build-test-cpp- + + - name: Build packages + run: | + export cache_dir="${{ github.workspace }}/.ccache" + # switch to linux paths instead of windows paths + # also make into abs path + export BOOST_ROOT="/$(echo "${{ steps.install-boost.outputs.BOOST_ROOT }}" | sed -e 's/\\/\//g' -e 's/://')" + bash build_tools/ci/build_test_cpp_windows.sh + + - name: Create artifacts + if: ${{ !cancelled() }} + run: | + # TODO: https://github.com/openxla/iree/issues/16230 + # We should not be packaging clang and llvm-link in the default dist + # installs. + rm -f iree-install/bin/clang* + rm -f iree-install/bin/llvm-link* + tar cf iree-dist.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: windows_x86_64_release_packages + path: | + iree-dist-win64.tar + if-no-files-found: warn + + - name: Save cache + uses: actions/cache/save@v3 + if: ${{ !cancelled() }} + with: + path: ${{ env.CACHE_DIR }} + key: windows-build-test-cpp-asserts-v1-${{ github.sha }} diff --git a/build_tools/ci/build_test_cpp_windows.sh b/build_tools/ci/build_test_cpp_windows.sh new file mode 100644 index 000000000..99ed2d2a9 --- /dev/null +++ b/build_tools/ci/build_test_cpp_windows.sh @@ -0,0 +1,102 @@ +#!/bin/bash + +set -eu -o errtrace + +this_dir="$(cd $(dirname $0) && pwd)" +repo_root="$(cd $this_dir/../.. && pwd)" +iree_dir="$(cd $repo_root/../iree && pwd)" +build_dir="$repo_root/iree-build" +install_dir="$repo_root/iree-install" +mkdir -p "$build_dir" +build_dir="$(cd $build_dir && pwd)" +cache_dir="${cache_dir:-}" + +# Setup cache dir. +if [ -z "${cache_dir}" ]; then + cache_dir="${repo_root}/.build-cache" + mkdir -p "${cache_dir}" + cache_dir="$(cd ${cache_dir} && pwd)" +fi +echo "Caching to ${cache_dir}" +mkdir -p "${cache_dir}/ccache" +mkdir -p "${cache_dir}/pip" + +python="$(which python)" +echo "Using python: $python" + +#export CCACHE_DIR="${cache_dir}/ccache" +#export CCACHE_MAXSIZE="700M" +#export CMAKE_C_COMPILER_LAUNCHER=ccache +#export CMAKE_CXX_COMPILER_LAUNCHER=ccache +# +## Clear ccache stats. +#ccache -z +# +## Build XRT. +#XRT_BUILD_DIR=$repo_root/xrt-build +#XRT_INSTALL_DIR=$repo_root/xrt-install +#$this_dir/build_xrt.sh $XRT_BUILD_DIR $XRT_INSTALL_DIR + +echo "Building IREE" +echo "=============" +echo '{ + "version": 4, + "cmakeMinimumRequired": { + "major": 3, + "minor": 23, + "patch": 0 + }, + "include": [ + "build_tools/cmake/presets/all.json" + ] +}' > $iree_dir/CMakeUserPresets.json + +cd $iree_dir + +pip download -q mlir -f https://makslevental.github.io/wheels +unzip -q mlir*whl +python3 -m pip install "numpy<2" pyyaml "pybind11[global]" nanobind + +cmake -S "$iree_dir" -B "$build_dir" \ + -GNinja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$install_dir" \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DIREE_ENABLE_ASSERTIONS=ON \ + -DIREE_BUILD_SAMPLES=OFF \ + -DIREE_BUILD_PYTHON_BINDINGS=OFF \ + -DIREE_BUILD_BINDINGS_TFLITE=OFF \ + -DIREE_HAL_DRIVER_DEFAULTS=OFF \ + -DIREE_HAL_DRIVER_LOCAL_SYNC=ON \ + -DIREE_HAL_DRIVER_LOCAL_TASK=ON \ + -DIREE_TARGET_BACKEND_DEFAULTS=OFF \ + -DIREE_TARGET_BACKEND_LLVM_CPU=ON \ + -DIREE_INPUT_TOSA=OFF \ + -DIREE_INPUT_STABLEHLO=OFF \ + -DIREE_INPUT_TORCH=OFF \ + -DIREE_CMAKE_PLUGIN_PATHS=../iree-amd-aie \ + -DCMAKE_OBJECT_PATH_MAX=4096 \ + -DBoost_INCLUDE_DIR=${BOOST_ROOT}/include\ + -DBoost_LIBRARY_DIRS=${BOOST_ROOT}/lib \ + -DIREE_ERROR_ON_MISSING_SUBMODULES=OFF \ + -DIREE_BUILD_BUNDLED_LLVM=OFF \ + -DCMAKE_PREFIX_PATH=$PWD/mlir \ + -DPython3_EXECUTABLE=$(which python3) +# -DIREE_EXTERNAL_HAL_DRIVERS=xrt \ +# -DXRT_DIR=$XRT_INSTALL_DIR/opt/xilinx/xrt/share/cmake/XRT + +echo "Building all" +echo "------------" +cmake --build "$build_dir" -- -k 0 + +echo "Installing" +echo "----------" +echo "Install to: $install_dir" +cmake --build "$build_dir" --target iree-install-dist + +echo "CTest" +echo "-----" +ctest --test-dir "$build_dir" -R amd-aie --output-on-failure -j + +# Show ccache stats. +#ccache --show-stats diff --git a/build_tools/remove_path_limit.ps1 b/build_tools/remove_path_limit.ps1 new file mode 100644 index 000000000..89dc34e70 --- /dev/null +++ b/build_tools/remove_path_limit.ps1 @@ -0,0 +1,5 @@ +# https://stackoverflow.com/a/68353105 +# Cannot open compiler generated file: '': Invalid argument +# -DCMAKE_OBJECT_PATH_MAX=4096 +# The registry value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (see below for the list of functions). The registry value will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value, a reboot might be required because some processes may have started before the key was set. +New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force \ No newline at end of file diff --git a/compiler/plugins/target/AMD-AIE/air/CMakeLists.txt b/compiler/plugins/target/AMD-AIE/air/CMakeLists.txt index 61659076d..d6d066169 100644 --- a/compiler/plugins/target/AMD-AIE/air/CMakeLists.txt +++ b/compiler/plugins/target/AMD-AIE/air/CMakeLists.txt @@ -4,7 +4,6 @@ # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -set(IREE_PACKAGE_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}") set(IREE_PACKAGE_ROOT_PREFIX "iree::target::amd-aie::air") list(APPEND IREE_COMPILER_TABLEGEN_INCLUDE_DIRS diff --git a/compiler/plugins/target/AMD-AIE/iree-amd-aie/CMakeLists.txt b/compiler/plugins/target/AMD-AIE/iree-amd-aie/CMakeLists.txt index f08adef4e..f1cae2c5e 100644 --- a/compiler/plugins/target/AMD-AIE/iree-amd-aie/CMakeLists.txt +++ b/compiler/plugins/target/AMD-AIE/iree-amd-aie/CMakeLists.txt @@ -20,9 +20,9 @@ iree_cc_library( iree::target::amd-aie::Transforms iree::target::amd-aie::aie::AIEDialectIR iree::target::amd-aie::aie::AIEXDialectIR - iree::target::amd-aie::air::AIRDialectIR + iree_target_amd-aie_air_AIRDialectIR iree::target::amd-aie::aie::AIEPasses - iree::target::amd-aie::air::AIRPasses + iree_target_amd-aie_air_AIRPasses iree::base::core_headers iree::base::internal::flatcc::building iree-amd-aie::schemas::xrt_executable_def_c_fbs diff --git a/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/CMakeLists.txt b/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/CMakeLists.txt index c761b2208..d83029862 100644 --- a/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/CMakeLists.txt +++ b/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/CMakeLists.txt @@ -47,7 +47,7 @@ iree_cc_library( iree::compiler::Dialect::HAL::Target iree::target::amd-aie::IR::AMDAIEDialect iree::target::amd-aie::Transforms - iree::target::amd-aie::air::AIRDialectIR + iree_target_amd-aie_air_AIRDialectIR MLIRLLVMDialect PUBLIC ) diff --git a/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp b/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp index a9bf83a60..72739a557 100644 --- a/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp +++ b/compiler/plugins/target/AMD-AIE/iree-amd-aie/Target/XCLBinGen.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -33,9 +34,7 @@ #define DEBUG_TYPE "amdaie-xclbingen" #ifdef _WIN32 -#include "windows.h" // For UUID stuff -#include "rpcdce.h" #else #include #endif @@ -166,17 +165,17 @@ static FailureOr findAMDAIETool(std::string toolName, Path toolBinExe = ""; if (!amdAIEInstallDir.empty()) { toolBinExe = amdAIEInstallDir / toolName; - if (llvm::sys::fs::exists(toolBinExe.native())) return toolBinExe; + if (std::filesystem::exists(toolBinExe)) return toolBinExe; toolBinExe = amdAIEInstallDir / "bin" / toolName; - if (llvm::sys::fs::exists(toolBinExe.native())) return toolBinExe; + if (std::filesystem::exists(toolBinExe)) return toolBinExe; toolBinExe = amdAIEInstallDir / "tools" / toolName; - if (llvm::sys::fs::exists(toolBinExe.native())) return toolBinExe; + if (std::filesystem::exists(toolBinExe)) return toolBinExe; } toolBinExe = mlir::iree_compiler::findTool(toolName); - if (llvm::sys::fs::exists(toolBinExe.native())) return toolBinExe; + if (std::filesystem::exists(toolBinExe)) return toolBinExe; llvm::errs() << "Could not find " << toolName << ". Check your --iree-amd-aie-install-dir flag"; @@ -222,7 +221,8 @@ std::pair> makeChessArgs(Path &vitisDir, "-I" + (aieToolsDir / "include").string()}; // disassemble output if (verbose) flags.emplace_back("-d"); - return {aieToolsDir / "bin" / "unwrapped" / "lnx64.o" / "xchesscc", flags}; + return {(aieToolsDir / "bin" / "unwrapped" / "lnx64.o" / "xchesscc").string(), + flags}; } std::vector makeChessEnv(Path &vitisDir) { @@ -259,19 +259,44 @@ std::optional dumpStrToDisk(const std::string &payload, return {}; } +namespace uuid { +static std::random_device rd; +static std::mt19937 gen(rd()); +static std::uniform_int_distribution<> dis(0, 15); +static std::uniform_int_distribution<> dis2(8, 11); + +std::string generate_uuid_v4() { + std::stringstream ss; + int i; + ss << std::hex; + for (i = 0; i < 8; i++) { + ss << dis(gen); + } + ss << "-"; + for (i = 0; i < 4; i++) { + ss << dis(gen); + } + ss << "-4"; + for (i = 0; i < 3; i++) { + ss << dis(gen); + } + ss << "-"; + ss << dis2(gen); + for (i = 0; i < 3; i++) { + ss << dis(gen); + } + ss << "-"; + for (i = 0; i < 12; i++) { + ss << dis(gen); + }; + return ss.str(); +} +} // namespace uuid + static std::string getUUIDString() { std::string val; #ifdef _WIN32 - UUID *uuid; - RPC_STATUS status; - status = UuidCreate(uuid); - if (status != RPC_S_OK) errs() << "Failed to create UUID\n"; - RPC_CSTR *uuidstring; - status = UuidToStringA(uuid, uuidstring); - if (status != RPC_S_OK) errs() << "Failed to convert UUID to string\n"; - val = std::string((char *)uuidstring); - status = RpcStringFreeA(uuidstring); - if (status != RPC_S_OK) errs() << "Failed to free UUID string\n"; + val = uuid::generate_uuid_v4(); #else uuid_t binuuid; uuid_generate_random(binuuid); @@ -440,7 +465,7 @@ static LogicalResult assembleFileUsingPeano( args.emplace_back("-o"); args.emplace_back(outputFile); if (verbose) args.emplace_back("-v"); - if (!runTool(peanoDir / "bin" / "clang", args, verbose)) { + if (!runTool((peanoDir / "bin" / "clang").string(), args, verbose)) { llvm::errs() << "Failed to assemble " << outputFile << ".o with peano"; return failure(); } @@ -457,9 +482,9 @@ static FailureOr assembleStringUsing( Path &outputDir, const std::vector &extraArgs, Path &workDir, Path &toolDir, bool verbose = false) { Path inputFile = workDir / inputFileName; - if (auto maybeErr = dumpStrToDisk(inputFileStr, inputFile); + if (auto maybeErr = dumpStrToDisk(inputFileStr, inputFile.string()); maybeErr.has_value()) { - llvm::errs() << "Failed to dump to disk " << inputFile + llvm::errs() << "Failed to dump to disk " << inputFile.string() << " because: " << maybeErr; return failure(); } @@ -470,8 +495,8 @@ static FailureOr assembleStringUsing( } else { outputFile = outputFileName; } - if (failed(assembler(inputFile, outputFile, extraArgs, workDir, toolDir, - verbose))) { + if (failed(assembler(inputFile.string(), outputFile.string(), extraArgs, + workDir, toolDir, verbose))) { llvm::errs() << "Failed to assemble " << outputFileName << ".o"; return failure(); } @@ -505,7 +530,7 @@ static LogicalResult generateCoreElfFiles( for (auto tileOp : tileOps) { int col = tileOp.getCol(); int row = tileOp.getRow(); - auto coreOp = getCoreOp(tileOp); + auto coreOp = AIE::getCoreOp(tileOp); if (!coreOp) continue; std::string elfFileName; @@ -587,9 +612,9 @@ static LogicalResult generateCoreElfFiles( chessArgs.emplace_back(mmObjectFilePath->string()); } chessArgs.emplace_back("+l"); - chessArgs.emplace_back(bcfPath); + chessArgs.emplace_back(bcfPath.string()); chessArgs.emplace_back("-o"); - chessArgs.emplace_back(elfFile); + chessArgs.emplace_back(elfFile.string()); std::vector env = makeChessEnv(*vitisDir); if (!runTool(xChessCCExe, chessArgs, verbose, env)) { llvm::errs() << "Failed to link with xbridge"; @@ -624,11 +649,11 @@ static LogicalResult generateCoreElfFiles( flags.emplace_back("-Wl,--gc-sections"); flags.emplace_back("-Wl,-T," + ldscriptPath.string()); flags.emplace_back("-o"); - flags.emplace_back(elfFile); + flags.emplace_back(elfFile.string()); if (verbose) flags.emplace_back("-v"); // we run clang (ie cc) so that libc, libm, crt0/1 paths are injected // automatically into the ld.lld invocation - if (!runTool(peanoDir / "bin" / "clang", flags, verbose)) { + if (!runTool((peanoDir / "bin" / "clang").string(), flags, verbose)) { llvm::errs() << "failed to link elf file for core(" << col << "," << row << ")"; return failure(); @@ -749,7 +774,8 @@ static LogicalResult generateXCLBin( ] } })"; - if (auto maybeErr = dumpStrToDisk(memTopologyData, memTopologyJsonFile); + if (auto maybeErr = + dumpStrToDisk(memTopologyData, memTopologyJsonFile.string()); maybeErr.has_value()) { llvm::errs() << "failed to dump to disk mem_topology.json because: " << *maybeErr; @@ -796,7 +822,7 @@ static LogicalResult generateXCLBin( } )"; if (auto maybeErr = - dumpStrToDisk(aiePartitionJsonData, aiePartitionJsonFile); + dumpStrToDisk(aiePartitionJsonData, aiePartitionJsonFile.string()); maybeErr.has_value()) { llvm::errs() << "failed to dump to disk aie_partition.json because: " << *maybeErr; @@ -815,7 +841,7 @@ static LogicalResult generateXCLBin( auto kernelStr = llvm::formatv("{0:2}", json::Value(std::move(kernelsData))); - if (auto maybeErr = dumpStrToDisk(kernelStr, kernelsJsonFile); + if (auto maybeErr = dumpStrToDisk(kernelStr, kernelsJsonFile.string()); maybeErr.has_value()) { llvm::errs() << "failed to dump to disk kernels.json because: " << *maybeErr; @@ -839,9 +865,12 @@ static LogicalResult generateXCLBin( << " {\n" << " name=aie_image, id=0x1c000000\n" << " { type=cdo\n" - << " file=" << tempDir << "/aie_cdo_elfs.bin\n" - << " file=" << tempDir << "/aie_cdo_init.bin\n" - << " file=" << tempDir << "/aie_cdo_enable.bin\n" + << " file=" << tempDir.string() + << "/aie_cdo_elfs.bin\n" + << " file=" << tempDir.string() + << "/aie_cdo_init.bin\n" + << " file=" << tempDir.string() + << "/aie_cdo_enable.bin\n" << " }\n" << " }\n" << "}"; @@ -851,15 +880,15 @@ static LogicalResult generateXCLBin( // Execute the bootgen command. { std::vector flags{"-arch", "versal", - "-image", designBifFile, - "-o", tempDir / "design.pdi", + "-image", designBifFile.string(), + "-o", (tempDir / "design.pdi").string(), "-w"}; FailureOr bootgenBin = findAMDAIETool("amdaie_bootgen", amdAIEInstallDir); if (!succeeded(bootgenBin) || - !runTool(bootgenBin.value(), flags, verbose)) { + !runTool(bootgenBin.value().string(), flags, verbose)) { llvm::errs() << "failed to execute bootgen"; return failure(); } @@ -881,7 +910,7 @@ static LogicalResult generateXCLBin( "--force", "--input", *inputXclbin}; if (!succeeded(xclbinutilBin) || - !runTool(xclbinutilBin.value(), inputFlags, verbose)) { + !runTool(xclbinutilBin.value().string(), inputFlags, verbose)) { llvm::errs() << "failed to execute xclbinutil"; return failure(); } @@ -918,7 +947,7 @@ static LogicalResult generateXCLBin( // rewrite aie partion json file if (auto maybeErr = dumpStrToDisk(formatv("{0:2}", *aieInputPartitionOutValue), - aiePartitionJsonFile); + aiePartitionJsonFile.string()); maybeErr.has_value()) { llvm::errs() << "failed to dump to disk aie_input_partition.json because: " @@ -929,12 +958,12 @@ static LogicalResult generateXCLBin( } else { flags.insert(flags.end(), {"--add-replace-section", memArg}); } - flags.insert(flags.end(), - {"--add-kernel", kernelsJsonFile, "--add-replace-section", - partArg, "--force", "--output", std::string(Output)}); + flags.insert(flags.end(), {"--add-kernel", kernelsJsonFile.string(), + "--add-replace-section", partArg, "--force", + "--output", std::string(Output)}); if (!succeeded(xclbinutilBin) || - !runTool(xclbinutilBin.value(), flags, verbose)) { + !runTool(xclbinutilBin.value().string(), flags, verbose)) { llvm::errs() << "failed to execute xclbinutil"; return failure(); } @@ -1065,7 +1094,7 @@ static LogicalResult generateUnifiedObject( if (failed(chessIntrinsicsObjFile)) return failure(); } else { Path LLVMIRFile = tempDir / "input.ll"; - if (auto maybeErr = dumpStrToDisk(inputLLStr, LLVMIRFile); + if (auto maybeErr = dumpStrToDisk(inputLLStr, LLVMIRFile.string()); maybeErr.has_value()) { llvm::errs() << "Failed to dump to disk input.ll" << " because: " << maybeErr; @@ -1076,20 +1105,20 @@ static LogicalResult generateUnifiedObject( Path OptLLVMIRFile = tempDir / "input.opt.ll"; std::vector args{ - "-O2", "--inline-threshold=10", "-S", std::string(LLVMIRFile), + "-O2", "--inline-threshold=10", "-S", LLVMIRFile.string(), // missing from libc - "--disable-builtin=memset", "-o", std::string(OptLLVMIRFile)}; + "--disable-builtin=memset", "-o", OptLLVMIRFile.string()}; std::vector peanoArgs = makePeanoOptArgs(); args.reserve(args.size() + peanoArgs.size()); args.insert(args.end(), peanoArgs.begin(), peanoArgs.end()); - if (!runTool(peanoOptBin, args, verbose)) { + if (!runTool(peanoOptBin.string(), args, verbose)) { llvm::errs() << "Failed to optimize ll with peano"; return failure(); } if (!runTool( - peanoLLCBin, - {std::string(OptLLVMIRFile), "-O2", + peanoLLCBin.string(), + {OptLLVMIRFile.string(), "-O2", "--march=" + StringRef(targetArch).lower(), "--function-sections", "--filetype=obj", "-o", std::string(outputFile)}, verbose)) { @@ -1140,15 +1169,15 @@ LogicalResult aie2xclbin( output->keep(); Path unifiedObj = Path(tempDir) / "input.o"; - if (failed(generateUnifiedObject(ctx, moduleOp, unifiedObj, printIRBeforeAll, - printIRAfterAll, printIRModuleScope, timing, - useChess, verbose, tempDir, vitisDir, - targetArch, peanoDir))) + if (failed(generateUnifiedObject( + ctx, moduleOp, unifiedObj.string(), printIRBeforeAll, printIRAfterAll, + printIRModuleScope, timing, useChess, verbose, tempDir, vitisDir, + targetArch, peanoDir))) return moduleOp.emitOpError("Failed to generate unified object"); - if (failed(generateCoreElfFiles(moduleOp, unifiedObj, tempDir, useChess, - vitisDir, targetArch, verbose, peanoDir, - ukernel))) + if (failed(generateCoreElfFiles(moduleOp, unifiedObj.string(), tempDir, + useChess, vitisDir, targetArch, verbose, + peanoDir, ukernel))) return moduleOp.emitOpError("Failed to generate core ELF file(s)"); if (failed(generateCDO(ctx, moduleOp, printIRBeforeAll, printIRAfterAll, diff --git a/compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/AMDAIECreateLogicalObjectFifoLink.cpp b/compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/AMDAIECreateLogicalObjectFifoLink.cpp index d4b0678bf..f9225e612 100644 --- a/compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/AMDAIECreateLogicalObjectFifoLink.cpp +++ b/compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/AMDAIECreateLogicalObjectFifoLink.cpp @@ -33,7 +33,8 @@ namespace mlir::iree_compiler::AMDAIE { /// 63]. template LogicalResult checkForNoOverlappingAccessPatterns( - const SmallVector> &stridedOps) { + const SmallVector> + &stridedOps) { for (auto &&[i, stridedOpAndOffset] : llvm::enumerate(stridedOps)) { DoublyStridedCopyOpInterface stridedOp = stridedOpAndOffset.first; std::optional extent; @@ -117,8 +118,9 @@ LogicalResult createLogicalObjectFifoLink( // Sort the inputs and outputs on offset as the link operation uses this order // to generate correct data buffer sizes. - auto comparator = [](std::pair a, - std::pair b) -> bool { + auto comparator = + [](std::pair a, + std::pair b) -> bool { return a.second < b.second; }; @@ -136,12 +138,12 @@ LogicalResult createLogicalObjectFifoLink( return failure(); } - SmallVector inResults = llvm::map_to_vector( - ins, [](std::pair elem) { + SmallVector inResults = llvm::map_to_vector<8>( + ins, [](std::pair elem) -> Value { return cast(elem.first->getResult(0)); }); SmallVector outResults = llvm::map_to_vector( - outs, [](std::pair elem) { + outs, [](std::pair elem) -> Value { return cast(elem.first->getResult(0)); }); diff --git a/compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/CMakeLists.txt b/compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/CMakeLists.txt index 171525b89..20615aa53 100644 --- a/compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/CMakeLists.txt +++ b/compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/CMakeLists.txt @@ -110,8 +110,8 @@ iree_cc_library( iree::target::amd-aie::aie::AIEPasses iree::target::amd-aie::aie::AIEXDialectIR iree::target::amd-aie::aievec::AIEVecConvertToLLVM - iree::target::amd-aie::air::AIRConversionPasses - iree::target::amd-aie::air::AIRTransformPasses + iree_target_amd-aie_air_AIRConversionPasses + iree_target_amd-aie_air_AIRTransformPasses IREELinalgTransformDialectPasses MLIRFuncAllExtensions MLIRFuncDialect diff --git a/runtime/src/iree-amd-aie/aie_runtime/CMakeLists.txt b/runtime/src/iree-amd-aie/aie_runtime/CMakeLists.txt index 0358cf23f..50022d2dc 100644 --- a/runtime/src/iree-amd-aie/aie_runtime/CMakeLists.txt +++ b/runtime/src/iree-amd-aie/aie_runtime/CMakeLists.txt @@ -368,10 +368,12 @@ set_target_properties( xaiengine PROPERTIES COMPILE_OPTIONS "${_aie_runtime_compile_options}") target_compile_definitions(xaiengine PRIVATE ${XAIE_DEBUG} __AIECDO__) -set(xaiengine_c_warning_ignores - -Wno-unused-but-set-variable - -Wno-incompatible-pointer-types) -target_compile_options(xaiengine PRIVATE ${xaiengine_c_warning_ignores}) +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") + set(xaiengine_c_warning_ignores + -Wno-unused-but-set-variable + -Wno-incompatible-pointer-types) + target_compile_options(xaiengine PRIVATE ${xaiengine_c_warning_ignores}) +endif() # For target_include_directories(xaiengine PRIVATE SYSTEM ${_bootgen_source_dir}) target_link_libraries(xaiengine PRIVATE cdo_driver) diff --git a/runtime/src/iree-amd-aie/aie_runtime/FindOpenSSL.cmake b/runtime/src/iree-amd-aie/aie_runtime/FindOpenSSL.cmake index 43b6d31d3..494667488 100644 --- a/runtime/src/iree-amd-aie/aie_runtime/FindOpenSSL.cmake +++ b/runtime/src/iree-amd-aie/aie_runtime/FindOpenSSL.cmake @@ -356,7 +356,6 @@ if(WIN32 AND NOT CYGWIN) endif () message(STATUS "searching for MSVC libs in ${_OPENSSL_PATH_SUFFIXES_DEBUG}") message(STATUS "searching for MSVC libs in ${_OPENSSL_PATH_SUFFIXES_RELEASE}") - message(FATAL_ERROR) find_library(LIB_EAY_DEBUG NAMES diff --git a/runtime/src/iree-amd-aie/aie_runtime/iree_aie_configure.cc b/runtime/src/iree-amd-aie/aie_runtime/iree_aie_configure.cc index b511027b8..4aba9c188 100644 --- a/runtime/src/iree-amd-aie/aie_runtime/iree_aie_configure.cc +++ b/runtime/src/iree-amd-aie/aie_runtime/iree_aie_configure.cc @@ -213,7 +213,8 @@ LogicalResult addElfToTile(const AMDAIEDeviceModel &deviceModel, const TileLoc &tileLoc, const Path &elfPath, bool aieSim) { auto devInst = const_cast(&deviceModel.devInst); - TRY_XAIE_API_LOGICAL_RESULT(XAie_LoadElf, devInst, tileLoc, elfPath.c_str(), + TRY_XAIE_API_LOGICAL_RESULT(XAie_LoadElf, devInst, tileLoc, + elfPath.string().c_str(), /*loadSym*/ aieSim); return success(); } @@ -361,7 +362,7 @@ void initializeCDOGenerator(byte_ordering endianness, bool cdoDebug) { LogicalResult generateCDOBinary(const Path &outputPath, const std::function &cb) { - startCDOFileStream(outputPath.c_str()); + startCDOFileStream(outputPath.string().c_str()); FileHeader(); // Never generate a completely empty CDO file. If the file only contains a // header, then bootgen flags it as invalid. diff --git a/runtime/src/iree-amd-aie/aie_runtime/iree_aie_runtime.cc b/runtime/src/iree-amd-aie/aie_runtime/iree_aie_runtime.cc index 6ec2616f0..7beb9cdc0 100644 --- a/runtime/src/iree-amd-aie/aie_runtime/iree_aie_runtime.cc +++ b/runtime/src/iree-amd-aie/aie_runtime/iree_aie_runtime.cc @@ -86,6 +86,10 @@ ::StrmSwPortType checkedAieRtCompatStrmSwPortType( return static_cast<::StrmSwPortType>(t); } +#ifdef _WIN32 +#define __PRETTY_FUNCTION__ __FUNCSIG__ +#endif + // macro so that line numbers are preserved for where the check fails #define CheckedAieRtCompatStrmSwPortType(t) \ checkedAieRtCompatStrmSwPortType(t, __FILE__, __LINE__, __PRETTY_FUNCTION__) @@ -119,22 +123,22 @@ AMDAIEDeviceModel::AMDAIEDeviceModel( uint8_t nMemTileRows, uint8_t nShimTileRows, int partitionNumCols, int partitionStartCol, uint64_t partBaseAddr, uint64_t npiAddr, bool aieSim, bool xaieDebug, AMDAIEDevice device) - : configPtr{.AieGen = aieGen, - .BaseAddr = baseAddr, - .ColShift = colShift, - .RowShift = rowShift, - .NumRows = devNRows, - .NumCols = devNColumns, - .ShimRowNum = 0, - .MemTileRowStart = memTileRowStart, - .MemTileNumRows = nMemTileRows, + : configPtr{/*AieGen*/aieGen, + /*BaseAddr*/baseAddr, + /*ColShift*/colShift, + /*RowShift*/rowShift, + /*NumRows*/devNRows, + /*NumCols*/devNColumns, + /*ShimRowNum*/0, + /*MemTileRowStart*/memTileRowStart, + /*MemTileNumRows*/nMemTileRows, // TODO(max): use XAIE*_AIE_TILE_ROW_START here // instead of this (once we eliminate legacy devices) - .AieTileRowStart = + /*AieTileRowStart*/ static_cast(memTileRowStart + nMemTileRows), - .AieTileNumRows = static_cast(devNRows - nMemTileRows - + /*AieTileNumRows*/static_cast(devNRows - nMemTileRows - nShimTileRows), - .PartProp = {}}, + /*PartProp*/{}}, devInst{}, device(device) { TRY_XAIE_API_FATAL_ERROR(XAie_SetupPartitionConfig, &devInst, partBaseAddr,