Early RDC for HIP - #774
Open
robinson96 wants to merge 27 commits into
Open
Conversation
…uilt and/or installed
…he output of a call to erdc.sh
…brary with earlyrdc true
…f EARLY_RDC_SOURCES
…dc_device and libale3d_earlyrdc_device
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.
Overview
This change extends BLT’s target helpers with support for HIP relocatable device code (RDC) and early device linking.
It allows projects to identify the subset of sources that require RDC, compile those sources separately with -fgpu-rdc, perform the HIP device link before the final
application link, and propagate the resulting archive through normal CMake target dependencies.
The ALE3D merge request updates the cmake/blt submodule reference to the corresponding BLT implementation.
Motivation
Large HIP applications can incur substantial work during the final device-link step when every RDC object is deferred until executable linking. Performing device linking
earlier at the library boundary can:
BLT interface changes
blt_add_library() and blt_add_executable() now accept these HIP-specific arguments:
These options are effective only when BLT_ENABLE_HIP is enabled.
Target behavior
RDC TRUE-fgpu-rdcand linked transitively.EARLY_RDC TRUE_hostand device-linked_devicearchives.EARLY_RDC TRUE_devicearchive propagated to consumers.EARLY_RDC TRUE_hostand_devicelibraries.Full-RDC executables are not supported by this implementation; early-RDC executables must retain at least one non-RDC source.
Implementation details
Source partitioning
BLT separates RDC_SOURCES from the target’s ordinary sources. This prevents the same source from being compiled into both the base target and the RDC archive.
The RDC sources are compiled with -fgpu-rdc, while ordinary sources in a mixed target retain their normal compilation flags. Executables that require RDC use the HIP
linker for the final link.
Early device-link helper
A new blt_setup_hip_early_rdc_target() helper:
Dependencies that expose an early-RDC host archive can also be supplied to the device-link operation. If a dependency already exposes a generated device archive, its host
input archive is not added again. This avoids duplicate host objects and duplicate-symbol failures.
erdc.sh
The new script uses ROCm’s LLVM tools to:
Generated-target metadata
BLT now exposes variables describing the targets produced by each macro.
For libraries:
For executables:
These variables allow downstream install and export logic to handle all generated targets without duplicating BLT’s naming rules.
Compatibility