diff -Nru onetbb-2021.7.0/Bazel.md onetbb-2021.9.0/Bazel.md --- onetbb-2021.7.0/Bazel.md 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/Bazel.md 2023-04-06 17:14:50.000000000 +0000 @@ -33,7 +33,7 @@ _WORKSPACE.bazel_: ```python -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +load("@platforms//tools/build_defs/repo:git.bzl", "git_repository") git_repository( name = "oneTBB", diff -Nru onetbb-2021.7.0/.bazelversion onetbb-2021.9.0/.bazelversion --- onetbb-2021.7.0/.bazelversion 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/.bazelversion 2023-04-06 17:14:50.000000000 +0000 @@ -1 +1 @@ -5.0.0 +6.0.0 diff -Nru onetbb-2021.7.0/BUILD.bazel onetbb-2021.9.0/BUILD.bazel --- onetbb-2021.7.0/BUILD.bazel 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/BUILD.bazel 2023-04-06 17:14:50.000000000 +0000 @@ -36,7 +36,7 @@ "include/oneapi/tbb/detail/*.h", ]), copts = ["-w"] + select({ - "@bazel_tools//platforms:windows": [""], + "@platforms//os:windows": [""], "//conditions:default": ["-mwaitpkg"], }), defines = @@ -47,7 +47,7 @@ ], }) + select({ - "@bazel_tools//platforms:osx": ["_XOPEN_SOURCE"], + "@platforms//os:osx": ["_XOPEN_SOURCE"], "//conditions:default": [], }), includes = [ @@ -55,8 +55,8 @@ ], linkopts = select({ - "@bazel_tools//platforms:windows": [], - "@bazel_tools//platforms:linux": [ + "@platforms//os:windows": [], + "@platforms//os:linux": [ "-ldl", "-pthread", "-lrt", diff -Nru onetbb-2021.7.0/cmake/compilers/AppleClang.cmake onetbb-2021.9.0/cmake/compilers/AppleClang.cmake --- onetbb-2021.7.0/cmake/compilers/AppleClang.cmake 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/cmake/compilers/AppleClang.cmake 2023-04-06 17:14:50.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021 Intel Corporation +# Copyright (c) 2020-2022 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,9 +32,15 @@ endif() # Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors -if (NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "^arm64$" AND CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64|AMD64)") # OSX systems are 64-bit only +if (CMAKE_OSX_ARCHITECTURES) + set(_tbb_target_architectures "${CMAKE_OSX_ARCHITECTURES}") +else() + set(_tbb_target_architectures "${CMAKE_SYSTEM_PROCESSOR}") +endif() +if ("${_tbb_target_architectures}" MATCHES "(x86_64|amd64|AMD64)") # OSX systems are 64-bit only set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm $<$>:-mwaitpkg>) endif() +unset(_tbb_target_architectures) # TBB malloc settings set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions) diff -Nru onetbb-2021.7.0/cmake/compilers/GNU.cmake onetbb-2021.9.0/cmake/compilers/GNU.cmake --- onetbb-2021.7.0/cmake/compilers/GNU.cmake 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/cmake/compilers/GNU.cmake 2023-04-06 17:14:50.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 Intel Corporation +# Copyright (c) 2020-2023 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -68,6 +68,9 @@ list (APPEND TBB_COMMON_COMPILE_FLAGS -msse2) endif () +# Gnu flags to prevent compiler from optimizing out security checks +set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv) + # TBB malloc settings set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions) set(TBB_OPENMP_FLAG -fopenmp) diff -Nru onetbb-2021.7.0/cmake/sanitize.cmake onetbb-2021.9.0/cmake/sanitize.cmake --- onetbb-2021.7.0/cmake/sanitize.cmake 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/cmake/sanitize.cmake 2023-04-06 17:14:50.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021 Intel Corporation +# Copyright (c) 2020-2022 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -39,4 +39,5 @@ "LSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/cmake/suppressions/lsan.suppressions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TBB_SANITIZE_OPTION}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TBB_SANITIZE_OPTION}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TBB_SANITIZE_OPTION}") diff -Nru onetbb-2021.7.0/CMakeLists.txt onetbb-2021.9.0/CMakeLists.txt --- onetbb-2021.7.0/CMakeLists.txt 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/CMakeLists.txt 2023-04-06 17:14:50.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022 Intel Corporation +# Copyright (c) 2020-2023 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -216,19 +216,17 @@ if (TBB_BUILD) add_subdirectory(src/tbb) endif() - if (NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips") - if (TBBMALLOC_BUILD) - add_subdirectory(src/tbbmalloc) - if(TBBMALLOC_PROXY_BUILD AND NOT "${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "ARM64") - add_subdirectory(src/tbbmalloc_proxy) - endif() - endif() - if (APPLE OR NOT BUILD_SHARED_LIBS) - message(STATUS "TBBBind build targets are disabled due to unsupported environment") - else() - add_subdirectory(src/tbbbind) + if (TBBMALLOC_BUILD) + add_subdirectory(src/tbbmalloc) + if(TBBMALLOC_PROXY_BUILD AND NOT "${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "ARM64") + add_subdirectory(src/tbbmalloc_proxy) endif() endif() + if (APPLE OR NOT BUILD_SHARED_LIBS) + message(STATUS "TBBBind build targets are disabled due to unsupported environment") + else() + add_subdirectory(src/tbbbind) + endif() # ------------------------------------------------------------------- # Installation instructions @@ -279,10 +277,27 @@ if (ANDROID_PLATFORM) if ("${ANDROID_STL}" STREQUAL "c++_shared") - configure_file( - "${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so" - "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so" - COPYONLY) + if (${ANDROID_NDK_MAJOR} GREATER_EQUAL "25") + if(ANDROID_ABI STREQUAL "arm64-v8a") + set(ANDROID_TOOLCHAIN_NAME "aarch64-linux-android") + elseif(ANDROID_ABI STREQUAL "x86_64") + set(ANDROID_TOOLCHAIN_NAME "x86_64-linux-android") + elseif(ANDROID_ABI STREQUAL "armeabi-v7a") + set(ANDROID_TOOLCHAIN_NAME "arm-linux-androideabi") + elseif(ANDROID_ABI STREQUAL "x86") + set(ANDROID_TOOLCHAIN_NAME "i686-linux-android") + endif() + + configure_file( + "${ANDROID_TOOLCHAIN_ROOT}/sysroot/usr/lib/${ANDROID_TOOLCHAIN_NAME}/libc++_shared.so" + "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so" + COPYONLY) + else() + configure_file( + "${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so" + "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so" + COPYONLY) + endif() endif() # This custom target may be implemented without separate CMake script, but it requires # ADB(Android Debug Bridge) executable file availability, so to incapsulate this requirement diff -Nru onetbb-2021.7.0/debian/changelog onetbb-2021.9.0/debian/changelog --- onetbb-2021.7.0/debian/changelog 2022-11-24 20:51:56.000000000 +0000 +++ onetbb-2021.9.0/debian/changelog 2023-09-02 03:33:47.000000000 +0000 @@ -1,17 +1,54 @@ -onetbb (2021.7.0-1ubuntu1~22.04.sav0) jammy; urgency=medium +onetbb (2021.9.0-2ubuntu1~22.04.sav0) jammy; urgency=medium * Backport to Jammy - * debian/patches: Remove -Wno-error=use-after-free from warning-flags.patch - * debian/libtbb12.symbols.amd64: Update from build log + * Revert "libtbb12: Add explicit Breaks against libtbb2" (on Ubuntu systems + src:tbb >= 2020.3-1ubuntu3 stops building libtbbmalloc2 due src:onetbb now + building this library as a distinct package, meaning no package conflict) + * Revert "Suppress compiler warnings appeared since GCC-12" (using GCC < 12) - -- Rob Savoury Thu, 24 Nov 2022 12:51:56 -0800 + -- Rob Savoury Fri, 01 Sep 2023 20:33:47 -0700 -onetbb (2021.7.0-1ubuntu1) lunar; urgency=low +onetbb (2021.9.0-2ubuntu1) mantic; urgency=medium - * Merge from Debian unstable. Remaining changes: - - Build with -O2 on ppc64el to fix a build failure + * Fix build on ppc64el by using -Wno-error=stringop-overflow - -- Gianfranco Costamagna Sat, 05 Nov 2022 17:25:29 +0100 + -- Gianfranco Costamagna Thu, 03 Aug 2023 08:30:44 +0200 + +onetbb (2021.9.0-2) unstable; urgency=medium + + * Team upload. + + * Added patch classiciation and added more metadata. + * Avoid build problem on armel caused by strange compiler + (Closes: #1042009). + + -- Petter Reinholdtsen Wed, 02 Aug 2023 22:42:54 +0200 + +onetbb (2021.9.0-1) unstable; urgency=medium + + * New upstream version 2021.9.0 + * Remove merged patches. + * Remove merged patches. Rebase remaining ones. + * Add patch for missing header to resolve FTBFS. (Closes: #1037798) + + -- Mo Zhou Thu, 13 Jul 2023 21:29:44 -0700 + +onetbb (2021.8.0-2) unstable; urgency=medium + + * Team upload. + * libtbb12: Add explicit Breaks against libtbb2 for smoother upgrades from + bullseye. The the existing transitive Breaks via libtbbmalloc2 is not + sufficient for all upgrade paths. (Closes: #1036073) + * Drop duplicate symbols. + + -- Andreas Beckmann Tue, 16 May 2023 12:23:01 +0200 + +onetbb (2021.8.0-1) unstable; urgency=medium + + * New upstream version 2021.8.0 + * Rebase existing patches. + + -- Mo Zhou Mon, 26 Dec 2022 11:21:23 -0500 onetbb (2021.7.0-1) unstable; urgency=medium @@ -31,12 +68,6 @@ -- Mo Zhou Fri, 28 Oct 2022 14:01:02 -0400 -onetbb (2021.5.0-15ubuntu1) kinetic; urgency=medium - - * Build with -O2 on ppc64el to fix a build failure - - -- Gianfranco Costamagna Wed, 14 Sep 2022 09:23:21 +0200 - onetbb (2021.5.0-15) unstable; urgency=medium * Upload to unstable. diff -Nru onetbb-2021.7.0/debian/patches/0001-Build-tbbmalloc-also-on-mips.patch onetbb-2021.9.0/debian/patches/0001-Build-tbbmalloc-also-on-mips.patch --- onetbb-2021.7.0/debian/patches/0001-Build-tbbmalloc-also-on-mips.patch 2022-10-30 09:18:04.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/0001-Build-tbbmalloc-also-on-mips.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -From 96efebb5ac83d7ddefa60786e8a21510446863ef Mon Sep 17 00:00:00 2001 -From: Adrian Bunk -Date: Wed, 15 Jun 2022 11:16:35 +0300 -Subject: Build tbbmalloc also on mips - -Signed-off-by: Adrian Bunk ---- - CMakeLists.txt | 18 ++++++++---------- - 1 file changed, 8 insertions(+), 10 deletions(-) - -Index: tbb/CMakeLists.txt -=================================================================== ---- tbb.orig/CMakeLists.txt -+++ tbb/CMakeLists.txt -@@ -216,19 +216,17 @@ else() - if (TBB_BUILD) - add_subdirectory(src/tbb) - endif() -- if (NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips") -- if (TBBMALLOC_BUILD) -- add_subdirectory(src/tbbmalloc) -- if(TBBMALLOC_PROXY_BUILD AND NOT "${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "ARM64") -- add_subdirectory(src/tbbmalloc_proxy) -- endif() -- endif() -- if (APPLE OR NOT BUILD_SHARED_LIBS) -- message(STATUS "TBBBind build targets are disabled due to unsupported environment") -- else() -- add_subdirectory(src/tbbbind) -+ if (TBBMALLOC_BUILD) -+ add_subdirectory(src/tbbmalloc) -+ if(TBBMALLOC_PROXY_BUILD AND NOT "${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "ARM64") -+ add_subdirectory(src/tbbmalloc_proxy) - endif() - endif() -+ if (APPLE OR NOT BUILD_SHARED_LIBS) -+ message(STATUS "TBBBind build targets are disabled due to unsupported environment") -+ else() -+ add_subdirectory(src/tbbbind) -+ endif() - - # ------------------------------------------------------------------- - # Installation instructions diff -Nru onetbb-2021.7.0/debian/patches/1000-remove-unaligned-test.patch onetbb-2021.9.0/debian/patches/1000-remove-unaligned-test.patch --- onetbb-2021.7.0/debian/patches/1000-remove-unaligned-test.patch 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/1000-remove-unaligned-test.patch 2023-08-02 20:42:54.000000000 +0000 @@ -0,0 +1,23 @@ +Description: Remove unaligned mem-accesses from test_malloc_pools.cpp + This should help sparc64 tests, if we miss a case a SIGBUS + will greet us. +Author: Steve Capper +Last-Changed: 2017-08-13 +Forwarded: no + +--- tbb.orig/test/tbbmalloc/test_malloc_pools.cpp ++++ tbb/test/tbbmalloc/test_malloc_pools.cpp +@@ -66,11 +66,11 @@ static std::atomic liveRegions; + + static void *getMallocMem(intptr_t /*pool_id*/, size_t &bytes) + { +- void *rawPtr = malloc(bytes+sizeof(MallocPoolHeader)+1); ++ void *rawPtr = malloc(bytes+sizeof(MallocPoolHeader)); + if (!rawPtr) + return nullptr; + // +1 to check working with unaligned space +- void *ret = (void *)((uintptr_t)rawPtr+sizeof(MallocPoolHeader)+1); ++ void *ret = (void *)((uintptr_t)rawPtr+sizeof(MallocPoolHeader)); + + MallocPoolHeader *hdr = (MallocPoolHeader*)ret-1; + hdr->rawPtr = rawPtr; diff -Nru onetbb-2021.7.0/debian/patches/1010-test-less-stress.patch onetbb-2021.9.0/debian/patches/1010-test-less-stress.patch --- onetbb-2021.7.0/debian/patches/1010-test-less-stress.patch 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/1010-test-less-stress.patch 2023-08-02 20:42:54.000000000 +0000 @@ -0,0 +1,27 @@ +Description: Reduce stress of test_collaborative_call_once on __arm__. +Author: Mo Zhou +Last-Update: 2022-02-15 +Forwarded: https://github.com/oneapi-src/oneTBB/pull/789 + +--- tbb.orig/test/tbb/test_collaborative_call_once.cpp ++++ tbb/test/tbb/test_collaborative_call_once.cpp +@@ -216,6 +216,9 @@ TEST_CASE("only calls once - stress test + // that makes impossible to create more than ~500 threads. + // Android has been added to decrease testing time. + constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 2; ++#elif defined(__ILP32__) && defined(__x86_64__) ++ // This is for x32 port https://wiki.debian.org/X32Port ++ constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 2; + #elif __TBB_USE_THREAD_SANITIZER + // Reduce execution time under Thread Sanitizer + constexpr std::size_t N = tbb::detail::d0::max_nfs_size + 64; +@@ -290,6 +293,9 @@ TEST_CASE("handles exceptions - stress t + // that makes impossible to create more than ~500 threads. + // Android has been added to decrease testing time. + constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 2; ++#elif defined(__ILP32__) && defined(__x86_64__) ++ // This is for x32 port https://wiki.debian.org/X32Port ++ constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 2; + #else + constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 4; + #endif diff -Nru onetbb-2021.7.0/debian/patches/1020-arch-generic.patch onetbb-2021.9.0/debian/patches/1020-arch-generic.patch --- onetbb-2021.7.0/debian/patches/1020-arch-generic.patch 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/1020-arch-generic.patch 2023-08-02 20:42:54.000000000 +0000 @@ -0,0 +1,31 @@ +Description: This patch provides the generic architecture fallback, which was + not merged by upstream. We just keep the patch here. +Author: Matthias Klose +Last-Update: 2023-06-17 +Bug-Debian: https://bugs.debian.org/1006920 +Forwarded: https://github.com/oneapi-src/oneTBB/issues/776 + +Index: tbb/src/tbb/tools_api/ittnotify_config.h +=================================================================== +--- tbb.orig/src/tbb/tools_api/ittnotify_config.h ++++ tbb/src/tbb/tools_api/ittnotify_config.h +@@ -184,6 +184,10 @@ + # define ITT_ARCH_RISCV64 10 + #endif /* ITT_ARCH_RISCV64 */ + ++#ifndef ITT_ARCH_GENERIC ++# define ITT_ARCH_GENERIC 99 ++#endif /* ITT_ARCH_GENERIC */ ++ + #ifndef ITT_ARCH + # if defined _M_IX86 || defined __i386__ + # define ITT_ARCH ITT_ARCH_IA32 +@@ -205,6 +209,8 @@ + # define ITT_ARCH ITT_ARCH_HPPA + # elif defined __riscv && __riscv_xlen == 64 + # define ITT_ARCH ITT_ARCH_RISCV64 ++# else ++# define ITT_ARCH ITT_ARCH_GENERIC + # endif + + #endif diff -Nru onetbb-2021.7.0/debian/patches/1040-missing-header.patch onetbb-2021.9.0/debian/patches/1040-missing-header.patch --- onetbb-2021.7.0/debian/patches/1040-missing-header.patch 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/1040-missing-header.patch 2023-08-02 20:42:54.000000000 +0000 @@ -0,0 +1,16 @@ +Description: Add patch for missing header to resolve FTBFS. +Author: Mo Zhou +Last-Update: 2023-07-13 +Bug-Debian: https://bugs.debian.org/1037798 +Forwarded: no + +--- tbb.orig/test/common/utils_assert.h ++++ tbb/test/common/utils_assert.h +@@ -19,6 +19,7 @@ + + #include "config.h" + #include "utils_report.h" ++#include + + #define REPORT_FATAL_ERROR REPORT + diff -Nru onetbb-2021.7.0/debian/patches/1050-armel-atomic-past-buffer.patch onetbb-2021.9.0/debian/patches/1050-armel-atomic-past-buffer.patch --- onetbb-2021.7.0/debian/patches/1050-armel-atomic-past-buffer.patch 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/1050-armel-atomic-past-buffer.patch 2023-08-02 20:42:54.000000000 +0000 @@ -0,0 +1,44 @@ +Description: Avoid build problem on armel caused by strange compiler. + Add indirection and a result test which seem to confuse GCC 13 less + than the original statements. + + Fixes build problem: + In file included from /usr/include/c++/13/atomic:41, + from /<>/test/common/doctest.h:2990, + from /<>/test/common/test.h:32, + from /<>/test/tbb/test_concurrent_monitor.cpp:26: + In member function ‘void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]’, + inlined from ‘void std::atomic::store(bool, std::memory_order)’ at /usr/include/c++/13/atomic:104:20, + inlined from ‘void tbb::detail::r1::concurrent_monitor_base::notify_one_relaxed() [with Context = unsigned int]’ at /<>/test/tbb/../../src/tbb/concurrent_monitor.h:293:53, + inlined from ‘void tbb::detail::r1::concurrent_monitor_base::notify_one() [with Context = unsigned int]’ at /<>/test/tbb/../../src/tbb/concurrent_monitor.h:276:27, + inlined from ‘void DOCTEST_ANON_FUNC_35()’ at /<>/test/tbb/test_concurrent_monitor.cpp:87:44: + /usr/include/c++/13/bits/atomic_base.h:481:25: error: ‘void __atomic_store_1(volatile void*, unsigned char, int)’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=] + 481 | __atomic_store_n(&_M_i, __i, int(__m)); + | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ + +Author: Petter Reinholdtsen +Forwarded: no +Bug-Debian: https://bugs.debian.org/1042009 +Last-Update: 2023-07-31 + +Index: tbb/src/tbb/concurrent_monitor.h +=================================================================== +--- tbb.orig/src/tbb/concurrent_monitor.h 2023-08-02 22:32:38.111877389 +0200 ++++ tbb/src/tbb/concurrent_monitor.h 2023-08-02 22:35:08.313405875 +0200 +@@ -290,7 +290,15 @@ + n = my_waitset.front(); + if (n != end) { + my_waitset.remove(*n); +- to_wait_node(n)->my_is_in_list.store(false, std::memory_order_relaxed); ++ wait_node* wn = to_wait_node(n); ++ // Artificial 'if' test to work around confused armel ++ // gcc 13 compiler, see ++ // . ++ if (wn) { ++ wn->my_is_in_list.store(false, std::memory_order_relaxed); ++ } else { ++ __TBB_ASSERT(wn, "to_wait_node(n) is NULL"); ++ } + } + } + diff -Nru onetbb-2021.7.0/debian/patches/776.diff onetbb-2021.9.0/debian/patches/776.diff --- onetbb-2021.7.0/debian/patches/776.diff 2022-10-30 09:18:04.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/776.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -https://github.com/oneapi-src/oneTBB/issues/776 - -Index: tbb/src/tbb/tools_api/ittnotify_config.h -=================================================================== ---- tbb.orig/src/tbb/tools_api/ittnotify_config.h -+++ tbb/src/tbb/tools_api/ittnotify_config.h -@@ -171,6 +171,10 @@ - # define ITT_ARCH_HPPA 8 - #endif /* ITT_ARCH_HPPA */ - -+#ifndef ITT_ARCH_GENERIC -+# define ITT_ARCH_GENERIC 99 -+#endif /* ITT_ARCH_GENERIC */ -+ - #ifndef ITT_ARCH - # if defined _M_IX86 || defined __i386__ - # define ITT_ARCH ITT_ARCH_IA32 -@@ -188,6 +192,8 @@ - # define ITT_ARCH ITT_ARCH_S390X - # elif defined __hppa__ - # define ITT_ARCH ITT_ARCH_HPPA -+# else -+# define ITT_ARCH ITT_ARCH_GENERIC - # endif - #endif - diff -Nru onetbb-2021.7.0/debian/patches/fetchadd4.patch onetbb-2021.9.0/debian/patches/fetchadd4.patch --- onetbb-2021.7.0/debian/patches/fetchadd4.patch 2022-10-30 09:18:04.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/fetchadd4.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -Forward: https://github.com/oneapi-src/oneTBB/issues/776 - -Index: tbb/src/tbb/tools_api/ittnotify_config.h -=================================================================== ---- tbb.orig/src/tbb/tools_api/ittnotify_config.h -+++ tbb/src/tbb/tools_api/ittnotify_config.h -@@ -163,6 +163,14 @@ - # define ITT_ARCH_ARM64 6 - #endif /* ITT_ARCH_ARM64 */ - -+#ifndef ITT_ARCH_S390X -+# define ITT_ARCH_S390X 7 -+#endif /* ITT_ARCH_S390X */ -+ -+#ifndef ITT_ARCH_HPPA -+# define ITT_ARCH_HPPA 8 -+#endif /* ITT_ARCH_HPPA */ -+ - #ifndef ITT_ARCH - # if defined _M_IX86 || defined __i386__ - # define ITT_ARCH ITT_ARCH_IA32 -@@ -176,6 +184,10 @@ - # define ITT_ARCH ITT_ARCH_ARM64 - # elif defined __powerpc64__ - # define ITT_ARCH ITT_ARCH_PPC64 -+# elif defined __s390__ || defined __s390x__ -+# define ITT_ARCH ITT_ARCH_S390X -+# elif defined __hppa__ -+# define ITT_ARCH ITT_ARCH_HPPA - # endif - #endif - diff -Nru onetbb-2021.7.0/debian/patches/README onetbb-2021.9.0/debian/patches/README --- onetbb-2021.7.0/debian/patches/README 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/README 2023-08-02 20:42:54.000000000 +0000 @@ -0,0 +1,3 @@ +0xxx: Grabbed from upstream development. +1xxx: Possibly relevant for upstream adoption. +2xxx: Only relevant for official Debian release. diff -Nru onetbb-2021.7.0/debian/patches/remove-unaligned-test.patch onetbb-2021.9.0/debian/patches/remove-unaligned-test.patch --- onetbb-2021.7.0/debian/patches/remove-unaligned-test.patch 2022-10-30 09:18:04.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/remove-unaligned-test.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -iDescription: Remove unaligned mem-accesses from test_malloc_pools.cpp -Index: tbb/test/tbbmalloc/test_malloc_pools.cpp -=================================================================== ---- tbb.orig/test/tbbmalloc/test_malloc_pools.cpp -+++ tbb/test/tbbmalloc/test_malloc_pools.cpp -@@ -66,11 +66,11 @@ static std::atomic liveRegions; - - static void *getMallocMem(intptr_t /*pool_id*/, size_t &bytes) - { -- void *rawPtr = malloc(bytes+sizeof(MallocPoolHeader)+1); -+ void *rawPtr = malloc(bytes+sizeof(MallocPoolHeader)); - if (!rawPtr) - return nullptr; - // +1 to check working with unaligned space -- void *ret = (void *)((uintptr_t)rawPtr+sizeof(MallocPoolHeader)+1); -+ void *ret = (void *)((uintptr_t)rawPtr+sizeof(MallocPoolHeader)); - - MallocPoolHeader *hdr = (MallocPoolHeader*)ret-1; - hdr->rawPtr = rawPtr; diff -Nru onetbb-2021.7.0/debian/patches/series onetbb-2021.9.0/debian/patches/series --- onetbb-2021.7.0/debian/patches/series 2022-11-05 16:25:29.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/series 2023-09-02 03:13:31.000000000 +0000 @@ -1,6 +1,5 @@ -remove-unaligned-test.patch -fetchadd4.patch -test-less-stress.patch -776.diff -0001-Build-tbbmalloc-also-on-mips.patch -warning-flags.patch +1000-remove-unaligned-test.patch +1010-test-less-stress.patch +1020-arch-generic.patch +1040-missing-header.patch +1050-armel-atomic-past-buffer.patch diff -Nru onetbb-2021.7.0/debian/patches/test-less-stress.patch onetbb-2021.9.0/debian/patches/test-less-stress.patch --- onetbb-2021.7.0/debian/patches/test-less-stress.patch 2022-10-30 09:18:04.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/test-less-stress.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -Forward: https://github.com/oneapi-src/oneTBB/pull/789 -Index: tbb/test/tbb/test_collaborative_call_once.cpp -=================================================================== ---- tbb.orig/test/tbb/test_collaborative_call_once.cpp -+++ tbb/test/tbb/test_collaborative_call_once.cpp -@@ -216,6 +216,9 @@ TEST_CASE("only calls once - stress test - // that makes impossible to create more than ~500 threads. - // Android has been added to decrease testing time. - constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 2; -+#elif defined(__ILP32__) && defined(__x86_64__) -+ // This is for x32 port https://wiki.debian.org/X32Port -+ constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 2; - #else - constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 4; - #endif -@@ -287,6 +290,9 @@ TEST_CASE("handles exceptions - stress t - // that makes impossible to create more than ~500 threads. - // Android has been added to decrease testing time. - constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 2; -+#elif defined(__ILP32__) && defined(__x86_64__) -+ // This is for x32 port https://wiki.debian.org/X32Port -+ constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 2; - #else - constexpr std::size_t N = tbb::detail::d0::max_nfs_size * 4; - #endif diff -Nru onetbb-2021.7.0/debian/patches/warning-flags.patch onetbb-2021.9.0/debian/patches/warning-flags.patch --- onetbb-2021.7.0/debian/patches/warning-flags.patch 2022-11-24 20:21:46.000000000 +0000 +++ onetbb-2021.9.0/debian/patches/warning-flags.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -Description: https://github.com/oneapi-src/oneTBB/issues/823 - -Last-Update: 2022-11-24 -Index: tbb/cmake/compilers/GNU.cmake -=================================================================== ---- tbb.orig/cmake/compilers/GNU.cmake -+++ tbb/cmake/compilers/GNU.cmake -@@ -26,7 +26,7 @@ else() - set(TBB_DEF_FILE_PREFIX lin${TBB_ARCH}) - endif() - --set(TBB_WARNING_LEVEL -Wall -Wextra $<$:-Werror> -Wfatal-errors) -+set(TBB_WARNING_LEVEL -Wall -Wextra $<$:-Werror> -Wfatal-errors -Wno-error=uninitialized -Wno-error=array-bounds -Wno-error=address) - set(TBB_TEST_WARNING_FLAGS -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor) - - # Depfile options (e.g. -MD) are inserted automatically in some cases. diff -Nru onetbb-2021.7.0/debian/rules onetbb-2021.9.0/debian/rules --- onetbb-2021.7.0/debian/rules 2022-11-05 16:25:27.000000000 +0000 +++ onetbb-2021.9.0/debian/rules 2023-08-03 06:30:42.000000000 +0000 @@ -7,10 +7,8 @@ ifneq (,$(filter $(DEB_BUILD_ARCH), m68k sh4)) BUILD_FLAGS := -DCMAKE_CXX_FLAGS="$(CXXFLAGS) $(CPPFLAGS) -faligned-new" -endif - -ifeq (ppc64el, $(DEB_BUILD_ARCH)) -BUILD_FLAGS += -DCMAKE_CXX_FLAGS="$(CXXFLAGS) $(CPPFLAGS) -O2" +else +BUILD_FLAGS := -DCMAKE_CXX_FLAGS="$(CXXFLAGS) $(CPPFLAGS) -Wno-error=stringop-overflow" endif ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH)) diff -Nru onetbb-2021.7.0/doc/conf.py onetbb-2021.9.0/doc/conf.py --- onetbb-2021.7.0/doc/conf.py 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/conf.py 2023-04-06 17:14:50.000000000 +0000 @@ -29,7 +29,7 @@ project = u'Intel® oneAPI Threading Building Blocks (oneTBB)' else: project = u'oneTBB' -copyright = u'2022, Intel Corporation' +copyright = u'2023, Intel Corporation' author = u'Intel' # The short X.Y version diff -Nru onetbb-2021.7.0/doc/GSG/get_started.rst onetbb-2021.9.0/doc/GSG/get_started.rst --- onetbb-2021.7.0/doc/GSG/get_started.rst 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/GSG/get_started.rst 2023-04-06 17:14:50.000000000 +0000 @@ -9,6 +9,8 @@ .. include:: before_beginning_and_example.rst +.. include:: hybrid_cpu_support.rst + Find more ********* diff -Nru onetbb-2021.7.0/doc/GSG/hybrid_cpu_support.rst onetbb-2021.9.0/doc/GSG/hybrid_cpu_support.rst --- onetbb-2021.7.0/doc/GSG/hybrid_cpu_support.rst 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/doc/GSG/hybrid_cpu_support.rst 2023-04-06 17:14:50.000000000 +0000 @@ -0,0 +1,40 @@ +.. _hybrid_cpu_support: + +Hybrid CPU and NUMA Support +*************************** + +If you need NUMA/Hybrid CPU support in oneTBB, you need to make sure that HWLOC* is installed on your system. + +HWLOC* (Hardware Locality) is a library that provides a portable abstraction of the hierarchical topology of modern architectures (NUMA, hybrid CPU systems, etc). +oneTBB relies on HWLOC* to identify the underlying topology of the system to optimize thread scheduling and memory allocation. + +Without HWLOC*, oneTBB may not take advantage of NUMA/Hybrid CPU support. Therefore, it's important to make sure that HWLOC* is installed before using oneTBB on such systems. + +Check HWLOC* on the System +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To check if HWLOC* is already installed on your system, run `hwloc-ls`: + + * For Linux* OS, in the command line. + * For Windows* OS, in the command prompt. + +If HWLOC* is installed, the command displays information about the hardware topology of your system. +If it is not installed, you receive an error message saying that the command ``hwloc-ls`` could not be found. + +.. note:: For Hybrid CPU support, make sure that HWLOC* is version 2.5 or higher. + For NUMA support, install HWLOC* version 1.11 or higher. + +Install HWLOC* +^^^^^^^^^^^^^^ + +To install HWLOC*, visit the official Portable Hardware Locality website (https://www-lb.open-mpi.org/projects/hwloc/). + +* For Windows* OS, binaries are available for download. +* For Linux* OS, only the source code is provided and binaries should be built. + +On Linux* OS, HWLOC* can be also installed with package managers, such as APT*, YUM*, etc. +To do so, run: ``sudo apt install hwloc``. + + +.. note:: For Hybrid CPU support, make sure that HWLOC* is version 2.5 or higher. + For NUMA support, install HWLOC* version 1.11 or higher. diff -Nru onetbb-2021.7.0/doc/main/intro/testing_approach.rst onetbb-2021.9.0/doc/main/intro/testing_approach.rst --- onetbb-2021.7.0/doc/main/intro/testing_approach.rst 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/main/intro/testing_approach.rst 2023-04-06 17:14:50.000000000 +0000 @@ -3,7 +3,7 @@ Testing Approach ================ -You can face four main hazard types in the libraries for parallelism: +There are four main types of errors/hazards you can encounter in the development of libraries for parallelism: * Interface correspondence to specification * Memory errors @@ -28,4 +28,4 @@ Continuous Integration triggers all the tests on each commit. This ensures that: * Issues are detected, starting from the early development phase and up to the moment of integration of changes into the library. -* The highest quality of the library even in such error-prone domains as parallelism. +* The highest quality of the library is maintained even in such error-prone domains as parallelism. diff -Nru onetbb-2021.7.0/doc/main/reference/reference.rst onetbb-2021.9.0/doc/main/reference/reference.rst --- onetbb-2021.7.0/doc/main/reference/reference.rst 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/main/reference/reference.rst 2023-04-06 17:14:50.000000000 +0000 @@ -19,6 +19,7 @@ info_namespace parallel_for_each_semantics parallel_sort_ranges_extension + scalable_memory_pools/malloc_replacement_log Preview features **************** @@ -47,7 +48,5 @@ scalable_memory_pools helpers_for_expressing_graphs concurrent_lru_cache_cls - constraints_extensions - info_namespace_extensions task_group_extensions custom_mutex_chmap diff -Nru onetbb-2021.7.0/doc/main/reference/scalable_memory_pools/malloc_replacement_log.rst onetbb-2021.9.0/doc/main/reference/scalable_memory_pools/malloc_replacement_log.rst --- onetbb-2021.7.0/doc/main/reference/scalable_memory_pools/malloc_replacement_log.rst 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/doc/main/reference/scalable_memory_pools/malloc_replacement_log.rst 2023-04-06 17:14:50.000000000 +0000 @@ -0,0 +1,84 @@ +.. _malloc_replacement_log: + +TBB_malloc_replacement_log Function +=================================== + +.. note:: This function is for Windows* OS only. + +Summary +******* + +Provides information about the status of dynamic memory allocation replacement. + +Syntax +******* + +:: + + extern "C" int TBB_malloc_replacement_log(char *** log_ptr); + + +Header +****** + +:: + + #include "oneapi/tbb/tbbmalloc_proxy.h" + + +Description +*********** + +Dynamic replacement of memory allocation functions on Windows* OS uses in-memory binary instrumentation techniques. +To make sure that such instrumentation is safe, oneTBB first searches for a subset of replaced functions in the Visual C++* runtime DLLs +and checks if each one has a known bytecode pattern. If any required function is not found or its bytecode pattern is unknown, the replacement is skipped, +and the program continues to use the standard memory allocation functions. + +The ``TBB_malloc_replacement_log`` function allows the program to check if the dynamic memory replacement happens and to get a log of the performed checks. + +**Returns:** + +* 0, if all necessary functions are successfully found and the replacement takes place. +* 1, otherwise. + +The ``log_ptr`` parameter must be an address of a char** variable or be ``NULL``. If it is not ``NULL``, the function writes there the address of an array of +NULL-terminated strings containing detailed information about the searched functions in the following format: + +:: + + search_status: function_name (dll_name), byte pattern: + + +For more information about the replacement of dynamic memory allocation functions, see :ref:`Windows_C_Dynamic_Memory_Interface_Replacement`. + + +Example +******* + +:: + + #include "oneapi/tbb/tbbmalloc_proxy.h" + #include + + int main(){ + char **func_replacement_log; + int func_replacement_status = TBB_malloc_replacement_log(&func_replacement_log); + + if (func_replacement_status != 0) { + printf("tbbmalloc_proxy cannot replace memory allocation routines\n"); + for (char** log_string = func_replacement_log; *log_string != 0; log_string++) { + printf("%s\n",*log_string); + } + } + + return 0; + } + + +Example output: + +:: + + tbbmalloc_proxy cannot replace memory allocation routines + Success: free (ucrtbase.dll), byte pattern: + Fail: _msize (ucrtbase.dll), byte pattern: diff -Nru onetbb-2021.7.0/doc/main/reference/scalable_memory_pools.rst onetbb-2021.9.0/doc/main/reference/scalable_memory_pools.rst --- onetbb-2021.7.0/doc/main/reference/scalable_memory_pools.rst 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/main/reference/scalable_memory_pools.rst 2023-04-06 17:14:50.000000000 +0000 @@ -41,3 +41,4 @@ scalable_memory_pools/memory_pool_cls scalable_memory_pools/fixed_pool_cls scalable_memory_pools/memory_pool_allocator_cls + diff -Nru onetbb-2021.7.0/doc/main/tbb_userguide/automatically-replacing-malloc.rst onetbb-2021.9.0/doc/main/tbb_userguide/automatically-replacing-malloc.rst --- onetbb-2021.7.0/doc/main/tbb_userguide/automatically-replacing-malloc.rst 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/doc/main/tbb_userguide/automatically-replacing-malloc.rst 2023-04-06 17:14:50.000000000 +0000 @@ -0,0 +1,22 @@ +.. _automatically-replacing-malloc: + +Automatically Replacing ``malloc`` and Other C/C++ Functions for Dynamic Memory Allocation +========================================================================================== + + +On Windows*, Linux\* operating systems, it is possible to automatically +replace all calls to standard functions for dynamic memory allocation +(such as ``malloc``) with the |full_name| scalable equivalents. +Doing so can sometimes improve application performance. + + +Replacements are provided by the proxy library (the library names can be +found in platform-specific sections below). A proxy library and a +scalable memory allocator library should be taken from the same release +of oneTBB, otherwise the libraries may be mutually incompatible. + +.. toctree:: + :maxdepth: 4 + + ../tbb_userguide/Windows_C_Dynamic_Memory_Interface_Replacement + ../tbb_userguide/Linux_C_Dynamic_Memory_Interface_Replacement diff -Nru onetbb-2021.7.0/doc/main/tbb_userguide/Floating_Point_Settings.rst onetbb-2021.9.0/doc/main/tbb_userguide/Floating_Point_Settings.rst --- onetbb-2021.7.0/doc/main/tbb_userguide/Floating_Point_Settings.rst 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/doc/main/tbb_userguide/Floating_Point_Settings.rst 2023-04-06 17:14:50.000000000 +0000 @@ -0,0 +1,60 @@ +.. _Floating_Point_Settings: + +Floating-point Settings +======================= + +To propagate CPU-specific settings for floating-point computations to tasks executed by the task scheduler, you can use one of the following two methods: + +* When a ``task_arena`` or a task scheduler for a given application thread is initialized, they capture the current floating-point settings of the thread. +* The ``task_group_context`` class has a method to capture the current floating-point settings. + +By default, worker threads use floating-point settings obtained during the initialization of a ``task_arena`` or the implicit arena of the application thread. The settings are applied to all computations within that ``task_arena`` or started by that application thread. + + +For better control over floating point behavior, a thread may capture the current settings in a task group context. Do it at context creation with a special flag passed to the constructor: + +:: + + task_group_context ctx( task_group_context::isolated, + task_group_context::default_traits | task_group_context::fp_settings ); + + +Or call the ``capture_fp_settings`` method: + +:: + + task_group_context ctx; + ctx.capture_fp_settings(); + + +You can then pass the task group context to most parallel algorithms, including ``flow::graph``, to ensure that all tasks related to this algorithm use the specified floating-point settings. +It is possible to execute the parallel algorithms with different floating-point settings captured to separate contexts, even at the same time. + +Floating-point settings captured to a task group context prevail over the settings captured during task scheduler initialization. It means, if a context is passed to a parallel algorithm, the floating-point settings captured to the context are used. +Otherwise, if floating-point settings are not captured to the context, or a context is not explicitly specified, the settings captured during the task arena initialization are used. + +In a nested call to a parallel algorithm that does not use the context of a task group with explicitly captured floating-point settings, the outer-level settings are used. +If none of the outer-level contexts capture floating-point settings, the settings captured during task arena initialization are used. + +It guarantees that: + +* Floating-point settings are applied to all tasks executed within a task arena, if they are captured: + + * To a task group context. + * During the arena initialization. + +* A call to a oneTBB parallel algorithm does not change the floating-point settings of the calling thread, even if the algorithm uses different settings. + +.. note:: + The guarantees above apply only to the following conditions: + + * A user code inside a task should: + + * Not change the floating-point settings. + * Revert any modifications. + * Restore previous settings before the end of the task. + + * oneTBB task scheduler observers are not used to set or modify floating point settings. + + Otherwise, the stated guarantees are not valid and the behavior related to floating-point settings is undefined. + diff -Nru onetbb-2021.7.0/doc/main/tbb_userguide/Flow-Graph-exception-tips.rst onetbb-2021.9.0/doc/main/tbb_userguide/Flow-Graph-exception-tips.rst --- onetbb-2021.7.0/doc/main/tbb_userguide/Flow-Graph-exception-tips.rst 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/doc/main/tbb_userguide/Flow-Graph-exception-tips.rst 2023-04-06 17:14:50.000000000 +0000 @@ -0,0 +1,17 @@ +.. _Flow_Graph_exception_tips: + +Flow Graph Tips for Exception Handling and Cancellation +======================================================= + + +The execution of a flow graph can be canceled directly or as a result of +an exception that propagates beyond a node's body. You can then +optionally reset the graph so that it can be re-executed. + +.. toctree:: + :maxdepth: 4 + + ../tbb_userguide/catching_exceptions + ../tbb_userguide/cancel_a_graph + ../tbb_userguide/use_graph_reset + ../tbb_userguide/cancelling_nested_parallelism diff -Nru onetbb-2021.7.0/doc/main/tbb_userguide/Flow-Graph-waiting-tips.rst onetbb-2021.9.0/doc/main/tbb_userguide/Flow-Graph-waiting-tips.rst --- onetbb-2021.7.0/doc/main/tbb_userguide/Flow-Graph-waiting-tips.rst 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/doc/main/tbb_userguide/Flow-Graph-waiting-tips.rst 2023-04-06 17:14:50.000000000 +0000 @@ -0,0 +1,11 @@ +.. _Flow_Graph_waiting_tips: + +Flow Graph Tips for Waiting for and Destroying a Flow Graph +=========================================================== + +.. toctree:: + :maxdepth: 4 + + ../tbb_userguide/always_use_wait_for_all + ../tbb_userguide/avoid_dynamic_node_removal + ../tbb_userguide/destroy_graphs_outside_main_thread diff -Nru onetbb-2021.7.0/doc/main/tbb_userguide/Guiding_Task_Scheduler_Execution.rst onetbb-2021.9.0/doc/main/tbb_userguide/Guiding_Task_Scheduler_Execution.rst --- onetbb-2021.7.0/doc/main/tbb_userguide/Guiding_Task_Scheduler_Execution.rst 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/main/tbb_userguide/Guiding_Task_Scheduler_Execution.rst 2023-04-06 17:14:50.000000000 +0000 @@ -61,8 +61,9 @@ The processors with `Intel® Hybrid Technology `_ contain several core types, each is suited for different purposes. -For example, some applications may improve their performance by preferring execution on the most performant cores. -To set execution preference, assign specific core type identifier to the ``task_arena::constraints::core_type`` field. +In most cases, systems with hybrid CPU architecture show reasonable performance without involving additional API calls. +However, in some exceptional scenarios, performance may be tuned by setting the preferred core type. +To set the preferred core type for the execution, assign a specific core type identifier to the ``task_arena::constraints::core_type`` field. The example shows how to set the most performant core type as preferable for work execution: diff -Nru onetbb-2021.7.0/doc/main/tbb_userguide/Memory_Allocation.rst onetbb-2021.9.0/doc/main/tbb_userguide/Memory_Allocation.rst --- onetbb-2021.7.0/doc/main/tbb_userguide/Memory_Allocation.rst 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/main/tbb_userguide/Memory_Allocation.rst 2023-04-06 17:14:50.000000000 +0000 @@ -68,4 +68,4 @@ ../tbb_userguide/Which_Dynamic_Libraries_to_Use ../tbb_userguide/Allocator_Configuration - ../tbb_userguide/Automically_Replacing_malloc + ../tbb_userguide/automatically-replacing-malloc diff -Nru onetbb-2021.7.0/doc/main/tbb_userguide/Migration_Guide/Task_API.rst onetbb-2021.9.0/doc/main/tbb_userguide/Migration_Guide/Task_API.rst --- onetbb-2021.7.0/doc/main/tbb_userguide/Migration_Guide/Task_API.rst 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/main/tbb_userguide/Migration_Guide/Task_API.rst 2023-04-06 17:14:50.000000000 +0000 @@ -361,7 +361,7 @@ tbb::task_spawn(child); - root.wait_for_all();; + root.wait_for_all(); } In oneTBB, this can be done using ``oneapi::tbb::task_group``. diff -Nru onetbb-2021.7.0/doc/main/tbb_userguide/snippets/flow_graph_examples.cpp onetbb-2021.9.0/doc/main/tbb_userguide/snippets/flow_graph_examples.cpp --- onetbb-2021.7.0/doc/main/tbb_userguide/snippets/flow_graph_examples.cpp 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/main/tbb_userguide/snippets/flow_graph_examples.cpp 2023-04-06 17:14:50.000000000 +0000 @@ -17,10 +17,6 @@ /* Flow Graph Code Example for the Userguide. */ -//! Enable extended task_arena constraints feature for supporting Intel Hybrid Technology -//! and Intel Hyper-Threading Technology. -#define TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION 1 - #include #include diff -Nru onetbb-2021.7.0/doc/main/tbb_userguide/title.rst onetbb-2021.9.0/doc/main/tbb_userguide/title.rst --- onetbb-2021.7.0/doc/main/tbb_userguide/title.rst 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/main/tbb_userguide/title.rst 2023-04-06 17:14:50.000000000 +0000 @@ -14,6 +14,7 @@ ../tbb_userguide/Flow_Graph ../tbb_userguide/work_isolation ../tbb_userguide/Exceptions_and_Cancellation + ../tbb_userguide/Floating_Point_Settings ../tbb_userguide/Containers ../tbb_userguide/Mutual_Exclusion ../tbb_userguide/Timing diff -Nru onetbb-2021.7.0/doc/main/tbb_userguide/Working_on_the_Assembly_Line_pipeline.rst onetbb-2021.9.0/doc/main/tbb_userguide/Working_on_the_Assembly_Line_pipeline.rst --- onetbb-2021.7.0/doc/main/tbb_userguide/Working_on_the_Assembly_Line_pipeline.rst 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/doc/main/tbb_userguide/Working_on_the_Assembly_Line_pipeline.rst 2023-04-06 17:14:50.000000000 +0000 @@ -115,13 +115,13 @@ oneapi::tbb::parallel_pipeline( ntoken, oneapi::tbb::make_filter( - oneapi::tbb::filter::serial_in_order, MyInputFunc(input_file) ) + oneapi::tbb::filter_mode::serial_in_order, MyInputFunc(input_file) ) & oneapi::tbb::make_filter( - oneapi::tbb::filter::parallel, MyTransformFunc() ) + oneapi::tbb::filter_mode::parallel, MyTransformFunc() ) & oneapi::tbb::make_filter( - oneapi::tbb::filter::serial_in_order, MyOutputFunc(output_file) ) ); + oneapi::tbb::filter_mode::serial_in_order, MyOutputFunc(output_file) ) ); } @@ -172,11 +172,11 @@ void RunPipeline( int ntoken, FILE* input_file, FILE* output_file ) { - oneapi::tbb::filter f1( oneapi::tbb::filter::serial_in_order, + oneapi::tbb::filter f1( oneapi::tbb::filter_mode::serial_in_order, MyInputFunc(input_file) ); - oneapi::tbb::filter f2(oneapi::tbb::filter::parallel, + oneapi::tbb::filter f2(oneapi::tbb::filter_mode::parallel, MyTransformFunc() ); - oneapi::tbb::filter f3(oneapi::tbb::filter::serial_in_order, + oneapi::tbb::filter f3(oneapi::tbb::filter_mode::serial_in_order, MyOutputFunc(output_file) ); oneapi::tbb::filter f = f1 & f2 & f3; oneapi::tbb::parallel_pipeline(ntoken,f); diff -Nru onetbb-2021.7.0/examples/README.md onetbb-2021.9.0/examples/README.md --- onetbb-2021.7.0/examples/README.md 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/examples/README.md 2023-04-06 17:14:50.000000000 +0000 @@ -3,17 +3,17 @@ | Code sample name | Description |:--- |:--- -| getting_started/sub_string_finder | Example referenced by the [oneAPI Threading Building Blocks Get Started Guide](https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-onetbb/top.html). Finds largest matching substrings. +| getting_started/sub_string_finder | Example referenced by the [oneAPI Threading Building Blocks Get Started Guide](https://oneapi-src.github.io/oneTBB/GSG/get_started.html#get-started-guide). Finds the largest matching substrings. | concurrent_hash_map/count_strings | Concurrently inserts strings into a `concurrent_hash_map` container. | concurrent_priority_queue/shortpath | Solves the single source shortest path problem using a `concurrent_priority_queue` container. -| graph/binpack | A solution to the binpacking problem using a `queue_node`, a `buffer_node` and `function_node`s. +| graph/binpack | A solution to the binpacking problem using a `queue_node`, a `buffer_node`, and `function_node`s. | graph/cholesky | Several versions of Cholesky Factorization algorithm implementation. -| graph/dining_philosophers | An implementation of dining philosophers in graph using the reserving `join_node`. +| graph/dining_philosophers | An implementation of dining philosophers in a graph using the reserving `join_node`. | graph/fgbzip2 | A parallel implementation of bzip2 block-sorting file compressor. | graph/logic_sim | An example of a collection of digital logic gates that can be easily composed into larger circuits. | graph/som | An example of a Kohonen Self-Organizing Map using cancellation. | parallel_for/game_of_life | Game of life overlay. -| parallel_for/polygon_overlay | polygon overlay. +| parallel_for/polygon_overlay | Polygon overlay. | parallel_for/seismic | Parallel seismic wave simulation. | parallel_for/tachyon | Parallel 2-D raytracer/renderer. | parallel_for_each/parallel_preorder | Parallel preorder traversal of a graph. @@ -25,16 +25,17 @@ | test_all/fibonacci | Compute Fibonacci numbers in different ways. ## System Requirements -"Refer to the [System Requirements](https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-threading-building-blocks-system-requirements.html) for the list of supported hardware and software". +Refer to the [System Requirements](https://github.com/oneapi-src/oneTBB/blob/master/SYSTEM_REQUIREMENTS.md) for the list of supported hardware and software. ### Graphical User Interface (GUI) -Some examples (fractal, seismic, tachyon, polygon_overlay) supports different GUI modes, which may be defined via the `EXAMPLES_UI_MODE` CMake variable. Supported values are: +Some examples (e.g., fractal, seismic, tachyon, polygon_overlay) support different GUI modes, which may be defined via the `EXAMPLES_UI_MODE` CMake variable. +Supported values are: - Cross-platform: - `con` - Console mode (Default). -- Windows: +- Windows* OS: - `gdi` - `GDI+` based implementation. - - `d2d` - `Direct 2D` based implementation. May offer superior performance, but can only be used if the Microsoft* DirectX* SDK is installed on your system(`DXSDK_DIR` should be defined). -- Linux: + - `d2d` - `Direct 2D` based implementation. May offer superior performance but can only be used if the Microsoft* DirectX* SDK is installed on your system(`DXSDK_DIR` should be defined). +- Linux* OS: - `x` - `X11` based implementation. Also `libXext` may be required to display the output correctly. -- MacOS: +- macOS*: - `mac` - `OpenGL` based implementation. Also requires the `Foundation` and `Cocoa` libraries availability. diff -Nru onetbb-2021.7.0/include/oneapi/tbb/concurrent_hash_map.h onetbb-2021.9.0/include/oneapi/tbb/concurrent_hash_map.h --- onetbb-2021.7.0/include/oneapi/tbb/concurrent_hash_map.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/concurrent_hash_map.h 2023-04-06 17:14:50.000000000 +0000 @@ -147,9 +147,9 @@ } template - void init_buckets_impl( segment_ptr_type ptr, size_type sz, Args&&... args ) { + void init_buckets_impl( segment_ptr_type ptr, size_type sz, const Args&... args ) { for (size_type i = 0; i < sz; ++i) { - bucket_allocator_traits::construct(my_allocator, ptr + i, std::forward(args)...); + bucket_allocator_traits::construct(my_allocator, ptr + i, args...); } } @@ -292,7 +292,7 @@ if( sz >= mask ) { // TODO: add custom load_factor segment_index_type new_seg = tbb::detail::log2( mask+1 ); //optimized segment_index_of __TBB_ASSERT( is_valid(my_table[new_seg-1].load(std::memory_order_relaxed)), "new allocations must not publish new mask until segment has allocated"); - static const segment_ptr_type is_allocating = segment_ptr_type(2);; + static const segment_ptr_type is_allocating = segment_ptr_type(2); segment_ptr_type disabled = nullptr; if (!(my_table[new_seg].load(std::memory_order_acquire)) && my_table[new_seg].compare_exchange_strong(disabled, is_allocating)) @@ -443,9 +443,11 @@ if( k&(k-2) ) // not the beginning of a segment ++my_bucket; else my_bucket = my_map->get_bucket( k ); - my_node = static_cast( my_bucket->node_list.load(std::memory_order_relaxed) ); - if( map_base::is_valid(my_node) ) { - my_index = k; return; + node_base *n = my_bucket->node_list.load(std::memory_order_relaxed); + if( map_base::is_valid(n) ) { + my_node = static_cast(n); + my_index = k; + return; } ++k; } diff -Nru onetbb-2021.7.0/include/oneapi/tbb/concurrent_lru_cache.h onetbb-2021.9.0/include/oneapi/tbb/concurrent_lru_cache.h --- onetbb-2021.7.0/include/oneapi/tbb/concurrent_lru_cache.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/concurrent_lru_cache.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -140,6 +140,11 @@ if (! --(map_it->second.my_ref_counter)) { // if the LRU history is full, evict the oldest items to get space if (my_history_list.size() >= my_history_list_capacity) { + if (my_history_list_capacity == 0) { + // Since LRU history capacity is zero, there is no need to keep the element in history + my_storage_map.erase(map_it); + return; + } std::size_t number_of_elements_to_evict = 1 + my_history_list.size() - my_history_list_capacity; for (std::size_t i = 0; i < number_of_elements_to_evict; ++i) { @@ -320,13 +325,16 @@ public: retrieve_aggregator_operation(key_type key) : aggregator_operation(aggregator_operation::op_type::retrieve), - my_key(key), my_is_new_value_needed(false) {} + my_key(key), my_map_record_ptr(nullptr), my_is_new_value_needed(false) {} void handle(lru_cache_type& lru_cache_ref) { my_map_record_ptr = &lru_cache_ref.retrieve_serial(my_key, my_is_new_value_needed); } - storage_map_reference_type result() { return *my_map_record_ptr; } + storage_map_reference_type result() { + __TBB_ASSERT(my_map_record_ptr, "Attempt to call result() before calling handle()"); + return *my_map_record_ptr; + } bool is_new_value_needed() { return my_is_new_value_needed; } }; diff -Nru onetbb-2021.7.0/include/oneapi/tbb/concurrent_queue.h onetbb-2021.9.0/include/oneapi/tbb/concurrent_queue.h --- onetbb-2021.7.0/include/oneapi/tbb/concurrent_queue.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/concurrent_queue.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,6 +28,24 @@ namespace detail { namespace d2 { +template +std::pair internal_try_pop_impl(void* dst, QueueRep& queue, Allocator& alloc ) { + ticket_type ticket{}; + do { + // Basically, we need to read `head_counter` before `tail_counter`. To achieve it we build happens-before on `head_counter` + ticket = queue.head_counter.load(std::memory_order_acquire); + do { + if (static_cast(queue.tail_counter.load(std::memory_order_relaxed) - ticket) <= 0) { // queue is empty + // Queue is empty + return { false, ticket }; + } + // Queue had item with ticket k when we looked. Attempt to get that item. + // Another thread snatched the item, retry. + } while (!queue.head_counter.compare_exchange_strong(ticket, ticket + 1)); + } while (!queue.choose(ticket).pop(dst, ticket, queue, alloc)); + return { true, ticket }; +} + // A high-performance thread-safe non-blocking concurrent queue. // Multiple threads may each push and pop concurrently. // Assignment construction is not allowed. @@ -148,10 +166,7 @@ // Clear the queue. not thread-safe. void clear() { - while (!empty()) { - T value; - try_pop(value); - } + my_queue_representation->clear(my_allocator); } // Return allocator object @@ -181,20 +196,7 @@ } bool internal_try_pop( void* dst ) { - ticket_type k; - do { - k = my_queue_representation->head_counter.load(std::memory_order_relaxed); - do { - if (static_cast(my_queue_representation->tail_counter.load(std::memory_order_relaxed) - k) <= 0) { - // Queue is empty - return false; - } - - // Queue had item with ticket k when we looked. Attempt to get that item. - // Another thread snatched the item, retry. - } while (!my_queue_representation->head_counter.compare_exchange_strong(k, k + 1)); - } while (!my_queue_representation->choose(k).pop(dst, k, *my_queue_representation, my_allocator)); - return true; + return internal_try_pop_impl(dst, *my_queue_representation, my_allocator).first; } template @@ -375,12 +377,12 @@ } // Attempt to dequeue an item from head of queue. - /** Does not wait for item to become available. - Returns true if successful; false otherwise. */ - bool pop( T& result ) { - return internal_pop(&result); + void pop( T& result ) { + internal_pop(&result); } + /** Does not wait for item to become available. + Returns true if successful; false otherwise. */ bool try_pop( T& result ) { return internal_pop_if_present(&result); } @@ -410,10 +412,7 @@ // Clear the queue. not thread-safe. void clear() { - while (!empty()) { - T value; - try_pop(value); - } + my_queue_representation->clear(my_allocator); } // Return allocator object @@ -482,7 +481,7 @@ return true; } - bool internal_pop( void* dst ) { + void internal_pop( void* dst ) { std::ptrdiff_t target; // This loop is a single pop operation; abort_counter should not be re-read inside unsigned old_abort_counter = my_abort_counter.load(std::memory_order_relaxed); @@ -508,25 +507,17 @@ } while (!my_queue_representation->choose(target).pop(dst, target, *my_queue_representation, my_allocator)); r1::notify_bounded_queue_monitor(my_monitors, cbq_slots_avail_tag, target); - return true; } bool internal_pop_if_present( void* dst ) { - ticket_type ticket; - do { - ticket = my_queue_representation->head_counter.load(std::memory_order_relaxed); - do { - if (static_cast(my_queue_representation->tail_counter.load(std::memory_order_relaxed) - ticket) <= 0) { // queue is empty - // Queue is empty - return false; - } - // Queue had item with ticket k when we looked. Attempt to get that item. - // Another thread snatched the item, retry. - } while (!my_queue_representation->head_counter.compare_exchange_strong(ticket, ticket + 1)); - } while (!my_queue_representation->choose(ticket).pop(dst, ticket, *my_queue_representation, my_allocator)); + bool present{}; + ticket_type ticket{}; + std::tie(present, ticket) = internal_try_pop_impl(dst, *my_queue_representation, my_allocator); - r1::notify_bounded_queue_monitor(my_monitors, cbq_slots_avail_tag, ticket); - return true; + if (present) { + r1::notify_bounded_queue_monitor(my_monitors, cbq_slots_avail_tag, ticket); + } + return present; } void internal_abort() { diff -Nru onetbb-2021.7.0/include/oneapi/tbb/concurrent_unordered_map.h onetbb-2021.9.0/include/oneapi/tbb/concurrent_unordered_map.h --- onetbb-2021.7.0/include/oneapi/tbb/concurrent_unordered_map.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/concurrent_unordered_map.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -223,6 +223,16 @@ -> concurrent_unordered_map, T, Hash, std::equal_to>, Alloc>; +#if __APPLE__ && __TBB_CLANG_VERSION == 100000 +// An explicit deduction guide is required for copy/move constructor with allocator for APPLE LLVM 10.0.0 +// due to an issue with generating an implicit deduction guide for these constructors under several strange surcumstances. +// Currently the issue takes place because the last template parameter for Traits is boolean, it should not affect the deduction guides +// The issue reproduces only on this version of the compiler +template +concurrent_unordered_map( concurrent_unordered_map, Alloc ) +-> concurrent_unordered_map; +#endif + #endif // __TBB_CPP17_DEDUCTION_GUIDES_PRESENT template @@ -372,6 +382,15 @@ -> concurrent_unordered_multimap, T, Hash, std::equal_to>, Alloc>; +#if __APPLE__ && __TBB_CLANG_VERSION == 100000 +// An explicit deduction guide is required for copy/move constructor with allocator for APPLE LLVM 10.0.0 +// due to an issue with generating an implicit deduction guide for these constructors under several strange surcumstances. +// Currently the issue takes place because the last template parameter for Traits is boolean, it should not affect the deduction guides +// The issue reproduces only on this version of the compiler +template +concurrent_unordered_multimap( concurrent_unordered_multimap, Alloc ) +-> concurrent_unordered_multimap; +#endif #endif // __TBB_CPP17_DEDUCTION_GUIDES_PRESENT template diff -Nru onetbb-2021.7.0/include/oneapi/tbb/concurrent_unordered_set.h onetbb-2021.9.0/include/oneapi/tbb/concurrent_unordered_set.h --- onetbb-2021.7.0/include/oneapi/tbb/concurrent_unordered_set.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/concurrent_unordered_set.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -163,6 +163,15 @@ concurrent_unordered_set( std::initializer_list, std::size_t, Hash, Alloc ) -> concurrent_unordered_set, Alloc>; +#if __APPLE__ && __TBB_CLANG_VERSION == 100000 +// An explicit deduction guide is required for copy/move constructor with allocator for APPLE LLVM 10.0.0 +// due to an issue with generating an implicit deduction guide for these constructors under several strange surcumstances. +// Currently the issue takes place because the last template parameter for Traits is boolean, it should not affect the deduction guides +// The issue reproduces only on this version of the compiler +template +concurrent_unordered_set( concurrent_unordered_set, Alloc ) +-> concurrent_unordered_set; +#endif #endif // __TBB_CPP17_DEDUCTION_GUIDES_PRESENT template @@ -292,6 +301,15 @@ concurrent_unordered_multiset( std::initializer_list, std::size_t, Hash, Alloc ) -> concurrent_unordered_multiset, Alloc>; +#if __APPLE__ && __TBB_CLANG_VERSION == 100000 +// An explicit deduction guide is required for copy/move constructor with allocator for APPLE LLVM 10.0.0 +// due to an issue with generating an implicit deduction guide for these constructors under several strange surcumstances. +// Currently the issue takes place because the last template parameter for Traits is boolean, it should not affect the deduction guides +// The issue reproduces only on this version of the compiler +template +concurrent_unordered_multiset( concurrent_unordered_multiset, Alloc ) +-> concurrent_unordered_multiset; +#endif #endif // __TBB_CPP17_DEDUCTION_GUIDES_PRESENT template diff -Nru onetbb-2021.7.0/include/oneapi/tbb/concurrent_vector.h onetbb-2021.9.0/include/oneapi/tbb/concurrent_vector.h --- onetbb-2021.7.0/include/oneapi/tbb/concurrent_vector.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/concurrent_vector.h 2023-04-06 17:14:50.000000000 +0000 @@ -1031,7 +1031,7 @@ this->delete_segment(seg_idx - 1); } } - if (!k) this->my_first_block.store(0, std::memory_order_relaxed);; + if (!k) this->my_first_block.store(0, std::memory_order_relaxed); } } diff -Nru onetbb-2021.7.0/include/oneapi/tbb/detail/_aggregator.h onetbb-2021.9.0/include/oneapi/tbb/detail/_aggregator.h --- onetbb-2021.7.0/include/oneapi/tbb/detail/_aggregator.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/detail/_aggregator.h 2023-04-06 17:14:50.000000000 +0000 @@ -155,14 +155,17 @@ // template friend class aggregating_functor; template class aggregating_functor { - AggregatingClass* my_object; + AggregatingClass* my_object{nullptr}; public: aggregating_functor() = default; aggregating_functor( AggregatingClass* object ) : my_object(object) { __TBB_ASSERT(my_object, nullptr); } - void operator()( OperationList* op_list ) { my_object->handle_operations(op_list); } + void operator()( OperationList* op_list ) { + __TBB_ASSERT(my_object, nullptr); + my_object->handle_operations(op_list); + } }; // class aggregating_functor diff -Nru onetbb-2021.7.0/include/oneapi/tbb/detail/_concurrent_queue_base.h onetbb-2021.9.0/include/oneapi/tbb/detail/_concurrent_queue_base.h --- onetbb-2021.7.0/include/oneapi/tbb/detail/_concurrent_queue_base.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/detail/_concurrent_queue_base.h 2023-04-06 17:14:50.000000000 +0000 @@ -123,7 +123,7 @@ page_allocator_traits::construct(page_allocator, p); } - if (tail_counter.load(std::memory_order_relaxed) != k) spin_wait_until_my_turn(tail_counter, k, base); + spin_wait_until_my_turn(tail_counter, k, base); d1::call_itt_notify(d1::acquired, &tail_counter); if (p) { @@ -134,9 +134,9 @@ } else { head_page.store(p, std::memory_order_relaxed); } - tail_page.store(p, std::memory_order_release); + tail_page.store(p, std::memory_order_relaxed); } else { - p = tail_page.load(std::memory_order_acquire); // TODO may be relaxed ? + p = tail_page.load(std::memory_order_relaxed); } return index; } @@ -173,13 +173,13 @@ tail_counter.fetch_add(queue_rep_type::n_queue); } - bool pop( void* dst, ticket_type k, queue_rep_type& base, queue_allocator_type& allocator) { + bool pop( void* dst, ticket_type k, queue_rep_type& base, queue_allocator_type& allocator ) { k &= -queue_rep_type::n_queue; spin_wait_until_eq(head_counter, k); d1::call_itt_notify(d1::acquired, &head_counter); spin_wait_while_eq(tail_counter, k); d1::call_itt_notify(d1::acquired, &tail_counter); - padded_page *p = head_page.load(std::memory_order_acquire); + padded_page *p = head_page.load(std::memory_order_relaxed); __TBB_ASSERT( p, nullptr ); size_type index = modulo_power_of_two( k/queue_rep_type::n_queue, items_per_page ); bool success = false; @@ -189,7 +189,7 @@ k + queue_rep_type::n_queue, index == items_per_page - 1 ? p : nullptr ); if (p->mask.load(std::memory_order_relaxed) & (std::uintptr_t(1) << index)) { success = true; - assign_and_destroy_item( dst, *p, index ); + assign_and_destroy_item(dst, *p, index); } else { --base.n_invalid_entries; } @@ -276,36 +276,38 @@ } } - padded_page* get_tail_page() { - return tail_page.load(std::memory_order_relaxed); - } - padded_page* get_head_page() { return head_page.load(std::memory_order_relaxed); } - void set_tail_page( padded_page* pg ) { - tail_page.store(pg, std::memory_order_relaxed); - } - - void clear(queue_allocator_type& allocator ) { - padded_page* curr_page = head_page.load(std::memory_order_relaxed); - std::size_t index = head_counter.load(std::memory_order_relaxed); + void clear(queue_allocator_type& allocator, padded_page* new_head = nullptr, padded_page* new_tail = nullptr) { + padded_page* curr_page = get_head_page(); + size_type index = (head_counter.load(std::memory_order_relaxed) / queue_rep_type::n_queue) % items_per_page; page_allocator_type page_allocator(allocator); - while (curr_page) { - for (; index != items_per_page - 1; ++index) { - curr_page->operator[](index).~value_type(); + while (curr_page && is_valid_page(curr_page)) { + while (index != items_per_page) { + if (curr_page->mask.load(std::memory_order_relaxed) & (std::uintptr_t(1) << index)) { + page_allocator_traits::destroy(page_allocator, &curr_page->operator[](index)); + } + ++index; } - padded_page* next_page = curr_page->next; - page_allocator_traits::destroy(page_allocator, curr_page); - page_allocator_traits::deallocate(page_allocator, curr_page, 1); - curr_page = next_page; - } + index = 0; + padded_page* next_page = curr_page->next; + page_allocator_traits::destroy(page_allocator, curr_page); + page_allocator_traits::deallocate(page_allocator, curr_page, 1); + curr_page = next_page; + } + head_counter.store(0, std::memory_order_relaxed); + tail_counter.store(0, std::memory_order_relaxed); + head_page.store(new_head, std::memory_order_relaxed); + tail_page.store(new_tail, std::memory_order_relaxed); + } + + void clear_and_invalidate(queue_allocator_type& allocator) { padded_page* invalid_page = reinterpret_cast(std::uintptr_t(1)); - head_page.store(invalid_page, std::memory_order_relaxed); - tail_page.store(invalid_page, std::memory_order_relaxed); + clear(allocator, invalid_page, invalid_page); } private: @@ -336,8 +338,8 @@ } void spin_wait_until_my_turn( std::atomic& counter, ticket_type k, queue_rep_type& rb ) const { - for (atomic_backoff b(true);; b.pause()) { - ticket_type c = counter; + for (atomic_backoff b{};; b.pause()) { + ticket_type c = counter.load(std::memory_order_acquire); if (c == k) return; else if (c & 1) { ++rb.n_invalid_entries; @@ -378,9 +380,9 @@ if( is_valid_page(p) ) { spin_mutex::scoped_lock lock( my_queue.page_mutex ); padded_page* q = p->next; - my_queue.head_page.store(q, std::memory_order_release); + my_queue.head_page.store(q, std::memory_order_relaxed); if( !is_valid_page(q) ) { - my_queue.tail_page.store(nullptr, std::memory_order_release); + my_queue.tail_page.store(nullptr, std::memory_order_relaxed); } } my_queue.head_counter.store(my_ticket_type, std::memory_order_release); @@ -430,18 +432,12 @@ concurrent_queue_rep& operator=( const concurrent_queue_rep& ) = delete; void clear( queue_allocator_type& alloc ) { - page_allocator_type page_allocator(alloc); - for (size_type i = 0; i < n_queue; ++i) { - padded_page* tail_page = array[i].get_tail_page(); - if( is_valid_page(tail_page) ) { - __TBB_ASSERT(array[i].get_head_page() == tail_page, "at most one page should remain" ); - page_allocator_traits::destroy(page_allocator, static_cast(tail_page)); - page_allocator_traits::deallocate(page_allocator, static_cast(tail_page), 1); - array[i].set_tail_page(nullptr); - } else { - __TBB_ASSERT(!is_valid_page(array[i].get_head_page()), "head page pointer corrupt?"); - } + for (size_type index = 0; index < n_queue; ++index) { + array[index].clear(alloc); } + head_counter.store(0, std::memory_order_relaxed); + tail_counter.store(0, std::memory_order_relaxed); + n_invalid_entries.store(0, std::memory_order_relaxed); } void assign( const concurrent_queue_rep& src, queue_allocator_type& alloc, item_constructor_type construct_item ) { @@ -457,7 +453,7 @@ } }).on_exception( [&] { for (size_type i = 0; i < queue_idx + 1; ++i) { - array[i].clear(alloc); + array[i].clear_and_invalidate(alloc); } head_counter.store(0, std::memory_order_relaxed); tail_counter.store(0, std::memory_order_relaxed); diff -Nru onetbb-2021.7.0/include/oneapi/tbb/detail/_concurrent_skip_list.h onetbb-2021.9.0/include/oneapi/tbb/detail/_concurrent_skip_list.h --- onetbb-2021.7.0/include/oneapi/tbb/detail/_concurrent_skip_list.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/detail/_concurrent_skip_list.h 2023-04-06 17:14:50.000000000 +0000 @@ -1068,6 +1068,7 @@ __TBB_ASSERT(!handle.empty(), "Extracted handle in merge is empty"); if (!insert(std::move(handle)).second) { + __TBB_ASSERT(!handle.empty(), "Handle should not be empty if insert fails"); //If the insertion fails - return the node into source source.insert(std::move(handle)); } diff -Nru onetbb-2021.7.0/include/oneapi/tbb/detail/_concurrent_unordered_base.h onetbb-2021.9.0/include/oneapi/tbb/detail/_concurrent_unordered_base.h --- onetbb-2021.7.0/include/oneapi/tbb/detail/_concurrent_unordered_base.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/detail/_concurrent_unordered_base.h 2023-04-06 17:14:50.000000000 +0000 @@ -917,7 +917,7 @@ node_allocator_traits::deallocate(dummy_node_allocator, node, 1); } else { // GCC 11.1 issues a warning here that incorrect destructor might be called for dummy_nodes - #if (__TBB_GCC_VERSION >= 110100 && __TBB_GCC_VERSION < 120000 ) && !__clang__ && !__INTEL_COMPILER + #if (__TBB_GCC_VERSION >= 110100 && __TBB_GCC_VERSION < 130000 ) && !__clang__ && !__INTEL_COMPILER volatile #endif value_node_ptr val_node = static_cast(node); diff -Nru onetbb-2021.7.0/include/oneapi/tbb/detail/_config.h onetbb-2021.9.0/include/oneapi/tbb/detail/_config.h --- onetbb-2021.7.0/include/oneapi/tbb/detail/_config.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/detail/_config.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2022 Intel Corporation + Copyright (c) 2005-2023 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -374,16 +374,12 @@ #define __TBB_ARENA_BINDING 1 #endif -#if (TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION || __TBB_BUILD) && __TBB_ARENA_BINDING - #define __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT 1 -#endif - #ifndef __TBB_ENQUEUE_ENFORCED_CONCURRENCY #define __TBB_ENQUEUE_ENFORCED_CONCURRENCY 1 #endif #if !defined(__TBB_SURVIVE_THREAD_SWITCH) && \ - (_WIN32 || _WIN64 || __APPLE__ || (__unix__ && !__ANDROID__)) + (_WIN32 || _WIN64 || __APPLE__ || (defined(__unix__) && !__ANDROID__)) #define __TBB_SURVIVE_THREAD_SWITCH 1 #endif /* __TBB_SURVIVE_THREAD_SWITCH */ diff -Nru onetbb-2021.7.0/include/oneapi/tbb/detail/_flow_graph_join_impl.h onetbb-2021.9.0/include/oneapi/tbb/detail/_flow_graph_join_impl.h --- onetbb-2021.7.0/include/oneapi/tbb/detail/_flow_graph_join_impl.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/detail/_flow_graph_join_impl.h 2023-04-06 17:14:50.000000000 +0000 @@ -384,7 +384,7 @@ graph_task* bypass_t; // constructor for value parameter queueing_port_operation(const T& e, op_type t) : - type(char(t)), my_val(e) + type(char(t)), my_val(e), my_arg(nullptr) , bypass_t(nullptr) {} // constructor for pointer parameter @@ -393,7 +393,7 @@ , bypass_t(nullptr) {} // constructor with no parameter - queueing_port_operation(op_type t) : type(char(t)) + queueing_port_operation(op_type t) : type(char(t)), my_arg(nullptr) , bypass_t(nullptr) {} }; @@ -422,6 +422,7 @@ break; case get__item: if(!this->buffer_empty()) { + __TBB_ASSERT(current->my_arg, nullptr); *(current->my_arg) = this->front(); current->status.store( SUCCEEDED, std::memory_order_release); } @@ -547,12 +548,12 @@ input_type *my_arg; // constructor for value parameter key_matching_port_operation(const input_type& e, op_type t) : - type(char(t)), my_val(e) {} + type(char(t)), my_val(e), my_arg(nullptr) {} // constructor for pointer parameter key_matching_port_operation(const input_type* p, op_type t) : type(char(t)), my_arg(const_cast(p)) {} // constructor with no parameter - key_matching_port_operation(op_type t) : type(char(t)) {} + key_matching_port_operation(op_type t) : type(char(t)), my_arg(nullptr) {} }; typedef aggregating_functor handler_type; @@ -573,6 +574,7 @@ break; case get__item: // use current_key from FE for item + __TBB_ASSERT(current->my_arg, nullptr); if(!this->find_with_key(my_join->current_key, *(current->my_arg))) { __TBB_ASSERT(false, "Failed to find item corresponding to current_key."); } @@ -667,12 +669,12 @@ template class join_node_FE : public reserving_forwarding_base { - public: + private: static const int N = std::tuple_size::value; typedef OutputTuple output_type; typedef InputTuple input_type; typedef join_node_base base_node_type; // for forwarding - + public: join_node_FE(graph &g) : reserving_forwarding_base(g), my_node(nullptr) { ports_with_no_inputs = N; join_helper::set_join_node_pointer(my_inputs, this); @@ -1212,10 +1214,10 @@ // using tuple_element. The class PT is the port type (reserving_port, queueing_port, key_matching_port) // and should match the typename. - template class PT, typename OutputTuple, typename JP> - class unfolded_join_node : public join_base::type { + template class PT, typename OutputTuple, typename JP> + class unfolded_join_node : public join_base::type { public: - typedef typename wrap_tuple_elements::type input_ports_type; + typedef typename wrap_tuple_elements::type input_ports_type; typedef OutputTuple output_type; private: typedef join_node_base base_type; diff -Nru onetbb-2021.7.0/include/oneapi/tbb/detail/_flow_graph_node_impl.h onetbb-2021.9.0/include/oneapi/tbb/detail/_flow_graph_node_impl.h --- onetbb-2021.7.0/include/oneapi/tbb/detail/_flow_graph_node_impl.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/detail/_flow_graph_node_impl.h 2023-04-06 17:14:50.000000000 +0000 @@ -159,8 +159,8 @@ }; graph_task* bypass_t; operation_type(const input_type& e, op_type t) : - type(char(t)), elem(const_cast(&e)) {} - operation_type(op_type t) : type(char(t)), r(nullptr) {} + type(char(t)), elem(const_cast(&e)), bypass_t(nullptr) {} + operation_type(op_type t) : type(char(t)), r(nullptr), bypass_t(nullptr) {} }; bool forwarder_busy; diff -Nru onetbb-2021.7.0/include/oneapi/tbb/detail/_segment_table.h onetbb-2021.9.0/include/oneapi/tbb/detail/_segment_table.h --- onetbb-2021.7.0/include/oneapi/tbb/detail/_segment_table.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/detail/_segment_table.h 2023-04-06 17:14:50.000000000 +0000 @@ -60,17 +60,19 @@ static constexpr size_type pointers_per_long_table = sizeof(size_type) * 8; public: segment_table( const allocator_type& alloc = allocator_type() ) - : my_segment_table_allocator(alloc), my_segment_table(my_embedded_table) + : my_segment_table_allocator(alloc), my_segment_table(nullptr) , my_first_block{}, my_size{}, my_segment_table_allocation_failed{} { + my_segment_table.store(my_embedded_table, std::memory_order_relaxed); zero_table(my_embedded_table, pointers_per_embedded_table); } segment_table( const segment_table& other ) : my_segment_table_allocator(segment_table_allocator_traits:: select_on_container_copy_construction(other.my_segment_table_allocator)) - , my_segment_table(my_embedded_table), my_first_block{}, my_size{}, my_segment_table_allocation_failed{} + , my_segment_table(nullptr), my_first_block{}, my_size{}, my_segment_table_allocation_failed{} { + my_segment_table.store(my_embedded_table, std::memory_order_relaxed); zero_table(my_embedded_table, pointers_per_embedded_table); try_call( [&] { internal_transfer(other, copy_segment_body_type{*this}); @@ -80,9 +82,10 @@ } segment_table( const segment_table& other, const allocator_type& alloc ) - : my_segment_table_allocator(alloc), my_segment_table(my_embedded_table) + : my_segment_table_allocator(alloc), my_segment_table(nullptr) , my_first_block{}, my_size{}, my_segment_table_allocation_failed{} { + my_segment_table.store(my_embedded_table, std::memory_order_relaxed); zero_table(my_embedded_table, pointers_per_embedded_table); try_call( [&] { internal_transfer(other, copy_segment_body_type{*this}); @@ -92,17 +95,19 @@ } segment_table( segment_table&& other ) - : my_segment_table_allocator(std::move(other.my_segment_table_allocator)), my_segment_table(my_embedded_table) + : my_segment_table_allocator(std::move(other.my_segment_table_allocator)), my_segment_table(nullptr) , my_first_block{}, my_size{}, my_segment_table_allocation_failed{} { + my_segment_table.store(my_embedded_table, std::memory_order_relaxed); zero_table(my_embedded_table, pointers_per_embedded_table); internal_move(std::move(other)); } segment_table( segment_table&& other, const allocator_type& alloc ) - : my_segment_table_allocator(alloc), my_segment_table(my_embedded_table), my_first_block{} + : my_segment_table_allocator(alloc), my_segment_table(nullptr), my_first_block{} , my_size{}, my_segment_table_allocation_failed{} { + my_segment_table.store(my_embedded_table, std::memory_order_relaxed); zero_table(my_embedded_table, pointers_per_embedded_table); using is_equal_type = typename segment_table_allocator_traits::is_always_equal; internal_move_construct_with_allocator(std::move(other), alloc, is_equal_type()); diff -Nru onetbb-2021.7.0/include/oneapi/tbb/flow_graph.h onetbb-2021.9.0/include/oneapi/tbb/flow_graph.h --- onetbb-2021.7.0/include/oneapi/tbb/flow_graph.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/flow_graph.h 2023-04-06 17:14:50.000000000 +0000 @@ -1183,8 +1183,9 @@ buffer_operation(const T& e, op_type t) : type(char(t)) , elem(const_cast(&e)) , ltask(nullptr) + , r(nullptr) {} - buffer_operation(op_type t) : type(char(t)), ltask(nullptr) {} + buffer_operation(op_type t) : type(char(t)), elem(nullptr), ltask(nullptr), r(nullptr) {} }; bool forwarder_busy; @@ -1271,12 +1272,14 @@ //! Register successor virtual void internal_reg_succ(buffer_operation *op) { + __TBB_ASSERT(op->r, nullptr); my_successors.register_successor(*(op->r)); op->status.store(SUCCEEDED, std::memory_order_release); } //! Remove successor virtual void internal_rem_succ(buffer_operation *op) { + __TBB_ASSERT(op->r, nullptr); my_successors.remove_successor(*(op->r)); op->status.store(SUCCEEDED, std::memory_order_release); } @@ -1330,12 +1333,14 @@ } virtual bool internal_push(buffer_operation *op) { + __TBB_ASSERT(op->elem, nullptr); this->push_back(*(op->elem)); op->status.store(SUCCEEDED, std::memory_order_release); return true; } virtual void internal_pop(buffer_operation *op) { + __TBB_ASSERT(op->elem, nullptr); if(this->pop_back(*(op->elem))) { op->status.store(SUCCEEDED, std::memory_order_release); } @@ -1345,6 +1350,7 @@ } virtual void internal_reserve(buffer_operation *op) { + __TBB_ASSERT(op->elem, nullptr); if(this->reserve_front(*(op->elem))) { op->status.store(SUCCEEDED, std::memory_order_release); } diff -Nru onetbb-2021.7.0/include/oneapi/tbb/info.h onetbb-2021.9.0/include/oneapi/tbb/info.h --- onetbb-2021.7.0/include/oneapi/tbb/info.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/info.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2019-2021 Intel Corporation + Copyright (c) 2019-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -49,7 +49,6 @@ max_concurrency = maximal_concurrency; return *this; } -#if __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT constraints& set_core_type(core_type_id id) { core_type = id; return *this; @@ -58,14 +57,11 @@ max_threads_per_core = threads_number; return *this; } -#endif numa_node_id numa_id = -1; int max_concurrency = -1; -#if __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT core_type_id core_type = -1; int max_threads_per_core = -1; -#endif }; } // namespace d1 @@ -96,7 +92,6 @@ return r1::numa_default_concurrency(id); } -#if __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT inline std::vector core_types() { std::vector core_type_indexes(r1::core_type_count()); r1::fill_core_type_indices(core_type_indexes.data()); @@ -107,22 +102,17 @@ if (c.max_concurrency > 0) { return c.max_concurrency; } return r1::constraints_default_concurrency(c); } -#endif /*__TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT*/ } // namespace d1 } // namespace detail inline namespace v1 { using detail::d1::numa_node_id; -#if __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT using detail::d1::core_type_id; -#endif namespace info { using detail::d1::numa_nodes; -#if __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT using detail::d1::core_types; -#endif using detail::d1::default_concurrency; } // namespace info diff -Nru onetbb-2021.7.0/include/oneapi/tbb/parallel_for_each.h onetbb-2021.9.0/include/oneapi/tbb/parallel_for_each.h --- onetbb-2021.7.0/include/oneapi/tbb/parallel_for_each.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/parallel_for_each.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2023 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -95,7 +95,7 @@ body(std::forward(item)); #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) - #pragma warning (push) + #pragma warning (pop) #endif } @@ -112,7 +112,7 @@ body(std::forward(item), *feeder); #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) - #pragma warning (push) + #pragma warning (pop) #endif } }; @@ -306,7 +306,9 @@ ~input_block_handling_task() { for(std::size_t counter = 0; counter < max_block_size; ++counter) { (task_pool.begin() + counter)->~iteration_task(); - (block_iteration_space.begin() + counter)->~Item(); + if (counter < my_size) { + (block_iteration_space.begin() + counter)->~Item(); + } } } diff -Nru onetbb-2021.7.0/include/oneapi/tbb/parallel_for.h onetbb-2021.9.0/include/oneapi/tbb/parallel_for.h --- onetbb-2021.7.0/include/oneapi/tbb/parallel_for.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/parallel_for.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -79,6 +79,7 @@ start_for( const Range& range, const Body& body, Partitioner& partitioner, small_object_allocator& alloc ) : my_range(range), my_body(body), + my_parent(nullptr), my_partition(partitioner), my_allocator(alloc) {} //! Splitting constructor used to generate children. @@ -86,6 +87,7 @@ start_for( start_for& parent_, typename Partitioner::split_type& split_obj, small_object_allocator& alloc ) : my_range(parent_.my_range, get_range_split_object(split_obj)), my_body(parent_.my_body), + my_parent(nullptr), my_partition(parent_.my_partition, split_obj), my_allocator(alloc) {} //! Construct right child from the given range as response to the demand. @@ -93,6 +95,7 @@ start_for( start_for& parent_, const Range& r, depth_t d, small_object_allocator& alloc ) : my_range(r), my_body(parent_.my_body), + my_parent(nullptr), my_partition(parent_.my_partition, split()), my_allocator(alloc) { diff -Nru onetbb-2021.7.0/include/oneapi/tbb/parallel_reduce.h onetbb-2021.9.0/include/oneapi/tbb/parallel_reduce.h --- onetbb-2021.7.0/include/oneapi/tbb/parallel_reduce.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/parallel_reduce.h 2023-04-06 17:14:50.000000000 +0000 @@ -104,6 +104,7 @@ start_reduce( const Range& range, Body& body, Partitioner& partitioner, small_object_allocator& alloc ) : my_range(range), my_body(&body), + my_parent(nullptr), my_partition(partitioner), my_allocator(alloc), is_right_child(false) {} @@ -112,6 +113,7 @@ start_reduce( start_reduce& parent_, typename Partitioner::split_type& split_obj, small_object_allocator& alloc ) : my_range(parent_.my_range, get_range_split_object(split_obj)), my_body(parent_.my_body), + my_parent(nullptr), my_partition(parent_.my_partition, split_obj), my_allocator(alloc), is_right_child(true) @@ -123,6 +125,7 @@ start_reduce( start_reduce& parent_, const Range& r, depth_t d, small_object_allocator& alloc ) : my_range(r), my_body(parent_.my_body), + my_parent(nullptr), my_partition(parent_.my_partition, split()), my_allocator(alloc), is_right_child(true) @@ -201,6 +204,7 @@ // The acquire barrier synchronizes the data pointed with my_body if the left // task has already finished. + __TBB_ASSERT(my_parent, nullptr); if( is_right_child && my_parent->m_ref_count.load(std::memory_order_acquire) == 2 ) { tree_node_type* parent_ptr = static_cast(my_parent); my_body = (Body*) new( parent_ptr->zombie_space.begin() ) Body(*my_body, split()); @@ -261,6 +265,7 @@ start_deterministic_reduce( const Range& range, Partitioner& partitioner, Body& body, small_object_allocator& alloc ) : my_range(range), my_body(body), + my_parent(nullptr), my_partition(partitioner), my_allocator(alloc) {} //! Splitting constructor used to generate children. @@ -269,6 +274,7 @@ small_object_allocator& alloc ) : my_range(parent_.my_range, get_range_split_object(split_obj)), my_body(body), + my_parent(nullptr), my_partition(parent_.my_partition, split_obj), my_allocator(alloc) {} static void run(const Range& range, Body& body, Partitioner& partitioner, task_group_context& context) { diff -Nru onetbb-2021.7.0/include/oneapi/tbb/partitioner.h onetbb-2021.9.0/include/oneapi/tbb/partitioner.h --- onetbb-2021.7.0/include/oneapi/tbb/partitioner.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/partitioner.h 2023-04-06 17:14:50.000000000 +0000 @@ -160,6 +160,7 @@ template void fold_tree(node* n, const execution_data& ed) { for (;;) { + __TBB_ASSERT(n, nullptr); __TBB_ASSERT(n->m_ref_count.load(std::memory_order_relaxed) > 0, "The refcount must be positive."); call_itt_task_notify(releasing, n); if (--n->m_ref_count > 0) { @@ -311,27 +312,6 @@ } }; -//! Helper type for checking availability of proportional_split constructor -template using supports_proportional_splitting = typename std::is_constructible; - -//! A helper class to create a proportional_split object for a given type of Range. -/** If the Range has proportional_split constructor, - then created object splits a provided value in an implemenation-defined proportion; - otherwise it represents equal-size split. */ -// TODO: check if this helper can be a nested class of proportional_mode. -template -struct proportion_helper { - static proportional_split get_split(std::size_t) { return proportional_split(1,1); } -}; - -template -struct proportion_helper::value>::type> { - static proportional_split get_split(std::size_t n) { - std::size_t right = n / 2; - std::size_t left = n - right; - return proportional_split(left, right); - } -}; //! Provides proportional splitting strategy for partition objects template @@ -357,8 +337,16 @@ } template proportional_split get_split() { - // Create a proportion for the number of threads expected to handle "this" subrange - return proportion_helper::get_split( self().my_divisor / my_partition::factor ); + // Create the proportion from partitioner internal resources (threads) that would be used: + // - into proportional_mode constructor to split the partitioner + // - if Range supports the proportional_split constructor it would use proposed proportion, + // otherwise, the tbb::proportional_split object will be implicitly (for Range implementor) + // casted to tbb::split + + std::size_t n = self().my_divisor / my_partition::factor; + std::size_t right = n / 2; + std::size_t left = n - right; + return proportional_split(left, right); } }; diff -Nru onetbb-2021.7.0/include/oneapi/tbb/task_arena.h onetbb-2021.9.0/include/oneapi/tbb/task_arena.h --- onetbb-2021.7.0/include/oneapi/tbb/task_arena.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/task_arena.h 2023-04-06 17:14:50.000000000 +0000 @@ -187,13 +187,8 @@ , my_num_reserved_slots(reserved_for_masters) , my_priority(a_priority) , my_numa_id(constraints_.numa_id) -#if __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT , my_core_type(constraints_.core_type) , my_max_threads_per_core(constraints_.max_threads_per_core) -#else - , my_core_type(automatic) - , my_max_threads_per_core(automatic) -#endif {} #endif /*__TBB_ARENA_BINDING*/ public: @@ -280,10 +275,8 @@ constraints{} .set_numa_id(s.my_numa_id) .set_max_concurrency(s.my_max_concurrency) -#if __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT .set_core_type(s.my_core_type) .set_max_threads_per_core(s.my_max_threads_per_core) -#endif , s.my_num_reserved_slots, s.my_priority) {} #else @@ -337,10 +330,8 @@ if( !is_active() ) { my_numa_id = constraints_.numa_id; my_max_concurrency = constraints_.max_concurrency; -#if __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT my_core_type = constraints_.core_type; my_max_threads_per_core = constraints_.max_threads_per_core; -#endif my_num_reserved_slots = reserved_for_masters; my_priority = a_priority; r1::initialize(*this); diff -Nru onetbb-2021.7.0/include/oneapi/tbb/version.h onetbb-2021.9.0/include/oneapi/tbb/version.h --- onetbb-2021.7.0/include/oneapi/tbb/version.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/include/oneapi/tbb/version.h 2023-04-06 17:14:50.000000000 +0000 @@ -17,13 +17,19 @@ #ifndef __TBB_version_H #define __TBB_version_H -#include "detail/_config.h" -#include "detail/_namespace_injection.h" +// Exclude all includes during .rc files compilation +#ifndef RC_INVOKED + #include "detail/_config.h" + #include "detail/_namespace_injection.h" +#else + #define __TBB_STRING_AUX(x) #x + #define __TBB_STRING(x) __TBB_STRING_AUX(x) +#endif // Product version #define TBB_VERSION_MAJOR 2021 // Update version -#define TBB_VERSION_MINOR 7 +#define TBB_VERSION_MINOR 9 // "Patch" version for custom releases #define TBB_VERSION_PATCH 0 // Suffix string @@ -34,7 +40,7 @@ // OneAPI oneTBB specification version #define ONETBB_SPEC_VERSION "1.0" // Full interface version -#define TBB_INTERFACE_VERSION 12070 +#define TBB_INTERFACE_VERSION 12090 // Major interface version #define TBB_INTERFACE_VERSION_MAJOR (TBB_INTERFACE_VERSION/1000) // Minor interface version diff -Nru onetbb-2021.7.0/INSTALL.md onetbb-2021.9.0/INSTALL.md --- onetbb-2021.7.0/INSTALL.md 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/INSTALL.md 2023-04-06 17:14:50.000000000 +0000 @@ -77,6 +77,19 @@ cpack ``` +## Installation from vcpkg + +You can download and install oneTBB using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: +```sh + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh #.\bootstrap-vcpkg.bat(for Windows) + ./vcpkg integrate install + ./vcpkg install tbb +``` + +The oneTBB port in vcpkg is kept up to date by Microsoft* team members and community contributors. If the version is out of date, create an issue or pull request on the [vcpkg repository](https://github.com/Microsoft/vcpkg). + ## Example of Installation ### Single-configuration generators diff -Nru onetbb-2021.7.0/python/rml/ipc_server.cpp onetbb-2021.9.0/python/rml/ipc_server.cpp --- onetbb-2021.7.0/python/rml/ipc_server.cpp 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/python/rml/ipc_server.cpp 2023-04-06 17:14:50.000000000 +0000 @@ -519,7 +519,7 @@ } void ipc_worker::start_shutdown(bool join) { - state_t s = my_state.load(std::memory_order_relaxed);; + state_t s = my_state.load(std::memory_order_relaxed); do { __TBB_ASSERT( s!=st_quit, nullptr ); @@ -538,7 +538,7 @@ } void ipc_worker::start_stopping(bool join) { - state_t s = my_state.load(std::memory_order_relaxed);; + state_t s = my_state.load(std::memory_order_relaxed); while( !my_state.compare_exchange_strong( s, st_quit ) ) {}; if( s==st_normal || s==st_starting ) { diff -Nru onetbb-2021.7.0/python/tbb/test.py onetbb-2021.9.0/python/tbb/test.py --- onetbb-2021.7.0/python/tbb/test.py 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/python/tbb/test.py 2023-04-06 17:14:50.000000000 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (c) 2016-2021 Intel Corporation +# Copyright (c) 2016-2022 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,6 +82,29 @@ say("[%d] Work done (%fms)." % (get_tid(), mseconds*10)) return res + # special flag to to be set by thread calling async work + spin_flag = None + def timeout_work(param): + say("[%d] Spin wait work start..." % get_tid()) + while spin_flag: + time.sleep(0.0001) # yield equivalent + say("[%d] Work done." % get_tid()) + return str(param) if param != None else None + + def prepare_timeout_exception(): + nonlocal spin_flag + spin_flag = True # lock threads in timeout_work + + def check_timeout_exception(pool_object, func): + nonlocal spin_flag + try: + func(pool_object) + except TimeoutError: + say("Good. Got expected timeout exception.") + else: + assert False, "Expected exception !" + spin_flag = False # unlock threads in timeout_work + ### Test copy/pasted from multiprocessing pool = Pool(4) # start worker threads @@ -105,13 +128,9 @@ assert next(it) == 4 # Test apply_sync exceptions - result = pool.apply_async(time.sleep, (3,)) - try: - say(result.get(timeout=1)) # raises `TimeoutError` - except TimeoutError: - say("Good. Got expected timeout exception.") - else: - assert False, "Expected exception !" + prepare_timeout_exception() + result = pool.apply_async(timeout_work, (None,)) + check_timeout_exception(result, lambda result : say(result.get(timeout=1))) assert result.get() is None # sleep() returns None def cb(s): @@ -126,23 +145,15 @@ str, range(10, 3, -1))) # Test map_async() - result = pool.map_async(work, range(10), callback=cb) - try: - result.get(timeout=0.01) # raises `TimeoutError` - except TimeoutError: - say("Good. Got expected timeout exception.") - else: - assert False, "Expected exception !" + prepare_timeout_exception() + result = pool.map_async(timeout_work, range(10), callback=cb) + check_timeout_exception(result, lambda result : result.get(timeout=0.01)) say(result.get()) # Test imap_async() - result = pool.imap_async(work, range(3, 10), callback=cb) - try: - result.get(timeout=0.01) # raises `TimeoutError` - except TimeoutError: - say("Good. Got expected timeout exception.") - else: - assert False, "Expected exception !" + prepare_timeout_exception() + result = pool.imap_async(timeout_work, range(3, 10), callback=cb) + check_timeout_exception(result, lambda result : result.get(timeout=0.01)) for i in result.get(): say("Item:", i) say("### Loop again:") @@ -150,13 +161,9 @@ say("Item2:", i) # Test imap_unordered_async() - result = pool.imap_unordered_async(work, range(10, 3, -1), callback=cb) - try: - say(result.get(timeout=0.01)) # raises `TimeoutError` - except TimeoutError: - say("Good. Got expected timeout exception.") - else: - assert False, "Expected exception !" + prepare_timeout_exception() + result = pool.imap_unordered_async(timeout_work, range(10, 3, -1), callback=cb) + check_timeout_exception(result, lambda result : result.get(timeout=0.01)) for i in result.get(): say("Item1:", i) for i in result.get(): diff -Nru onetbb-2021.7.0/README.md onetbb-2021.9.0/README.md --- onetbb-2021.7.0/README.md 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/README.md 2023-04-06 17:14:50.000000000 +0000 @@ -20,6 +20,8 @@ oneTBB is a part of [oneAPI](https://oneapi.io). The current branch implements version 1.1 of oneAPI Specification. +> **_NOTE:_** Threading Building Blocks (TBB) is now called oneAPI Threading Building Blocks (oneTBB) to highlight that the tool is a part of the oneAPI ecosystem. + ## Release Information Here are [Release Notes](RELEASE_NOTES.md) and [System Requirements](SYSTEM_REQUIREMENTS.md). @@ -28,6 +30,7 @@ * [oneTBB Developer Guide and Reference](https://oneapi-src.github.io/oneTBB) * [Migrating from TBB to oneTBB](https://oneapi-src.github.io/oneTBB/main/tbb_userguide/Migration_Guide.html) * [README for the CMake build system](cmake/README.md) +* [oneTBB Testing Approach](https://oneapi-src.github.io/oneTBB/main/intro/testing_approach.html) * [Basic support for the Bazel build system](Bazel.md) * [oneTBB Discussions](https://github.com/oneapi-src/oneTBB/discussions) diff -Nru onetbb-2021.7.0/RELEASE_NOTES.md onetbb-2021.9.0/RELEASE_NOTES.md --- onetbb-2021.7.0/RELEASE_NOTES.md 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/RELEASE_NOTES.md 2023-04-06 17:14:50.000000000 +0000 @@ -18,36 +18,25 @@ This document contains changes of oneTBB compared to the last release. ## Table of Contents -- [New Features](#new_features) - [Known Limitations](#known-limitations) - [Fixed Issues](#fixed-issues) - [Open-source Contributions Integrated](#open-source-contributions-integrated) -## :white_check_mark: New Features -- Improved support and use of the latest C++ standards for parallel_sort that allows using this algorithm with user-defined and standard library-defined objects with modern semantics. -- The following features are now fully functional: task_arena extensions, collaborative_call_once, adaptive mutexes, heterogeneous overloads for concurrent_hash_map, and task_scheduler_handle. -- Added support for Windows* Server 2022 and Python 3.10. - ## :rotating_light: Known Limitations +- A static assert causes compilation failures in oneTBB headers when compiling with Clang* 12.0.0 or newer if using the LLVM* standard library with -ffreestanding and C++11/14 compiler options. - An application using Parallel STL algorithms in libstdc++ versions 9 and 10 may fail to compile due to incompatible interface changes between earlier versions of Threading Building Blocks (TBB) and oneAPI Threading Building Blocks (oneTBB). Disable support for Parallel STL algorithms by defining PSTL_USE_PARALLEL_POLICIES (in libstdc++ 9) or _GLIBCXX_USE_TBB_PAR_BACKEND (in libstdc++ 10) macro to zero before inclusion of the first standard header file in each translation unit. - On Linux* OS, if oneAPI Threading Building Blocks (oneTBB) or Threading Building Blocks (TBB) are installed in a system folder like /usr/lib64, the application may fail to link due to the order in which the linker searches for libraries. Use the -L linker option to specify the correct location of oneTBB library. This issue does not affect the program execution. - The oneapi::tbb::info namespace interfaces might unexpectedly change the process affinity mask on Windows* OS systems (see https://github.com/open-mpi/hwloc/issues/366 for details) when using hwloc version lower than 2.5. -- Using a hwloc version other than 1.11, 2.0, or 2.5 may cause an undefined behavior on Windows OS. See https://github.com/open-mpi/hwloc/issues/477 for details. +- Using a hwloc version other than 1.11, 2.0, or 2.5 may cause an undefined behavior on Windows* OS. See https://github.com/open-mpi/hwloc/issues/477 for details. - The NUMA topology may be detected incorrectly on Windows OS machines where the number of NUMA node threads exceeds the size of 1 processor group. - On Windows OS on ARM64*, when compiling an application using oneTBB with the Microsoft* Compiler, the compiler issues a warning C4324 that a structure was padded due to the alignment specifier. Consider suppressing the warning by specifying /wd4324 to the compiler command line. - oneTBB does not support fork(), to work-around the issue, consider using task_scheduler_handle to join oneTBB worker threads before using fork(). - C++ exception handling mechanism on Windows* OS on ARM64* might corrupt memory if an exception is thrown from any oneTBB parallel algorithm (see Windows* OS on ARM64* compiler issue: https://developercommunity.visualstudio.com/t/ARM64-incorrect-stack-unwinding-for-alig/1544293). ## :hammer: Fixed Issues -- Memory allocator crash on a system with an incomplete /proc/meminfo (GitHub* [#584](https://github.com/oneapi-src/oneTBB/issues/584)). -- Incorrect blocking of task stealing (GitHub* #[478](https://github.com/oneapi-src/oneTBB/issues/478)). -- Hang due to incorrect decrement of a limiter_node (GitHub* [#634](https://github.com/oneapi-src/oneTBB/issues/634)). -- Memory corruption in some rare cases when passing big messages in a flow graph (GitHub* [#639](https://github.com/oneapi-src/oneTBB/issues/639)). -- Possible deadlock in a throwable flow graph node with a lightweight policy. The lightweight policy is now ignored for functors that can throw exceptions (GitHub* [#420](https://github.com/oneapi-src/oneTBB/issues/420)). -- Crash when obtaining a range from empty ordered and unordered containers (GitHub* [#641](https://github.com/oneapi-src/oneTBB/issues/641)). -- Deadlock in a concurrent_vector resize() that could happen when the new size is less than the previous size (GitHub* [#733](https://github.com/oneapi-src/oneTBB/issues/733)). +- Memory allocator crash when allocating ~1TB on 64-bit systems (GitHub* [#838](https://github.com/oneapi-src/oneTBB/issues/838)). +- Fixed thread distribution over NUMA nodes on Windows* OS systems. +- For oneapi::tbb::suspend, it is guaranteed that the user-specified callable object is executed by the calling thread. ## :octocat: Open-source Contributions Integrated -- Improved aligned memory allocation. Contributed by Andrey Semashev (https://github.com/oneapi-src/oneTBB/pull/671). -- Optimized usage of atomic_fence on IA-32 and Intel(R) 64 architectures. Contributed by Andrey Semashev (https://github.com/oneapi-src/oneTBB/pull/328). -- Fixed incorrect definition of the assignment operator in containers. Contributed by Andrey Semashev (https://github.com/oneapi-src/oneTBB/issues/372). +- Fix for full LTO* build, library and tests, on UNIX* OS systems. Contributed by Vladislav Shchapov (https://github.com/oneapi-src/oneTBB/pull/798). diff -Nru onetbb-2021.7.0/src/tbb/arena.cpp onetbb-2021.9.0/src/tbb/arena.cpp --- onetbb-2021.7.0/src/tbb/arena.cpp 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/arena.cpp 2023-04-06 17:14:50.000000000 +0000 @@ -436,17 +436,11 @@ (void)governor::get_thread_data(); if (ta.my_max_concurrency < 1) { #if __TBB_ARENA_BINDING - -#if __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT d1::constraints arena_constraints = d1::constraints{} .set_core_type(ta.core_type()) .set_max_threads_per_core(ta.max_threads_per_core()) .set_numa_id(ta.my_numa_id); ta.my_max_concurrency = (int)default_concurrency(arena_constraints); -#else /*!__TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT*/ - ta.my_max_concurrency = (int)default_concurrency(ta.my_numa_id); -#endif /*!__TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT*/ - #else /*!__TBB_ARENA_BINDING*/ ta.my_max_concurrency = (int)governor::default_num_threads(); #endif /*!__TBB_ARENA_BINDING*/ @@ -736,15 +730,11 @@ #if __TBB_ARENA_BINDING if (ta) { -#if __TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT d1::constraints arena_constraints = d1::constraints{} .set_numa_id(ta->my_numa_id) .set_core_type(ta->core_type()) .set_max_threads_per_core(ta->max_threads_per_core()); return (int)default_concurrency(arena_constraints); -#else /*!__TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT*/ - return (int)default_concurrency(ta->my_numa_id); -#endif /*!__TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION_PRESENT*/ } #endif /*!__TBB_ARENA_BINDING*/ diff -Nru onetbb-2021.7.0/src/tbb/arena_slot.h onetbb-2021.9.0/src/tbb/arena_slot.h --- onetbb-2021.7.0/src/tbb/arena_slot.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/arena_slot.h 2023-04-06 17:14:50.000000000 +0000 @@ -221,7 +221,7 @@ } acquire_task_pool(); std::size_t H = head.load(std::memory_order_relaxed); // mirror - d1::task** new_task_pool = task_pool_ptr;; + d1::task** new_task_pool = task_pool_ptr; __TBB_ASSERT( my_task_pool_size >= min_task_pool_size, nullptr); // Count not skipped tasks. Consider using std::count_if. for ( std::size_t i = H; i < T; ++i ) diff -Nru onetbb-2021.7.0/src/tbb/CMakeLists.txt onetbb-2021.9.0/src/tbb/CMakeLists.txt --- onetbb-2021.7.0/src/tbb/CMakeLists.txt 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/CMakeLists.txt 2023-04-06 17:14:50.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021 Intel Corporation +# Copyright (c) 2020-2022 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ add_library(TBB::tbb ALIAS tbb) if (WIN32) + target_sources(tbb PRIVATE tbb.rc) set_target_properties(tbb PROPERTIES OUTPUT_NAME "tbb${TBB_BINARY_VERSION}") endif() @@ -92,8 +93,8 @@ if (TBB_DEF_FILE_PREFIX) # If there's no prefix, assume we're using export directives set_target_properties(tbb PROPERTIES - LINK_FLAGS ${TBB_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbb.def - LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbb.def + LINK_FLAGS "${TBB_LINK_DEF_FILE_FLAG}\"${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbb.def\"" + LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbb.def" ) endif() diff -Nru onetbb-2021.7.0/src/tbb/itt_notify.h onetbb-2021.9.0/src/tbb/itt_notify.h --- onetbb-2021.7.0/src/tbb/itt_notify.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/itt_notify.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ #include "tools_api/ittnotify.h" #include "tools_api/legacy/ittnotify.h" extern "C" void __itt_fini_ittlib(void); +extern "C" void __itt_release_resources(void); #if _WIN32||_WIN64 #undef _T @@ -75,6 +76,7 @@ #define ITT_NOTIFY(name,obj) __itt_##name(const_cast(static_cast(obj))) #define ITT_THREAD_SET_NAME(name) __itt_thread_set_name(name) #define ITT_FINI_ITTLIB() __itt_fini_ittlib() +#define ITT_RELEASE_RESOURCES() __itt_release_resources() #define ITT_SYNC_CREATE(obj, type, name) __itt_sync_create((void*)(obj), type, name, 2) #define ITT_STACK_CREATE(obj) obj = __itt_stack_caller_create() #define ITT_STACK_DESTROY(obj) (obj!=nullptr) ? __itt_stack_caller_destroy(static_cast<__itt_caller>(obj)) : ((void)0) @@ -94,6 +96,7 @@ #define ITT_NOTIFY(name,obj) ((void)0) #define ITT_THREAD_SET_NAME(name) ((void)0) #define ITT_FINI_ITTLIB() ((void)0) +#define ITT_RELEASE_RESOURCES() ((void)0) #define ITT_SYNC_CREATE(obj, type, name) ((void)0) #define ITT_STACK_CREATE(obj) ((void)0) #define ITT_STACK_DESTROY(obj) ((void)0) diff -Nru onetbb-2021.7.0/src/tbb/main.cpp onetbb-2021.9.0/src/tbb/main.cpp --- onetbb-2021.7.0/src/tbb/main.cpp 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/main.cpp 2023-04-06 17:14:50.000000000 +0000 @@ -100,6 +100,7 @@ if( k==0 ) { governor::release_resources(); ITT_FINI_ITTLIB(); + ITT_RELEASE_RESOURCES(); } } diff -Nru onetbb-2021.7.0/src/tbb/rml_thread_monitor.h onetbb-2021.9.0/src/tbb/rml_thread_monitor.h --- onetbb-2021.7.0/src/tbb/rml_thread_monitor.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/rml_thread_monitor.h 2023-04-06 17:14:50.000000000 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include #else #error Unsupported platform #endif @@ -191,8 +192,25 @@ check(pthread_attr_init( &s ), "pthread_attr_init has failed"); if( stack_size>0 ) check(pthread_attr_setstacksize( &s, stack_size ), "pthread_attr_setstack_size has failed" ); + + // pthread_create(2) can spuriously fail with EAGAIN. We retry + // max_num_tries times with progressively longer wait times. pthread_t handle; - check( pthread_create( &handle, &s, thread_routine, arg ), "pthread_create has failed" ); + const int max_num_tries = 20; + int error = EAGAIN; + + for (int i = 0; i < max_num_tries && error == EAGAIN; i++) { + if (i != 0) { + // Wait i milliseconds + struct timespec ts = {0, i * 1000 * 1000}; + nanosleep(&ts, NULL); + } + error = pthread_create(&handle, &s, thread_routine, arg); + } + + if (error) + handle_perror(error, "pthread_create has failed"); + check( pthread_attr_destroy( &s ), "pthread_attr_destroy has failed" ); return handle; } diff -Nru onetbb-2021.7.0/src/tbb/semaphore.h onetbb-2021.9.0/src/tbb/semaphore.h --- onetbb-2021.7.0/src/tbb/semaphore.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/semaphore.h 2023-04-06 17:14:50.000000000 +0000 @@ -22,10 +22,7 @@ #if _WIN32||_WIN64 #include #elif __APPLE__ -#include -#include -#include -#include +#include #else #include #ifdef TBB_USE_DEBUG @@ -150,28 +147,18 @@ class semaphore : no_copy { public: //! ctor - semaphore(int start_cnt_ = 0) : sem(start_cnt_) { init_semaphore(start_cnt_); } + semaphore(int start_cnt_ = 0) { my_sem = dispatch_semaphore_create(start_cnt_); } //! dtor - ~semaphore() { - kern_return_t ret = semaphore_destroy( mach_task_self(), sem ); - __TBB_ASSERT_EX( ret==err_none, nullptr); - } + ~semaphore() { dispatch_release(my_sem); } //! wait/acquire void P() { - int ret; - do { - ret = semaphore_wait( sem ); - } while( ret==KERN_ABORTED ); - __TBB_ASSERT( ret==KERN_SUCCESS, "semaphore_wait() failed" ); + std::intptr_t ret = dispatch_semaphore_wait(my_sem, DISPATCH_TIME_FOREVER); + __TBB_ASSERT_EX(ret == 0, "dispatch_semaphore_wait() failed"); } //! post/release - void V() { semaphore_signal( sem ); } + void V() { dispatch_semaphore_signal(my_sem); } private: - semaphore_t sem; - void init_semaphore(int start_cnt_) { - kern_return_t ret = semaphore_create( mach_task_self(), &sem, SYNC_POLICY_FIFO, start_cnt_ ); - __TBB_ASSERT_EX( ret==err_none, "failed to create a semaphore" ); - } + dispatch_semaphore_t my_sem; }; #else /* Linux/Unix */ typedef uint32_t sem_count_t; @@ -244,31 +231,7 @@ #endif /* !__TBB_USE_SRWLOCK */ #elif __APPLE__ //! binary_semaphore for concurrent monitor -class binary_semaphore : no_copy { -public: - //! ctor - binary_semaphore() : my_sem(0) { - kern_return_t ret = semaphore_create( mach_task_self(), &my_sem, SYNC_POLICY_FIFO, 0 ); - __TBB_ASSERT_EX( ret==err_none, "failed to create a semaphore" ); - } - //! dtor - ~binary_semaphore() { - kern_return_t ret = semaphore_destroy( mach_task_self(), my_sem ); - __TBB_ASSERT_EX( ret==err_none, nullptr); - } - //! wait/acquire - void P() { - int ret; - do { - ret = semaphore_wait( my_sem ); - } while( ret==KERN_ABORTED ); - __TBB_ASSERT( ret==KERN_SUCCESS, "semaphore_wait() failed" ); - } - //! post/release - void V() { semaphore_signal( my_sem ); } -private: - semaphore_t my_sem; -}; +using binary_semaphore = semaphore; #else /* Linux/Unix */ #if __TBB_USE_FUTEX diff -Nru onetbb-2021.7.0/src/tbb/task_stream.h onetbb-2021.9.0/src/tbb/task_stream.h --- onetbb-2021.7.0/src/tbb/task_stream.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/task_stream.h 2023-04-06 17:14:50.000000000 +0000 @@ -193,10 +193,11 @@ d1::task* pop( const lane_selector_t& next_lane ) { d1::task* popped = nullptr; unsigned lane = 0; - do { - lane = next_lane( /*out_of=*/N ); - __TBB_ASSERT( lane < N, "Incorrect lane index." ); - } while( !empty() && !(popped = try_pop( lane )) ); + for (atomic_backoff b; !empty() && !popped; b.pause()) { + lane = next_lane( /*out_of=*/N); + __TBB_ASSERT(lane < N, "Incorrect lane index."); + popped = try_pop(lane); + } return popped; } diff -Nru onetbb-2021.7.0/src/tbb/tbb.rc onetbb-2021.9.0/src/tbb/tbb.rc --- onetbb-2021.7.0/src/tbb/tbb.rc 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/tbb.rc 2023-04-06 17:14:50.000000000 +0000 @@ -0,0 +1,74 @@ +// Copyright (c) 2005-2023 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +///////////////////////////////////////////////////////////////////////////// +// +// Includes +// +#include +#include "../../include/oneapi/tbb/version.h" + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#define TBB_VERNUMBERS TBB_VERSION_MAJOR,TBB_VERSION_MINOR +#define TBB_VERSION TBB_VERSION_STRING + +VS_VERSION_INFO VERSIONINFO + FILEVERSION TBB_VERNUMBERS + PRODUCTVERSION TBB_VERNUMBERS + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Intel Corporation\0" + VALUE "FileDescription", "oneAPI Threading Building Blocks (oneTBB) library\0" + VALUE "FileVersion", TBB_VERSION "\0" + VALUE "LegalCopyright", "Copyright 2005-2022 Intel Corporation. All Rights Reserved.\0" + VALUE "LegalTrademarks", "\0" +#ifndef TBB_USE_DEBUG + VALUE "OriginalFilename", "tbb12.dll\0" +#else + VALUE "OriginalFilename", "tbb12_debug.dll\0" +#endif + VALUE "ProductName", "oneAPI Threading Building Blocks (oneTBB)\0" + VALUE "ProductVersion", TBB_VERSION "\0" + VALUE "PrivateBuild", "\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff -Nru onetbb-2021.7.0/src/tbb/tools_api/disable_warnings.h onetbb-2021.9.0/src/tbb/tools_api/disable_warnings.h --- onetbb-2021.7.0/src/tbb/tools_api/disable_warnings.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/tools_api/disable_warnings.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,7 +16,9 @@ #include "ittnotify_config.h" -#if ITT_PLATFORM==ITT_PLATFORM_WIN && _MSC_VER +#if ITT_PLATFORM==ITT_PLATFORM_WIN + +#if defined _MSC_VER #pragma warning (disable: 593) /* parameter "XXXX" was set but never used */ #pragma warning (disable: 344) /* typedef name has already been declared (with same type) */ @@ -24,6 +26,8 @@ #pragma warning (disable: 4127) /* conditional expression is constant */ #pragma warning (disable: 4306) /* conversion from '?' to '?' of greater size */ +#endif + #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ #if defined __INTEL_COMPILER diff -Nru onetbb-2021.7.0/src/tbb/tools_api/ittnotify_config.h onetbb-2021.9.0/src/tbb/tools_api/ittnotify_config.h --- onetbb-2021.7.0/src/tbb/tools_api/ittnotify_config.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/tools_api/ittnotify_config.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2023 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -121,7 +121,12 @@ #if ITT_PLATFORM==ITT_PLATFORM_WIN /* use __forceinline (VC++ specific) */ +#if defined(__MINGW32__) && !defined(__cplusplus) +#define ITT_INLINE static __inline__ __attribute__((__always_inline__,__gnu_inline__)) +#else #define ITT_INLINE static __forceinline +#endif /* __MINGW32__ */ + #define ITT_INLINE_ATTRIBUTE /* nothing */ #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ /* @@ -163,6 +168,22 @@ # define ITT_ARCH_ARM64 6 #endif /* ITT_ARCH_ARM64 */ +#ifndef ITT_ARCH_LOONGARCH64 +# define ITT_ARCH_LOONGARCH64 7 +#endif /* ITT_ARCH_LOONGARCH64 */ + +#ifndef ITT_ARCH_S390X +# define ITT_ARCH_S390X 8 +#endif /* ITT_ARCH_S390X */ + +#ifndef ITT_ARCH_HPPA +# define ITT_ARCH_HPPA 9 +#endif /* ITT_ARCH_HPPA */ + +#ifndef ITT_ARCH_RISCV64 +# define ITT_ARCH_RISCV64 10 +#endif /* ITT_ARCH_RISCV64 */ + #ifndef ITT_ARCH # if defined _M_IX86 || defined __i386__ # define ITT_ARCH ITT_ARCH_IA32 @@ -176,7 +197,16 @@ # define ITT_ARCH ITT_ARCH_ARM64 # elif defined __powerpc64__ # define ITT_ARCH ITT_ARCH_PPC64 +# elif defined __loongarch__ +# define ITT_ARCH ITT_ARCH_LOONGARCH64 +# elif defined __s390__ || defined __s390x__ +# define ITT_ARCH ITT_ARCH_S390X +# elif defined __hppa__ +# define ITT_ARCH ITT_ARCH_HPPA +# elif defined __riscv && __riscv_xlen == 64 +# define ITT_ARCH ITT_ARCH_RISCV64 # endif + #endif #ifdef __cplusplus @@ -205,7 +235,7 @@ #define API_VERSION_BUILD 20180723 #ifndef API_VERSION_NUM -#define API_VERSION_NUM 3.18.6 +#define API_VERSION_NUM 3.23.0 #endif /* API_VERSION_NUM */ #define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \ @@ -249,13 +279,13 @@ #define __itt_mutex_init(mutex) InitializeCriticalSection(mutex) #define __itt_mutex_lock(mutex) EnterCriticalSection(mutex) #define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex) +#define __itt_mutex_destroy(mutex) DeleteCriticalSection(mutex) #define __itt_load_lib(name) LoadLibraryA(name) #define __itt_unload_lib(handle) FreeLibrary(handle) #define __itt_system_error() (int)GetLastError() #define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2) #define __itt_fstrnlen(s, l) strnlen_s(s, l) #define __itt_fstrcpyn(s1, b, s2, l) strncpy_s(s1, b, s2, l) -#define __itt_fstrdup(s) _strdup(s) #define __itt_thread_id() GetCurrentThreadId() #define __itt_thread_yield() SwitchToThread() #ifndef ITT_SIMPLE_INIT @@ -265,6 +295,13 @@ { return InterlockedIncrement(ptr); } +ITT_INLINE long +__itt_interlocked_compare_exchange(volatile long* ptr, long exchange, long comperand) ITT_INLINE_ATTRIBUTE; +ITT_INLINE long +__itt_interlocked_compare_exchange(volatile long* ptr, long exchange, long comperand) +{ + return InterlockedCompareExchange(ptr, exchange, comperand); +} #endif /* ITT_SIMPLE_INIT */ #define DL_SYMBOLS (1) @@ -294,6 +331,7 @@ } #define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex) #define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex) +#define __itt_mutex_destroy(mutex) pthread_mutex_destroy(mutex) #define __itt_load_lib(name) dlopen(name, RTLD_LAZY) #define __itt_unload_lib(handle) dlclose(handle) #define __itt_system_error() errno @@ -320,14 +358,13 @@ } #endif /* SDL_STRNCPY_S */ -#define __itt_fstrdup(s) strdup(s) #define __itt_thread_id() pthread_self() #define __itt_thread_yield() sched_yield() #if ITT_ARCH==ITT_ARCH_IA64 #ifdef __INTEL_COMPILER #define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val) #else /* __INTEL_COMPILER */ -/* TODO: Add Support for not Intel compilers for IA-64 architecture */ +#define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val) #endif /* __INTEL_COMPILER */ #elif ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_IA32E /* ITT_ARCH!=ITT_ARCH_IA64 */ ITT_INLINE long @@ -351,6 +388,13 @@ { return __TBB_machine_fetchadd4(ptr, 1) + 1L; } +ITT_INLINE long +__itt_interlocked_compare_exchange(volatile long* ptr, long exchange, long comperand) ITT_INLINE_ATTRIBUTE; +ITT_INLINE long +__itt_interlocked_compare_exchange(volatile long* ptr, long exchange, long comperand) +{ + return __sync_val_compare_and_swap(ptr, exchange, comperand); +} #endif /* ITT_SIMPLE_INIT */ void* dlopen(const char*, int) __attribute__((weak)); @@ -370,10 +414,20 @@ #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ -typedef enum { - __itt_collection_normal = 0, - __itt_collection_paused = 1 -} __itt_collection_state; +/* strdup() is not included into C99 which results in a compiler warning about + * implicitly declared symbol. To avoid the issue strdup is implemented + * manually. + */ +#define ITT_STRDUP_MAX_STRING_SIZE 4096 +#define __itt_fstrdup(s, new_s) do { \ + if (s != NULL) { \ + size_t s_len = __itt_fstrnlen(s, ITT_STRDUP_MAX_STRING_SIZE); \ + new_s = (char *)malloc(s_len + 1); \ + if (new_s != NULL) { \ + __itt_fstrcpyn(new_s, s_len + 1, s, s_len); \ + } \ + } \ +} while(0) typedef enum { __itt_thread_normal = 0, @@ -439,6 +493,9 @@ struct ___itt_domain; struct ___itt_string_handle; +struct ___itt_histogram; + +#include "ittnotify.h" typedef struct ___itt_global { @@ -460,8 +517,9 @@ struct ___itt_domain* domain_list; struct ___itt_string_handle* string_list; __itt_collection_state state; - __itt_counter_info_t* counter_list; + __itt_counter_info_t* counter_list; unsigned int ipt_collect_events; + struct ___itt_histogram* histogram_list; } __itt_global; #pragma pack(pop) @@ -487,7 +545,9 @@ h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \ if (h != NULL) { \ h->tid = t; \ - h->nameA = n ? __itt_fstrdup(n) : NULL; \ + char *n_copy = NULL; \ + __itt_fstrdup(n, n_copy); \ + h->nameA = n_copy; \ h->nameW = NULL; \ h->state = s; \ h->extra1 = 0; /* reserved */ \ @@ -520,7 +580,9 @@ h = (__itt_domain*)malloc(sizeof(__itt_domain)); \ if (h != NULL) { \ h->flags = 1; /* domain is enabled by default */ \ - h->nameA = name ? __itt_fstrdup(name) : NULL; \ + char *name_copy = NULL; \ + __itt_fstrdup(name, name_copy); \ + h->nameA = name_copy; \ h->nameW = NULL; \ h->extra1 = 0; /* reserved */ \ h->extra2 = NULL; /* reserved */ \ @@ -550,7 +612,9 @@ #define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \ h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \ if (h != NULL) { \ - h->strA = name ? __itt_fstrdup(name) : NULL; \ + char *name_copy = NULL; \ + __itt_fstrdup(name, name_copy); \ + h->strA = name_copy; \ h->strW = NULL; \ h->extra1 = 0; /* reserved */ \ h->extra2 = NULL; /* reserved */ \ @@ -582,9 +646,13 @@ #define NEW_COUNTER_A(gptr,h,h_tail,name,domain,type) { \ h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \ if (h != NULL) { \ - h->nameA = name ? __itt_fstrdup(name) : NULL; \ + char *name_copy = NULL; \ + __itt_fstrdup(name, name_copy); \ + h->nameA = name_copy; \ h->nameW = NULL; \ - h->domainA = domain ? __itt_fstrdup(domain) : NULL; \ + char *domain_copy = NULL; \ + __itt_fstrdup(domain, domain_copy); \ + h->domainA = domain_copy; \ h->domainW = NULL; \ h->type = type; \ h->index = 0; \ @@ -594,6 +662,42 @@ else \ h_tail->next = h; \ } \ +} + +#define NEW_HISTOGRAM_W(gptr,h,h_tail,domain,name,x_type,y_type) { \ + h = (__itt_histogram*)malloc(sizeof(__itt_histogram)); \ + if (h != NULL) { \ + h->domain = domain; \ + h->nameA = NULL; \ + h->nameW = name ? _wcsdup(name) : NULL; \ + h->x_type = x_type; \ + h->y_type = y_type; \ + h->extra1 = 0; \ + h->extra2 = NULL; \ + if (h_tail == NULL) \ + (gptr)->histogram_list = h; \ + else \ + h_tail->next = h; \ + } \ +} + +#define NEW_HISTOGRAM_A(gptr,h,h_tail,domain,name,x_type,y_type) { \ + h = (__itt_histogram*)malloc(sizeof(__itt_histogram)); \ + if (h != NULL) { \ + h->domain = domain; \ + char *name_copy = NULL; \ + __itt_fstrdup(name, name_copy); \ + h->nameA = name_copy; \ + h->nameW = NULL; \ + h->x_type = x_type; \ + h->y_type = y_type; \ + h->extra1 = 0; \ + h->extra2 = NULL; \ + if (h_tail == NULL) \ + (gptr)->histogram_list = h; \ + else \ + h_tail->next = h; \ + } \ } #endif /* _ITTNOTIFY_CONFIG_H_ */ diff -Nru onetbb-2021.7.0/src/tbb/tools_api/ittnotify.h onetbb-2021.9.0/src/tbb/tools_api/ittnotify.h --- onetbb-2021.7.0/src/tbb/tools_api/ittnotify.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/tools_api/ittnotify.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ @brief Public User API functions and types @mainpage -The Instrumentation and Tracing Technology API (ITT API) is used to +The Instrumentation and Tracing Technology API (ITT API) is used to annotate a user's program with additional information that can be used by correctness and performance tools. The user inserts calls in their program. Those calls generate information that is collected @@ -188,7 +188,12 @@ #if ITT_PLATFORM==ITT_PLATFORM_WIN /* use __forceinline (VC++ specific) */ +#if defined(__MINGW32__) && !defined(__cplusplus) +#define ITT_INLINE static __inline__ __attribute__((__always_inline__,__gnu_inline__)) +#else #define ITT_INLINE static __forceinline +#endif /* __MINGW32__ */ + #define ITT_INLINE_ATTRIBUTE /* nothing */ #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ /* @@ -249,20 +254,20 @@ #define ITTNOTIFY_VOID(n) (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n) #define ITTNOTIFY_DATA(n) (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n) -#define ITTNOTIFY_VOID_D0(n,d) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d) -#define ITTNOTIFY_VOID_D1(n,d,x) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x) -#define ITTNOTIFY_VOID_D2(n,d,x,y) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y) -#define ITTNOTIFY_VOID_D3(n,d,x,y,z) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z) -#define ITTNOTIFY_VOID_D4(n,d,x,y,z,a) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) -#define ITTNOTIFY_VOID_D5(n,d,x,y,z,a,b) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) -#define ITTNOTIFY_VOID_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) -#define ITTNOTIFY_DATA_D0(n,d) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d) -#define ITTNOTIFY_DATA_D1(n,d,x) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x) -#define ITTNOTIFY_DATA_D2(n,d,x,y) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y) -#define ITTNOTIFY_DATA_D3(n,d,x,y,z) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z) -#define ITTNOTIFY_DATA_D4(n,d,x,y,z,a) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) -#define ITTNOTIFY_DATA_D5(n,d,x,y,z,a,b) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) -#define ITTNOTIFY_DATA_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) +#define ITTNOTIFY_VOID_D0(n,d) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_VOID_D1(n,d,x) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_VOID_D2(n,d,x,y) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_VOID_D3(n,d,x,y,z) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_VOID_D4(n,d,x,y,z,a) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_VOID_D5(n,d,x,y,z,a,b) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_VOID_D6(n,d,x,y,z,a,b,c) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) +#define ITTNOTIFY_DATA_D0(n,d) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_DATA_D1(n,d,x) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_DATA_D2(n,d,x,y) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_DATA_D3(n,d,x,y,z) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_DATA_D4(n,d,x,y,z,a) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_DATA_D5(n,d,x,y,z,a,b) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_DATA_D6(n,d,x,y,z,a,b,c) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) #ifdef ITT_STUB #undef ITT_STUB @@ -591,6 +596,18 @@ } __itt_suppress_mode_t; /** + * @enum __itt_collection_state + * @brief Enumerator for collection state. All non-work states have negative values. + */ +typedef enum { + __itt_collection_uninitialized = 0, /* uninitialized */ + __itt_collection_init_fail = 1, /* failed to init */ + __itt_collection_collector_absent = 2, /* non work state collector exists */ + __itt_collection_collector_exists = 3, /* work state collector exists */ + __itt_collection_init_successful = 4 /* success to init */ +} __itt_collection_state; + +/** * @brief Mark a range of memory for error suppression or unsuppression for error types included in mask */ void ITTAPI __itt_suppress_mark_range(__itt_suppress_mode_t mode, unsigned int mask, void * address, size_t size); @@ -3869,6 +3886,125 @@ #endif /* INTEL_NO_MACRO_BODY */ /** @endcond */ +/** @cond exclude_from_documentation */ +#pragma pack(push, 8) + +typedef struct ___itt_histogram +{ + const __itt_domain* domain; /*!< Domain of the histogram*/ + const char* nameA; /*!< Name of the histogram */ +#if defined(UNICODE) || defined(_UNICODE) + const wchar_t* nameW; +#else /* UNICODE || _UNICODE */ + void* nameW; +#endif /* UNICODE || _UNICODE */ + __itt_metadata_type x_type; /*!< Type of the histogram X axis */ + __itt_metadata_type y_type; /*!< Type of the histogram Y axis */ + int extra1; /*!< Reserved to the runtime */ + void* extra2; /*!< Reserved to the runtime */ + struct ___itt_histogram* next; +} __itt_histogram; + +#pragma pack(pop) +/** @endcond */ + +/** + * @brief Create a typed histogram instance with given name/domain. + * @param[in] domain The domain controlling the call. + * @param[in] name The name of the histogram. + * @param[in] x_type The type of the X axis in histogram (may be 0 to calculate batch statistics). + * @param[in] y_type The type of the Y axis in histogram. +*/ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +__itt_histogram* ITTAPI __itt_histogram_createA(const __itt_domain* domain, const char* name, __itt_metadata_type x_type, __itt_metadata_type y_type); +__itt_histogram* ITTAPI __itt_histogram_createW(const __itt_domain* domain, const wchar_t* name, __itt_metadata_type x_type, __itt_metadata_type y_type); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_histogram_create __itt_histogram_createW +# define __itt_histogram_create_ptr __itt_histogram_createW_ptr +#else /* UNICODE */ +# define __itt_histogram_create __itt_histogram_createA +# define __itt_histogram_create_ptr __itt_histogram_createA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +__itt_histogram* ITTAPI __itt_histogram_create(const __itt_domain* domain, const char* name, __itt_metadata_type x_type, __itt_metadata_type y_type); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_histogram*, histogram_createA, (const __itt_domain* domain, const char* name, __itt_metadata_type x_type, __itt_metadata_type y_type)) +ITT_STUB(ITTAPI, __itt_histogram*, histogram_createW, (const __itt_domain* domain, const wchar_t* name, __itt_metadata_type x_type, __itt_metadata_type y_type)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_histogram*, histogram_create, (const __itt_domain* domain, const char* name, __itt_metadata_type x_type, __itt_metadata_type y_type)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_histogram_createA ITTNOTIFY_DATA(histogram_createA) +#define __itt_histogram_createA_ptr ITTNOTIFY_NAME(histogram_createA) +#define __itt_histogram_createW ITTNOTIFY_DATA(histogram_createW) +#define __itt_histogram_createW_ptr ITTNOTIFY_NAME(histogram_createW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_histogram_create ITTNOTIFY_DATA(histogram_create) +#define __itt_histogram_create_ptr ITTNOTIFY_NAME(histogram_create) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_histogram_createA(domain, name, x_type, y_type) (__itt_histogram*)0 +#define __itt_histogram_createA_ptr 0 +#define __itt_histogram_createW(domain, name, x_type, y_type) (__itt_histogram*)0 +#define __itt_histogram_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_histogram_create(domain, name, x_type, y_type) (__itt_histogram*)0 +#define __itt_histogram_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_histogram_createA_ptr 0 +#define __itt_histogram_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_histogram_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Submit statistics for a histogram instance. + * @param[in] histogram Pointer to the histogram instance to which the histogram statistic is to be dumped. + * @param[in] length The number of elements in dumped axis data array. + * @param[in] x_data The X axis dumped data itself (may be NULL to calculate batch statistics). + * @param[in] y_data The Y axis dumped data itself. +*/ +void ITTAPI __itt_histogram_submit(__itt_histogram* histogram, size_t length, void* x_data, void* y_data); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, histogram_submit, (__itt_histogram* histogram, size_t length, void* x_data, void* y_data)) +#define __itt_histogram_submit ITTNOTIFY_VOID(histogram_submit) +#define __itt_histogram_submit_ptr ITTNOTIFY_NAME(histogram_submit) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_histogram_submit(histogram, length, x_data, y_data) +#define __itt_histogram_submit_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_histogram_submit_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ + +/** +* @brief function allows to obtain the current collection state at the moment +* @return collection state as a enum __itt_collection_state +*/ +__itt_collection_state __itt_get_collection_state(void); + +/** +* @brief function releases resources allocated by ITT API static part +* this API should be called from the library destructor +* @return void +*/ +void __itt_release_resources(void); +/** @endcond */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff -Nru onetbb-2021.7.0/src/tbb/tools_api/ittnotify_static.c onetbb-2021.9.0/src/tbb/tools_api/ittnotify_static.c --- onetbb-2021.7.0/src/tbb/tools_api/ittnotify_static.c 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/tools_api/ittnotify_static.c 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,13 +14,14 @@ limitations under the License. */ +#define INTEL_NO_MACRO_BODY +#define INTEL_ITTNOTIFY_API_PRIVATE #include "ittnotify_config.h" #if ITT_PLATFORM==ITT_PLATFORM_WIN -#ifdef PATH_MAX -#undef PATH_MAX -#endif +#if !defined(PATH_MAX) #define PATH_MAX 512 +#endif #else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ #include #include @@ -31,8 +32,6 @@ #include #include -#define INTEL_NO_MACRO_BODY -#define INTEL_ITTNOTIFY_API_PRIVATE #include "ittnotify.h" #include "legacy/ittnotify.h" @@ -138,7 +137,7 @@ { \ if (!p.mutex_initialized) \ { \ - if (__itt_interlocked_increment(&p.atomic_counter) == 1) \ + if (__itt_interlocked_compare_exchange(&p.atomic_counter, 1, 0) == 0) \ { \ __itt_mutex_init(&p.mutex); \ p.mutex_initialized = 1; \ @@ -151,6 +150,20 @@ } \ } +#define ITT_MUTEX_DESTROY(p) { \ + if (PTHREAD_SYMBOLS) \ + { \ + if (p.mutex_initialized) \ + { \ + if (__itt_interlocked_compare_exchange(&p.atomic_counter, 0, 1) == 1) \ + { \ + __itt_mutex_destroy(&p.mutex); \ + p.mutex_initialized = 0; \ + } \ + } \ + } \ +} + #define ITT_MODULE_OBJECT_VERSION 1 typedef int (__itt_init_ittlib_t)(const char*, __itt_group_id); @@ -242,9 +255,11 @@ #pragma pack(pop) -#if ITT_PLATFORM==ITT_PLATFORM_WIN && _MSC_VER +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#if _MSC_VER #pragma warning(push) #pragma warning(disable: 4054) /* warning C4054: 'type cast' : from function pointer 'XXX' to data pointer 'void *' */ +#endif #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ static __itt_api_info api_list[] = { @@ -265,8 +280,10 @@ {NULL, NULL, NULL, NULL, __itt_group_none} }; -#if ITT_PLATFORM==ITT_PLATFORM_WIN && _MSC_VER +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#if _MSC_VER #pragma warning(pop) +#endif #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ /* static part descriptor which handles. all notification api attributes. */ @@ -285,9 +302,10 @@ NULL, /* thread_list */ NULL, /* domain_list */ NULL, /* string_list */ - __itt_collection_normal, /* collection state */ + __itt_collection_uninitialized, /* collection state */ NULL, /* counter_list */ - 0 /* ipt_collect_events */ + 0, /* ipt_collect_events */ + NULL /* histogram_list */ }; typedef void (__itt_api_init_t)(__itt_global*, __itt_group_id); @@ -300,9 +318,11 @@ ITT_EXTERN_C void _N_(error_handler)(__itt_error_code, va_list args); #endif /* ITT_NOTIFY_EXT_REPORT */ -#if ITT_PLATFORM==ITT_PLATFORM_WIN && _MSC_VER +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#if _MSC_VER #pragma warning(push) #pragma warning(disable: 4055) /* warning C4055: 'type cast' : from data pointer 'void *' to function pointer 'XXX' */ +#endif #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ static void __itt_report_error(int code, ...) @@ -320,8 +340,12 @@ va_end(args); } -#if ITT_PLATFORM==ITT_PLATFORM_WIN && _MSC_VER +static int __itt_is_collector_available(void); + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#if _MSC_VER #pragma warning(pop) +#endif #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ #if ITT_PLATFORM==ITT_PLATFORM_WIN @@ -348,13 +372,16 @@ return &dummy_domain; } } - for (h_tail = NULL, h = _N_(_ittapi_global).domain_list; h != NULL; h_tail = h, h = h->next) - { - if (h->nameW != NULL && !wcscmp(h->nameW, name)) break; - } - if (h == NULL) + if (__itt_is_collector_available()) { - NEW_DOMAIN_W(&_N_(_ittapi_global),h,h_tail,name); + for (h_tail = NULL, h = _N_(_ittapi_global).domain_list; h != NULL; h_tail = h, h = h->next) + { + if (h->nameW != NULL && !wcscmp(h->nameW, name)) break; + } + if (h == NULL) + { + NEW_DOMAIN_W(&_N_(_ittapi_global), h, h_tail, name); + } } if (PTHREAD_SYMBOLS) __itt_mutex_unlock(&_N_(_ittapi_global).mutex); return h; @@ -398,13 +425,16 @@ return &dummy_domain; } } - for (h_tail = NULL, h = _N_(_ittapi_global).domain_list; h != NULL; h_tail = h, h = h->next) - { - if (h->nameA != NULL && !__itt_fstrcmp(h->nameA, name)) break; - } - if (h == NULL) + if (__itt_is_collector_available()) { - NEW_DOMAIN_A(&_N_(_ittapi_global),h,h_tail,name); + for (h_tail = NULL, h = _N_(_ittapi_global).domain_list; h != NULL; h_tail = h, h = h->next) + { + if (h->nameA != NULL && !__itt_fstrcmp(h->nameA, name)) break; + } + if (h == NULL) + { + NEW_DOMAIN_A(&_N_(_ittapi_global), h, h_tail, name); + } } if (PTHREAD_SYMBOLS) __itt_mutex_unlock(&_N_(_ittapi_global).mutex); return h; @@ -466,13 +496,16 @@ return NULL; } } - for (h_tail = NULL, h = _N_(_ittapi_global).string_list; h != NULL; h_tail = h, h = h->next) - { - if (h->strW != NULL && !wcscmp(h->strW, name)) break; - } - if (h == NULL) + if (__itt_is_collector_available()) { - NEW_STRING_HANDLE_W(&_N_(_ittapi_global),h,h_tail,name); + for (h_tail = NULL, h = _N_(_ittapi_global).string_list; h != NULL; h_tail = h, h = h->next) + { + if (h->strW != NULL && !wcscmp(h->strW, name)) break; + } + if (h == NULL) + { + NEW_STRING_HANDLE_W(&_N_(_ittapi_global), h, h_tail, name); + } } __itt_mutex_unlock(&_N_(_ittapi_global).mutex); return h; @@ -516,13 +549,16 @@ return NULL; } } - for (h_tail = NULL, h = _N_(_ittapi_global).string_list; h != NULL; h_tail = h, h = h->next) - { - if (h->strA != NULL && !__itt_fstrcmp(h->strA, name)) break; - } - if (h == NULL) + if (__itt_is_collector_available()) { - NEW_STRING_HANDLE_A(&_N_(_ittapi_global),h,h_tail,name); + for (h_tail = NULL, h = _N_(_ittapi_global).string_list; h != NULL; h_tail = h, h = h->next) + { + if (h->strA != NULL && !__itt_fstrcmp(h->strA, name)) break; + } + if (h == NULL) + { + NEW_STRING_HANDLE_A(&_N_(_ittapi_global), h, h_tail, name); + } } if (PTHREAD_SYMBOLS) __itt_mutex_unlock(&_N_(_ittapi_global).mutex); return h; @@ -553,15 +589,18 @@ return NULL; } } - for (h_tail = NULL, h = _N_(_ittapi_global).counter_list; h != NULL; h_tail = h, h = h->next) + if (__itt_is_collector_available()) { - if (h->nameW != NULL && h->type == (int)type && !wcscmp(h->nameW, name) && ((h->domainW == NULL && domain == NULL) || - (h->domainW != NULL && domain != NULL && !wcscmp(h->domainW, domain)))) break; + for (h_tail = NULL, h = _N_(_ittapi_global).counter_list; h != NULL; h_tail = h, h = h->next) + { + if (h->nameW != NULL && h->type == (int)type && !wcscmp(h->nameW, name) && ((h->domainW == NULL && domain == NULL) || + (h->domainW != NULL && domain != NULL && !wcscmp(h->domainW, domain)))) break; - } - if (h == NULL) - { - NEW_COUNTER_W(&_N_(_ittapi_global),h,h_tail,name,domain,type); + } + if (h == NULL) + { + NEW_COUNTER_W(&_N_(_ittapi_global), h, h_tail, name, domain, type); + } } __itt_mutex_unlock(&_N_(_ittapi_global).mutex); return (__itt_counter)h; @@ -606,14 +645,17 @@ return NULL; } } - for (h_tail = NULL, h = _N_(_ittapi_global).counter_list; h != NULL; h_tail = h, h = h->next) - { - if (h->nameA != NULL && h->type == (int)type && !__itt_fstrcmp(h->nameA, name) && ((h->domainA == NULL && domain == NULL) || - (h->domainA != NULL && domain != NULL && !__itt_fstrcmp(h->domainA, domain)))) break; - } - if (h == NULL) + if (__itt_is_collector_available()) { - NEW_COUNTER_A(&_N_(_ittapi_global),h,h_tail,name,domain,type); + for (h_tail = NULL, h = _N_(_ittapi_global).counter_list; h != NULL; h_tail = h, h = h->next) + { + if (h->nameA != NULL && h->type == (int)type && !__itt_fstrcmp(h->nameA, name) && ((h->domainA == NULL && domain == NULL) || + (h->domainA != NULL && domain != NULL && !__itt_fstrcmp(h->domainA, domain)))) break; + } + if (h == NULL) + { + NEW_COUNTER_A(&_N_(_ittapi_global), h, h_tail, name, domain, type); + } } if (PTHREAD_SYMBOLS) __itt_mutex_unlock(&_N_(_ittapi_global).mutex); return (__itt_counter)h; @@ -643,15 +685,18 @@ return NULL; } } - for (h_tail = NULL, h = _N_(_ittapi_global).counter_list; h != NULL; h_tail = h, h = h->next) + if (__itt_is_collector_available()) { - if (h->nameW != NULL && h->type == (int)type && !wcscmp(h->nameW, name) && ((h->domainW == NULL && domain == NULL) || - (h->domainW != NULL && domain != NULL && !wcscmp(h->domainW, domain)))) break; + for (h_tail = NULL, h = _N_(_ittapi_global).counter_list; h != NULL; h_tail = h, h = h->next) + { + if (h->nameW != NULL && h->type == (int)type && !wcscmp(h->nameW, name) && ((h->domainW == NULL && domain == NULL) || + (h->domainW != NULL && domain != NULL && !wcscmp(h->domainW, domain)))) break; - } - if (h == NULL) - { - NEW_COUNTER_W(&_N_(_ittapi_global),h,h_tail,name,domain,type); + } + if (h == NULL) + { + NEW_COUNTER_W(&_N_(_ittapi_global), h, h_tail, name, domain, type); + } } __itt_mutex_unlock(&_N_(_ittapi_global).mutex); return (__itt_counter)h; @@ -695,17 +740,114 @@ return NULL; } } - for (h_tail = NULL, h = _N_(_ittapi_global).counter_list; h != NULL; h_tail = h, h = h->next) + if (__itt_is_collector_available()) + { + for (h_tail = NULL, h = _N_(_ittapi_global).counter_list; h != NULL; h_tail = h, h = h->next) + { + if (h->nameA != NULL && h->type == (int)type && !__itt_fstrcmp(h->nameA, name) && ((h->domainA == NULL && domain == NULL) || + (h->domainA != NULL && domain != NULL && !__itt_fstrcmp(h->domainA, domain)))) break; + } + if (h == NULL) + { + NEW_COUNTER_A(&_N_(_ittapi_global), h, h_tail, name, domain, type); + } + } + if (PTHREAD_SYMBOLS) __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return (__itt_counter)h; +} + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +static __itt_histogram* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(histogram_createW),_init))(const __itt_domain* domain, const wchar_t* name, __itt_metadata_type x_type, __itt_metadata_type y_type) +{ + __itt_histogram *h_tail = NULL, *h = NULL; + + if (domain == NULL || name == NULL) + { + return NULL; + } + + ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global)); + if (_N_(_ittapi_global).api_initialized) + { + if (ITTNOTIFY_NAME(histogram_createW) && ITTNOTIFY_NAME(histogram_createW) != ITT_VERSIONIZE(ITT_JOIN(_N_(histogram_createW),_init))) + { + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return ITTNOTIFY_NAME(histogram_createW)(domain, name, x_type, y_type); + } + else + { + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return NULL; + } + } + if (__itt_is_collector_available()) + { + for (h_tail = NULL, h = _N_(_ittapi_global).histogram_list; h != NULL; h_tail = h, h = h->next) + { + if (h->domain == NULL) continue; + else if (h->domain == domain && h->nameW != NULL && !wcscmp(h->nameW, name)) break; + } + if (h == NULL) + { + NEW_HISTOGRAM_W(&_N_(_ittapi_global), h, h_tail, domain, name, x_type, y_type); + } + } + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return (__itt_histogram*)h; +} + +static __itt_histogram* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(histogram_createA),_init))(const __itt_domain* domain, const char* name, __itt_metadata_type x_type, __itt_metadata_type y_type) +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +static __itt_histogram* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(histogram_create),_init))(const __itt_domain* domain, const char* name, __itt_metadata_type x_type, __itt_metadata_type y_type) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +{ + __itt_histogram *h_tail = NULL, *h = NULL; + + if (domain == NULL || name == NULL) { - if (h->nameA != NULL && h->type == (int)type && !__itt_fstrcmp(h->nameA, name) && ((h->domainA == NULL && domain == NULL) || - (h->domainA != NULL && domain != NULL && !__itt_fstrcmp(h->domainA, domain)))) break; + return NULL; } - if (h == NULL) + + ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global)); + if (_N_(_ittapi_global).api_initialized) { - NEW_COUNTER_A(&_N_(_ittapi_global),h,h_tail,name,domain,type); +#if ITT_PLATFORM==ITT_PLATFORM_WIN + if (ITTNOTIFY_NAME(histogram_createA) && ITTNOTIFY_NAME(histogram_createA) != ITT_VERSIONIZE(ITT_JOIN(_N_(histogram_createA),_init))) + { + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return ITTNOTIFY_NAME(histogram_createA)(domain, name, x_type, y_type); + } +#else + if (ITTNOTIFY_NAME(histogram_create) && ITTNOTIFY_NAME(histogram_create) != ITT_VERSIONIZE(ITT_JOIN(_N_(histogram_create),_init))) + { + if (PTHREAD_SYMBOLS) __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return ITTNOTIFY_NAME(histogram_create)(domain, name, x_type, y_type); + } +#endif + else + { +#if ITT_PLATFORM==ITT_PLATFORM_WIN + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); +#else + if (PTHREAD_SYMBOLS) __itt_mutex_unlock(&_N_(_ittapi_global).mutex); +#endif + return NULL; + } + } + if (__itt_is_collector_available()) + { + for (h_tail = NULL, h = _N_(_ittapi_global).histogram_list; h != NULL; h_tail = h, h = h->next) + { + if (h->domain == NULL) continue; + else if (h->domain == domain && h->nameA != NULL && !__itt_fstrcmp(h->nameA, name)) break; + } + if (h == NULL) + { + NEW_HISTOGRAM_A(&_N_(_ittapi_global), h, h_tail, domain, name, x_type, y_type); + } } if (PTHREAD_SYMBOLS) __itt_mutex_unlock(&_N_(_ittapi_global).mutex); - return (__itt_counter)h; + return (__itt_histogram*)h; } /* -------------------------------------------------------------------------- */ @@ -720,10 +862,6 @@ { ITTNOTIFY_NAME(pause)(); } - else - { - _N_(_ittapi_global).state = __itt_collection_paused; - } } static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(resume),_init))(void) @@ -736,10 +874,6 @@ { ITTNOTIFY_NAME(resume)(); } - else - { - _N_(_ittapi_global).state = __itt_collection_normal; - } } #if ITT_PLATFORM==ITT_PLATFORM_WIN @@ -1143,10 +1277,27 @@ *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].null_func; } -#if ITT_PLATFORM==ITT_PLATFORM_WIN && _MSC_VER +static int __itt_is_collector_available(void) +{ + int is_available; + + ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global)); + if (_N_(_ittapi_global).state == __itt_collection_uninitialized) + { + _N_(_ittapi_global).state = (NULL == __itt_get_lib_name()) ? __itt_collection_collector_absent : __itt_collection_collector_exists; + } + is_available = (_N_(_ittapi_global).state == __itt_collection_collector_exists || + _N_(_ittapi_global).state == __itt_collection_init_successful); + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return is_available; +} + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#if _MSC_VER #pragma warning(push) #pragma warning(disable: 4054) /* warning C4054: 'type cast' : from function pointer 'XXX' to data pointer 'void *' */ #pragma warning(disable: 4055) /* warning C4055: 'type cast' : from data pointer 'void *' to function pointer 'XXX' */ +#endif #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ ITT_EXTERN_C void _N_(fini_ittlib)(void) @@ -1186,6 +1337,64 @@ } } +/* !!! this function should be called under mutex lock !!! */ +static void __itt_free_allocated_resources(void) +{ + __itt_string_handle* current_string = _N_(_ittapi_global).string_list; + while (current_string != NULL) + { + __itt_string_handle* tmp = current_string->next; + free((char*)current_string->strA); +#if ITT_PLATFORM==ITT_PLATFORM_WIN + free((wchar_t*)current_string->strW); +#endif + free(current_string); + current_string = tmp; + } + _N_(_ittapi_global).string_list = NULL; + + __itt_domain* current_domain = _N_(_ittapi_global).domain_list; + while (current_domain != NULL) + { + __itt_domain* tmp = current_domain->next; + free((char*)current_domain->nameA); +#if ITT_PLATFORM==ITT_PLATFORM_WIN + free((wchar_t*)current_domain->nameW); +#endif + free(current_domain); + current_domain = tmp; + } + _N_(_ittapi_global).domain_list = NULL; + + __itt_counter_info_t* current_couter = _N_(_ittapi_global).counter_list; + while (current_couter != NULL) + { + __itt_counter_info_t* tmp = current_couter->next; + free((char*)current_couter->nameA); + free((char*)current_couter->domainA); +#if ITT_PLATFORM==ITT_PLATFORM_WIN + free((wchar_t*)current_couter->nameW); + free((wchar_t*)current_couter->domainW); +#endif + free(current_couter); + current_couter = tmp; + } + _N_(_ittapi_global).counter_list = NULL; + + __itt_histogram* current_histogram = _N_(_ittapi_global).histogram_list; + while (current_histogram != NULL) + { + __itt_histogram* tmp = current_histogram->next; + free((char*)current_histogram->nameA); +#if ITT_PLATFORM==ITT_PLATFORM_WIN + free((wchar_t*)current_histogram->nameW); +#endif + free(current_histogram); + current_histogram = tmp; + } + _N_(_ittapi_global).histogram_list = NULL; +} + ITT_EXTERN_C int _N_(init_ittlib)(const char* lib_name, __itt_group_id init_groups) { int i; @@ -1217,6 +1426,7 @@ if (_N_(_ittapi_global).lib != NULL) { + _N_(_ittapi_global).state = __itt_collection_init_successful; __itt_api_init_t* __itt_api_init_ptr; int lib_version = __itt_lib_version(_N_(_ittapi_global).lib); @@ -1277,6 +1487,8 @@ } else { + _N_(_ittapi_global).state = __itt_collection_init_fail; + __itt_free_allocated_resources(); __itt_nullify_all_pointers(); __itt_report_error(__itt_error_no_module, lib_name, @@ -1290,6 +1502,7 @@ } else { + _N_(_ittapi_global).state = __itt_collection_collector_absent; __itt_nullify_all_pointers(); } _N_(_ittapi_global).api_initialized = 1; @@ -1323,8 +1536,10 @@ return prev; } -#if ITT_PLATFORM==ITT_PLATFORM_WIN && _MSC_VER +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#if _MSC_VER #pragma warning(pop) +#endif #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ /** __itt_mark_pt_region functions marks region of interest @@ -1367,3 +1582,24 @@ (void)region; #endif } + +ITT_EXTERN_C __itt_collection_state (_N_(get_collection_state))(void) +{ + if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL) + { + __itt_init_ittlib_name(NULL, __itt_group_all); + } + return _N_(_ittapi_global).state; +} + +/* !!! should be called from the library destructor !!! + * this function destroys the mutex and frees resources + * allocated by ITT API static part + */ +ITT_EXTERN_C void (_N_(release_resources))(void) +{ + ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global)); + __itt_free_allocated_resources(); + if (PTHREAD_SYMBOLS) __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + ITT_MUTEX_DESTROY(_N_(_ittapi_global)); +} diff -Nru onetbb-2021.7.0/src/tbb/tools_api/ittnotify_static.h onetbb-2021.9.0/src/tbb/tools_api/ittnotify_static.h --- onetbb-2021.7.0/src/tbb/tools_api/ittnotify_static.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/tools_api/ittnotify_static.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -82,6 +82,14 @@ ITT_STUB(LIBITTAPI, int, thr_name_set, (const char *name, int namelen), (ITT_FORMAT name, namelen), thr_name_set, __itt_group_thread | __itt_group_legacy, "\"%s\", %d") #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ ITT_STUBV(LIBITTAPI, void, thr_ignore, (void), (ITT_NO_PARAMS), thr_ignore, __itt_group_thread | __itt_group_legacy, "no args") + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_histogram*, histogram_createA, (const __itt_domain* domain, const char* name, __itt_metadata_type x_type, __itt_metadata_type y_type), (ITT_FORMAT domain, name, x_type, y_type), histogram_createA, __itt_group_structure, "%p, \"%s\", %d, %d") +ITT_STUB(ITTAPI, __itt_histogram*, histogram_createW, (const __itt_domain* domain, const wchar_t* name, __itt_metadata_type x_type, __itt_metadata_type y_type), (ITT_FORMAT domain, name, x_type, y_type), histogram_createW, __itt_group_structure, "%p, \"%s\", %d, %d") +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_histogram*, histogram_create, (const __itt_domain* domain, const char* name, __itt_metadata_type x_type, __itt_metadata_type y_type), (ITT_FORMAT domain, name, x_type, y_type), histogram_create, __itt_group_structure, "%p, \"%s\", %d, %d") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + #endif /* __ITT_INTERNAL_BODY */ ITT_STUBV(ITTAPI, void, enable_attach, (void), (ITT_NO_PARAMS), enable_attach, __itt_group_all, "no args") @@ -352,5 +360,6 @@ #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ ITT_STUBV(ITTAPI, void, module_unload, (void *start_addr), (ITT_FORMAT start_addr), module_unload, __itt_group_module, "%p") +ITT_STUBV(ITTAPI, void, histogram_submit, (__itt_histogram* histogram, size_t length, void* x_data, void* y_data), (ITT_FORMAT histogram, length, x_data, y_data), histogram_submit, __itt_group_structure, "%p, %lu, %p, %p") #endif /* __ITT_INTERNAL_INIT */ diff -Nru onetbb-2021.7.0/src/tbb/tools_api/ittnotify_types.h onetbb-2021.9.0/src/tbb/tools_api/ittnotify_types.h --- onetbb-2021.7.0/src/tbb/tools_api/ittnotify_types.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/tools_api/ittnotify_types.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff -Nru onetbb-2021.7.0/src/tbb/tools_api/legacy/ittnotify.h onetbb-2021.9.0/src/tbb/tools_api/legacy/ittnotify.h --- onetbb-2021.7.0/src/tbb/tools_api/legacy/ittnotify.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbb/tools_api/legacy/ittnotify.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -126,7 +126,12 @@ #if ITT_PLATFORM==ITT_PLATFORM_WIN /* use __forceinline (VC++ specific) */ +#if defined(__MINGW32__) && !defined(__cplusplus) +#define ITT_INLINE static __inline__ __attribute__((__always_inline__,__gnu_inline__)) +#else #define ITT_INLINE static __forceinline +#endif /* __MINGW32__ */ + #define ITT_INLINE_ATTRIBUTE /* nothing */ #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ /* @@ -178,20 +183,20 @@ #define ITTNOTIFY_VOID(n) (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n) #define ITTNOTIFY_DATA(n) (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n) -#define ITTNOTIFY_VOID_D0(n,d) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d) -#define ITTNOTIFY_VOID_D1(n,d,x) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x) -#define ITTNOTIFY_VOID_D2(n,d,x,y) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y) -#define ITTNOTIFY_VOID_D3(n,d,x,y,z) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z) -#define ITTNOTIFY_VOID_D4(n,d,x,y,z,a) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) -#define ITTNOTIFY_VOID_D5(n,d,x,y,z,a,b) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) -#define ITTNOTIFY_VOID_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) -#define ITTNOTIFY_DATA_D0(n,d) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d) -#define ITTNOTIFY_DATA_D1(n,d,x) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x) -#define ITTNOTIFY_DATA_D2(n,d,x,y) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y) -#define ITTNOTIFY_DATA_D3(n,d,x,y,z) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z) -#define ITTNOTIFY_DATA_D4(n,d,x,y,z,a) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) -#define ITTNOTIFY_DATA_D5(n,d,x,y,z,a,b) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) -#define ITTNOTIFY_DATA_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) +#define ITTNOTIFY_VOID_D0(n,d) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_VOID_D1(n,d,x) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_VOID_D2(n,d,x,y) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_VOID_D3(n,d,x,y,z) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_VOID_D4(n,d,x,y,z,a) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_VOID_D5(n,d,x,y,z,a,b) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_VOID_D6(n,d,x,y,z,a,b,c) (d == NULL) ? (void)0 : (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) +#define ITTNOTIFY_DATA_D0(n,d) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_DATA_D1(n,d,x) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_DATA_D2(n,d,x,y) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_DATA_D3(n,d,x,y,z) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_DATA_D4(n,d,x,y,z,a) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_DATA_D5(n,d,x,y,z,a,b) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_DATA_D6(n,d,x,y,z,a,b,c) (d == NULL) ? 0 : (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) #ifdef ITT_STUB #undef ITT_STUB diff -Nru onetbb-2021.7.0/src/tbbbind/CMakeLists.txt onetbb-2021.9.0/src/tbbbind/CMakeLists.txt --- onetbb-2021.7.0/src/tbbbind/CMakeLists.txt 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbbbind/CMakeLists.txt 2023-04-06 17:14:50.000000000 +0000 @@ -24,6 +24,13 @@ return() endif() add_library(${TBBBIND_NAME} tbb_bind.cpp) + + if (WIN32) + if(${TBBBIND_NAME} STREQUAL tbbbind) #adding resource info for default tbbbind + target_sources(${TBBBIND_NAME} PRIVATE tbb_bind.rc) + endif() + endif() + add_library(TBB::${TBBBIND_NAME} ALIAS ${TBBBIND_NAME}) target_compile_definitions(${TBBBIND_NAME} @@ -59,8 +66,8 @@ if (TBB_DEF_FILE_PREFIX) # If there's no prefix, assume we're using export directives set_target_properties(${TBBBIND_NAME} PROPERTIES - LINK_FLAGS ${TBB_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbbind.def - LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbbind.def + LINK_FLAGS "${TBB_LINK_DEF_FILE_FLAG}\"${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbbind.def\"" + LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbbind.def" ) endif() diff -Nru onetbb-2021.7.0/src/tbbbind/tbb_bind.rc onetbb-2021.9.0/src/tbbbind/tbb_bind.rc --- onetbb-2021.7.0/src/tbbbind/tbb_bind.rc 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/src/tbbbind/tbb_bind.rc 2023-04-06 17:14:50.000000000 +0000 @@ -0,0 +1,74 @@ +// Copyright (c) 2005-2023 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +///////////////////////////////////////////////////////////////////////////// +// +// Includes +// +#include +#include "../../include/oneapi/tbb/version.h" + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#define TBB_VERNUMBERS TBB_VERSION_MAJOR,TBB_VERSION_MINOR +#define TBB_VERSION TBB_VERSION_STRING + +VS_VERSION_INFO VERSIONINFO + FILEVERSION TBB_VERNUMBERS + PRODUCTVERSION TBB_VERNUMBERS + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Intel Corporation\0" + VALUE "FileDescription", "oneAPI Threading Building Blocks (oneTBB) library\0" + VALUE "FileVersion", TBB_VERSION "\0" + VALUE "LegalCopyright", "Copyright 2005-2022 Intel Corporation. All Rights Reserved.\0" + VALUE "LegalTrademarks", "\0" +#ifndef TBB_USE_DEBUG + VALUE "OriginalFilename", "tbbbind.dll\0" +#else + VALUE "OriginalFilename", "tbbbind_debug.dll\0" +#endif + VALUE "ProductName", "oneAPI Threading Building Blocks (oneTBB)\0" + VALUE "ProductVersion", TBB_VERSION "\0" + VALUE "PrivateBuild", "\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff -Nru onetbb-2021.7.0/src/tbbmalloc/CMakeLists.txt onetbb-2021.9.0/src/tbbmalloc/CMakeLists.txt --- onetbb-2021.7.0/src/tbbmalloc/CMakeLists.txt 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbbmalloc/CMakeLists.txt 2023-04-06 17:14:50.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021 Intel Corporation +# Copyright (c) 2020-2022 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,6 +19,10 @@ large_objects.cpp tbbmalloc.cpp ../tbb/itt_notify.cpp) + +if (WIN32) + target_sources(tbbmalloc PRIVATE tbbmalloc.rc) +endif() add_library(TBB::tbbmalloc ALIAS tbbmalloc) @@ -75,8 +79,8 @@ if (TBB_DEF_FILE_PREFIX) # If there's no prefix, assume we're using export directives set_target_properties(tbbmalloc PROPERTIES - LINK_FLAGS ${TBB_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbmalloc.def - LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbmalloc.def + LINK_FLAGS "${TBB_LINK_DEF_FILE_FLAG}\"${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbmalloc.def\"" + LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbbmalloc.def" ) endif() diff -Nru onetbb-2021.7.0/src/tbbmalloc/Customize.h onetbb-2021.9.0/src/tbbmalloc/Customize.h --- onetbb-2021.7.0/src/tbbmalloc/Customize.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbbmalloc/Customize.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -37,12 +37,14 @@ #define MALLOC_ITT_SYNC_RELEASING(pointer) ITT_NOTIFY(sync_releasing, (pointer)) #define MALLOC_ITT_SYNC_CANCEL(pointer) ITT_NOTIFY(sync_cancel, (pointer)) #define MALLOC_ITT_FINI_ITTLIB() ITT_FINI_ITTLIB() +#define MALLOC_ITT_RELEASE_RESOURCES() ITT_RELEASE_RESOURCES() #else #define MALLOC_ITT_SYNC_PREPARE(pointer) ((void)0) #define MALLOC_ITT_SYNC_ACQUIRED(pointer) ((void)0) #define MALLOC_ITT_SYNC_RELEASING(pointer) ((void)0) #define MALLOC_ITT_SYNC_CANCEL(pointer) ((void)0) #define MALLOC_ITT_FINI_ITTLIB() ((void)0) +#define MALLOC_ITT_RELEASE_RESOURCES() ((void)0) #endif inline intptr_t BitScanRev(uintptr_t x) { diff -Nru onetbb-2021.7.0/src/tbbmalloc/frontend.cpp onetbb-2021.9.0/src/tbbmalloc/frontend.cpp --- onetbb-2021.7.0/src/tbbmalloc/frontend.cpp 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbbmalloc/frontend.cpp 2023-04-06 17:14:50.000000000 +0000 @@ -2925,8 +2925,10 @@ for( int i=1; i<=nThreads && i +#include "../../include/oneapi/tbb/version.h" + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#define TBB_VERNUMBERS TBB_VERSION_MAJOR,TBB_VERSION_MINOR +#define TBB_VERSION TBB_VERSION_STRING + +VS_VERSION_INFO VERSIONINFO + FILEVERSION TBB_VERNUMBERS + PRODUCTVERSION TBB_VERNUMBERS + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Intel Corporation\0" + VALUE "FileDescription", "oneAPI Threading Building Blocks (oneTBB) library\0" + VALUE "FileVersion", TBB_VERSION "\0" + VALUE "LegalCopyright", "Copyright 2005-2022 Intel Corporation. All Rights Reserved.\0" + VALUE "LegalTrademarks", "\0" +#ifndef TBB_USE_DEBUG + VALUE "OriginalFilename", "tbbmalloc.dll\0" +#else + VALUE "OriginalFilename", "tbbmalloc_debug.dll\0" +#endif + VALUE "ProductName", "oneAPI Threading Building Blocks (oneTBB)\0" + VALUE "ProductVersion", TBB_VERSION "\0" + VALUE "PrivateBuild", "\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff -Nru onetbb-2021.7.0/src/tbbmalloc_proxy/CMakeLists.txt onetbb-2021.9.0/src/tbbmalloc_proxy/CMakeLists.txt --- onetbb-2021.7.0/src/tbbmalloc_proxy/CMakeLists.txt 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/src/tbbmalloc_proxy/CMakeLists.txt 2023-04-06 17:14:50.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021 Intel Corporation +# Copyright (c) 2020-2022 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,6 +20,10 @@ function_replacement.cpp proxy.cpp) +if (WIN32) + target_sources(tbbmalloc_proxy PRIVATE tbbmalloc_proxy.rc) +endif() + add_library(TBB::tbbmalloc_proxy ALIAS tbbmalloc_proxy) target_compile_definitions(tbbmalloc_proxy diff -Nru onetbb-2021.7.0/src/tbbmalloc_proxy/tbbmalloc_proxy.rc onetbb-2021.9.0/src/tbbmalloc_proxy/tbbmalloc_proxy.rc --- onetbb-2021.7.0/src/tbbmalloc_proxy/tbbmalloc_proxy.rc 1970-01-01 00:00:00.000000000 +0000 +++ onetbb-2021.9.0/src/tbbmalloc_proxy/tbbmalloc_proxy.rc 2023-04-06 17:14:50.000000000 +0000 @@ -0,0 +1,74 @@ +// Copyright (c) 2005-2023 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +///////////////////////////////////////////////////////////////////////////// +// +// Includes +// +#include +#include "../../include/oneapi/tbb/version.h" + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#define TBB_VERNUMBERS TBB_VERSION_MAJOR,TBB_VERSION_MINOR +#define TBB_VERSION TBB_VERSION_STRING + +VS_VERSION_INFO VERSIONINFO + FILEVERSION TBB_VERNUMBERS + PRODUCTVERSION TBB_VERNUMBERS + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Intel Corporation\0" + VALUE "FileDescription", "oneAPI Threading Building Blocks (oneTBB) library\0" + VALUE "FileVersion", TBB_VERSION "\0" + VALUE "LegalCopyright", "Copyright 2005-2022 Intel Corporation. All Rights Reserved.\0" + VALUE "LegalTrademarks", "\0" +#ifndef TBB_USE_DEBUG + VALUE "OriginalFilename", "tbbmalloc_proxy.dll\0" +#else + VALUE "OriginalFilename", "tbbmalloc_proxy_debug.dll\0" +#endif + VALUE "ProductName", "oneAPI Threading Building Blocks (oneTBB)\0" + VALUE "ProductVersion", TBB_VERSION "\0" + VALUE "PrivateBuild", "\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff -Nru onetbb-2021.7.0/SYSTEM_REQUIREMENTS.md onetbb-2021.9.0/SYSTEM_REQUIREMENTS.md --- onetbb-2021.7.0/SYSTEM_REQUIREMENTS.md 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/SYSTEM_REQUIREMENTS.md 2023-04-06 17:14:50.000000000 +0000 @@ -21,6 +21,7 @@ - [Supported Hardware](#supported-hardware) - [Software](#software) - [Supported Operating Systems](#supported-operating-systems) + - [Community-Supported Platforms](#community-supported-platforms) - [Supported Compilers](#supported-compilers) @@ -54,6 +55,12 @@ - Systems with Android* operating systems - Android* 9 +### Community-Supported Platforms +- MinGW* +- FreeBSD* +- Microsoft* Windows* on ARM*/ARM64* +- macOS* on ARM64* + ### Supported Compilers - Intel* oneAPI DPC++/C++ Compiler - Intel* C++ Compiler 19.0 and 19.1 version diff -Nru onetbb-2021.7.0/test/CMakeLists.txt onetbb-2021.9.0/test/CMakeLists.txt --- onetbb-2021.7.0/test/CMakeLists.txt 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/test/CMakeLists.txt 2023-04-06 17:14:50.000000000 +0000 @@ -361,17 +361,29 @@ # Common target for the tbbbind related tests add_custom_target(test_suite_arena_constraints) +# Check support for --no-as-needed linker option +if (MINGW OR NOT WIN32) + include(CheckCXXSourceCompiles) + set(CMAKE_REQUIRED_LIBRARIES "-Wl,--no-as-needed") + check_cxx_source_compiles("int main(int, char*[]) { return 0; }" LINKER_HAS_NO_AS_NEEDED) + unset(CMAKE_REQUIRED_LIBRARIES) +endif() + if (TARGET TBB::tbb) # Define the tests tbb_add_test(SUBDIR tbb NAME test_tick_count DEPENDENCIES TBB::tbb) tbb_add_test(SUBDIR tbb NAME test_allocators DEPENDENCIES TBB::tbb) tbb_add_test(SUBDIR tbb NAME test_arena_priorities DEPENDENCIES TBB::tbb) tbb_add_test(SUBDIR tbb NAME test_dynamic_link DEPENDENCIES TBB::tbb) - if (WIN32) - tbb_add_test(SUBDIR tbb NAME test_numa_dist DEPENDENCIES TBB::tbb) + if (LINKER_HAS_NO_AS_NEEDED) + # The linker may not detect a dependency on pthread in static variable constructors. + target_link_libraries(test_dynamic_link PRIVATE "-Wl,--no-as-needed") endif() if (APPLE OR ANDROID_PLATFORM) - target_link_libraries(test_dynamic_link PRIVATE -rdynamic) # for the test_dynamic_link + target_link_libraries(test_dynamic_link PRIVATE -rdynamic) + endif() + if (WIN32) + tbb_add_test(SUBDIR tbb NAME test_numa_dist DEPENDENCIES TBB::tbb) endif() tbb_add_test(SUBDIR tbb NAME test_collaborative_call_once DEPENDENCIES TBB::tbb) tbb_add_test(SUBDIR tbb NAME test_concurrent_lru_cache DEPENDENCIES TBB::tbb) diff -Nru onetbb-2021.7.0/test/common/common_arena_constraints.h onetbb-2021.9.0/test/common/common_arena_constraints.h --- onetbb-2021.7.0/test/common/common_arena_constraints.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/test/common/common_arena_constraints.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2019-2021 Intel Corporation + Copyright (c) 2019-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,8 +17,6 @@ #ifndef __TBB_test_common_arena_constraints_H_ #define __TBB_test_common_arena_constraints_H_ -#define TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION 1 - #if _WIN32 || _WIN64 #define _CRT_SECURE_NO_WARNINGS #endif diff -Nru onetbb-2021.7.0/test/common/concurrent_lru_cache_common.h onetbb-2021.9.0/test/common/concurrent_lru_cache_common.h --- onetbb-2021.7.0/test/common/concurrent_lru_cache_common.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/test/common/concurrent_lru_cache_common.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include "test.h" +#include "utils.h" #include //----------------------------------------------------------------------------- @@ -114,10 +115,17 @@ } ~instance_counter() { - if (! --(*my_p_count)) + bool is_last = ! --(*my_p_count); +#if __GNUC__ == 12 + // GCC 12 warns about using my_p_count after delete. + // The test was investigated and no problems were detected + // The following statement silence the warning + static bool unused_is_last = is_last; + utils::suppress_unused_warning(unused_is_last); +#endif + if (is_last) delete(my_p_count); } - std::size_t instances_count() const { return *my_p_count; } }; diff -Nru onetbb-2021.7.0/test/common/doctest.h onetbb-2021.9.0/test/common/doctest.h --- onetbb-2021.7.0/test/common/doctest.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/test/common/doctest.h 2023-04-06 17:14:50.000000000 +0000 @@ -1362,11 +1362,13 @@ , m_at(at) {} DOCTEST_NOINLINE operator Result() { +DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Waddress") // this is needed only for MSVC 2015: // https://ci.appveyor.com/project/onqtam/doctest/builds/38181202 DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4800) // 'int': forcing value to bool bool res = static_cast(lhs); DOCTEST_MSVC_SUPPRESS_WARNING_POP +DOCTEST_GCC_SUPPRESS_WARNING_POP if(m_at & assertType::is_false) //!OCLINT bitwise operator in conditional res = !res; @@ -3692,6 +3694,7 @@ String toString(double in) { return fpToString(in, 10); } String toString(double long in) { return fpToString(in, 15); } +DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations") #define DOCTEST_TO_STRING_OVERLOAD(type, fmt) \ String toString(type in) { \ char buf[64]; \ @@ -3710,6 +3713,7 @@ DOCTEST_TO_STRING_OVERLOAD(int long unsigned, "%lu") DOCTEST_TO_STRING_OVERLOAD(int long long, "%lld") DOCTEST_TO_STRING_OVERLOAD(int long long unsigned, "%llu") +DOCTEST_CLANG_SUPPRESS_WARNING_POP String toString(std::nullptr_t) { return "NULL"; } diff -Nru onetbb-2021.7.0/test/common/parallel_for_each_common.h onetbb-2021.9.0/test/common/parallel_for_each_common.h --- onetbb-2021.7.0/test/common/parallel_for_each_common.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/test/common/parallel_for_each_common.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -36,12 +36,12 @@ constexpr std::size_t depths_nubmer = 20; static std::atomic g_values_counter; -class value_t { +class value_t : public utils::NoAfterlife { size_t x; value_t& operator=(const value_t&); public: value_t(size_t xx) : x(xx) { ++g_values_counter; } - value_t(const value_t& v) : x(v.x) { ++g_values_counter; } + value_t(const value_t& v) : utils::NoAfterlife(v), x(v.x) { ++g_values_counter; } value_t(value_t&& v) : x(v.x) { ++g_values_counter; } ~value_t() { --g_values_counter; } size_t value() const volatile { return x; } diff -Nru onetbb-2021.7.0/test/common/utils.h onetbb-2021.9.0/test/common/utils.h --- onetbb-2021.7.0/test/common/utils.h 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/test/common/utils.h 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ #include #include #include +#include #if HARNESS_TBBMALLOC_THREAD_SHUTDOWN && __TBB_SOURCE_DIRECTLY_INCLUDED && (_WIN32 || _WIN64) #include "../../src/tbbmalloc/tbbmalloc_internal_api.h" @@ -437,6 +438,43 @@ }; #endif // __TBB_CPP20_CONCEPTS_PRESENT +class LifeTrackableObject { + using set_type = std::unordered_set; + static set_type alive_objects; +public: + LifeTrackableObject() { + alive_objects.insert(this); + } + + LifeTrackableObject(const LifeTrackableObject&) { + alive_objects.insert(this); + } + + LifeTrackableObject(LifeTrackableObject&&) { + alive_objects.insert(this); + } + + LifeTrackableObject& operator=(const LifeTrackableObject&) = default; + LifeTrackableObject& operator=(LifeTrackableObject&&) = default; + + ~LifeTrackableObject() { + alive_objects.erase(this); + } + + static bool is_alive(const LifeTrackableObject& object) { + return is_alive(&object); + } + + static bool is_alive(const LifeTrackableObject* object) { + return alive_objects.find(object) != alive_objects.end(); + } + + static const set_type& set() { + return alive_objects; + } +}; +std::unordered_set LifeTrackableObject::alive_objects{}; + } // namespace utils #endif // __TBB_test_common_utils_H diff -Nru onetbb-2021.7.0/test/conformance/conformance_arena_constraints.cpp onetbb-2021.9.0/test/conformance/conformance_arena_constraints.cpp --- onetbb-2021.7.0/test/conformance/conformance_arena_constraints.cpp 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/test/conformance/conformance_arena_constraints.cpp 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2019-2021 Intel Corporation + Copyright (c) 2019-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -57,6 +57,21 @@ REQUIRE_MESSAGE(numa_nodes_info.empty(), "Some available NUMA nodes indexes were not detected."); } +#if __HYBRID_CPUS_TESTING +//! Testing NUMA topology traversal correctness +//! \brief \ref interface \ref requirement +TEST_CASE("Test core types topology traversal correctness") { + system_info::initialize(); + std::vector core_types_info = system_info::get_cpu_kinds_info(); + std::vector core_types = tbb::info::core_types(); + + REQUIRE_MESSAGE(core_types_info.size() == core_types.size(), "Wrong core types number detected."); + for (unsigned i = 0; i < core_types.size(); ++i) { + REQUIRE_MESSAGE(core_types[i] == core_types_info[i].index, "Wrong core type index detected."); + } +} +#endif /*__HYBRID_CPUS_TESTING*/ + #else /*!__TBB_HWLOC_VALID_ENVIRONMENT*/ //! Testing NUMA support interfaces validity when HWLOC is not presented on system diff -Nru onetbb-2021.7.0/test/conformance/conformance_concurrent_queue.cpp onetbb-2021.9.0/test/conformance/conformance_concurrent_queue.cpp --- onetbb-2021.7.0/test/conformance/conformance_concurrent_queue.cpp 2022-10-07 14:34:12.000000000 +0000 +++ onetbb-2021.9.0/test/conformance/conformance_concurrent_queue.cpp 2023-04-06 17:14:50.000000000 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -1319,7 +1319,7 @@ T::construction_num = T::destruction_num = 0; CQ dst_queue( std::move(src_queue), allocator(1) ); CHECK(T::construction_num == size); - CHECK(T::destruction_num == size * 2); // One item is used by the queue destructor + CHECK(T::destruction_num == size); TestQueueOperabilityAfterDataMove( src_queue ); @@ -1585,3 +1585,95 @@ TEST_CASE("concurrent_bounded_queue iterator comparisons") { TestQueueIteratorComparisons>(); } + +class MinimalisticObject { +public: + struct flag {}; + + MinimalisticObject() = delete; + MinimalisticObject(flag) : underlying_obj(default_obj) {} + + MinimalisticObject(const MinimalisticObject&) = delete; + MinimalisticObject& operator=(const MinimalisticObject&) = delete; + + std::size_t get_obj() const { return underlying_obj; } + std::size_t get_default_obj() const { return default_obj; } + +protected: + static constexpr std::size_t default_obj = 42; + std::size_t underlying_obj; + friend struct MoveAssignableMinimalisticObject; +}; + +struct MoveAssignableMinimalisticObject : MinimalisticObject { +public: + using MinimalisticObject::MinimalisticObject; + + MoveAssignableMinimalisticObject& operator=(MoveAssignableMinimalisticObject&& other) { + if (this != &other) { + underlying_obj = other.underlying_obj; + other.underlying_obj = 0; + } + return *this; + } +}; + +template +void test_basics(Container& container, std::size_t desired_size) { + CHECK(!container.empty()); + + std::size_t counter = 0; + for (auto it = container.unsafe_begin(); it != container.unsafe_end(); ++it) { + CHECK(it->get_obj() == it->get_default_obj()); + ++counter; + } + CHECK(counter == desired_size); + + container.clear(); + CHECK(container.empty()); +} + +template