-
Notifications
You must be signed in to change notification settings - Fork 790
[DeviceMSAN] Fix false negative report due to __spirv_GroupAsyncCopy #18216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the PR's description when creating one. Like giving the context of this change and some high level summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends DeviceMSAN to correctly handle the SPIR-V __spirv_GroupAsyncCopy
intrinsic by adding a strided copy callback, demangling helper, and RTL implementation for unpoisoning shadows.
- Registers a new
__msan_unpoison_strided_copy
callback in the SPIR pass - Skips sanitization for
__spirv_GroupAsyncCopy
calls and emits a call to the new unpoison function - Implements the strided-copy logic and debug messaging in the
msan_rtl.cpp
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | Added callback registration, demangling helper, and visitor hook |
libdevice/sanitizer/msan_rtl.cpp | Introduced __msan_unpoison_strided_copy RTL with template copy |
Files not reviewed (1)
- llvm/test/Instrumentation/MemorySanitizer/SPIRV/spirv_groupasynccopy.ll: Language not supported
Comments suppressed due to low confidence (1)
libdevice/sanitizer/msan_rtl.cpp:604
- Add unit or integration tests to verify
__msan_unpoison_strided_copy
correctly handles various element sizes and stride values to prevent regressions.
void __msan_unpoison_strided_copy(uptr dest, uint32_t dest_as, uptr src,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes a false negative report caused by misidentifying __spirv_GroupAsyncCopy. Key changes include adding a new callback function (__msan_unpoison_strided_copy) with its registration in the sanitizer, introducing helper logic to demangle __spirv_GroupAsyncCopy names, and extending RTL support via a templated GroupAsyncCopy.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | Added friend declaration, new FunctionCallee for MsanUnpoisonStridedCopy, helper function for mangling demangle, and adjusted metadata exclusion for __spirv_GroupAsyncCopy calls |
libdevice/sanitizer/msan_rtl.cpp | Introduced a templated GroupAsyncCopy helper and implemented __msan_unpoison_strided_copy to support strided copy unpoisoning |
Files not reviewed (1)
- llvm/test/Instrumentation/MemorySanitizer/SPIRV/spirv_groupasynccopy.ll: Language not supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fix false negative MSan reports for __spirv_GroupAsyncCopy
by adding a custom strided-copy unpoison callback and associated runtime support.
- Register and call a new
__msan_unpoison_strided_copy
in the SPIR-V instrumenter - Exclude
__spirv_GroupAsyncCopy
from the no-sanitize filter and demangle its element type - Implement device-side shadow propagation for strided copies in the MSan RTL
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | Added MsanUnpoisonStridedCopyFunc , excluded GroupAsyncCopy from no-sanitize, demangled vector types, and emitted the strided-copy call |
libdevice/sanitizer/msan_rtl.cpp | Defined __msan_unpoison_strided_copy , shadow-copy loop template, and error message for unsupported types |
Files not reviewed (1)
- llvm/test/Instrumentation/MemorySanitizer/SPIRV/spirv_groupasynccopy.ll: Language not supported
Comments suppressed due to low confidence (1)
libdevice/sanitizer/msan_rtl.cpp:602
- The identifier
__msan_print_strided_copy_unsupport_type
has a typo; rename to__msan_print_strided_copy_unsupported_type
for consistency.
static __SYCL_CONSTANT__ const char __msan_print_strided_copy_unsupport_type[] = "[kernel] __msan_unpoison_strided_copy: unsupported type(%d)\n";
Hi @AllanZyne , please update the description, thanks. |
Hi @intel/llvm-gatekeepers, the failed tests are infrastructure issues, this PR is ready to merge, thanks! |
"__spirv_GroupAsyncCopy" is used to copy data between local and global buffer, we need to sync the shadow value of them.
I add a new function "__msan_unpoison_strided_copy" for this sync.