Skip to content

Fix device side memory faults with Asan#7760

Open
fabiomestre wants to merge 1 commit into
developfrom
fabio/fix_dev_memory_faults_asan
Open

Fix device side memory faults with Asan#7760
fabiomestre wants to merge 1 commit into
developfrom
fabio/fix_dev_memory_faults_asan

Conversation

@fabiomestre

@fabiomestre fabiomestre commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Motivation

Technical Details

JIRA ID

Test Plan

Test Result

Submission Checklist

Copilot AI review requested due to automatic review settings June 24, 2026 16:29
@fabiomestre fabiomestre requested review from a team as code owners June 24, 2026 16:29

Copilot AI 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.

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

2 participants