Skip to content

[hotswap] Install and link libhsa-hotswap tool#7577

Closed
harsh-amd wants to merge 2 commits into
ROCm:developfrom
harsh-amd:hotswap-revert-7342
Closed

[hotswap] Install and link libhsa-hotswap tool#7577
harsh-amd wants to merge 2 commits into
ROCm:developfrom
harsh-amd:hotswap-revert-7342

Conversation

@harsh-amd

@harsh-amd harsh-amd commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

ISSUE ID: ROCm/llvm-project#3000

Stack

Layer 1 of the rocm-systems hotswap stack, paired with ROCm/llvm-project#3007.

Summary

  • Install libhsa-hotswap.so from projects/hotswap so TheRock can package it.
  • Link the hotswap HSA tool against hsa-runtime64::hsa-runtime64.
  • Keep libhsa-hotswap.so as the runtime HSA tools library while COMGR provides the rewrite API.

Testing

  • cmake -S projects/hotswap -B build-hotswap-reorder-layer1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -Damd_comgr_DIR=/home/harsh/llvm-pr3000-refactor/build-comgr-displacement-shared/lib/cmake/amd_comgr -Dhsa-runtime64_DIR=/opt/rocm-7.2.0/lib/cmake/hsa-runtime64
  • cmake --build build-hotswap-reorder-layer1 --target hsa-hotswap hotswap_test hotswap_tool_test --parallel 32
  • cmake --install build-hotswap-reorder-layer1 --prefix build-hotswap-reorder-layer1/install-check

Full hotswap CTest is run at layer 2, where the same-ISA passthrough and entry-trampoline gating behavior are introduced.

@harsh-amd harsh-amd force-pushed the hotswap-revert-7342 branch from 2eeaf68 to 81c0eff Compare June 22, 2026 13:24
@harsh-amd harsh-amd changed the title [hotswap] Install and test libhsa-hotswap tool integration [hotswap] Install and link libhsa-hotswap tool Jun 22, 2026
@harsh-amd harsh-amd marked this pull request as ready for review June 22, 2026 13:43
@nirmie

nirmie commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

We need to re-point the tool names to the new names:

projects/clr/rocclr/device/hotswap.hpp line 30: (instead of old name use:)
inline constexpr const char* kHotswapToolLib = "libhsa-hotswap.so"

projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp line 2722 (similar fix)
static constexpr const char* kHotswapToolLib = "libhsa-hotswap.so";

nirmie added a commit to nirmie/rocm-systems that referenced this pull request Jun 22, 2026
Fold in the install rule and HSA runtime linkage previously
provided by ROCm#7577 so this branch no longer depends on it:
add GNUInstallDirs, find_package(hsa-runtime64), link
hsa-runtime64::hsa-runtime64, and install(TARGETS hsa-hotswap).
nirmie added a commit to nirmie/rocm-systems that referenced this pull request Jun 22, 2026
Fold in the install rule and HSA runtime linkage previously
provided by ROCm#7577 so this branch no longer depends on it:
add GNUInstallDirs, find_package(hsa-runtime64), link
hsa-runtime64::hsa-runtime64, and install(TARGETS hsa-hotswap).
@harsh-amd

Copy link
Copy Markdown
Contributor Author

No longer needed, instead use #7629

@harsh-amd harsh-amd closed this Jun 23, 2026
harsh-amd added a commit that referenced this pull request Jun 26, 2026
… header paths (#7629)

## Motivation
This PR contains two components. One component is to update to use the
tooling bundled in projects/hotswap instead of the tool that exists at
comgr (deprecated). The other component is to resolve amd_comgr header
issues during the build. Additionally, there are some changes to the
CMakeLists.txt to have the hotswap HSA tool against
hsa-runtime64::hsa-runtime64.

<!-- Explain the purpose of this PR and the goals it aims to achieve.
-->

## Technical Details
~~Builds on top of Harsh's PRs here: #7577~~ (deprecated, #7577 code is
directly in this)
Relevant PRs: amd-llvm: ROCm/llvm-project#3007
<!-- Explain the changes along with any relevant GitHub links. -->

## JIRA ID
N/A
<!-- If applicable, mention the JIRA ID resolved by this PR (Example:
Resolves SWDEV-12345). -->
<!-- Do not post any JIRA links here. -->

## Test Plan
Contained build for the tool (verifies if linking resolves)
```
git sparse-checkout add projects/rocr-runtime/runtime/hsa-runtime/inc 2>/dev/null || true

P=~/hotswap/npi-build/_gapfix/comgr-prefix
DIST=~/hotswap/npi-build/therock/build/dist/rocm

cmake -S projects/hotswap -B /tmp/build-hotswap -GNinja -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_PREFIX_PATH="$DIST" \
  -Damd_comgr_DIR="$P/lib/cmake/amd_comgr" \
  -Dhsa-runtime64_DIR="$DIST/lib/cmake/hsa-runtime64"

cmake --build /tmp/build-hotswap --target hsa-hotswap
```
Tool name testing must be done with full build
<!-- Explain any relevant testing done to verify this PR. -->

## Test Result
Ran:
ls -l /tmp/build-hotswap/libhsa-hotswap.so
nm -D /tmp/build-hotswap/libhsa-hotswap.so | grep hotswap_rewrite
```
nm -D /tmp/build-hotswap/libhsa-hotswap.so | grep hotswap_rewrite
-rwxrwxr-x 1 nisenthi nisenthi 50480 Jun 22 18:45 /tmp/build-hotswap/libhsa-hotswap.so
                 U amd_comgr_hotswap_rewrite@amd_comgr_3.2
```
<!-- Briefly summarize test outcomes. -->

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants