Skip to content

Commit

Permalink
move aie_cdo_gen_test.cxx
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Aug 18, 2024
1 parent 60ab046 commit 9d8c3b7
Show file tree
Hide file tree
Showing 19 changed files with 884 additions and 52 deletions.
803 changes: 803 additions & 0 deletions cmake/FindOpenSSL.cmake

Large diffs are not rendered by default.

37 changes: 30 additions & 7 deletions cmake/iree_aie_bootgen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,46 @@ target_compile_options(iree-aie-bootgen PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:${_bootgen_c_warning_ignores};${_bootgen_cxx_warning_ignores}>)

set(OPENSSL_USE_STATIC_LIBS TRUE CACHE BOOL "" FORCE)
set(_openssl_libs "")
if(WIN32)
set(SYSTEM_OPENSSL ON)
if(NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
message(
FATAL_ERROR
"Building on 32bit platforms/toolchains is not supported; if you are seeing this on windows, "
"it's possible you have opened the win32 developer shell rather than the x64 developer shell."
)
endif()
# We use our own, slightly modified, FindOpenSSL because of issues in CMake's
# distribution of the same for versions prior to 3.29.
# https://gitlab.kitware.com/cmake/cmake/-/issues/25702
find_package(OpenSSL)
if(NOT DEFINED OPENSSL_FOUND OR NOT ${OPENSSL_FOUND})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
find_package(OpenSSL)
if(NOT DEFINED USE_IREE_AMD_AIE_FIND_OPENSSL
OR NOT ${USE_IREE_AMD_AIE_FIND_OPENSSL})
message(FATAL_ERROR "Didn't pickup/use adjacent FindOpenSSL.cmake")
endif()
if(NOT DEFINED OPENSSL_FOUND OR NOT ${OPENSSL_FOUND})
message(FATAL_ERROR "OpenSSL not found")
endif()
endif()
message(STATUS "OpenSSL include directories:" ${OPENSSL_INCLUDE_DIR})
list(APPEND _openssl_libs OpenSSL::SSL OpenSSL::Crypto)
else()
set(BUILD_OPENSSL ON)
# openssl-cmake doesn't have 1.1.1b but this one works
set(OPENSSL_BUILD_VERSION 1.1.1k)
# no zlib
set(OPENSSL_MODULES no-comp)
add_subdirectory(${IREE_AMD_AIE_SOURCE_DIR}/third_party/openssl openssl)
list(APPEND _openssl_libs $<BUILD_LOCAL_INTERFACE:ssl> $<BUILD_LOCAL_INTERFACE:crypto>)
endif()
add_subdirectory(${IREE_AMD_AIE_SOURCE_DIR}/third_party/openssl openssl)
target_include_directories(iree-aie-bootgen PRIVATE ${_BOOTGEN_SOURCE_DIR})
target_link_libraries(iree-aie-bootgen PRIVATE
$<BUILD_LOCAL_INTERFACE:ssl>
$<BUILD_LOCAL_INTERFACE:crypto>)
target_include_directories(iree-aie-bootgen PRIVATE ${_BOOTGEN_SOURCE_DIR} ${OPENSSL_INCLUDE_DIR})
target_link_libraries(iree-aie-bootgen PRIVATE ${_openssl_libs})

iree_install_targets(
TARGETS iree-aie-bootgen
COMPONENT IREEBundledLibraries
EXPORT_SET Runtime
EXPORT_SET Compiler
)
39 changes: 27 additions & 12 deletions cmake/iree_aie_xrt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ if(TARGET iree-aie-xclbinutil)
return()
endif()

# error: relocation R_X86_64_PC32 cannot be used against symbol
# 'vtable for boost::filesystem::filesystem_error'; recompile with -fPIC
# shared libs are compiled with -fPIC
set(Boost_USE_STATIC_LIBS OFF CACHE BOOL "" FORCE)
if(WIN32)
set(STATIC_OR_SHARED ON)
else()
# R_X86_64_PC32 relocation at offset 0x684 against symbol
#`boost::system::detail::cat_holder<void>::system_category_instance' can not be used; recompile with -fPIC
set(STATIC_OR_SHARED OFF)
endif()
set(Boost_USE_STATIC_LIBS ${SHARED_OR_STATIC} CACHE BOOL "" FORCE)
find_package(Threads REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem program_options system)
message(STATUS "Boost include directories:" ${Boost_INCLUDE_DIRS})
Expand Down Expand Up @@ -119,9 +123,14 @@ file(
"${_xclbinutil_source_dir}/XclBinUtilMain.cxx"
)

# R_X86_64_PC32 relocation at offset 0x684 against symbol
#`boost::system::detail::cat_holder<void>::system_category_instance' can not be used; recompile with -fPIC
add_library(iree-aie-xclbinutil SHARED ${_xclbinutil_srcs})
if(WIN32)
set(STATIC_OR_SHARED STATIC)
else()
# R_X86_64_PC32 relocation at offset 0x684 against symbol
#`boost::system::detail::cat_holder<void>::system_category_instance' can not be used; recompile with -fPIC
set(STATIC_OR_SHARED SHARED)
endif()
add_library(iree-aie-xclbinutil ${STATIC_OR_SHARED} ${_xclbinutil_srcs})
target_compile_options(iree-aie-xclbinutil PRIVATE -fexceptions -frtti)

set(THREADS_PREFER_PTHREAD_FLAG ON)
Expand All @@ -130,14 +139,16 @@ set(_xclbin_libs
Boost::program_options
Boost::system
Threads::Threads)
# prevents collision with bootgen's Section class
set(_xclbinutil_compile_definitions -DBOOST_BIND_GLOBAL_PLACEHOLDERS -DSection=XCLBinUtilSection)
set(_xclbinutil_compile_definitions
-DBOOST_BIND_GLOBAL_PLACEHOLDERS
# prevents collision with bootgen's Section class
-DSection=XCLBinUtilSection)

if(WIN32)
list(APPEND _xclbinutil_compile_definitions -D"/EHsc")
# Uncomment if you get LINK : fatal error LNK1104: cannot open file
# 'libboost_filesystem-vc142-mt-gd-x64-1_74.lib'
# target_compile_definitions(xclbinutil-lib PUBLIC BOOST_ALL_DYN_LINK
# target_compile_definitions(iree-aie-xclbinutil PUBLIC BOOST_ALL_DYN_LINK)
else()
list(APPEND _xclbinutil_compile_definitions -DENABLE_JSON_SCHEMA_VALIDATION)
list(APPEND _xclbin_libs $<BUILD_LOCAL_INTERFACE:transformcdo>)
Expand All @@ -154,7 +165,8 @@ target_include_directories(iree-aie-xclbinutil
${_xclbinutil_source_dir})
# for some reason windows doesn't respect the standard output path without this
set_target_properties(iree-aie-xclbinutil
PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
iree_install_targets(
TARGETS iree-aie-xclbinutil
COMPONENT IREEBundledLibraries
Expand Down Expand Up @@ -191,5 +203,8 @@ foreach(_core_lib IN LISTS _core_libs)
target_include_directories(${_core_lib} SYSTEM PUBLIC
${IREE_XRT_SOURCE_DIR}/runtime_src/core/common/elf)
target_compile_definitions(${_core_lib} PRIVATE -DBOOST_BIND_GLOBAL_PLACEHOLDERS)
target_link_libraries(${_core_lib} PRIVATE Boost::boost)
target_link_libraries(${_core_lib} PRIVATE
Boost::filesystem
Boost::program_options
Boost::system)
endforeach()
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ iree_cc_library(
iree-amd-aie::aie_runtime::iree_aie_runtime_static
iree::target::amd-aie::Transforms
iree-aie-bootgen
iree-aie-xclbinutil
)

if(IREE_AMD_AIE_ENABLE_XRT_DRIVER)
# on windows for some reason `DEPS` above doesn't trigger a build
# and also doesn't point to the .dll (points to .lib instead)
target_link_libraries(iree_target_amd-aie_Target_AIETargets PRIVATE iree-aie-xclbinutil)
# add_dependencies(iree_target_amd-aie_Target_AIETargets iree-aie-xclbinutil)
endif()

iree_cc_library(
NAME
Target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,28 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

iree_cc_binary(
NAME
aie_cdo_gen_test
SRCS
aie_cdo_gen_test.cxx
DEPS
iree::target::amd-aie::aie::AIEDialectIR
iree::target::amd-aie::Target::AIETargets
)

file(GLOB _mlir_files *.mlir)

iree_lit_test_suite(
NAME
lit
SRCS
"amd_aie_target_backend.mlir"
${_mlir_files}
TOOLS
${IREE_LLD_TARGET}
::aie_cdo_gen_test
FileCheck
iree-compile
LABELS
"hostonly"
)
1 change: 1 addition & 0 deletions iree_runtime_plugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ endif()

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

add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/runtime/src AMD-AIE)
Expand Down
2 changes: 0 additions & 2 deletions runtime/src/iree-amd-aie/aie_runtime/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,3 @@ iree_lit_test(
LABELS
"hostonly"
)

add_subdirectory(cdo)
29 changes: 0 additions & 29 deletions runtime/src/iree-amd-aie/aie_runtime/test/cdo/CMakeLists.txt

This file was deleted.

0 comments on commit 9d8c3b7

Please sign in to comment.