318d13870f
## Motivation - Structured logging with proper log levels (TRACE, DEBUG, INFO, WARNING, ERROR, CRITICAL) - Better performance through compile-time formatting - Consistent formatting using fmt library - Runtime log level control via arguments and environment variables - Easier maintenance and debugging capabilities ## Technical Details - Added spdlog as a submodule and integrated it into CMake build system - Created new `rocprofiler-systems-logger` library wrapping spdlog functionality - Replaced custom logging macros (`ROCPROFSYS_VERBOSE`, `ROCPROFSYS_DEBUG`, `ROCPROFSYS_FATAL`, `ROCPROFSYS_REQUIRE`, `ROCPROFSYS_CI_THROW`, etc.) with spdlog equivalents (`LOG_DEBUG`, `LOG_WARNING`, `LOG_CRITICAL`, etc.) - Implemented log level control through command-line arguments and environment variables - Converted assertion macros to proper error handling with exceptions and std::abort()
85 строки
3.2 KiB
CMake
85 строки
3.2 KiB
CMake
# MIT License
|
|
#
|
|
# Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
# in the Software without restriction, including without limitation the rights
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
# THE SOFTWARE.
|
|
|
|
# -------------------------------------------------------------------------------------- #
|
|
#
|
|
# thread-limit tests
|
|
#
|
|
# -------------------------------------------------------------------------------------- #
|
|
|
|
if(NOT TARGET thread-limit)
|
|
return()
|
|
endif()
|
|
|
|
set(_thread_limit_environment
|
|
"${_base_environment}"
|
|
"ROCPROFSYS_PROFILE=ON"
|
|
"ROCPROFSYS_COUT_OUTPUT=ON"
|
|
"ROCPROFSYS_USE_SAMPLING=ON"
|
|
"ROCPROFSYS_SAMPLING_FREQ=250"
|
|
"ROCPROFSYS_VERBOSE=2"
|
|
"ROCPROFSYS_LOG_LEVEL=trace"
|
|
"ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,peak_rss,page_rss"
|
|
)
|
|
|
|
math(EXPR THREAD_VAL_1 "${ROCPROFSYS_MAX_THREADS} - 1")
|
|
math(EXPR THREAD_VAL_2 "${ROCPROFSYS_MAX_THREADS} + 24")
|
|
|
|
set(THREAD_VALUES ${THREAD_VAL_1} ${THREAD_VAL_2} ${ROCPROFSYS_MAX_THREADS})
|
|
|
|
# Loop over thread values
|
|
foreach(THREADS IN LISTS THREAD_VALUES)
|
|
set(THREAD_PASS_VALUE ${THREADS})
|
|
math(EXPR THREAD_FAIL_VALUE "${THREADS} + 1")
|
|
if(${THREADS} GREATER_EQUAL ${ROCPROFSYS_MAX_THREADS})
|
|
math(EXPR THREAD_PASS_VALUE "${ROCPROFSYS_MAX_THREADS} - 1")
|
|
math(EXPR THREAD_FAIL_VALUE "${ROCPROFSYS_MAX_THREADS} + 1")
|
|
endif()
|
|
|
|
set(_thread_limit_pass_regex "\\|${THREAD_PASS_VALUE}>>>")
|
|
set(_thread_limit_fail_regex "\\|${THREAD_FAIL_VALUE}>>>|ROCPROFSYS_ABORT_FAIL_REGEX")
|
|
|
|
# Unique test name
|
|
set(_test_name thread-limit-${THREADS})
|
|
|
|
# Add test
|
|
rocprofiler_systems_add_test(
|
|
SKIP_BASELINE
|
|
NAME ${_test_name}
|
|
TARGET thread-limit
|
|
LABELS "max-threads"
|
|
REWRITE_ARGS -e -v 2 -i 1024 --label return args
|
|
RUNTIME_ARGS -e -v 1 -i 1024 --label return args
|
|
RUN_ARGS 35 2 ${THREADS}
|
|
SAMPLING_TIMEOUT 480
|
|
REWRITE_TIMEOUT 480
|
|
RUNTIME_TIMEOUT 480
|
|
RUNTIME_PASS_REGEX "${_thread_limit_pass_regex}"
|
|
SAMPLING_PASS_REGEX "${_thread_limit_pass_regex}"
|
|
REWRITE_RUN_PASS_REGEX "${_thread_limit_pass_regex}"
|
|
RUNTIME_FAIL_REGEX "${_thread_limit_fail_regex}"
|
|
SAMPLING_FAIL_REGEX "${_thread_limit_fail_regex}"
|
|
REWRITE_RUN_FAIL_REGEX "${_thread_limit_fail_regex}"
|
|
ENVIRONMENT "${_thread_limit_environment}"
|
|
)
|
|
endforeach()
|