Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5e85b83
Use main branch for testing
Aug 28, 2026
428fd01
docs(ci): clarify which trigger consumes linux_amdgpu_families
dileepr1 Aug 12, 2026
fddd7ad
ci(asan): stop the sanity check from hiding hip-tests and rocrtst res…
dileepr1 Aug 13, 2026
90128c5
Test users/raramakr/asan-presubmit-test branch
Aug 25, 2026
4a5a96f
use latest main sha
Aug 28, 2026
de30b81
ci: update TheRock ref to test host-asan presubmit
Aug 28, 2026
05604bc
Use host-asan as build variant
Aug 31, 2026
da1647f
ci(asan): declare this workflow a presubmit gate explicitly
dileepr1 Sep 3, 2026
e95986a
ci(asan): rename presubmit input to asan_presubmit
dileepr1 Sep 8, 2026
862047f
Merge branch 'develop' into users/dravindr/asan_test
dileepr1 Sep 8, 2026
08cce2e
ci(asan): point TheRock refs at users/dravindr/host_asan_prs_test
dileepr1 Sep 9, 2026
b30b97a
ci(asan): retrigger validation run
dileepr1 Sep 9, 2026
7a68d4c
Merge remote-tracking branch 'origin/develop' into users/dravindr/asa…
dileepr1 Sep 9, 2026
10dc6b8
ci(asan): retrigger with TheRock f7df346e7 (sanity ASAN preload)
dileepr1 Sep 9, 2026
16421ae
ci(asan): retrigger with TheRock e9bf3f869 (leak suppression + error …
dileepr1 Sep 9, 2026
1ae5e21
ci(asan): retrigger with TheRock a839e1e6d (preload for hip_check)
dileepr1 Sep 9, 2026
fc398d0
ci(asan): retrigger with TheRock ab67b82e2 (absolute symbolizer path)
dileepr1 Sep 9, 2026
a70295b
ci(asan): retrigger with workflow-level ASAN env (drops script-side b…
dileepr1 Sep 10, 2026
21c53ef
ci(asan): retrigger with sanity-scoped ASAN env + per-process hip_che…
dileepr1 Sep 10, 2026
a05b287
ci(asan): retrigger with configure_asan_env.py refactor (#8123)
dileepr1 Sep 10, 2026
c783eb8
ci(asan): retrigger with verify_asan_link_order=0
dileepr1 Sep 11, 2026
12bf9b2
ci(asan): rerun with #7780 only, on current main
dileepr1 Sep 11, 2026
439d5fd
ci(asan): rerun with the baseline-gate fix
dileepr1 Sep 11, 2026
7373da8
Merge remote-tracking branch 'origin/develop' into users/dravindr/asa…
dileepr1 Sep 15, 2026
67bbb88
ci(asan): rerun with the ASAN runtime layout fixes
dileepr1 Sep 16, 2026
7826f8e
Merge remote-tracking branch 'origin/develop' into users/dravindr/asa…
dileepr1 Sep 16, 2026
b69d3ae
ci(asan): test the #8455 trigger policy instead of #7780's input
dileepr1 Sep 30, 2026
86e5631
Merge remote-tracking branch 'origin/develop' into users/dravindr/asa…
dileepr1 Sep 30, 2026
168fcad
ci(asan): re-run against the reworked TheRock#8455
dileepr1 Oct 1, 2026
bf797dd
Merge origin/develop into users/dravindr/asan_test_8455
dileepr1 Oct 12, 2026
5c6f3f7
ci(asan): keep develop's summary job rename
dileepr1 Oct 12, 2026
f501b0d
Merge remote-tracking branch 'origin/develop' into users/dravindr/asa…
dileepr1 Oct 13, 2026
c127ef4
ci(asan): pass pr_number so the external-repo path filter uses the API
dileepr1 Oct 13, 2026
865e39c
chore: touch rocrtst source to defeat the path filter
dileepr1 Oct 13, 2026
8b502b6
ci(asan): rerun with sanity non-blocking
dileepr1 Oct 14, 2026
39d9e87
Merge origin/develop into users/dravindr/asan_test_8455
dileepr1 Oct 14, 2026
16f85b9
fix(clr): instrument host objects when TheRock selects ASan
dileepr1 Oct 21, 2026
e718d5c
fix(clr): pass a plain -fsanitize=address that ccache keeps
dileepr1 Oct 21, 2026
67ab4cb
fix(clr): accept instrumented ASan symbol output
dileepr1 Oct 21, 2026
ca906e1
merge origin/develop, keeping the host-asan presubmit workflow
dileepr1 Oct 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions .github/workflows/therock-multi-arch-ci-asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
# automatically selects host-asan for pull_request events (faster, host-only)
# and full asan for workflow_dispatch (comprehensive device-side instrumentation).
#
# The presubmit is scoped to a runtime-only build (compiler-runtime and
# runtime-tests) testing hip-tests and rocrtst, so that it is cheap enough to
# run automatically on every pull request. See ROCm/TheRock#7202.
#
# TEMPORARY: TheRock users/dravindr/host_asan_8455_test lets hip-tests and
# rocrtst run even when the sanity check fails, so this validation run can
# record those failures. Revert with that workflow change.
#
# For scheduled nightly runs, see therock-multi-arch-ci-asan-nightly.yml.

name: TheRock Multi-Arch CI ASAN
Expand All @@ -24,9 +32,9 @@
type: string
description: "Insert comma-separated list of Linux GPU families to build and test. ex: gfx94X, gfx120X"
default: ""
pr_labels:
linux_test_labels:
type: string
description: "Comma-separated PR labels (e.g. ci:skip-pytorch,test:rocprim,test_filter:quick)."
description: "If enabled, reduce test set on Linux to the list of labels prefixed with 'test:'. ex: test:rocprim, test:hipcub"
default: ""
prebuilt_stages:
type: string
Expand Down Expand Up @@ -57,20 +65,30 @@

jobs:

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.

🤖 AI-assisted pre-review (for @cfreeamd)

[Required] This pins to a mutable branch ref (users/dravindr/host_asan_8455_test) rather than a commit SHA. The original lines used c01e3a3f3f67966dd35612cf363b49964f33cd47 — branch refs can be force-pushed, silently changing what the CI runs. All three ref: occurrences here must be replaced with a pinned SHA before merge.

setup:
uses: ROCm/TheRock/.github/workflows/setup_multi_arch.yml@47434387de730d51788b705e5600602dd6064997 # 2026-10-16
uses: ROCm/TheRock/.github/workflows/setup_multi_arch.yml@users/dravindr/host_asan_8455_test # 2026-09-30
with:
build_variant: "asan"
build_variant: "host-asan"
# Only applies to workflow_dispatch; a pull_request trigger starts from
# TheRock's presubmit family defaults and drops every family that has no
# host-asan variant, which leaves gfx94X either way.
linux_amdgpu_families: ${{ inputs.linux_amdgpu_families || 'gfx94X' }}
linux_test_labels: ${{ inputs.linux_test_labels || 'test:hip-tests,test:rocrtst' }}
# Runtime-only build: everything outside these two stages, math-libs
# included, is dropped from the build graph.
build_stages: "compiler-runtime,runtime-tests"
# No presubmit opt-in input here: host-asan lists "presubmit" in its
# tests_on_trigger in amdgpu_family_matrix.py, so reaching this gate with
# a host-asan build is enough to claim a sandbox test runner.
build_native_linux: false
# Python/PyTorch/JAX builds are not supported with ASAN yet
build_python_packages: false
build_pytorch: false
build_jax: false
linux_amdgpu_families: ${{ inputs.linux_amdgpu_families || 'gfx94X,gfx950,gfx125X' }}
pr_labels: ${{ inputs.pr_labels || '' }}
prebuilt_stages: ${{ inputs.prebuilt_stages || '' }}
baseline_run_id: ${{ inputs.baseline_run_id || '' }}
baseline_repository: ${{ inputs.baseline_repository || (inputs.baseline_run_id != '' && github.repository) || '' }}
repository: ROCm/TheRock
ref: 47434387de730d51788b705e5600602dd6064997 # 2026-10-16
ref: users/dravindr/host_asan_8455_test # 2026-09-30
external_repo: >-
{
"repository": "${{ github.repository }}",
Expand All @@ -90,7 +108,7 @@
needs.setup.outputs.linux_build_config != '' &&
needs.setup.outputs.enable_build_jobs == 'true'
}}
uses: ROCm/TheRock/.github/workflows/multi_arch_ci_linux.yml@47434387de730d51788b705e5600602dd6064997 # 2026-10-16
uses: ROCm/TheRock/.github/workflows/multi_arch_ci_linux.yml@users/dravindr/host_asan_8455_test # 2026-09-30
with:
build_config: ${{ needs.setup.outputs.linux_build_config }}
test_labels: ${{ needs.setup.outputs.linux_test_labels }}
Expand All @@ -100,7 +118,7 @@
test_type: ${{ needs.setup.outputs.test_type }}
external_repo_config: ${{ needs.setup.outputs.external_repo_config }}
repository: ROCm/TheRock
ref: 47434387de730d51788b705e5600602dd6064997 # 2026-10-16
ref: users/dravindr/host_asan_8455_test # 2026-09-30
permissions:
contents: read
id-token: write
Expand All @@ -118,14 +136,13 @@
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: "ROCm/TheRock"
ref: 47434387de730d51788b705e5600602dd6064997 # 2026-10-16
ref: users/dravindr/host_asan_8455_test # 2026-09-30
sparse-checkout: build_tools/github_actions
sparse-checkout-cone-mode: true

- name: Evaluate workflow results
env:
GITHUB_TOKEN: ${{ github.token }}
NEEDS_JSON: ${{ toJSON(needs) }}
run: |
python build_tools/github_actions/workflow_summary.py \
--needs-json "${NEEDS_JSON}"
--needs-json '${{ toJSON(needs) }}'
73 changes: 64 additions & 9 deletions projects/clr/cmake/CLRSanitizers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ endif()

# TheRock injects THEROCK_SANITIZER variable. It takes precedence over ENABLE_SANITIZER.
if(THEROCK_SANITIZER STREQUAL "ASAN" OR THEROCK_SANITIZER STREQUAL "HOST_ASAN")
# TheRock puts the host -fsanitize=address flags on the compile line itself. Fail if they
# are absent, because CLR adds none of its own in this mode and would build uninstrumented.
# The enclosing toolchain must already be selecting a sanitizer. CLR still
# appends the host flags below; this only rejects a THEROCK_SANITIZER value
# that never reached the toolchain file.
if(NOT (CMAKE_CXX_FLAGS_INIT MATCHES "-fsanitize=address"
OR CMAKE_CXX_FLAGS MATCHES "-fsanitize=address"))
message(FATAL_ERROR
"THEROCK_SANITIZER='${THEROCK_SANITIZER}' but no -fsanitize=address reaches the C++ "
"compile line. CLR does not add host flags when THEROCK_SANITIZER is set. For a "
"standalone build pass -DENABLE_SANITIZER=${THEROCK_SANITIZER} instead.")
"compile line. For a standalone build pass -DENABLE_SANITIZER=${THEROCK_SANITIZER} "
"instead.")
endif()
set(ENABLE_SANITIZER "${THEROCK_SANITIZER}")
endif()
Expand Down Expand Up @@ -68,9 +69,17 @@ else()
add_compile_definitions(DEVICE_ADDRESS_SANITIZER=0)
endif()

# Host instrumentation. Skipped under TheRock, which already instruments the C and C++
# compile lines through CMAKE_CXX_FLAGS_INIT.
if(NOT ENABLE_SANITIZER STREQUAL "OFF" AND NOT THEROCK_SANITIZER)
# Host instrumentation. Always applied, including under TheRock.
# TheRock's HOST_ASAN path puts -Xarch_host -fsanitize=address in
# CMAKE_*_FLAGS_INIT and links with -fsanitize=address, but FLAGS_INIT is not
# re-copied into CMAKE_*_FLAGS on a reconfigure. The shipped libamdhip64 then
# NEEDs libclang_rt.asan.so and only has the weak __asan_report_* stubs from
# the link line, so hipFree aborts with "free on address which was not
# malloc()-ed". Appending the flags here is what the compiler actually uses.
# Repeating -fsanitize=address is harmless when the enclosing build already
# added it. These are host C/C++ flags; device bitcode is compiled by hiprtc
# custom commands that do not inherit CMAKE_CXX_FLAGS.
if(NOT ENABLE_SANITIZER STREQUAL "OFF")
set(_linker_flags "-fsanitize=address")
set(_compiler_flags "-fno-omit-frame-pointer -fsanitize=address")
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand All @@ -88,9 +97,55 @@ if(NOT ENABLE_SANITIZER STREQUAL "OFF" AND NOT THEROCK_SANITIZER)
"${CMAKE_EXE_LINKER_FLAGS} ${_linker_flags} -Wl,--build-id=sha1")
set(CMAKE_SHARED_LINKER_FLAGS
"${CMAKE_SHARED_LINKER_FLAGS} ${_linker_flags} -Wl,--build-id=sha1")

