diff --git a/projects/rocprofiler-sdk/cmake/Modules/rocprofiler-sdk-utilities.cmake b/projects/rocprofiler-sdk/cmake/Modules/rocprofiler-sdk-utilities.cmake index dcd0d81105..0ed9a061a7 100644 --- a/projects/rocprofiler-sdk/cmake/Modules/rocprofiler-sdk-utilities.cmake +++ b/projects/rocprofiler-sdk/cmake/Modules/rocprofiler-sdk-utilities.cmake @@ -49,3 +49,80 @@ function(rocprofiler_sdk_get_gfx_architectures _VAR) endif() endif() endfunction() + +# In case the underlying architecture does not support PC sampling, this function will +# tell us whether the PC sampling is disabled +function(rocprofiler_sdk_pc_sampling_disabled _VAR) + cmake_parse_arguments(ARG "ECHO" "PREFIX" "" ${ARGN}) + + if(NOT DEFINED ARG_PREFIX) + set(ARG_PREFIX "[${PROJECT_NAME}] ") + endif() + + rocprofiler_sdk_get_gfx_architectures(rocprofiler-sdk-tests-gfx-info ECHO) + list(GET rocprofiler-sdk-tests-gfx-info 0 pc-sampling-gpu-0-gfx-info) + + if("${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx90a$" + OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx94[0-9]$" + OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx95[0-9]$") + # PC sampling is enabled on this architecture. + set(${_VAR} + FALSE + PARENT_SCOPE) + if(ARG_ECHO) + message( + STATUS + "${ARG_PREFIX}PC Sampling is enabled for ${pc-sampling-gpu-0-gfx-info}" + ) + endif() + else() + # PC sampling is disabled on this architecture. + set(${_VAR} + TRUE + PARENT_SCOPE) + if(ARG_ECHO) + message( + STATUS + "${ARG_PREFIX}PC Sampling is disabled for ${pc-sampling-gpu-0-gfx-info}" + ) + endif() + endif() +endfunction() + +# In case the underlying architecture does not support stochastic PC sampling, this +# function will tell us whether the PC sampling is disabled +function(rocprofiler_sdk_pc_sampling_stochastic_disabled _VAR) + cmake_parse_arguments(ARG "ECHO" "PREFIX" "" ${ARGN}) + + if(NOT DEFINED ARG_PREFIX) + set(ARG_PREFIX "[${PROJECT_NAME}] ") + endif() + + rocprofiler_sdk_get_gfx_architectures(rocprofiler-sdk-tests-gfx-info ECHO) + list(GET rocprofiler-sdk-tests-gfx-info 0 pc-sampling-gpu-0-gfx-info) + + if("${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx94[0-9]$" + OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx95[0-9]$") + # PC sampling is enabled on this architecture. + set(${_VAR} + FALSE + PARENT_SCOPE) + if(ARG_ECHO) + message( + STATUS + "${ARG_PREFIX}PC Sampling is enabled for ${pc-sampling-gpu-0-gfx-info}" + ) + endif() + else() + # PC sampling is disabled on this architecture. + set(${_VAR} + TRUE + PARENT_SCOPE) + if(ARG_ECHO) + message( + STATUS + "${ARG_PREFIX}PC Sampling is disabled for ${pc-sampling-gpu-0-gfx-info}" + ) + endif() + endif() +endfunction() diff --git a/projects/rocprofiler-sdk/samples/pc_sampling/CMakeLists.txt b/projects/rocprofiler-sdk/samples/pc_sampling/CMakeLists.txt index f8ae9f0147..c3fbf54f74 100644 --- a/projects/rocprofiler-sdk/samples/pc_sampling/CMakeLists.txt +++ b/projects/rocprofiler-sdk/samples/pc_sampling/CMakeLists.txt @@ -47,6 +47,9 @@ target_link_libraries( rocprofiler_samples_get_preload_env(PRELOAD_ENV pc-sampling-client) rocprofiler_samples_get_ld_library_path_env(LIBRARY_PATH_ENV) +# Check if PC sampling is disabled and whether we should disable the test +rocprofiler_sdk_pc_sampling_disabled(IS_PC_SAMPLING_DISABLED) + set(pc-sampling-env ${PRELOAD_ENV} ${LIBRARY_PATH_ENV}) add_test(NAME pc-sampling COMMAND $) @@ -62,4 +65,6 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/pc_sampling/CMakeLists.txt b/projects/rocprofiler-sdk/tests/pc_sampling/CMakeLists.txt index fa8e85ba36..e6745cf4f6 100644 --- a/projects/rocprofiler-sdk/tests/pc_sampling/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/pc_sampling/CMakeLists.txt @@ -61,6 +61,9 @@ target_link_libraries( PRIVATE pc-sampling-integration-test-client Threads::Threads rocprofiler-sdk::tests-build-flags) +# Check if PC sampling is disabled and whether we should disable the test +rocprofiler_sdk_pc_sampling_disabled(IS_PC_SAMPLING_DISABLED) + add_test(NAME pc-sampling-integration-test COMMAND $) @@ -77,4 +80,6 @@ set_tests_properties( ENVIRONMENT "${pc-sampling-integration-test-env}" FAIL_REGULAR_EXPRESSION - "${ROCPROFILER_DEFAULT_FAIL_REGEX}") + "${ROCPROFILER_DEFAULT_FAIL_REGEX}" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/CMakeLists.txt index 06f8926d0c..3684560364 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/exec-mask-manipulation/CMakeLists.txt @@ -8,6 +8,9 @@ project( LANGUAGES CXX VERSION 0.0.0) +# Checking whether host-trap PC sampling is disabled. If so, skip the tests. +rocprofiler_sdk_pc_sampling_disabled(IS_PC_SAMPLING_DISABLED) + find_package(rocprofiler-sdk REQUIRED) rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py @@ -37,7 +40,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json-execute @@ -58,7 +63,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml-execute @@ -79,7 +86,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") # ========================= Validation tests @@ -104,7 +113,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-json-validate @@ -127,7 +138,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-host-trap-exec-mask-manipulation-input-yaml-validate @@ -150,4 +163,6 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/CMakeLists.txt index 2e83a69b04..6bb00915c3 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/host-trap/transpose-multiple-agents/CMakeLists.txt @@ -10,6 +10,9 @@ project( find_package(rocprofiler-sdk REQUIRED) +# Check if PC sampling is disabled and whether we should skip the tests. +rocprofiler_sdk_pc_sampling_disabled(IS_PC_SAMPLING_DISABLED) + rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py input.json input.yml) @@ -43,7 +46,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json-execute @@ -64,7 +69,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml-execute @@ -85,7 +92,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") # ========================= Validation tests @@ -112,7 +121,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-json-validate @@ -137,7 +148,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-host-trap-transpose-multiple-agents-input-yaml-validate @@ -162,4 +175,6 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/CMakeLists.txt index 35e0a4a927..644aaad358 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/CMakeLists.txt @@ -32,6 +32,9 @@ project( find_package(rocprofiler-sdk REQUIRED) +# Checking whether stochastic PC sampling is disabled. If so, skip the tests. +rocprofiler_sdk_pc_sampling_stochastic_disabled(IS_PC_SAMPLING_STOCHASTIC_DISABLED) + rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py input.json input.yml) @@ -59,7 +62,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json-execute @@ -80,7 +85,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml-execute @@ -101,7 +108,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") # ========================= Validation tests @@ -126,7 +135,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-json-validate @@ -149,7 +160,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-stochastic-exec-mask-manipulation-input-yaml-validate @@ -172,4 +185,6 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") diff --git a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/CMakeLists.txt b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/CMakeLists.txt index b2f5e55d2b..af8d7a07d0 100644 --- a/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/CMakeLists.txt +++ b/projects/rocprofiler-sdk/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/CMakeLists.txt @@ -32,6 +32,9 @@ project( find_package(rocprofiler-sdk REQUIRED) +# Checking whether stochastic PC sampling is disabled. If so, skip the tests. +rocprofiler_sdk_pc_sampling_stochastic_disabled(IS_PC_SAMPLING_STOCHASTIC_DISABLED) + rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py input.json input.yml) @@ -65,7 +68,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json-execute @@ -86,7 +91,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml-execute @@ -107,7 +114,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") # ========================= Validation tests @@ -136,7 +145,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-json-validate @@ -163,7 +174,9 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}") add_test( NAME rocprofv3-test-pc-sampling-stochastic-transpose-multiple-agents-input-yaml-validate @@ -190,4 +203,6 @@ set_tests_properties( FAIL_REGULAR_EXPRESSION "${ROCPROFILER_DEFAULT_FAIL_REGEX}" SKIP_REGULAR_EXPRESSION - "PC sampling unavailable") + "PC sampling unavailable" + DISABLED + "${IS_PC_SAMPLING_STOCHASTIC_DISABLED}")