Skip to content

Commit

Permalink
fork XRT
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Aug 22, 2024
1 parent ae4db73 commit 57898d0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[submodule "third_party/XRT"]
path = third_party/XRT
url = https://github.com/Xilinx/XRT.git
url = https://github.com/nod-ai/XRT.git
shallow = true
branch = iree-amd-aie-patches
[submodule "third_party/mlir-air"]
path = third_party/mlir-air
url = https://github.com/nod-ai/mlir-air.git
Expand Down
36 changes: 5 additions & 31 deletions cmake/iree_aie_xrt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,6 @@ set(IREE_XRT_SOURCE_DIR "${IREE_AMD_AIE_SOURCE_DIR}/third_party/XRT/src")

set(_xclbinutil_source_dir ${IREE_XRT_SOURCE_DIR}/runtime_src/tools/xclbinutil)

# remove ssl dep
replace_string_in_file(${_xclbinutil_source_dir}/XclBinUtilMain.cxx
"bValidateSignature == true" "false")
# returning string& to an iterator...............
replace_string_in_file(${_xclbinutil_source_dir}/SectionAIEResourcesBin.h
"static const std::string& getSubSectionName" "static std::string getSubSectionName")
set(_const_str "
const std::string&
SectionAIEResourcesBin::getSubSectionName")
replace_string_in_file(${_xclbinutil_source_dir}/SectionAIEResourcesBin.cxx
"${_const_str}" "std::string SectionAIEResourcesBin::getSubSectionName")

# transformcdo target
if(NOT WIN32)
replace_string_in_file(${_xclbinutil_source_dir}/aie-pdi-transform/src/CMakeLists.txt
Expand All @@ -74,7 +62,7 @@ endif()

# otherwise the various stois that read these will explode...
# XRT/src/runtime_src/tools/xclbinutil/XclBinClass.cxx#L55
file(READ ${IREE_XRT_SOURCE_DIR}/CMakeLists.txt _xrt_cmake_file_contents)
file(READ ${IREE_XRT_SOURCE_DIR}/CMake/settings.cmake _xrt_cmake_file_contents)
string(REGEX MATCH "XRT_VERSION_MAJOR ([0-9]+)" XRT_VERSION_MAJOR ${_xrt_cmake_file_contents})
# note CMAKE_MATCH_0 is the whole match...
set(XRT_VERSION_MAJOR ${CMAKE_MATCH_1})
Expand All @@ -95,24 +83,6 @@ configure_file(${IREE_XRT_SOURCE_DIR}/CMake/config/version.h.in
${IREE_XRT_SOURCE_DIR}/runtime_src/core/common/gen/version.h)
configure_file(${IREE_XRT_SOURCE_DIR}/CMake/config/version.h.in
${IREE_XRT_SOURCE_DIR}/runtime_src/core/common/api/version.h)
replace_string_in_file(${IREE_XRT_SOURCE_DIR}/runtime_src/core/common/query.h
"#include <stdexcept>" "#include <any>")

set(_noop_xclbin_sig_cxx "
#include \"XclBinSignature.h\"
void signXclBinImage(const std::string& _fileOnDisk,
const std::string& _sPrivateKey,
const std::string& _sCertificate,
const std::string& _sDigestAlgorithm,
bool _bEnableDebugOutput) {}
void verifyXclBinImage(const std::string& _fileOnDisk,
const std::string& _sCertificate,
bool _bEnableDebugOutput) {}
void dumpSignatureFile(const std::string& _fileOnDisk,
const std::string& _signatureFile) {}
void getXclBinPKCSStats(const std::string& _xclBinFile,
XclBinPKCSImageStats& _xclBinPKCSImageStats) {}")
file(WRITE "${_xclbinutil_source_dir}/XclBinSignature.cxx" "${_noop_xclbin_sig_cxx}")

file(
GLOB
Expand Down Expand Up @@ -176,8 +146,12 @@ install(
# ##############################################################################
# xrt_coreutil
# ##############################################################################

message(STATUS "building XRT core libs")

set(XRT_AIE_BUILD "yes")
set(XRT_ENABLE_AIE "yes")
set(XRT_NATIVE_BUILD "yes")
add_definitions(-DXRT_ENABLE_AIE -DXRT_AIE_BUILD)

# send xrt_coreutil to trash so it doesn't get installed
Expand Down
8 changes: 4 additions & 4 deletions runtime/src/iree-amd-aie/driver/xrt/native_executable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ iree_status_t iree_hal_xrt_native_executable_create(
std::vector<char> xclbinVector(
xclbin_fb, xclbin_fb + flatbuffers_string_len(xclbin_fb));
std::unique_ptr<xrt::xclbin> xclbin;
std::cerr << "XILINX_XRT: " << getenv("XILINX_XRT") << "\n";
try {
xclbin = std::make_unique<xrt::xclbin>(xclbinVector);
} catch (std::runtime_error& e) {
Expand All @@ -189,8 +188,8 @@ iree_status_t iree_hal_xrt_native_executable_create(
try {
xrt::hw_context context(*device, xclbin->get_uuid());
} catch (std::runtime_error& e) {
return iree_make_status(IREE_STATUS_INTERNAL, "xrt::hw_context context: %s",
e.what());
return iree_make_status(IREE_STATUS_INTERNAL,
"xrt::hw_context context: %s", e.what());
}
xrt::hw_context context(*device, xclbin->get_uuid());
uint32_t asm_instr_index =
Expand All @@ -209,7 +208,8 @@ iree_status_t iree_hal_xrt_native_executable_create(
// the second argument to the kernel and we can use group id 1.
int group_id = 1;
instr = std::make_unique<xrt::bo>(*device, num_instr * sizeof(uint32_t),
XCL_BO_FLAGS_CACHEABLE, kernel->group_id(group_id));
XCL_BO_FLAGS_CACHEABLE,
kernel->group_id(group_id));
} catch (...) {
iree_hal_executable_destroy((iree_hal_executable_t*)executable);
IREE_TRACE_ZONE_END(z0);
Expand Down
2 changes: 1 addition & 1 deletion third_party/XRT
Submodule XRT updated 439 files

0 comments on commit 57898d0

Please sign in to comment.