# Directory and target options, not only CMAKE_*_FLAGS. ccache drops
# -Xarch_* unless the compile also passes -arch, so TheRock's
# -Xarch_host -fsanitize=address never reaches clang and the cached objects
# are uninstrumented. A plain -fsanitize=address is what the compiler and
# ccache both keep. These sources are host C/C++; hiprtc device commands
# do not inherit them.
add_compile_options(
"$<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>"
"$<$<COMPILE_LANGUAGE:C,CXX>:-fsanitize=address>")
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND BUILD_SHARED_LIBS)
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:-shared-libsan>")
add_link_options(
"$<$<LINK_LANGUAGE:C,CXX>:-fsanitize=address>"
"$<$<LINK_LANGUAGE:C,CXX>:-shared-libsan>")
endif()
unset(_compiler_flags)
unset(_linker_flags)
message(STATUS "CLR sanitizer: ${ENABLE_SANITIZER} (host flags applied by CLR)")
elseif(NOT ENABLE_SANITIZER STREQUAL "OFF")
message(STATUS "CLR sanitizer: ${ENABLE_SANITIZER} (host flags from the enclosing build)")
endif()

# Attach the host sanitizer to one target. add_compile_options above covers
# targets created later in this directory tree; call this for targets that
# must stay instrumented even if a subdirectory replaces the directory flags.
function(clr_asan_instrument_target target)
if(ENABLE_SANITIZER STREQUAL "OFF")
return()
endif()
target_compile_options(${target} PRIVATE
"$<$<COMPILE_LANGUAGE:C,CXX>:-fno-omit-frame-pointer>"
"$<$<COMPILE_LANGUAGE:C,CXX>:-fsanitize=address>")
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND BUILD_SHARED_LIBS)
target_compile_options(${target} PRIVATE
"$<$<COMPILE_LANGUAGE:C,CXX>:-shared-libsan>")
target_link_options(${target} PRIVATE -fsanitize=address -shared-libsan)
endif()
endfunction()

