From 373cf9083fdba52f6bea94a5c89f279c8ce99f35 Mon Sep 17 00:00:00 2001 From: Mikhail Ryzhov Date: Fri, 18 Oct 2024 15:49:37 +0200 Subject: [PATCH] [GHA] Enable thread sanitizer (#26634) ### Details: - Enable thread sanitizer - Fixed protobuf build ### Tickets: - *ticket-id* --- .github/workflows/linux_sanitizers.yml | 234 +++++++++--------- .../compile_flags/sanitizer.cmake | 10 +- .../frontend/tensorflow/node_context.hpp | 3 +- tests/{ => sanitizers}/asan/ignore.txt | 0 tests/{ => sanitizers}/asan/suppressions.supp | 0 tests/{ => sanitizers}/lsan/suppressions.txt | 0 tests/sanitizers/tsan/suppressions.txt | 15 ++ thirdparty/dependencies.cmake | 9 + 8 files changed, 155 insertions(+), 116 deletions(-) rename tests/{ => sanitizers}/asan/ignore.txt (100%) rename tests/{ => sanitizers}/asan/suppressions.supp (100%) rename tests/{ => sanitizers}/lsan/suppressions.txt (100%) create mode 100644 tests/sanitizers/tsan/suppressions.txt diff --git a/.github/workflows/linux_sanitizers.yml b/.github/workflows/linux_sanitizers.yml index e1a71fe92dc1a3..f13f3765d4f353 100644 --- a/.github/workflows/linux_sanitizers.yml +++ b/.github/workflows/linux_sanitizers.yml @@ -1,10 +1,9 @@ -name: Linux Sanitizers (Ubuntu 20.04, Python 3.11) +name: Linux Sanitizers (Ubuntu 20.04, Python 3.9) on: schedule: # run daily at 00:00 - cron: '0 0 * * *' workflow_dispatch: - # pull_request: concurrency: # github.ref is not unique in post-commit @@ -14,22 +13,69 @@ concurrency: permissions: read-all env: - PIP_CACHE_PATH: /mount/caches/pip/linux - PYTHON_VERSION: '3.11' TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || github.ref }} jobs: + Smart_CI: + runs-on: ubuntu-latest + outputs: + affected_components: "${{ steps.smart_ci.outputs.affected_components }}" + changed_components: "${{ steps.smart_ci.outputs.changed_components }}" + skip_workflow: "${{ steps.smart_ci.outputs.skip_workflow }}" + steps: + - name: checkout action + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + sparse-checkout: .github/actions/smart-ci + + - name: Get affected components + id: smart_ci + uses: ./.github/actions/smart-ci + with: + repository: ${{ github.repository }} + pr: ${{ github.event.number }} + commit_sha: ${{ github.sha }} + ref_name: ${{ github.ref_name }} + component_pattern: "category: (.*)" + repo_token: ${{ secrets.GITHUB_TOKEN }} + skip_when_only_listed_labels_set: 'docs' + skip_when_only_listed_files_changed: '*.md,*.rst,*.png,*.jpg,*.svg,*/layer_tests_summary/*,*/conformance/*' + + Docker: + needs: Smart_CI + runs-on: aks-linux-4-cores-16gb-docker-build + container: + image: openvinogithubactions.azurecr.io/docker_build:0.2 + volumes: + - /mount:/mount + outputs: + images: "${{ steps.handle_docker.outputs.images }}" + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - uses: ./.github/actions/handle_docker + id: handle_docker + with: + images: | + ov_build/ubuntu_22_04_x64 + registry: 'openvinogithubactions.azurecr.io' + dockerfiles_root_dir: '.github/dockerfiles' + changed_components: ${{ needs.smart_ci.outputs.changed_components }} + Build: + needs: [Smart_CI, Docker] timeout-minutes: 500 defaults: run: shell: bash - runs-on: aks-linux-16-cores-32gb + runs-on: aks-linux-16-cores-64gb if: ${{ github.repository_owner == 'openvinotoolkit' }} container: - image: openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04 + image: ${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_22_04_x64 }} volumes: - /mount:/mount + options: -e SCCACHE_AZURE_BLOB_CONTAINER -e SCCACHE_AZURE_CONNECTION_STRING strategy: max-parallel: 3 fail-fast: false @@ -39,10 +85,9 @@ jobs: SANITIZER_CMAKE_OPTION: '-DENABLE_SANITIZER=ON' - SANITIZER: 'UndefinedBehavior' SANITIZER_CMAKE_OPTION: '-DENABLE_UB_SANITIZER=ON' -# - SANITIZER: 'Thread' # Problems with protobuf -# SANITIZER_CMAKE_OPTION: '-DENABLE_THREAD_SANITIZER=ON' + - SANITIZER: 'Thread' + SANITIZER_CMAKE_OPTION: '-DENABLE_THREAD_SANITIZER=ON' env: - DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input CMAKE_BUILD_TYPE: 'RelWithDebInfo' CMAKE_GENERATOR: 'Ninja' GITHUB_WORKSPACE: '/__w/openvino/openvino' @@ -51,20 +96,16 @@ jobs: INSTALL_DIR: /__w/openvino/openvino/openvino_install INSTALL_TEST_DIR: /__w/openvino/openvino/tests_install BUILD_DIR: /__w/openvino/openvino/openvino_build - LSAN_IGNORE: /__w/openvino/openvino/openvino/tests/lsan/suppressions.txt - ASAN_IGNORE: /__w/openvino/openvino/openvino/tests/asan/suppressions.supp - CXX: clang++ - CC: clang + CMAKE_CXX_COMPILER_LAUNCHER: sccache + CMAKE_C_COMPILER_LAUNCHER: sccache + SCCACHE_IGNORE_SERVER_IO_ERROR: 1 + SCCACHE_SERVER_PORT: 35555 + SCCACHE_ERROR_LOG: /__w/openvino/sccache_log.txt + SCCACHE_LOG: warn + SCCACHE_AZURE_KEY_PREFIX: sanitizers_lin_${{ matrix.SANITIZER }}_master + SCCACHE_CACHE_SIZE: 50G steps: - - name: Set apt retries - run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - - - name: Install git - run: | - apt-get update - apt-get install --assume-yes --no-install-recommends git ca-certificates - - name: Clone OpenVINO uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: @@ -79,31 +120,9 @@ jobs: submodules: 'true' ref: ${{ env.TARGET_BRANCH }} - # - # Print system info - # - - name: System info uses: ./openvino/.github/actions/system_info - - # - # Dependencies - # - - - name: Install build dependencies - run: | - bash ${OPENVINO_REPO}/install_build_dependencies.sh - apt --assume-yes install clang lld - - - name: Setup Python ${{ env.PYTHON_VERSION }} - uses: ./openvino/.github/actions/setup_python - with: - version: ${{ env.PYTHON_VERSION }} - pip-cache-path: ${{ env.PIP_CACHE_PATH }} - should-setup-pip-paths: 'true' - self-hosted-runner: 'true' - show-cache-info: 'true' - + - name: Install python dependencies run: | # For Python API: build and wheel packaging @@ -120,17 +139,15 @@ jobs: # For running Paddle frontend unit tests python3 -m pip install -r ${OPENVINO_REPO}/src/frontends/paddle/tests/requirements.txt - + # # Build # - + - name: Clean sccache stats + run: ${SCCACHE_PATH} --zero-stats + - name: CMake configure - OpenVINO run: | - export ASAN_OPTIONS=halt_on_error=0:suppressions=${ASAN_IGNORE} - export LSAN_OPTIONS=suppressions=${LSAN_IGNORE}:NEOReadDebugKeys=1:DisableDeepBind=1 - export CC=clang - export CXX=clang++ cmake \ -G "${{ env.CMAKE_GENERATOR }}" \ -DENABLE_CPPLINT=OFF \ @@ -147,24 +164,26 @@ jobs: -DENABLE_OV_PYTORCH_FRONTEND=ON \ -DENABLE_OV_JAX_FRONTEND=ON \ -DENABLE_OV_ONNX_FRONTEND=ON \ + -DENABLE_INTEL_NPU=OFF \ -DENABLE_ONEDNN_FOR_GPU=OFF \ -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF \ + -DENABLE_WHEEL=OFF \ ${{ matrix.SANITIZER_CMAKE_OPTION }} \ -S ${OPENVINO_REPO} \ -B ${BUILD_DIR} - name: Cmake build - OpenVINO run: | - export ASAN_OPTIONS=halt_on_error=0:suppressions=${ASAN_IGNORE} - export LSAN_OPTIONS=suppressions=${LSAN_IGNORE}:NEOReadDebugKeys=1:DisableDeepBind=1 - cmake --build ${BUILD_DIR} --parallel --config ${{ env.CMAKE_BUILD_TYPE }} - + cmake --build ${BUILD_DIR} --parallel $(nproc) --config ${{ env.CMAKE_BUILD_TYPE }} + + - name: Show sccache stats + run: ${SCCACHE_PATH} --show-stats + - name: Cmake install - OpenVINO run: | cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -P ${BUILD_DIR}/cmake_install.cmake --config ${{ env.CMAKE_BUILD_TYPE }} cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_TEST_DIR} -DCOMPONENT=tests -P ${BUILD_DIR}/cmake_install.cmake --config ${{ env.CMAKE_BUILD_TYPE }} - cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCOMPONENT=python_wheels -P ${BUILD_DIR}/cmake_install.cmake --config ${{ env.CMAKE_BUILD_TYPE }} - + - name: Remove unused files to free space run: rm -rf ${BUILD_DIR}/* @@ -185,6 +204,13 @@ jobs: # # Upload build artifacts # + - name: Upload sccache log + if: ${{ always() }} + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: sccache_log_${{ matrix.SANITIZER }} + path: ${{ env.SCCACHE_ERROR_LOG }} + if-no-files-found: 'error' - name: Upload openvino package if: ${{ always() }} @@ -205,11 +231,11 @@ jobs: CXX_Unit_Tests: name: C++ unit tests if: ${{ github.repository_owner == 'openvinotoolkit' }} - needs: Build - timeout-minutes: 100 - runs-on: 'aks-linux-16-cores-32gb' + needs: [Docker, Build] + timeout-minutes: 120 + runs-on: aks-linux-16-cores-32gb container: - image: 'openvinogithubactions.azurecr.io/dockerhub/ubuntu:20.04' + image: ${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_22_04_x64 }} defaults: run: shell: bash @@ -220,18 +246,18 @@ jobs: include: - SANITIZER: 'AddressAndLeak' - SANITIZER: 'UndefinedBehavior' -# - SANITIZER: 'Thread' # Problems with protobuf at the Build stage + - SANITIZER: 'Thread' env: - DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input - INSTALL_DIR: ${{ github.workspace }}/install - INSTALL_TEST_DIR: ${{ github.workspace }}/install/tests + OPENVINO_REPO: /__w/openvino/openvino/openvino + INSTALL_DIR: /__w/openvino/openvino/install + INSTALL_TEST_DIR: /__w/openvino/openvino/install/tests + BUILD_DIR: /__w/openvino/openvino/openvino_build TBB_ENABLE_SANITIZERS: 1 - CC: clang - CXX: clang++ + ASAN_OPTIONS: halt_on_error=0:suppressions=/__w/openvino/openvino/openvino/tests/sanitizers/asan/suppressions.supp + LSAN_OPTIONS: suppressions=/__w/openvino/openvino/openvino/tests/sanitizers/lsan/suppressions.txt:NEOReadDebugKeys=1:DisableDeepBind=1 + TSAN_OPTIONS: suppressions=/__w/openvino/openvino/openvino/tests/sanitizers/tsan/suppressions.txt + steps: - - name: Set apt retries - run: echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80-retries - - name: Download OpenVINO package uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: @@ -244,16 +270,6 @@ jobs: name: ${{ format('openvino_tests_{0}', matrix.SANITIZER) }} path: ${{ env.INSTALL_TEST_DIR }} - # Needed as ${{ github.workspace }} is not working correctly when using Docker - - name: Setup Variables - continue-on-error: true - run: | - echo "INSTALL_DIR=$GITHUB_WORKSPACE/install" >> "$GITHUB_ENV" - echo "INSTALL_TEST_DIR=$GITHUB_WORKSPACE/install/tests" >> "$GITHUB_ENV" - - echo "ASAN_OPTIONS=halt_on_error=0:suppressions=$GITHUB_WORKSPACE/openvino/tests/asan/suppressions.supp" >> "$GITHUB_ENV" - echo "LSAN_OPTIONS=suppressions=$GITHUB_WORKSPACE/openvino/tests/lsan/suppressions.txt:NEOReadDebugKeys=1:DisableDeepBind=1" >> "$GITHUB_ENV" - - name: Extract OpenVINO packages run: | pushd $INSTALL_DIR @@ -263,77 +279,71 @@ jobs: pigz -dc openvino_tests.tar.gz | tar -xf - -C ${INSTALL_DIR} popd - - name: Install dependencies (Linux) - run: | - $INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh -c=core -c=dev -c=gpu -y - apt update && apt --assume-yes install clang lld - - name: Fetch Sanitizer Suppression Lists uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: sparse-checkout: | - tests/lsan/suppressions.txt - tests/asan/suppressions.supp + tests/sanitizers/lsan/suppressions.txt + tests/sanitizers/asan/suppressions.supp + tests/sanitizers/tsan/suppressions.txt sparse-checkout-cone-mode: false - path: 'openvino' + path: ${{ env.OPENVINO_REPO }} # # Tests # - name: OpenVINO Core Unit Tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_core_unit_tests --gtest_print_time=1 --gtest_filter=-*IE_GPU* \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-OVCoreUT.xml - name: OpenVINO Inference Functional Tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh - ${INSTALL_TEST_DIR}/ov_inference_functional_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-InferenceFunc.xml - name: OpenVINO Inference Unit Tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_inference_unit_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-InferenceUnit.xml - name: Low Precision Transformations Tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh - ${INSTALL_TEST_DIR}/ov_lp_transformations_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-LpTransformations.xml - name: OpenVINO Conditional compilation tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_conditional_compilation_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-ConditionalCompilation.xml - name: IR frontend tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_ir_frontend_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-IRFrontend.xml - name: PaddlePaddle frontend tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/paddle_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-PaddleTests.xml - name: ONNX frontend tests - if: always() + if: ${{ !cancelled() && matrix.SANITIZER != 'Thread' }} # Ticket: 155291 run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_onnx_frontend_tests --gtest_print_time=1 \ @@ -341,14 +351,14 @@ jobs: --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-ONNXFrontend.xml - name: TensorFlow Common frontend tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_tensorflow_common_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-TensorFlowCommonFrontend.xml - name: TensorFlow frontend tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh @@ -371,56 +381,56 @@ jobs: --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-Transformations.xml - name: Common test utils tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_util_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-CommonUtilTests.xml - name: Snippets func tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_snippets_func_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-SnippetsFuncTests.xml - name: CPU plugin unit tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_cpu_unit_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-CPUUnitTests.xml - name: ov_subgraphs_dumper_tests tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_subgraphs_dumper_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-ov_subgraphs_dumper_tests.xml - name: Template OpImpl tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_op_conformance_tests --gtest_print_time=1 --device=TEMPLATE --gtest_filter=*OpImpl*\ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-OpImplTests.xml - name: AUTO unit tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_auto_unit_tests --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-ov_auto_unit_tests.xml - name: AUTO func Tests - if: always() + if: ${{ 'false' }} # Issue 155210 run: | source ${{ env.INSTALL_DIR }}/setupvars.sh ${{ env.INSTALL_TEST_DIR }}/ov_auto_func_tests --gtest_print_time=1 \ --gtest_output=xml:${{ env.INSTALL_TEST_DIR }}/TEST-ov_auto_func_tests.xml - name: Template plugin func tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_template_func_tests --gtest_print_time=1 \ @@ -428,32 +438,32 @@ jobs: --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-TemplateFuncTests.xml - name: OpenVINO C API tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_capi_test --gtest_print_time=1 \ --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-OpenVINOCAPITests.xml - name: AutoBatch unit tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_auto_batch_unit_tests --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-ov_auto_batch_unit_tests.xml - name: AutoBatch func tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_auto_batch_func_tests --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-ov_auto_batch_func_tests.xml --gtest_filter="*smoke*" - name: Proxy Plugin func tests - if: always() + if: ${{ !cancelled() }} run: | source ${INSTALL_DIR}/setupvars.sh ${INSTALL_TEST_DIR}/ov_proxy_plugin_tests --gtest_print_time=1 --gtest_output=xml:${INSTALL_TEST_DIR}/TEST-OVProxyTests.xml - name: Hetero unit tests - if: always() + if: ${{ !cancelled() }} run: | source ${{ env.INSTALL_DIR }}/setupvars.sh ${{ env.INSTALL_TEST_DIR }}/ov_hetero_unit_tests --gtest_print_time=1 --gtest_output=xml:${{ env.INSTALL_TEST_DIR }}/TEST-OVHeteroUnitTests.xml diff --git a/cmake/developer_package/compile_flags/sanitizer.cmake b/cmake/developer_package/compile_flags/sanitizer.cmake index 73f109d726c88b..5fc24c4f862239 100644 --- a/cmake/developer_package/compile_flags/sanitizer.cmake +++ b/cmake/developer_package/compile_flags/sanitizer.cmake @@ -17,7 +17,7 @@ if (ENABLE_SANITIZER) "https://github.com/openvinotoolkit/openvino/wiki/AddressSanitizer-and-LeakSanitizer") endif() elseif(OV_COMPILER_IS_CLANG) - set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=address -fsanitize-blacklist=${OpenVINO_SOURCE_DIR}/tests/asan/ignore.txt") + set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=address -fsanitize-blacklist=${OpenVINO_SOURCE_DIR}/tests/sanitizers/asan/ignore.txt") if(BUILD_SHARED_LIBS) set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -shared-libasan") endif() @@ -27,7 +27,7 @@ if (ENABLE_SANITIZER) set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize-recover=address") endif() - set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=address -fsanitize-blacklist=${OpenVINO_SOURCE_DIR}/tests/asan/ignore.txt") + set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=address -fsanitize-blacklist=${OpenVINO_SOURCE_DIR}/tests/sanitizers/asan/ignore.txt") if(BUILD_SHARED_LIBS) set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -shared-libasan") endif() @@ -89,7 +89,11 @@ if(ENABLE_THREAD_SANITIZER) message(FATAL_ERROR "Thread sanitizer is not supported in Windows with MSVC compiler. Please, use clang-cl or mingw") elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=thread") - set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=thread") + if(OV_COMPILER_IS_CLANG) + set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -ltsan") + else() + set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=thread") + endif() else() message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}") endif() diff --git a/src/frontends/tensorflow/include/openvino/frontend/tensorflow/node_context.hpp b/src/frontends/tensorflow/include/openvino/frontend/tensorflow/node_context.hpp index f2dba04b49dca7..c23890b90dcab4 100644 --- a/src/frontends/tensorflow/include/openvino/frontend/tensorflow/node_context.hpp +++ b/src/frontends/tensorflow/include/openvino/frontend/tensorflow/node_context.hpp @@ -8,6 +8,7 @@ #include "exception.hpp" #include "openvino/core/any.hpp" #include "openvino/frontend/node_context.hpp" +#include "openvino/frontend/tensorflow/visibility.hpp" #include "variable.hpp" #include "variables_map.hpp" @@ -18,7 +19,7 @@ class TranslateSession; /// Keep necessary data for a single node in the original FW graph to facilitate /// conversion process in the rules code. -class NodeContext : public ov::frontend::NodeContext { +class TENSORFLOW_API NodeContext : public ov::frontend::NodeContext { public: using Ptr = std::shared_ptr; NodeContext(const std::shared_ptr& decoder, diff --git a/tests/asan/ignore.txt b/tests/sanitizers/asan/ignore.txt similarity index 100% rename from tests/asan/ignore.txt rename to tests/sanitizers/asan/ignore.txt diff --git a/tests/asan/suppressions.supp b/tests/sanitizers/asan/suppressions.supp similarity index 100% rename from tests/asan/suppressions.supp rename to tests/sanitizers/asan/suppressions.supp diff --git a/tests/lsan/suppressions.txt b/tests/sanitizers/lsan/suppressions.txt similarity index 100% rename from tests/lsan/suppressions.txt rename to tests/sanitizers/lsan/suppressions.txt diff --git a/tests/sanitizers/tsan/suppressions.txt b/tests/sanitizers/tsan/suppressions.txt new file mode 100644 index 00000000000000..0814ce119a0d1d --- /dev/null +++ b/tests/sanitizers/tsan/suppressions.txt @@ -0,0 +1,15 @@ +# Copyright (C) 2018-2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +# This is a ThreadSanitizer (TSan) suppression file which provides a default +# configuration for the builds with -DENABLE_SANITIZER=ON. +# More information about LSan suppressions on +# https://github.com/google/sanitizers/wiki/threadsanitizersuppressions + +# race conditions from thirdparty libs +race:libtbb +mutex:libtbb +race:libhwloc +# race conditions from std libs +race:libstdc++ +race:libc \ No newline at end of file diff --git a/thirdparty/dependencies.cmake b/thirdparty/dependencies.cmake index 8313ca73178283..0e8536a1714a35 100644 --- a/thirdparty/dependencies.cmake +++ b/thirdparty/dependencies.cmake @@ -357,6 +357,15 @@ if(ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_TF_FRONTEND endif() else() add_subdirectory(thirdparty/protobuf EXCLUDE_FROM_ALL) + # protobuf fails to build with -fsanitize=thread by clang + if(ENABLE_THREAD_SANITIZER AND OV_COMPILER_IS_CLANG) + foreach(proto_target protoc libprotobuf libprotobuf-lite) + if(TARGET ${proto_target}) + target_compile_options(${proto_target} PUBLIC -fno-sanitize=thread) + target_link_options(${proto_target} PUBLIC -fno-sanitize=thread) + endif() + endforeach() + endif() endif() # forward additional variables used in the other places