1517a398bf
* [rocprofiler-sdk] Fix buffer flush ordering and sanitizer CI improvements Buffer Pool Design ------------------ Replace the fixed array-based double buffer with a dynamic pool design to fix race conditions that caused "internal correlation id was retired prematurely" errors. The original design had a race where flush callbacks could be delivered out-of-order: when buffer 0 fills and begins flushing, writes go to buffer 1. If buffer 1 fills before buffer 0's flush completes, the buffer index wraps back to 0 (which may still be flushing). Independent flush tasks submitted to the thread pool can complete out of order. The new pool design: - Uses a std::deque of buffer instances that grows as needed - Allocates buffers from the pool when the current buffer needs to flush - Serializes flushes with a mutex to ensure FIFO callback ordering - Returns buffers to the pool after flush completion - Eliminates the race between buffer selection and write operations New Unit Tests -------------- - buffer_correlation_ordering.cpp: Tests that API records are always delivered before their corresponding retirement records - buffer_ordering_stress.cpp: Stress tests buffer flush ordering under high contention with multiple threads rapidly filling buffers HSA Tool Hooks -------------- Added hsa_tool_hooks.cpp/hpp to register an HSA OnUnload callback that waits for pending flush tasks before tool finalization, preventing "retired prematurely" errors during HSA shutdown. Sanitizer Improvements ---------------------- - LSAN: Set fast_unwind_on_malloc=1 to prevent deadlock in libgcc unwinder - LSAN: Added suppressions for external tools (liblzma, liblsan, seq, strdup) - TSAN: Added suppression for false positive on C++11 thread-safe static initialization in create_write_functor - ASAN/UBSAN: Added patterns for known issues in HSA runtime, HIP, perfetto - Disabled attachment tests for sanitizers due to library preloading issues Other Fixes ----------- - Thread-trace agent test: Use heap-allocated callback state - Correlation ID: Refactored reference counting and finalization ordering * [rocprofiler-sdk] Revert buffer pool design changes Revert buffer.cpp and buffer.hpp to the original double-buffer design from develop branch. The pool-based redesign introduced concerns about: - Signal safety (mutex vs atomic_flag) - API changes (flush() return type) - Complexity of the new design This revert removes: - Dynamic buffer pool with std::deque - std::mutex/condition_variable synchronization - buffer_correlation_ordering.cpp test - buffer_ordering_stress.cpp test The underlying buffer flush ordering issue will need to be addressed with a different approach that preserves the original API and synchronization characteristics. * [rocprofiler-sdk] Consistent fini_status checks to prevent correlation ID creation during finalization - Revert TOCTOU CAS loop change in sub_ref_count() - not needed with consistent checks - Add fini_status check in correlation_tracing_service::construct() with ROCP_CI_LOG warning - Add nullptr checks at all construct() call sites (queue.cpp, async_copy.cpp, memory_allocation.cpp) - Change all 'get_fini_status() > 0' to '!= 0' for consistent behavior: - hsa/queue.cpp (lines 105, 210) - hsa/async_copy.cpp (line 344) - hsa/hsa_barrier.cpp (line 43) - buffer.cpp (lines 107, 138, 185) This ensures no correlation IDs are created once finalization starts (fini_status != 0), preventing races between finalization and ongoing tracing operations. * [rocprofiler-sdk] Replace arrival-order checks with timestamp-based temporal validation Buffer records are not guaranteed to arrive in any specific order. Tests and samples should use timestamps for temporal ordering validation instead. Changes: - samples/external_correlation_id_request: Replace 'retired prematurely' arrival order check with timestamp-based validation that retirement timestamp >= max(end_timestamps) for records with the same correlation ID - tests/external_correlation.cpp: Remove EXPECT_GT(corr_id, last_corr_id) check - tests/registration.cpp: Remove EXPECT_GT(corr_id, last_corr_id) check - tests/roctx.cpp: Remove EXPECT_GT(corr_id, last_corr_id) check Correlation IDs are not guaranteed to be monotonically increasing when records are sorted by timestamp. Temporal ordering should be validated using the timestamp fields in each record. * [rocprofiler-sdk] Revert external/CMakeLists.txt SYSTEM keyword removal Restore the SYSTEM keyword to target_include_directories for rocprofiler-sdk-fmt to match develop branch. * [rccl] Remove orphaned rocSHMEM gitlink Remove orphaned submodule reference that was introduced during a merge but never had a corresponding .gitmodules entry, causing CI failures with "fatal: no submodule mapping found in .gitmodules". * [rocprofiler-sdk] Add HSA ABI version 0x09 support Add ABI checks for HSA_AMD_EXT_API_TABLE_STEP_VERSION 0x09 which introduces hsa_amd_counted_queue_acquire and hsa_amd_counted_queue_release functions (added in rocr-runtime SWDEV-561708). * [rocprofiler-sdk] Handle finalized status gracefully in buffer flush operations This commit consolidates fixes for handling the finalization status during buffer flush operations across the SDK. Changes: - Tool and samples: Handle ROCPROFILER_STATUS_ERROR_FINALIZED gracefully when flushing buffers, as this indicates buffers were already flushed during finalization (not an error condition) - HSA handlers (queue.cpp, async_copy.cpp, hsa_barrier.cpp): Use > 0 check for fini_status to allow operations during finalization process - buffer.cpp: Revert fini_status checks to use > 0 for consistency - correlation_id.cpp: Add fini_status > 0 check with ROCP_TRACE logging to prevent correlation ID creation after finalization starts Files modified: - source/lib/rocprofiler-sdk-tool/tool.cpp - tests/tools/json-tool.cpp - source/lib/rocprofiler-sdk/tests/registration.cpp - source/lib/rocprofiler-sdk/tests/roctx.cpp - samples/api_buffered_tracing/client.cpp - samples/counter_collection/buffered_client.cpp - samples/counter_collection/device_counting_async_client.cpp - samples/external_correlation_id_request/client.cpp - samples/pc_sampling/client.cpp - source/lib/rocprofiler-sdk/buffer.cpp - source/lib/rocprofiler-sdk/context/correlation_id.cpp - source/lib/rocprofiler-sdk/hsa/queue.cpp - source/lib/rocprofiler-sdk/hsa/async_copy.cpp - source/lib/rocprofiler-sdk/hsa/hsa_barrier.cpp * [rocprofiler-sdk] Remove hsa_tool_hooks and simplify buffer flush handling Remove the hsa_tool_hooks infrastructure and simplify buffer flush calls in samples and tools. The ERROR_FINALIZED handling was overly complex and the hsa_tool_hooks OnUnload synchronization is no longer needed. Changes: - Remove hsa_tool_hooks.cpp/hpp and related registration.cpp code - Simplify buffer flush calls in samples to use direct ROCPROFILER_CALL - Simplify buffer flush in tool.cpp and json-tool.cpp - Remove ERROR_FINALIZED special handling from test files Co-Authored-By: Claude <noreply@anthropic.com> * [rocprofiler-sdk] Fix output_stream move semantics to null source pointers The default move constructor and move assignment operator for output_stream did not null out the source's pointers after the move. This caused double-close when the moved-from temporary was destroyed, leading to use-after-free crashes (SIGSEGV in std::ostream::sentry). Co-Authored-By: Claude <noreply@anthropic.com> * [rocprofiler-sdk] Improve Perfetto trace writer and sanitizer configuration - generatePerfetto.cpp: Move output_stream into shared_state to prevent use-after-free race conditions during Perfetto callback execution - run-ci.py: Simplify and consolidate sanitizer environment variable configuration for better maintainability Co-Authored-By: Claude <noreply@anthropic.com> * [rocprofiler-sdk] Revert run-ci.py changes that broke sanitizer suppressions The previous changes removed MEMCHECK_SANITIZER_OPTIONS which is required for CTest to properly pass suppression files to the sanitizers during memcheck runs. Co-Authored-By: Claude <noreply@anthropic.com> * Revert "[rccl] Remove orphaned rocSHMEM gitlink" This reverts commit 1ad21003941355658fff8114fa27768f11a948f7. * [rocprofiler-sdk] Revert registration.cpp changes Revert changes to registration.cpp to match develop branch. Co-Authored-By: Claude <noreply@anthropic.com> * [rocprofiler-sdk] Remove suppression file content printing from run-ci.py Co-Authored-By: Claude <noreply@anthropic.com> * Fix output_stream move ctor/assignment operator * Fix erroneous revert of registration.cpp * Fix handling of fini status in correlation ID construction * [rocprofiler-sdk] Fix OMPT segfault during finalization Add nullptr checks in OMPT tracing code to handle the case where correlation_tracing_service::construct() returns nullptr during finalization. This fixes segfaults in openmp-target-sample and tests.integration.execute.openmp-tools. The correlation ID construction now returns nullptr when fini_status > 0, but the OMPT callbacks were not checking for this, causing crashes when dereferencing the null pointer during OpenMP runtime shutdown. Changes: - event_common(): Return nullptr early if correlation ID is null - event(): Check for nullptr before calling sub_ref_count() - ompt_task_create_callback(): Return early if correlation ID is null - ompt_task_schedule_callback(): Return early if correlation ID is null * [rocprofiler-sdk] Fix HSA API tracing segfault during finalization Add nullptr check in hsa_api_impl::functor after correlation ID construction. During finalization, correlation_service::construct() returns nullptr, and without this check the code would dereference the null pointer when accessing corr_id->internal. This fixes the SEGV at address 0x000000000008 (null + 8 byte offset) that occurs when HSA async event threads call hsa_signal_destroy during runtime shutdown after finalization has started. --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
557 line
22 KiB
YAML
557 line
22 KiB
YAML
name: rocprofiler-sdk Code Coverage
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- develop
|
|
paths:
|
|
- 'projects/rocprofiler-sdk/**'
|
|
- '.github/workflows/rocprofiler-sdk-code_coverage.yml'
|
|
- '!**/*.md'
|
|
- '!**/*.rtf'
|
|
- '!**/*.rst'
|
|
- '!**/.markdownlint-ci2.yaml'
|
|
- '!**/.readthedocs.yaml'
|
|
- '!**/.spellcheck.local.yaml'
|
|
- '!**/.wordlist.txt'
|
|
- '!projects/rocprofiler-sdk/CODEOWNERS'
|
|
- '!projects/rocprofiler-sdk/source/docs/**'
|
|
pull_request:
|
|
paths:
|
|
- 'projects/rocprofiler-sdk/**'
|
|
- '.github/workflows/rocprofiler-sdk-code_coverage.yml'
|
|
- '!**/*.md'
|
|
- '!**/*.rtf'
|
|
- '!**/*.rst'
|
|
- '!**/.markdownlint-ci2.yaml'
|
|
- '!**/.readthedocs.yaml'
|
|
- '!**/.spellcheck.local.yaml'
|
|
- '!**/.wordlist.txt'
|
|
- '!projects/rocprofiler-sdk/CODEOWNERS'
|
|
- '!projects/rocprofiler-sdk/source/docs/**'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
# TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_TARGETS, etc. with internal handling in cmake
|
|
ROCM_PATH: "/opt/rocm"
|
|
ROCM_VERSION: "7.0.0"
|
|
GPU_TARGETS: "gfx906 gfx908 gfx90a gfx942 gfx950 gfx1030 gfx1100 gfx1101 gfx1102 gfx1201"
|
|
PATH: "/usr/bin:$PATH"
|
|
## No tests should be excluded here except for extreme emergencies; tests should only be disabled in CMake
|
|
## A task should be assigned directly to fix the issue
|
|
## Scratch memory tests need to be fixed for ROCm 7.0 release
|
|
navi3_EXCLUDE_TESTS_REGEX: ""
|
|
vega20_EXCLUDE_TESTS_REGEX: ""
|
|
mi200_EXCLUDE_TESTS_REGEX: ""
|
|
mi300_EXCLUDE_TESTS_REGEX: ""
|
|
mi300a_EXCLUDE_TESTS_REGEX: ""
|
|
mi325_EXCLUDE_TESTS_REGEX: ""
|
|
mi3xx_EXCLUDE_TESTS_REGEX: ""
|
|
navi4_EXCLUDE_TESTS_REGEX: ""
|
|
navi3_EXCLUDE_LABEL_REGEX: ""
|
|
vega20_EXCLUDE_LABEL_REGEX: ""
|
|
mi200_EXCLUDE_LABEL_REGEX: ""
|
|
mi300_EXCLUDE_LABEL_REGEX: ""
|
|
mi300a_EXCLUDE_LABEL_REGEX: ""
|
|
mi325_EXCLUDE_LABEL_REGEX: ""
|
|
mi3xx_EXCLUDE_LABEL_REGEX: ""
|
|
navi4_EXCLUDE_LABEL_REGEX: ""
|
|
GLOBAL_CMAKE_OPTIONS: ""
|
|
ENABLE_ROCR_BUILD: "true"
|
|
ENABLE_HIP_CLR_BUILD: "true"
|
|
|
|
jobs:
|
|
code-coverage:
|
|
# TEMPORARILY DISABLED: pending CI stabilization
|
|
if: false
|
|
name: Code Coverage • ${{ matrix.system.gpu }} • ${{ matrix.system.os }}
|
|
strategy:
|
|
# fail-fast: false
|
|
matrix:
|
|
system:
|
|
- { gpu: 'mi300a', runner: 'rocprofiler-mi300a-dind', os: 'ubuntu-22.04', build-type: 'Release', gpu-target: 'gfx94X' }
|
|
|
|
runs-on: ${{ matrix.system.runner }}
|
|
container:
|
|
image: docker.io/rocm/rocprofiler-private:${{ matrix.system.os }}-${{ matrix.system.gpu-target }}-latest
|
|
credentials:
|
|
username: ${{ secrets.ROCPROFILER_AZURE_CI_USER }}
|
|
password: ${{ secrets.ROCPROFILER_AZURE_CI_PASS }}
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive
|
|
options: --privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
|
|
|
|
# define this for containers
|
|
env:
|
|
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
|
|
GPU_RUNNER: ${{ matrix.system.runner }}
|
|
GCC_COMPILER_VERSION: 11
|
|
ROCPROFILER_PC_SAMPLING_BETA_ENABLED: 1
|
|
|
|
steps:
|
|
- name: Install Latest Nightly ROCm
|
|
shell: bash
|
|
working-directory: /tmp
|
|
run: |
|
|
tar -xf ${{ env.ROCM_PATH }}-${{ matrix.system.gpu-target }}.tar.gz -C ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}
|
|
ln -s ${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} ${{ env.ROCM_PATH }}
|
|
echo "ROCm installed to: ${{ env.ROCM_PATH }}"
|
|
|
|
- name: Clone ROCProfiler SDK & AQLProfile & ROCProfiler Register & ROCR-Runtime
|
|
uses: actions/checkout@v5
|
|
with:
|
|
sparse-checkout: |
|
|
projects/rocprofiler-sdk
|
|
projects/aqlprofile
|
|
projects/rocprofiler-register
|
|
projects/rocr-runtime
|
|
projects/clr
|
|
projects/hip
|
|
submodules: false
|
|
set-safe-directory: true
|
|
|
|
- name: Compute submodule cache key
|
|
id: submods
|
|
shell: bash
|
|
run: |
|
|
git config --global --add safe.directory '*'
|
|
git submodule status --recursive | awk '{print $1,$2}' > .git-submodules-status
|
|
echo "hash=$(sha256sum .git-submodules-status | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
|
|
# collect submodule paths for cache 'path'
|
|
git config --file .gitmodules --get-regexp path | awk '{print $2}' > .git-submodule-paths
|
|
{ echo "paths<<EOF"; cat .git-submodule-paths; echo "EOF"; } >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore submodule cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
.git/modules
|
|
${{ steps.submods.outputs.paths }}
|
|
key: submods-${{ runner.os }}-${{ steps.submods.outputs.hash }}
|
|
restore-keys: |
|
|
submods-${{ runner.os }}-
|
|
submods-
|
|
|
|
- name: Init/Update submodules
|
|
run: git submodule update --init --recursive --jobs 16
|
|
|
|
- name: Clone ROCDecode
|
|
uses: actions/checkout@v5
|
|
with:
|
|
repository: 'ROCm/rocDecode'
|
|
ref: 'release/rocm-rel-7.0'
|
|
set-safe-directory: true
|
|
path: 'rocDecode'
|
|
|
|
- name: Clone ROCJPEG
|
|
uses: actions/checkout@v5
|
|
with:
|
|
repository: 'ROCm/rocJPEG'
|
|
ref: 'release/rocm-rel-7.0'
|
|
set-safe-directory: true
|
|
path: 'rocJPEG'
|
|
|
|
- name: Load Existing XML Code Coverage
|
|
if: github.event_name == 'pull_request'
|
|
id: load-coverage
|
|
uses: actions/cache@v4
|
|
with:
|
|
key: ${{ github.event.pull_request.base.sha }}-codecov
|
|
path: .codecov/**
|
|
|
|
- name: Copy Existing XML Code Coverage
|
|
if: github.event_name == 'pull_request'
|
|
shell: bash
|
|
run: |
|
|
if [ -d .codecov ]; then cp -r .codecov .codecov.ref; fi
|
|
|
|
- name: Configure Env
|
|
shell: bash
|
|
run: |
|
|
echo "${PATH}:/usr/local/bin:${HOME}/.local/bin" >> $GITHUB_PATH
|
|
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:${HOME}/.local/lib" >> $GITHUB_ENV
|
|
|
|
- name: Install requirements
|
|
timeout-minutes: 10
|
|
shell: bash
|
|
working-directory: projects/rocprofiler-sdk
|
|
run: |
|
|
git config --global --add safe.directory '*'
|
|
apt-get update
|
|
apt-get install -y build-essential cmake python3-pip gcovr wkhtmltopdf xvfb xfonts-base xfonts-75dpi xfonts-100dpi xfonts-utils xfonts-encodings libfontconfig libdw-dev libsqlite3-dev libdrm-dev file autoconf pkg-config rpm libzstd-dev
|
|
python3 -m pip install -U --user -r requirements.txt
|
|
rm -rf \
|
|
${{ env.ROCM_PATH }}/lib/*rocprofiler-sdk* \
|
|
${{ env.ROCM_PATH }}/lib/cmake/*rocprofiler-sdk* \
|
|
${{ env.ROCM_PATH }}/share/*rocprofiler-sdk* \
|
|
${{ env.ROCM_PATH }}/libexec/*rocprofiler-sdk* \
|
|
${{ env.ROCM_PATH }}*/lib/python*/site-packages/roctx \
|
|
${{ env.ROCM_PATH }}*/lib/python*/site-packages/rocpd
|
|
|
|
- name: Sync gcov with compilers
|
|
timeout-minutes: 10
|
|
shell: bash
|
|
run:
|
|
apt-get install -y gcc-${{ env.GCC_COMPILER_VERSION }} g++-${{ env.GCC_COMPILER_VERSION }} &&
|
|
update-alternatives
|
|
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_COMPILER_VERSION }} 500
|
|
--slave /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_COMPILER_VERSION }}
|
|
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_COMPILER_VERSION }}
|
|
|
|
- name: List Files
|
|
shell: bash
|
|
working-directory: projects/rocprofiler-sdk
|
|
run: |
|
|
echo "PATH: ${PATH}"
|
|
echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
|
|
which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; }
|
|
for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done
|
|
cat ${{ env.ROCM_PATH }}/.info/version
|
|
ls -la
|
|
|
|
- name: Enable PC Sampling
|
|
if: ${{ contains(matrix.system.gpu, 'mi200') || contains(matrix.system.gpu, 'mi300a') }}
|
|
shell: bash
|
|
working-directory: projects/rocprofiler-sdk
|
|
run: |
|
|
echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV
|
|
|
|
- name: Setup ccache
|
|
uses: hendrikmuhs/ccache-action@63069e3931dedbf3b63792097479563182fe70d1 # v1.2.18
|
|
with:
|
|
key: ccache-${{ matrix.system.os }}-${{ matrix.system.runner }}-${{ matrix.system.gpu }}
|
|
max-size: 2G
|
|
save: true
|
|
|
|
- name: Install Missing ROCm Dependencies
|
|
shell: bash
|
|
run: |
|
|
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
|
|
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:/usr/local/bin:~/.local/bin:$PATH
|
|
echo -e "Building & Installing ROCDecode..."
|
|
cmake -B build-rocdecode \
|
|
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
|
|
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} \
|
|
-DCMAKE_CXX_COMPILER=${{ env.ROCM_PATH }}/bin/amdclang++ \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
${GITHUB_WORKSPACE}/rocDecode
|
|
cmake --build build-rocdecode --target all --parallel 16
|
|
cmake --build build-rocdecode --target install
|
|
echo -e "ROCDecode Installed Successfully!"
|
|
echo -e "Building & Installing ROCJPEG..."
|
|
cmake -B build-rocjpeg \
|
|
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
|
|
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }} \
|
|
-DCMAKE_CXX_COMPILER=${{ env.ROCM_PATH }}/bin/amdclang++ \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
${GITHUB_WORKSPACE}/rocJPEG
|
|
cmake --build build-rocjpeg --target all --parallel 16
|
|
cmake --build build-rocjpeg --target install
|
|
echo -e "ROCJPEG Installed Successfully!"
|
|
|
|
- name: Build and Install ROCProfiler-Register
|
|
shell: bash
|
|
working-directory: projects/rocprofiler-register
|
|
run: |
|
|
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
|
|
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:/usr/local/bin:~/.local/bin:$PATH
|
|
echo "Install ROCProfiler-Register"
|
|
cmake -B build-rocprofiler-register \
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
|
|
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
.
|
|
cmake --build build-rocprofiler-register --target all --parallel 16
|
|
cmake --build build-rocprofiler-register --target install
|
|
echo "✅ ROCProfiler-Register Installation complete!"
|
|
|
|
- name: Build and Install ROCR-Runtime
|
|
if: ${{ env.ENABLE_ROCR_BUILD == 'true' }}
|
|
shell: bash
|
|
working-directory: projects/rocr-runtime
|
|
run: |
|
|
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
|
|
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:/usr/local/bin:~/.local/bin:$PATH
|
|
echo "Install ROCR-Runtime..."
|
|
cmake -B build \
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }};${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}/llvm' \
|
|
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
|
|
.
|
|
cmake --build build --target all --parallel 16
|
|
cmake --build build --target install
|
|
echo "✅ ROCR-Runtime Installation complete!"
|
|
|
|
- name: Build and Install HIP
|
|
if: ${{ env.ENABLE_HIP_CLR_BUILD == 'true' }}
|
|
shell: bash
|
|
working-directory: projects
|
|
run: |
|
|
export HIP_DIR=$PWD/hip
|
|
export CLR_DIR=$PWD/clr
|
|
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
|
|
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$PATH
|
|
echo "Install HIP..."
|
|
cd $CLR_DIR
|
|
cmake \
|
|
-DHIP_COMMON_DIR=$HIP_DIR \
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
-DHIP_PLATFORM=amd \
|
|
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }};${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }}/llvm' \
|
|
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
|
|
-DHIP_LLVM_ROOT=${{ env.ROCM_PATH }}/lib/llvm \
|
|
-DHIP_CATCH_TEST=0 \
|
|
-DCLR_BUILD_HIP=ON \
|
|
-DCLR_BUILD_OCL=ON \
|
|
-S $CLR_DIR \
|
|
-B build
|
|
cmake --build build --target all --parallel 16
|
|
cmake --build build --target install
|
|
echo "✅ HIP Installation complete!"
|
|
|
|
- name: Build and Install Aqlprofile
|
|
shell: bash
|
|
working-directory: projects/aqlprofile
|
|
run: |
|
|
export LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
|
|
export PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:/usr/local/bin:~/.local/bin:$PATH
|
|
echo "Install Aqlprofile..."
|
|
cmake -B build-aqlprofile \
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
-DCMAKE_PREFIX_PATH=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
|
|
-DCMAKE_INSTALL_PREFIX=${{ env.ROCM_PATH }}-${{ env.ROCM_VERSION }} \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
.
|
|
cmake --build build-aqlprofile --target all --parallel 16
|
|
cmake --build build-aqlprofile --target install
|
|
echo "✅ AQLProfile Installation complete!"
|
|
|
|
- name: Configure, Build, and Test (Total Code Coverage)
|
|
timeout-minutes: 30
|
|
shell: bash
|
|
working-directory: projects/rocprofiler-sdk
|
|
run:
|
|
LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
|
|
PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH
|
|
python3 ./source/scripts/run-ci.py -B build
|
|
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov
|
|
--build-jobs 16
|
|
--site ${{ matrix.system.runner }}
|
|
--gpu-targets ${{ env.GPU_TARGETS }}
|
|
--coverage all
|
|
--run-attempt ${{ github.run_attempt }}
|
|
--
|
|
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
|
|
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm'
|
|
-DPython3_EXECUTABLE=$(which python3)
|
|
${{ env.GLOBAL_CMAKE_OPTIONS }}
|
|
--
|
|
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
|
|
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
|
|
|
|
- name: Configure, Build, and Test (Tests Code Coverage)
|
|
timeout-minutes: 30
|
|
shell: bash
|
|
working-directory: projects/rocprofiler-sdk
|
|
run:
|
|
find build -type f | egrep '\.gcda$' | xargs rm &&
|
|
LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
|
|
PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH
|
|
python3 ./source/scripts/run-ci.py -B build
|
|
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov-tests
|
|
--build-jobs 16
|
|
--site ${{ matrix.system.runner }}
|
|
--gpu-targets ${{ env.GPU_TARGETS }}
|
|
--coverage tests
|
|
--run-attempt ${{ github.run_attempt }}
|
|
--
|
|
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
|
|
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm'
|
|
-DPython3_EXECUTABLE=$(which python3)
|
|
${{ env.GLOBAL_CMAKE_OPTIONS }}
|
|
--
|
|
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
|
|
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
|
|
|
|
- name: Configure, Build, and Test (Samples Code Coverage)
|
|
timeout-minutes: 30
|
|
working-directory: projects/rocprofiler-sdk
|
|
shell: bash
|
|
run:
|
|
find build -type f | egrep '\.gcda$' | xargs rm &&
|
|
LD_LIBRARY_PATH=${{ env.ROCM_PATH }}/lib:${{ env.ROCM_PATH }}/llvm/lib:$LD_LIBRARY_PATH
|
|
PATH=${{ env.ROCM_PATH }}/bin:${{ env.ROCM_PATH }}/llvm/bin:$HOME/.local/bin:$PATH
|
|
python3 ./source/scripts/run-ci.py -B build
|
|
--name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-codecov-samples
|
|
--build-jobs 16
|
|
--site ${{ matrix.system.runner }}
|
|
--gpu-targets ${{ env.GPU_TARGETS }}
|
|
--coverage samples
|
|
--run-attempt ${{ github.run_attempt }}
|
|
--
|
|
-DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }}
|
|
-DCMAKE_PREFIX_PATH='${{ env.ROCM_PATH }};${{ env.ROCM_PATH }}/llvm'
|
|
-DPython3_EXECUTABLE=$(which python3)
|
|
${{ env.GLOBAL_CMAKE_OPTIONS }}
|
|
--
|
|
-LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}"
|
|
-E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}"
|
|
|
|
- name: Save XML Code Coverage
|
|
id: save-coverage
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
key: ${{ github.sha }}-codecov
|
|
path: |
|
|
projects/rocprofiler-sdk/.codecov/*.xml
|
|
|
|
- id: generatereport
|
|
name: Generate Code Coverage Comment
|
|
if: github.event_name == 'pull_request'
|
|
timeout-minutes: 5
|
|
working-directory: projects/rocprofiler-sdk
|
|
shell: bash
|
|
run: |
|
|
echo "PWD: ${PWD}"
|
|
ls -la
|
|
|
|
for i in "all" "tests" "samples"; do
|
|
wkhtmltoimage --enable-local-file-access --quality 70 .codecov/${i}.html .codecov/${i}.png
|
|
done
|
|
ls -la .codecov
|
|
which -a git
|
|
git --version
|
|
|
|
./source/scripts/upload-image-to-github.py --bot --token ${{ secrets.ROCPROFILER_TOKEN }} --files .codecov/{all,tests,samples}.png --output-dir .codecov --name pr-${{ github.event.pull_request.number }}
|
|
|
|
echo -e "\n${PWD}:"
|
|
ls -la .
|
|
|
|
echo -e "\n.codecov:"
|
|
ls -la .codecov
|
|
|
|
get-base-md-contents() { cat .codecov/${1}.png.md; }
|
|
get-full-md-contents() { cat .codecov/${1}.png.md .codecov/${1}.md; }
|
|
cat << EOF > .codecov/report.md
|
|
# Code Coverage Report
|
|
|
|
## Tests Only
|
|
$(get-base-md-contents tests)
|
|
|
|
## Samples Only
|
|
$(get-base-md-contents samples)
|
|
|
|
## Tests + Samples
|
|
$(get-base-md-contents all)
|
|
|
|
<!-- code-coverage-comment-identifier -->
|
|
EOF
|
|
|
|
echo 'CODECOVERAGE_REPORT<<EOF' > $GITHUB_OUTPUT
|
|
cat .codecov/report.md >> $GITHUB_OUTPUT
|
|
echo 'EOF' >> $GITHUB_OUTPUT
|
|
|
|
- name: Write Code Coverage Comment
|
|
if: github.event_name == 'pull_request'
|
|
timeout-minutes: 5
|
|
uses: actions/github-script@v6
|
|
env:
|
|
COMMENT_BODY: |
|
|
<details>
|
|
<summary><h2>Code Coverage Report</h2></summary>
|
|
|
|
<!-- Keep the empty line above to render markdown properly -->
|
|
${{ steps.generatereport.outputs.CODECOVERAGE_REPORT }}
|
|
</details>
|
|
with:
|
|
github-token: ${{ secrets.ROCPROFILER_TOKEN }}
|
|
script: |
|
|
const commentIdentifier = '<!-- code-coverage-comment-identifier -->'; // Used to identify codecov comment
|
|
const commentBody = process.env.COMMENT_BODY;
|
|
|
|
// Fetch existing comments
|
|
const { data: comments } = await github.rest.issues.listComments({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.payload.pull_request.number,
|
|
});
|
|
|
|
// Check for an existing comment
|
|
const existingComment = comments.find(comment => comment.body.includes(commentIdentifier));
|
|
|
|
if (existingComment) {
|
|
// Update the existing comment
|
|
await github.rest.issues.updateComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
comment_id: existingComment.id,
|
|
body: commentBody,
|
|
});
|
|
core.info(`Updated comment with ID: ${existingComment.id}`);
|
|
} else {
|
|
// Create a new comment
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.payload.pull_request.number,
|
|
body: commentBody,
|
|
});
|
|
core.info('Created a new comment.');
|
|
}
|
|
|
|
- name: Archive Code Coverage Data
|
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: code-coverage-details
|
|
path: |
|
|
${{github.workspace}}/projects/rocprofiler-sdk/.codecov/*
|
|
|
|
- name: Verify Test Labels
|
|
timeout-minutes: 5
|
|
shell: bash
|
|
working-directory: projects/rocprofiler-sdk
|
|
run: |
|
|
pushd build
|
|
#
|
|
# if following fails, there is a test that does not have
|
|
# a label identifying it as sample or test (unit or integration).
|
|
# Recommended labels are:
|
|
# - samples
|
|
# - unittests
|
|
# - integration-tests
|
|
#
|
|
ctest -N -LE 'samples|tests' -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" -O ctest.mislabeled.log
|
|
grep 'Total Tests: 0' ctest.mislabeled.log
|
|
#
|
|
# if following fails, then there is overlap between the labels.
|
|
# A test cannot both be a sample and (unit/integration) test.
|
|
#
|
|
ctest -N -O ctest.all.log
|
|
ctest -N -O ctest.samples.log -L samples
|
|
ctest -N -O ctest.tests.log -L tests
|
|
NUM_ALL=$(grep 'Total Tests:' ctest.all.log | awk '{print $NF}')
|
|
NUM_SAMPLE=$(grep 'Total Tests:' ctest.samples.log | awk '{print $NF}')
|
|
NUM_TEST=$(grep 'Total Tests:' ctest.tests.log | awk '{print $NF}')
|
|
NUM_SUM=$((${NUM_SAMPLE} + ${NUM_TEST}))
|
|
echo "Total tests: ${NUM_ALL}"
|
|
echo "Total labeled tests: ${NUM_SUM}"
|
|
if [ ${NUM_ALL} != ${NUM_SUM} ]; then
|
|
echo "Test label overlap"
|
|
exit 1
|
|
fi
|
|
popd
|