cmake: order HIP device compiles after the pass plugin link - #1526
Open
pvelesko wants to merge 2 commits into
Open
cmake: order HIP device compiles after the pass plugin link#1526pvelesko wants to merge 2 commits into
pvelesko wants to merge 2 commits into
Conversation
TestFix1488PassPluginBuildOrder walks the Ninja build graph and asserts that objects compiled from HIP sources are ordered after lib/libLLVMHipSpvPasses.so, the pass plugin clang loads through --hip-path. It probes one object per registration path: the Test* glob in tests/runtime, add_hip_test(), and the catch suite. Today all three fail: add_dependencies(CHIP LLVMHipPasses) only orders a consumer's object compiles after the plugin's objects, not after its link, and the catch tree has no dependency on the plugin at all.
Route the in-tree toolchain (LLVMHipPasses, devicelib_bc, hipcc.bin) through a utility target, hip_device_toolchain, and make CHIP and the catch object libraries depend on it. Under the Ninja generator a dependency on a library target only orders a consumer's object compiles after that library's objects, not after its link, so add_dependencies(CHIP LLVMHipPasses) let test TUs compile while lib/libLLVMHipSpvPasses.so was being relinked and their device link failed with "file too short" or "invalid ELF header". A utility target is waited on completely, and every target that compiles HIP code against the build tree reaches it through CHIP, or through KERNELS/Main_Object in the catch tree, which sets hipcc.bin as its compiler and never links CHIP. Fixes #1488
Collaborator
Author
|
/run-aurora-ci |
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.
Under the Ninja generator a dependency on a library target only orders a consumer's object compiles after that library's objects, not after its link, so
add_dependencies(CHIP LLVMHipPasses)let test TUs compile whilelib/libLLVMHipSpvPasses.sowas being relinked and their device link failed withfile too shortorinvalid ELF header. The in-tree toolchain (LLVMHipPasses,devicelib_bc,hipcc.bin) now goes through a utility target,hip_device_toolchain, which Ninja waits on completely; CHIP and the catch object libraries (KERNELS,Main_Object) depend on it, so every target that compiles HIP code against the build tree is ordered after the plugin link.TestFix1488PassPluginBuildOrderwalks the Ninja graph for one object per registration path (runtime glob,add_hip_test, catch) and fails on main.Fixes #1488