Improve dependency discovery for MLIR-AIE - #38
Open
thomthehound wants to merge 3 commits into
Open
Conversation
Signed-off-by: thomthehound <thomthehound@gmail.com>
Signed-off-by: thomthehound <thomthehound@gmail.com>
Signed-off-by: thomthehound <thomthehound@gmail.com>
Contributor
Author
|
@jgmelber I think this could potentially make our lives much easier when building CMake examples. At least, once I wrap up my follow-on patch for MLIR-AIE, that is. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MLIR-AIE is currently carrying too much dependency-specific path handling in its own CMake code. That includes: hard-coded package locations, manually assembled include and library paths, and assumptions that do not hold across both Linux and Windows installs.
That makes the repo-side CMake harder to maintain, as well as making it unnecessarily difficult to expose a clean interface for native C++ applications.
These changes put the platform and package-layout knowledge in the "find" modules that own them. MLIR-AIE can then consume stable CMake contracts instead of reproducing the discovery logic itself.
This is a drop-in replacement for the existing finders, so it does not require any changes to MLIR-AIE itself (or any other downstream consumers). It also does not change the existing variable-based interface, so existing consumers remain compatible. This only adds new target-based interfaces and fixes some missing or broken behavior in the released packages.
Changes
XRT
FindXRT.cmakenow providesXRT::xrt_coreutilfor target-based consumers while preserving the existingXRT_COREUTILlibrary-path variable and other established variables.Linux prefers XRT's installed config package and retains direct installed-layout discovery for packages that do not provide one.
Windows links through
xrt_coreutil.lib. A localxrt_coreutil.dllis not supplied with the Windows XRT SDK because the installed driver provides the runtime DLL. Previously, one was assumed. However, existing support for source-built XRT installations where a local test DLL is present is retained.Existing Windows packages are given
/Zc:__cplusplusso MSVC C++17 consumers use XRT'sstd::anyinterface instead of incorrectly falling back to Boost because they think the compiler is from 1997(!!!).AIEBU
A new
FindAIEBU.cmakesupports both a standalone Linux installation and the AIEBU package bundled with the Windows XRT SDK (or a custom XRT/AIEBU build).It exposes
AIEBU::aiebu_static, repairs the missing public include directory in the current Windows SDK, and preserves the MSVC runtime required by the static library. New packages can report that runtime directly; existing packages use a compatibility fallback.This removes the need for MLIR-AIE to search a fixed list of Linux package directories.
LibXAIE
FindLibXAIE.cmakeretains its existing variable-based interface while adding:LibXAIE_ROOT;lib64and GNU multiarch library directories;xaiengineandxaienginecdo.Headers and libraries are selected from the same explicit prefix.
Effects
This is the first major step in the larger CMake infrastructure overhaul as mentioned in the MLIR-AIE
ROADMAP.md.The immediate benefit is simpler MLIR-AIE CMake:
I am finishing up work on a larger CMake package for MLIR-AIE itself, which will better take advantage of these improvements. That package will expose native host support through targets such as
AIE::HostUtils, allowing a C++ application to link normal CMake targets instead of manually collecting XRT headers, libraries, compiler options, runtime settings, and platform-specific paths.Testing
cmake/modulesXilinx.check-aiesuite.xrt_coreutil.dll.XRT_ROOTandCMAKE_PREFIX_PATH.