Skip to content

core: enable WSL backend for amdsmi on non-Windows - #7102

Merged
bill-shuzhou-liu merged 3 commits into
mainfrom
users/shuzhliu/amdsmi-enable-wsl-backend
Aug 25, 2026
Merged

bill-shuzhou-liu merged 3 commits into
mainfrom
users/shuzhliu/amdsmi-enable-wsl-backend

Conversation

@bill-shuzhou-liu

Copy link
Copy Markdown
Contributor

Summary

  • Pass -DENABLE_WSL_BACKEND=ON to the amdsmi subproject so the experimental WSL (WDDM/dxg) GPU backend is compiled in on Linux/WSL builds.
  • The backend dlopen's librocdxg.so at runtime, so no additional build or runtime dependencies are required in TheRock.
  • The change is already inside the existing if(NOT WIN32) guard, so Windows builds are unaffected.

JIRA ID : ROCM-28065

Test plan

  • Verify amdsmi configures and builds successfully with THEROCK_ENABLE_CORE_AMDSMI=ON on Linux
  • Confirm libamd_smi.so includes the WSL backend symbols when ENABLE_WSL_BACKEND=ON
  • Confirm Windows build is unaffected (no change to WIN32 code path)

🤖 Generated with Claude Code

@therock-pr-bot

therock-pr-bot Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass PR does not contain code files — Unit Test auto-passed
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot

therock-pr-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@JeniferC99 JeniferC99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pending on ROCm/rocm-systems#9725. Also this pr is duplicate for #6885, please close either this or that one.

Pass -DENABLE_WSL_BACKEND=ON to the amdsmi subproject so that the
experimental WSL (WDDM/dxg) GPU backend is compiled in on Linux/WSL
builds. The backend dlopen's librocdxg.so at runtime, so no additional
build or runtime dependencies are required.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marifamd
marifamd force-pushed the users/shuzhliu/amdsmi-enable-wsl-backend branch from 1147b2f to 3dd4d5f Compare August 18, 2026 18:56
@marifamd
marifamd requested a review from JeniferC99 August 21, 2026 15:29
@jayhawk-commits

Copy link
Copy Markdown
Contributor

Please share confirmation that the .so produced has the WSL symbols. CI results look good overall.

@bill-shuzhou-liu

bill-shuzhou-liu commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Confirmed directly from the CI artifact (run 32498518713):

  • amdsmi_build.log shows -DENABLE_WSL_BACKEND=ON was passed at configure, and amd_smi_wsl_device.cc was compiled and linked into src/libamd_smi.so.27.0.0.
  • I downloaded the actual core-amdsmi_lib_generic.tar.zst artifact from that run and ran strings on the resulting libamd_smi.so.27.0.0. It contains the WSL/dxg backend code

$ strings /tmp/core-amdsmi-extract/core/amdsmi/stage/lib/libamd_smi.so.27.0.0 | grep rocdxg
rocdxg_smi_get_temperature
rocdxg_smi_get_device_info
rocdxg_smi_get_vram_usage
rocdxg_smi_get_power_info
rocdxg_smi_get_clock_info
rocdxg_smi_get_gpu_metrics_info

{EC392FCA-1BCF-4056-9726-B0AC58739E42}

@bill-shuzhou-liu
bill-shuzhou-liu merged commit 910423b into main Aug 25, 2026
297 of 303 checks passed
@bill-shuzhou-liu
bill-shuzhou-liu deleted the users/shuzhliu/amdsmi-enable-wsl-backend branch August 25, 2026 17:36
@github-project-automation github-project-automation Bot moved this from TODO to Done in TheRock Triage Aug 25, 2026
marifamd added a commit that referenced this pull request Sep 1, 2026
## Summary

Follow-up to #7102, which added `-DENABLE_WSL_BACKEND=ON` to the
`amdsmi` subproject unconditionally.

TheRock already has a switch for this component,
`THEROCK_ENABLE_WSL_ROCDXG` (feature group `WSL`, off in default/CI
builds). With the backend forced on, the two disagree:

- Default builds ship an amdsmi WSL backend that `dlopen`s
`librocdxg.so`, while the `wsl-rocdxg` subproject that produces that
library is not built. The `dlopen` just fails at runtime, so nothing
breaks, but the code is dead weight in every default build.
- `ENABLE_WSL_BACKEND=ON` is not dependency-free on the amdsmi side. It
has a `FATAL_ERROR` gate requiring
`rocr-runtime/libhsakmt/include/hsakmt/rocdxg_smi.h`, resolved through a
hardcoded sibling path. That works today only because `rocm-systems` is
checked out whole, and it is a build-time dependency default builds
should not take on.

This makes the amdsmi flag follow TheRock's existing switch, matching
the `-DBUILD_TESTS=${THEROCK_BUILD_TESTING}` pattern on the adjacent
line. Turning on `THEROCK_ENABLE_WSL_ROCDXG` now builds both the bridge
library and the amdsmi backend that consumes it.

## JIRA ID

ROCM-28065

## Test plan

Verified `THEROCK_ENABLE_WSL_ROCDXG` is a `CACHE BOOL` created by
`therock_add_feature`, and that `therock_finalize_features()` (top-level
`CMakeLists.txt:277`) runs well before `add_subdirectory(core)`
(`CMakeLists.txt:503`), so the variable is in scope at the point of use.

Substitution checked for every state:

| `THEROCK_ENABLE_WSL_ROCDXG` | Emitted argument |
|---|---|
| `OFF` | `-DENABLE_WSL_BACKEND=OFF` |
| `ON` | `-DENABLE_WSL_BACKEND=ON` |
| undefined | `-DENABLE_WSL_BACKEND=` (falsey; amdsmi's `option(...
OFF)` default preserved, no error) |

- [x] Default Linux build no longer compiles the WSL backend (restores
pre-#7102 artifact content)
- [x] `THEROCK_ENABLE_WSL_ROCDXG=ON` propagates `ENABLE_WSL_BACKEND=ON`
to amdsmi
- [x] Windows unaffected (change stays inside the existing `if(NOT
WIN32)` guard)
- [x] `pre-commit run --files core/CMakeLists.txt
docs/development/wsl_rocdxg.md` passes


Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants