Repository navigation
refactor(rocr): abstract thunk loader platform-specific code - #7125
Conversation
dayatsin-amd
left a comment
There was a problem hiding this comment.
Please change licence for header to MIT.
/*
- Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
- SPDX-License-Identifier: MIT
*/
bb96266 to
17c5cb3
Compare
|
This pull request has been inactive for 25 days and will be marked as stale. If you would like to keep this PR open, please:
This PR will be automatically closed in 5 days if no further activity occurs. |
cfreeamd
left a comment
There was a problem hiding this comment.
thunk_loader.cpp, thunk_loader_linux.cpp, thunk_loader_win.cpp, and thunk_loader_platform.h look correct — behavior for all four call sites is preserved: DTIF detection, DXG detection (Linux /dev/dxg + flag, Windows unconditional), dynamic API loading, and static API binding.
17c5cb3 to
5d0d48e
Compare
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
2022324 to
5236ef0
Compare
57403d8 to
39de11d
Compare
|
@cfreeamd can you please review this change as well thanks |
|
@cfreeamd can you please review this change |
|
@cfreeamd can you please review this change
it is done |
cfreeamd
left a comment
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @cfreeamd) — follow-up after author update
Prior items resolved: license headers now use SPDX-License-Identifier: MIT (addresses the earlier CHANGES_REQUESTED), and the earlier question about DetectDxgDriver() on Windows was clarified as intentional. The refactor has since grown to also collapse is_win_dxg_/is_wsl_dxg_ into a single is_dxg_; left two follow-up notes on the resulting behavior change.
| Runtime::MappedHandleAllowedAgent::~MappedHandleAllowedAgent() { | ||
| if (targetAgent->device_type() == core::Agent::DeviceType::kAmdCpuDevice) { | ||
| if (core::Runtime::runtime_singleton_->thunkLoader()->IsWslDxg()) assert(!"Unimplemented"); | ||
| if (core::Runtime::runtime_singleton_->thunkLoader()->IsDXG()) assert(!"Unimplemented"); |
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @cfreeamd)
[Question] This PR now collapses is_win_dxg_/is_wsl_dxg_ into a single is_dxg_ and replaces IsWinDxg()/IsWslDxg() with IsDXG(). That changes behavior at a few call sites vs. the original pure-refactor:
- Here (and the other
MappedHandleAllowedAgentguards) the predicate wasIsWslDxg(), which was false on Windows-native DXG. It's nowIsDXG(), so Windows-native DXG also takes theUnimplemented/return-error/skip path. - In
amd_kfd_driver.cpp/amd_memory_region.cppthe predicate wasIsWinDxg(), which was false under WSL2; it's nowIsDXG(), so WSL2 now skips pinning and the per-region cap like Windows.
Both look reasonable (both paths are DXG/WDDM), but could you confirm the win-dxg/wsl-dxg merge is intentional and that no remaining caller needs to distinguish the two?
| // is best-effort; WDDM will demand-page on GPU access. | ||
| const bool is_windxg = | ||
| core::Runtime::runtime_singleton_->thunkLoader()->IsWinDxg(); | ||
| core::Runtime::runtime_singleton_->thunkLoader()->IsDXG(); |
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @cfreeamd)
[Nit] The local is still named is_windxg but is now assigned from IsDXG(), which is also true under WSL2 (/dev/dxg). Consider renaming to is_dxg here (and in amd_memory_region.cpp) so the name matches the broadened predicate.
|
My agent found this as a potential build failure:
Does this look related? @shadidashmiz |
1c71b88 to
e45639c
Compare
- remove if defs - Abstract platform specific functions Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
e45639c to
0ebf3a1
Compare
The refactoring unified is_win_dxg_ and is_wsl_dxg_ into a single is_dxg_ bool but amd_topology.cpp still needs to distinguish WSL DXG from native Windows DXG for tool registration. Restore IsWslDxg() using a compile-time #ifdef: on Linux is_dxg_ implies WSL, on Windows it does not. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Resolve thunk_loader.h against develop's thunk-loader platform split (#7125) and the GL2 residency entry point (#10183): keep this branch's nullptr-initialized table and add hsaKmtSetPersistingCacheSize to it. Bind hsaKmtSetPersistingCacheSize as an optional entry point, like hsaKmtSetSigbusDelay. librocdxg does not export it, so as a required export it would make LoadThunkApiTable() fail and hsa_init() refuse to start under WSL. The static path defaults it to the NOT_SUPPORTED stub and the Linux BindPlatformStaticApis() binds the libhsakmt implementation, which was otherwise left unbound.
TheRock Submodule Bump ActivityNewest first
|
AIRUNTIME-2002
remove if defs
Abstract platform specific functions
Motivation
Remove if defs from the body of code
Technical Details
Separate Linux and Win specific functions so the thunk loader is opaque
JIRA ID: AIRUNTIME-2002
Test Plan
Hip Rocr tests
Test Result
PSDB
Submission Checklist