# Fail the build if a shared library was only linked with ASan. Link-only
# -fsanitize=address emits weak __asan_report_* symbols and no __asan_init.
function(clr_require_asan_instrumentation target)
if(ENABLE_SANITIZER STREQUAL "OFF" OR NOT BUILD_SHARED_LIBS OR NOT UNIX)
return()
endif()
add_custom_command(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND}
-DFILE=$<TARGET_FILE:${target}>
-P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/check_asan_instrumentation.cmake
COMMENT "Verifying ${target} is instrumented with ASan"
VERBATIM)
endfunction()
42 changes: 42 additions & 0 deletions projects/clr/cmake/check_asan_instrumentation.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
#
# SPDX-License-Identifier: MIT

# Post-build check invoked as:
# cmake -DFILE=<shared object> -P check_asan_instrumentation.cmake
# A link-only -fsanitize=address DSO has weak __asan_report_* symbols and no
# __asan_init. Instrumented objects reference __asan_init.

if(NOT FILE)
message(FATAL_ERROR "FILE must be the shared object to check")
endif()

find_program(NM_TOOL NAMES nm llvm-nm REQUIRED)
execute_process(
COMMAND ${NM_TOOL} -D ${FILE}
RESULT_VARIABLE _nm_rc
OUTPUT_VARIABLE _nm_out
ERROR_VARIABLE _nm_err)
if(NOT _nm_rc EQUAL 0)
message(FATAL_ERROR "nm -D ${FILE} failed (${_nm_rc}): ${_nm_err}")
endif()
# __asan_init is emitted only when at least one object was instrumented.
# Do not anchor this to whitespace: CMake's regex engine does not treat a
# newline after the symbol as a line boundary for `$`, which made a genuine
# `U __asan_init` false-negative after llvm-strip.
if(NOT _nm_out MATCHES "__asan_init")
set(_asan_lines "")
string(REPLACE "\n" ";" _nm_lines "${_nm_out}")
foreach(_line IN LISTS _nm_lines)
if(_line MATCHES "asan")
string(APPEND _asan_lines "\n ${_line}")
endif()
endforeach()
if(_asan_lines STREQUAL "")
set(_asan_lines "\n (no asan symbols in the dynamic table)")
endif()
message(FATAL_ERROR
"${FILE} is not instrumented with ASan (dynamic symbol __asan_init is missing). "
"The library was linked with the ASan runtime but its objects were not compiled "
"with -fsanitize=address. Dynamic asan symbols:${_asan_lines}")
endif()
7 changes: 7 additions & 0 deletions projects/clr/hipamd/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,10 @@ install(
DESTINATION
${CONFIG_LANG_PACKAGE_INSTALL_DIR}/
)

if(COMMAND clr_asan_instrument_target)
clr_asan_instrument_target(amdhip64)
endif()
if(COMMAND clr_require_asan_instrumentation)
clr_require_asan_instrumentation(amdhip64)
endif()
4 changes: 4 additions & 0 deletions projects/clr/rocclr/cmake/ROCclr.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,7 @@ endif()
if(ROCCLR_ENABLE_PAL)
include(ROCclrPAL)
endif()

if(COMMAND clr_asan_instrument_target)
clr_asan_instrument_target(rocclr)
endif()
2 changes: 2 additions & 0 deletions projects/rocr-runtime/rocrtst/common/os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ char* GetEnv(const char* env_var_name) {
}

} // namespace rocrtst

// Touched to force a CI build for host-ASAN validation (TheRock#8455). Revert before merge.

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.

🤖 AI-assisted pre-review (for @cfreeamd)

[Required] This comment-touch must be reverted before merge (as the comment itself notes). No functional change — just a CI trigger artifact.

Loading