Skip to content

fix(rocr): Dup dmabuf fd on VMemoryImportShareableHandle for deferred import#8440

Merged
dayatsin-amd merged 2 commits into
developfrom
users/dayatsin/put-back-dup-dmabuf-fd
Jul 11, 2026
Merged

fix(rocr): Dup dmabuf fd on VMemoryImportShareableHandle for deferred import#8440
dayatsin-amd merged 2 commits into
developfrom
users/dayatsin/put-back-dup-dmabuf-fd

Conversation

@dayatsin-amd

@dayatsin-amd dayatsin-amd commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Re-land the dmabuf fd duplication fix from #8304, which was reverted in #8436 to unblock TheRock R-S bump.

After #6471 deferred per-GPU dmabuf import to hsa_amd_vmem_set_access time, VMemoryImportShareableHandle must own a dup of the caller's fd so deferred import still works after the caller closes its fd (normal IPC ownership). This restores correct behavior for multi-rank VMM/IPC peer-access flows (e.g. RCCL CE collectives).

Also removes LogPrint from DmaBufDup on Linux to avoid rocdxg WSL link issues (same pattern as #8436 follow-up).

Adds a rocrtst regression test that imports a shareable handle, closes the caller fd before set_access, and verifies GPU access succeeds.

JIRA ID

JIRA ID : ROCM-27777

Test plan

  • Run ImportedShareableHandleSetAccessAfterFdClose rocrtst subtest on Linux with VMM support
  • Verify HIP/RCCL multi-rank VMM peer-access reproducer from ROCM-27777 (hip-allgather-batch-cumem1.cpp)
  • Confirm WSL/rocdxg build succeeds without LogPrint link errors in DmaBufDup

Made with Cursor

dayatsin-amd and others added 2 commits July 11, 2026 02:15
Co-authored-by: Cursor <cursoragent@cursor.com>
@therock-pr-bot

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ❌ Fail Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rocr-runtime/rocrtst/suites/functional/virtual_memory.cc, projects/rocr-runtime/rocrtst/suites/functional/virtual_memory.h, projects/rocr-runtime/rocrtst/suites/test_common/main.cc, projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp, projects/rocr-runtime/runtime/hsa-runtime/core/util/lnx/os_linux.cpp (+2 more); no test file found
🔎 pre-commit ⏳ Pending ⏳ Still running…
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ Unit Test

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

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

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ Unit Test

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@shwetagkhatri shwetagkhatri 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.

LGTM.

@amd-justchen

Copy link
Copy Markdown
Contributor

Errors:
https://github.com/ROCm/rocm-systems/actions/runs/29136101237/job/86515367494?pr=8440#step:10:1716

1644 - Unit_Buffered_Printf_Flags (Failed) level_2 printf

https://github.com/ROCm/rocm-systems/actions/runs/29136101237/job/86515367484?pr=8440#step:11:1800

761 - Unit_hipMemcpyBatchAsync_H2D_Pageable_Stream_SourceAccess (Failed) level_2 memory stream transfer
1525 - Unit_hipOccupancyMaxActiveBlocksPerMultiprocessor_Positive_RangeValidation (Failed) level_2 occupancy
1533 - Unit_hipOccupancyMaxPotBlkSizeVariableSMemWithFlags_Functor (Failed) level_2 occupancy
1645 - Unit_Buffered_Printf_Specifier (Failed) level_2 printf

https://github.com/ROCm/rocm-systems/actions/runs/29136101237/job/86515367476?pr=8440#step:11:1878

6 - Unit_hiprtc_devicemalloc (SEGFAULT) integration level_2 rtc
762 - Unit_hipMemcpyBatchAsync_D2H_Functional (Failed) level_2 memory
1526 - Unit_hipOccupancyMaxActiveBlocksPerMultiprocessor_Positive_TemplateInvocation (Failed) level_2 occupancy
1534 - Unit_hipOccupancyMaxPotBlkSizeVariableSMemWithFlags_Lambda (Failed) level_2 occupancy
1642 - Unit_Printf_specifier_Sanity_Positive (Failed) level_2 printf
1646 - Unit_Host_Printf (SEGFAULT) level_2 printf
2538 - Unit_deviceAllocation_SingKernels_MulThreads (SEGFAULT) deviceLib level_2 memory

https://github.com/ROCm/rocm-systems/actions/runs/29136101237/job/86515367468?pr=8440#step:11:1890

759 - Unit_hipMemcpyBatchAsync_H2D_Functional (Failed) level_2 memory
1507 - Unit_hipEventIpc_DestroyNonBlocking (Failed) event ipc level_2 lifecycle
1531 - Unit_hipOccupancyMaxPotBlkSizeVariableSMemWithFlags_chkRange (Failed) level_2 occupancy
1539 - Unit_hipOccupancyAvailableDynamicSMemPerBlock_Positive (Failed) level_2 occupancy
2539 - Unit_deviceAllocationFollowedByDeviceReset (SEGFAULT) deviceLib level_2 memory
2847 - Unit_AccessMallocAcrossKernels (SEGFAULT) level_2 sanityTests

@dayatsin-amd

dayatsin-amd commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

These errors are not caused by this change:

Other PRs with identical Windows ROCR failures

The same 4/4 shard ROCR failure pattern appears on unrelated open PRs — same platform (gfx1151), same backend (ROCR):

PR Title
#8293 fix(rocr): Return hipErrorNotReady when fabric export not ready
#8445 Bump PAL_CLIENT_INTERFACE_MAJOR_VERSION 954 --> 995
#8439 fix(clr): remove unused x86 SSE headers
#8435 feat(rocr): PC sampling trap handler refactor and lock-free MPSC queue
#8424 Fix: [hip-tests] add --offload-device-only to copyKernel.s build target

Failure themes are printf, occupancy, memcpy batch, event IPC, RTC, and device allocation — none related to dmabuf fd duplication or deferred VMM import.

Conclusion: Windows gfx1151 ROCR hip-test failures look like a pre-existing platform baseline issue, not caused by this PR.

@dayatsin-amd dayatsin-amd merged commit 643e3cc into develop Jul 11, 2026
35 of 43 checks passed
@dayatsin-amd dayatsin-amd deleted the users/dayatsin/put-back-dup-dmabuf-fd branch July 11, 2026 13:07
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.

4 participants