Fix device side memory faults with Asan#7760
Open
fabiomestre wants to merge 1 commit into
Open
Conversation
a5b5f0b to
d6d4d67
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve AddressSanitizer (ASan) build/run stability for HIP components, with a focus on avoiding device-side faults and handling ASan flags in SPIR-V and hiprtc flows.
Changes:
- Introduces a SPIR-V-specific device flag list that drops ASan-related flags and uses it for SPIR-V kernel generation.
- Adds additional synchronization in a P2P async memcpy test before disabling peer access (to avoid races that can surface as faults).
- Disables a hiprtc test under ASan due to current COMGR handling limitations and adds ASan flag propagation in hiprtc internal compile options when hiprtc is built with ASan.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/hip-tests/catch/unit/module/CMakeLists.txt | Use SPIR-V-specific device flags for SPIR-V kernel custom targets. |
| projects/hip-tests/catch/unit/memory/hipMemcpyPeerAsync.cc | Add synchronization prior to disabling peer access in async P2P test. |
| projects/hip-tests/catch/config/configs/unit/rtc.yaml | Disable Unit_hiprtc_devicemalloc for ASan due to COMGR limitation. |
| projects/hip-tests/catch/CMakeLists.txt | Add HIP_DEVICE_BUILD_FLAGS_NO_ARCH_SPIRV and apply ASan-flag filtering for SPIR-V builds. |
| projects/clr/hipamd/src/hiprtc/hiprtcInternal.cpp | Add -fsanitize=address to hiprtc compile options when hiprtc is built with ASan. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| list(FILTER HIP_DEVICE_BUILD_FLAGS_NO_ARCH_SPIRV EXCLUDE REGEX "-fno-omit-frame-pointer") | ||
| list(FILTER HIP_DEVICE_BUILD_FLAGS_NO_ARCH_SPIRV EXCLUDE REGEX "-shared-libasan") | ||
|
|
||
| # Asan is not supported by SPIR-V, so the Asan device flags must be dropped in those case. |
Comment on lines
+134
to
+135
| HIP_CHECK(hipStreamSynchronize(stream)); | ||
| HIP_CHECK(hipDeviceSynchronize()); |
Comment on lines
+60
to
+63
| #if defined(__clang__) | ||
| #if __has_feature(address_sanitizer) | ||
| compile_options_.push_back("-fsanitize=address"); | ||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Technical Details
JIRA ID
Test Plan
Test Result
Submission Checklist