Skip to content

Commit 3eb1ff7

Browse files
committed
Commit oneTBB source code 3b16143
1 parent c949771 commit 3eb1ff7

File tree

87 files changed

+1121
-623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1121
-623
lines changed

.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.0
1+
6.0.0

BUILD.bazel

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ cc_library(
3636
"include/oneapi/tbb/detail/*.h",
3737
]),
3838
copts = ["-w"] + select({
39-
"@bazel_tools//platforms:windows": [""],
39+
"@platforms//os:windows": [""],
4040
"//conditions:default": ["-mwaitpkg"],
4141
}),
4242
defines =
@@ -47,16 +47,16 @@ cc_library(
4747
],
4848
}) +
4949
select({
50-
"@bazel_tools//platforms:osx": ["_XOPEN_SOURCE"],
50+
"@platforms//os:osx": ["_XOPEN_SOURCE"],
5151
"//conditions:default": [],
5252
}),
5353
includes = [
5454
"include",
5555
],
5656
linkopts =
5757
select({
58-
"@bazel_tools//platforms:windows": [],
59-
"@bazel_tools//platforms:linux": [
58+
"@platforms//os:windows": [],
59+
"@platforms//os:linux": [
6060
"-ldl",
6161
"-pthread",
6262
"-lrt",

Bazel.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ example
3333

3434
_WORKSPACE.bazel_:
3535
```python
36-
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
36+
load("@platforms//tools/build_defs/repo:git.bzl", "git_repository")
3737

3838
git_repository(
3939
name = "oneTBB",

CMakeLists.txt

+31-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020-2022 Intel Corporation
1+
# Copyright (c) 2020-2023 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -216,19 +216,17 @@ else()
216216
if (TBB_BUILD)
217217
add_subdirectory(src/tbb)
218218
endif()
219-
if (NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips")
220-
if (TBBMALLOC_BUILD)
221-
add_subdirectory(src/tbbmalloc)
222-
if(TBBMALLOC_PROXY_BUILD AND NOT "${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "ARM64")
223-
add_subdirectory(src/tbbmalloc_proxy)
224-
endif()
225-
endif()
226-
if (APPLE OR NOT BUILD_SHARED_LIBS)
227-
message(STATUS "TBBBind build targets are disabled due to unsupported environment")
228-
else()
229-
add_subdirectory(src/tbbbind)
219+
if (TBBMALLOC_BUILD)
220+
add_subdirectory(src/tbbmalloc)
221+
if(TBBMALLOC_PROXY_BUILD AND NOT "${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "ARM64")
222+
add_subdirectory(src/tbbmalloc_proxy)
230223
endif()
231224
endif()
225+
if (APPLE OR NOT BUILD_SHARED_LIBS)
226+
message(STATUS "TBBBind build targets are disabled due to unsupported environment")
227+
else()
228+
add_subdirectory(src/tbbbind)
229+
endif()
232230

233231
# -------------------------------------------------------------------
234232
# Installation instructions
@@ -279,10 +277,27 @@ endif()
279277

280278
if (ANDROID_PLATFORM)
281279
if ("${ANDROID_STL}" STREQUAL "c++_shared")
282-
configure_file(
283-
"${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so"
284-
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so"
285-
COPYONLY)
280+
if (${ANDROID_NDK_MAJOR} GREATER_EQUAL "25")
281+
if(ANDROID_ABI STREQUAL "arm64-v8a")
282+
set(ANDROID_TOOLCHAIN_NAME "aarch64-linux-android")
283+
elseif(ANDROID_ABI STREQUAL "x86_64")
284+
set(ANDROID_TOOLCHAIN_NAME "x86_64-linux-android")
285+
elseif(ANDROID_ABI STREQUAL "armeabi-v7a")
286+
set(ANDROID_TOOLCHAIN_NAME "arm-linux-androideabi")
287+
elseif(ANDROID_ABI STREQUAL "x86")
288+
set(ANDROID_TOOLCHAIN_NAME "i686-linux-android")
289+
endif()
290+
291+
configure_file(
292+
"${ANDROID_TOOLCHAIN_ROOT}/sysroot/usr/lib/${ANDROID_TOOLCHAIN_NAME}/libc++_shared.so"
293+
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so"
294+
COPYONLY)
295+
else()
296+
configure_file(
297+
"${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so"
298+
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so"
299+
COPYONLY)
300+
endif()
286301
endif()
287302
# This custom target may be implemented without separate CMake script, but it requires
288303
# ADB(Android Debug Bridge) executable file availability, so to incapsulate this requirement

INSTALL.md

+13
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ cmake <options> ..
7777
cpack
7878
```
7979

80+
## Installation from vcpkg
81+
82+
You can download and install oneTBB using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
83+
```sh
84+
git clone https://github.com/Microsoft/vcpkg.git
85+
cd vcpkg
86+
./bootstrap-vcpkg.sh #.\bootstrap-vcpkg.bat(for Windows)
87+
./vcpkg integrate install
88+
./vcpkg install tbb
89+
```
90+
91+
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).
92+
8093
## Example of Installation
8194

8295
### Single-configuration generators

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Refer to oneTBB [examples](examples) and [samples](https://github.com/oneapi-src
2020

2121
oneTBB is a part of [oneAPI](https://oneapi.io). The current branch implements version 1.1 of oneAPI Specification.
2222

23+
> **_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.
24+
2325
## Release Information
2426
Here are [Release Notes](RELEASE_NOTES.md) and [System Requirements](SYSTEM_REQUIREMENTS.md).
2527

RELEASE_NOTES.md

+6-17
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,25 @@
1818
This document contains changes of oneTBB compared to the last release.
1919

2020
## Table of Contents <!-- omit in toc -->
21-
- [New Features](#new_features)
2221
- [Known Limitations](#known-limitations)
2322
- [Fixed Issues](#fixed-issues)
2423
- [Open-source Contributions Integrated](#open-source-contributions-integrated)
2524

26-
## :white_check_mark: New Features
27-
- 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.
28-
- 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.
29-
- Added support for Windows* Server 2022 and Python 3.10.
30-
3125
## :rotating_light: Known Limitations
26+
- 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.
3227
- 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.
3328
- 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.
3429
- 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.
35-
- 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.
30+
- 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.
3631
- 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.
3732
- 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.
3833
- oneTBB does not support fork(), to work-around the issue, consider using task_scheduler_handle to join oneTBB worker threads before using fork().
3934
- 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).
4035

4136
## :hammer: Fixed Issues
42-
- Memory allocator crash on a system with an incomplete /proc/meminfo (GitHub* [#584](https://github.com/oneapi-src/oneTBB/issues/584)).
43-
- Incorrect blocking of task stealing (GitHub* #[478](https://github.com/oneapi-src/oneTBB/issues/478)).
44-
- Hang due to incorrect decrement of a limiter_node (GitHub* [#634](https://github.com/oneapi-src/oneTBB/issues/634)).
45-
- Memory corruption in some rare cases when passing big messages in a flow graph (GitHub* [#639](https://github.com/oneapi-src/oneTBB/issues/639)).
46-
- 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)).
47-
- Crash when obtaining a range from empty ordered and unordered containers (GitHub* [#641](https://github.com/oneapi-src/oneTBB/issues/641)).
48-
- 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)).
37+
- Memory allocator crash when allocating ~1TB on 64-bit systems (GitHub* [#838](https://github.com/oneapi-src/oneTBB/issues/838)).
38+
- Fixed thread distribution over NUMA nodes on Windows* OS systems.
39+
- For oneapi::tbb::suspend, it is guaranteed that the user-specified callable object is executed by the calling thread.
4940

5041
## :octocat: Open-source Contributions Integrated
51-
- Improved aligned memory allocation. Contributed by Andrey Semashev (https://github.com/oneapi-src/oneTBB/pull/671).
52-
- 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).
53-
- Fixed incorrect definition of the assignment operator in containers. Contributed by Andrey Semashev (https://github.com/oneapi-src/oneTBB/issues/372).
42+
- Fix for full LTO* build, library and tests, on UNIX* OS systems. Contributed by Vladislav Shchapov (https://github.com/oneapi-src/oneTBB/pull/798).

SYSTEM_REQUIREMENTS.md

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This document provides details about hardware, operating system, and software pr
2121
- [Supported Hardware](#supported-hardware)
2222
- [Software](#software)
2323
- [Supported Operating Systems](#supported-operating-systems)
24+
- [Community-Supported Platforms](#community-supported-platforms)
2425
- [Supported Compilers](#supported-compilers)
2526

2627

@@ -54,6 +55,12 @@ This document provides details about hardware, operating system, and software pr
5455
- Systems with Android* operating systems
5556
- Android* 9
5657

58+
### Community-Supported Platforms
59+
- MinGW*
60+
- FreeBSD*
61+
- Microsoft* Windows* on ARM*/ARM64*
62+
- macOS* on ARM64*
63+
5764
### Supported Compilers
5865
- Intel* oneAPI DPC++/C++ Compiler
5966
- Intel* C++ Compiler 19.0 and 19.1 version

cmake/compilers/GNU.cmake

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020-2022 Intel Corporation
1+
# Copyright (c) 2020-2023 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -68,6 +68,9 @@ if (MINGW AND CMAKE_SYSTEM_PROCESSOR MATCHES "i.86")
6868
list (APPEND TBB_COMMON_COMPILE_FLAGS -msse2)
6969
endif ()
7070

71+
# Gnu flags to prevent compiler from optimizing out security checks
72+
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv)
73+
7174
# TBB malloc settings
7275
set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions)
7376
set(TBB_OPENMP_FLAG -fopenmp)

cmake/sanitize.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020-2021 Intel Corporation
1+
# Copyright (c) 2020-2022 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -39,4 +39,5 @@ set(TBB_TESTS_ENVIRONMENT ${TBB_TESTS_ENVIRONMENT}
3939
"LSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/cmake/suppressions/lsan.suppressions")
4040

4141
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TBB_SANITIZE_OPTION}")
42+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TBB_SANITIZE_OPTION}")
4243
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TBB_SANITIZE_OPTION}")

doc/main/reference/reference.rst

-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,5 @@ The key properties of a preview feature are:
4747
scalable_memory_pools
4848
helpers_for_expressing_graphs
4949
concurrent_lru_cache_cls
50-
constraints_extensions
51-
info_namespace_extensions
5250
task_group_extensions
5351
custom_mutex_chmap
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. _Flow_Graph_exception_tips:
2+
3+
Flow Graph Tips for Exception Handling and Cancellation
4+
=======================================================
5+
6+
7+
The execution of a flow graph can be canceled directly or as a result of
8+
an exception that propagates beyond a node's body. You can then
9+
optionally reset the graph so that it can be re-executed.
10+
11+
.. toctree::
12+
:maxdepth: 4
13+
14+
../tbb_userguide/catching_exceptions
15+
../tbb_userguide/cancel_a_graph
16+
../tbb_userguide/use_graph_reset
17+
../tbb_userguide/cancelling_nested_parallelism
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. _Flow_Graph_waiting_tips:
2+
3+
Flow Graph Tips for Waiting for and Destroying a Flow Graph
4+
===========================================================
5+
6+
.. toctree::
7+
:maxdepth: 4
8+
9+
../tbb_userguide/always_use_wait_for_all
10+
../tbb_userguide/avoid_dynamic_node_removal
11+
../tbb_userguide/destroy_graphs_outside_main_thread

doc/main/tbb_userguide/Guiding_Task_Scheduler_Execution.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ assign a NUMA node identifier to the ``task_arena::constraints::numa_id`` field.
6161

6262
The processors with `Intel® Hybrid Technology <https://www.intel.com/content/www/us/en/products/docs/processors/core/core-processors-with-hybrid-technology-brief.html>`_
6363
contain several core types, each is suited for different purposes.
64-
For example, some applications may improve their performance by preferring execution on the most performant cores.
65-
To set execution preference, assign specific core type identifier to the ``task_arena::constraints::core_type`` field.
64+
In most cases, systems with hybrid CPU architecture show reasonable performance without involving additional API calls.
65+
However, in some exceptional scenarios, performance may be tuned by setting the preferred core type.
66+
To set the preferred core type for the execution, assign a specific core type identifier to the ``task_arena::constraints::core_type`` field.
6667

6768
The example shows how to set the most performant core type as preferable for work execution:
6869

doc/main/tbb_userguide/Memory_Allocation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ redirect the standard routines to these functions.
6868

6969
../tbb_userguide/Which_Dynamic_Libraries_to_Use
7070
../tbb_userguide/Allocator_Configuration
71-
../tbb_userguide/Automically_Replacing_malloc
71+
../tbb_userguide/automatically-replacing-malloc

doc/main/tbb_userguide/Migration_Guide/Task_API.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ is not guaranteed to be executed next by the current thread.
361361
362362
tbb::task_spawn(child);
363363
364-
root.wait_for_all();;
364+
root.wait_for_all();
365365
}
366366
367367
In oneTBB, this can be done using ``oneapi::tbb::task_group``.

doc/main/tbb_userguide/Working_on_the_Assembly_Line_pipeline.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ the overhead of copying a ``TextSlice``.
115115
oneapi::tbb::parallel_pipeline(
116116
ntoken,
117117
oneapi::tbb::make_filter<void,TextSlice*>(
118-
oneapi::tbb::filter::serial_in_order, MyInputFunc(input_file) )
118+
oneapi::tbb::filter_mode::serial_in_order, MyInputFunc(input_file) )
119119
&
120120
oneapi::tbb::make_filter<TextSlice*,TextSlice*>(
121-
oneapi::tbb::filter::parallel, MyTransformFunc() )
121+
oneapi::tbb::filter_mode::parallel, MyTransformFunc() )
122122
&
123123
oneapi::tbb::make_filter<TextSlice*,void>(
124-
oneapi::tbb::filter::serial_in_order, MyOutputFunc(output_file) ) );
124+
oneapi::tbb::filter_mode::serial_in_order, MyOutputFunc(output_file) ) );
125125
}
126126

127127

@@ -172,13 +172,13 @@ equivalent version of the previous example that does this follows:
172172

173173

174174
void RunPipeline( int ntoken, FILE* input_file, FILE* output_file ) {
175-
oneapi::tbb::filter<void,TextSlice*> f1( oneapi::tbb::filter::serial_in_order,
175+
oneapi::tbb::filter_mode<void,TextSlice*> f1( oneapi::tbb::filter_mode::serial_in_order,
176176
MyInputFunc(input_file) );
177-
oneapi::tbb::filter<TextSlice*,TextSlice*> f2(oneapi::tbb::filter::parallel,
177+
oneapi::tbb::filter_mode<TextSlice*,TextSlice*> f2(oneapi::tbb::filter_mode::parallel,
178178
MyTransformFunc() );
179-
oneapi::tbb::filter<TextSlice*,void> f3(oneapi::tbb::filter::serial_in_order,
179+
oneapi::tbb::filter_mode<TextSlice*,void> f3(oneapi::tbb::filter_mode::serial_in_order,
180180
MyOutputFunc(output_file) );
181-
oneapi::tbb::filter<void,void> f = f1 & f2 & f3;
181+
oneapi::tbb::filter_mode<void,void> f = f1 & f2 & f3;
182182
oneapi::tbb::parallel_pipeline(ntoken,f);
183183
}
184184

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. _automatically-replacing-malloc:
2+
3+
Automatically Replacing ``malloc`` and Other C/C++ Functions for Dynamic Memory Allocation
4+
==========================================================================================
5+
6+
7+
On Windows*, Linux\* operating systems, it is possible to automatically
8+
replace all calls to standard functions for dynamic memory allocation
9+
(such as ``malloc``) with the |full_name| scalable equivalents.
10+
Doing so can sometimes improve application performance.
11+
12+
13+
Replacements are provided by the proxy library (the library names can be
14+
found in platform-specific sections below). A proxy library and a
15+
scalable memory allocator library should be taken from the same release
16+
of oneTBB, otherwise the libraries may be mutually incompatible.
17+
18+
.. toctree::
19+
:maxdepth: 4
20+
21+
../tbb_userguide/Windows_C_Dynamic_Memory_Interface_Replacement
22+
../tbb_userguide/Linux_C_Dynamic_Memory_Interface_Replacement

doc/main/tbb_userguide/snippets/flow_graph_examples.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
/* Flow Graph Code Example for the Userguide.
1818
*/
1919

20-
//! Enable extended task_arena constraints feature for supporting Intel Hybrid Technology
21-
//! and Intel Hyper-Threading Technology.
22-
#define TBB_PREVIEW_TASK_ARENA_CONSTRAINTS_EXTENSION 1
23-
2420
#include <oneapi/tbb/flow_graph.h>
2521
#include <vector>
2622

0 commit comments

Comments
 (0)