Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package tbb for openSUSE:Factory checked in at 2023-01-06 17:04:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/tbb (Old) and /work/SRC/openSUSE:Factory/.tbb.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tbb" Fri Jan 6 17:04:51 2023 rev:30 rq:1056064 version:2021.8.0 Changes: -------- --- /work/SRC/openSUSE:Factory/tbb/tbb.changes 2022-12-14 14:10:32.823353998 +0100 +++ /work/SRC/openSUSE:Factory/.tbb.new.1563/tbb.changes 2023-01-06 17:05:18.856100018 +0100 @@ -1,0 +2,14 @@ +Wed Jan 4 20:08:08 UTC 2023 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to v2021.8.0 + * Fixed oneapi::tbb::concurrent_bounded_queue::pop return type (GitHub* #807). + * Fixed oneapi::tbb::concurrent_queue and oneapi::tbb::concurrent_bounded_queue + with non-default constructible value types (GitHub* #885). + * Fixed incorrect splitting of iteration space in case there is no + support for proportional splitting in custom ranges. +- Add patch to link against libatomic where necessary + * add-cmake-check-for-libatomic-requirement-when-build.patch +- Drop 5cb212d44732947396abdd39eae1229c7cd51644.patch, merged upstream +- Use correct changelog entries for v2021.7.0 + +------------------------------------------------------------------- @@ -5,13 +19,4 @@ - * Memory allocator crash on a system with an incomplete /proc/meminfo - (GitHub* #584). - * Incorrect blocking of task stealing (GitHub* #478). - * Hang due to incorrect decrement of a limiter_node (GitHub* #634). - * Memory corruption in some rare cases when passing big messages in a flow - graph (GitHub* #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). - * Crash when obtaining a range from empty ordered and unordered containers - (GitHub* #641). - * Deadlock in a concurrent_vector resize() that could happen when the new - size is less than the previous size (GitHub* #733). + * Memory allocator crash when allocating ~1TB on 64-bit systems (GitHub* #838). + * Thread Distribution over NUMA Nodes on Windows OS systems. + * For oneapi::tbb::suspend it is now guaranteed that the user-specified + callable object is executed by the calling thread. Old: ---- 5cb212d44732947396abdd39eae1229c7cd51644.patch tbb-2021.7.0.tar.gz New: ---- add-cmake-check-for-libatomic-requirement-when-build.patch tbb-2021.8.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ tbb.spec ++++++ --- /var/tmp/diff_new_pack.Vnono3/_old 2023-01-06 17:05:19.468103455 +0100 +++ /var/tmp/diff_new_pack.Vnono3/_new 2023-01-06 17:05:19.472103478 +0100 @@ -40,7 +40,7 @@ %bcond_with python3 %endif Name: tbb -Version: 2021.7.0 +Version: 2021.8.0 Release: 0 Summary: Threading Building Blocks (TBB) License: Apache-2.0 @@ -48,11 +48,11 @@ URL: https://www.threadingbuildingblocks.org/ Source0: https://github.com/oneapi-src/oneTBB/archive/v%{version}.tar.gz#/tbb-%{version}.tar.gz Source99: tbb-rpmlintrc -Patch0: https://github.com/oneapi-src/oneTBB/commit/5cb212d44732947396abdd39eae1229c7cd51644.patch Patch1: https://github.com/oneapi-src/oneTBB/pull/917.patch # PATCH-FIX-OPENSUSE cmake-remove-include-path.patch -- openCV include error Patch2: cmake-remove-include-path.patch Patch3: retry-pthread_create.patch +Patch4: add-cmake-check-for-libatomic-requirement-when-build.patch BuildRequires: cmake BuildRequires: fdupes BuildRequires: gcc-c++ ++++++ add-cmake-check-for-libatomic-requirement-when-build.patch ++++++ >From faea2c59a95ff609d23a4e4f859edef83d02f417 Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> Date: Fri, 9 Dec 2022 12:36:11 +0100 Subject: [PATCH] Add cmake check for libatomic requirement when building with gcc (#980) Signed-off-by: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> --- cmake/compilers/GNU.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake index cd76acfe..59f4e693 100644 --- a/cmake/compilers/GNU.cmake +++ b/cmake/compilers/GNU.cmake @@ -44,6 +44,22 @@ if (NOT MINGW) set(TBB_COMMON_LINK_LIBS dl) endif() +# Check whether code with full atomics can be built without libatomic +# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358 +include(CheckCXXSourceCompiles) +check_cxx_source_compiles("#include <atomic> +int main() { + std::atomic<uint8_t> w1; + std::atomic<uint16_t> w2; + std::atomic<uint32_t> w4; + std::atomic<uint64_t> w8; + return ++w1 + ++w2 + ++w4 + ++w8; +}" TBB_BUILDS_WITHOUT_LIBATOMIC) + +if(NOT TBB_BUILDS_WITHOUT_LIBATOMIC) + set(TBB_COMMON_LINK_LIBS ${TBB_COMMON_LINK_LIBS} atomic) +endif() + # Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled. if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag) tbb_remove_compile_flag(-Werror) -- 2.30.2 ++++++ tbb-2021.7.0.tar.gz -> tbb-2021.8.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/README.md new/oneTBB-2021.8.0/README.md --- old/oneTBB-2021.7.0/README.md 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/README.md 2022-12-22 16:39:46.000000000 +0100 @@ -28,6 +28,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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/cmake/compilers/AppleClang.cmake new/oneTBB-2021.8.0/cmake/compilers/AppleClang.cmake --- old/oneTBB-2021.7.0/cmake/compilers/AppleClang.cmake 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/cmake/compilers/AppleClang.cmake 2022-12-22 16:39:46.000000000 +0100 @@ -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 $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},12.0>>:-mwaitpkg>) endif() +unset(_tbb_target_architectures) # TBB malloc settings set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/doc/main/intro/testing_approach.rst new/oneTBB-2021.8.0/doc/main/intro/testing_approach.rst --- old/oneTBB-2021.7.0/doc/main/intro/testing_approach.rst 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/doc/main/intro/testing_approach.rst 2022-12-22 16:39:46.000000000 +0100 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/include/oneapi/tbb/concurrent_queue.h new/oneTBB-2021.8.0/include/oneapi/tbb/concurrent_queue.h --- old/oneTBB-2021.7.0/include/oneapi/tbb/concurrent_queue.h 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/include/oneapi/tbb/concurrent_queue.h 2022-12-22 16:39:46.000000000 +0100 @@ -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. @@ -148,10 +148,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 @@ -375,12 +372,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 +407,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 +476,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,7 +502,6 @@ } 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 ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/include/oneapi/tbb/concurrent_unordered_map.h new/oneTBB-2021.8.0/include/oneapi/tbb/concurrent_unordered_map.h --- old/oneTBB-2021.7.0/include/oneapi/tbb/concurrent_unordered_map.h 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/include/oneapi/tbb/concurrent_unordered_map.h 2022-12-22 16:39:46.000000000 +0100 @@ -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<std::remove_const_t<Key>, T, Hash, std::equal_to<std::remove_const_t<Key>>, 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 <typename Key, typename T, typename Hash, typename KeyEq, typename Alloc> +concurrent_unordered_map( concurrent_unordered_map<Key, T, Hash, KeyEq, Alloc>, Alloc ) +-> concurrent_unordered_map<Key, T, Hash, KeyEq, Alloc>; +#endif + #endif // __TBB_CPP17_DEDUCTION_GUIDES_PRESENT template <typename Key, typename T, typename Hash, typename KeyEqual, typename Allocator> @@ -372,6 +382,15 @@ -> concurrent_unordered_multimap<std::remove_const_t<Key>, T, Hash, std::equal_to<std::remove_const_t<Key>>, 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 <typename Key, typename T, typename Hash, typename KeyEq, typename Alloc> +concurrent_unordered_multimap( concurrent_unordered_multimap<Key, T, Hash, KeyEq, Alloc>, Alloc ) +-> concurrent_unordered_multimap<Key, T, Hash, KeyEq, Alloc>; +#endif #endif // __TBB_CPP17_DEDUCTION_GUIDES_PRESENT template <typename Key, typename T, typename Hash, typename KeyEqual, typename Allocator> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/include/oneapi/tbb/concurrent_unordered_set.h new/oneTBB-2021.8.0/include/oneapi/tbb/concurrent_unordered_set.h --- old/oneTBB-2021.7.0/include/oneapi/tbb/concurrent_unordered_set.h 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/include/oneapi/tbb/concurrent_unordered_set.h 2022-12-22 16:39:46.000000000 +0100 @@ -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<T>, std::size_t, Hash, Alloc ) -> concurrent_unordered_set<T, Hash, std::equal_to<T>, 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 <typename T, typename Hash, typename KeyEq, typename Alloc> +concurrent_unordered_set( concurrent_unordered_set<T, Hash, KeyEq, Alloc>, Alloc ) +-> concurrent_unordered_set<T, Hash, KeyEq, Alloc>; +#endif #endif // __TBB_CPP17_DEDUCTION_GUIDES_PRESENT template <typename Key, typename Hash, typename KeyEqual, typename Allocator> @@ -292,6 +301,15 @@ concurrent_unordered_multiset( std::initializer_list<T>, std::size_t, Hash, Alloc ) -> concurrent_unordered_multiset<T, Hash, std::equal_to<T>, 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 <typename T, typename Hash, typename KeyEq, typename Alloc> +concurrent_unordered_multiset( concurrent_unordered_multiset<T, Hash, KeyEq, Alloc>, Alloc ) +-> concurrent_unordered_multiset<T, Hash, KeyEq, Alloc>; +#endif #endif // __TBB_CPP17_DEDUCTION_GUIDES_PRESENT template <typename Key, typename Hash, typename KeyEqual, typename Allocator> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/include/oneapi/tbb/detail/_concurrent_queue_base.h new/oneTBB-2021.8.0/include/oneapi/tbb/detail/_concurrent_queue_base.h --- old/oneTBB-2021.7.0/include/oneapi/tbb/detail/_concurrent_queue_base.h 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/include/oneapi/tbb/detail/_concurrent_queue_base.h 2022-12-22 16:39:46.000000000 +0100 @@ -173,7 +173,7 @@ 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); @@ -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<padded_page*>(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: @@ -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<padded_page*>(tail_page)); - page_allocator_traits::deallocate(page_allocator, static_cast<padded_page*>(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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/include/oneapi/tbb/partitioner.h new/oneTBB-2021.8.0/include/oneapi/tbb/partitioner.h --- old/oneTBB-2021.7.0/include/oneapi/tbb/partitioner.h 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/include/oneapi/tbb/partitioner.h 2022-12-22 16:39:46.000000000 +0100 @@ -311,27 +311,6 @@ } }; -//! Helper type for checking availability of proportional_split constructor -template <typename T> using supports_proportional_splitting = typename std::is_constructible<T, T&, proportional_split&>; - -//! 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 <typename Range, typename = void> -struct proportion_helper { - static proportional_split get_split(std::size_t) { return proportional_split(1,1); } -}; - -template <typename Range> -struct proportion_helper<Range, typename std::enable_if<supports_proportional_splitting<Range>::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 <typename Partition> @@ -357,8 +336,16 @@ } template <typename Range> proportional_split get_split() { - // Create a proportion for the number of threads expected to handle "this" subrange - return proportion_helper<Range>::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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/include/oneapi/tbb/version.h new/oneTBB-2021.8.0/include/oneapi/tbb/version.h --- old/oneTBB-2021.7.0/include/oneapi/tbb/version.h 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/include/oneapi/tbb/version.h 2022-12-22 16:39:46.000000000 +0100 @@ -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 8 // "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 12080 // Major interface version #define TBB_INTERFACE_VERSION_MAJOR (TBB_INTERFACE_VERSION/1000) // Minor interface version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/python/tbb/test.py new/oneTBB-2021.8.0/python/tbb/test.py --- old/oneTBB-2021.7.0/python/tbb/test.py 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/python/tbb/test.py 2022-12-22 16:39:46.000000000 +0100 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/src/tbb/CMakeLists.txt new/oneTBB-2021.8.0/src/tbb/CMakeLists.txt --- old/oneTBB-2021.7.0/src/tbb/CMakeLists.txt 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/src/tbb/CMakeLists.txt 2022-12-22 16:39:46.000000000 +0100 @@ -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() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/src/tbb/tbb.rc new/oneTBB-2021.8.0/src/tbb/tbb.rc --- old/oneTBB-2021.7.0/src/tbb/tbb.rc 1970-01-01 01:00:00.000000000 +0100 +++ new/oneTBB-2021.8.0/src/tbb/tbb.rc 2022-12-22 16:39:46.000000000 +0100 @@ -0,0 +1,111 @@ +// 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. +// 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. + +// Microsoft Visual C++ generated resource script. +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include <winresrc.h> +#include "../../include/oneapi/tbb/version.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// manifest integration +#ifdef TBB_MANIFEST +#include "winuser.h" +2 RT_MANIFEST tbbmanifest.exe.manifest +#endif + +///////////////////////////////////////////////////////////////////////////// +// +// 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 + +//#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/src/tbb/tools_api/ittnotify_config.h new/oneTBB-2021.8.0/src/tbb/tools_api/ittnotify_config.h --- old/oneTBB-2021.7.0/src/tbb/tools_api/ittnotify_config.h 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/src/tbb/tools_api/ittnotify_config.h 2022-12-22 16:39:46.000000000 +0100 @@ -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,10 @@ # 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 # if defined _M_IX86 || defined __i386__ # define ITT_ARCH ITT_ARCH_IA32 @@ -176,6 +180,8 @@ # define ITT_ARCH ITT_ARCH_ARM64 # elif defined __powerpc64__ # define ITT_ARCH ITT_ARCH_PPC64 +# elif defined __loongarch__ +# define ITT_ARCH ITT_ARCH_LOONGARCH64 # endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/src/tbbbind/CMakeLists.txt new/oneTBB-2021.8.0/src/tbbbind/CMakeLists.txt --- old/oneTBB-2021.7.0/src/tbbbind/CMakeLists.txt 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/src/tbbbind/CMakeLists.txt 2022-12-22 16:39:46.000000000 +0100 @@ -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} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/src/tbbbind/tbb_bind.rc new/oneTBB-2021.8.0/src/tbbbind/tbb_bind.rc --- old/oneTBB-2021.7.0/src/tbbbind/tbb_bind.rc 1970-01-01 01:00:00.000000000 +0100 +++ new/oneTBB-2021.8.0/src/tbbbind/tbb_bind.rc 2022-12-22 16:39:46.000000000 +0100 @@ -0,0 +1,111 @@ +// 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. +// 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. + +// Microsoft Visual C++ generated resource script. +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include <winresrc.h> +#include "../../include/oneapi/tbb/version.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// manifest integration +#ifdef TBB_MANIFEST +#include "winuser.h" +2 RT_MANIFEST tbbmanifest.exe.manifest +#endif + +///////////////////////////////////////////////////////////////////////////// +// +// 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 + +//#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/src/tbbmalloc/CMakeLists.txt new/oneTBB-2021.8.0/src/tbbmalloc/CMakeLists.txt --- old/oneTBB-2021.7.0/src/tbbmalloc/CMakeLists.txt 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/src/tbbmalloc/CMakeLists.txt 2022-12-22 16:39:46.000000000 +0100 @@ -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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/src/tbbmalloc/tbbmalloc.rc new/oneTBB-2021.8.0/src/tbbmalloc/tbbmalloc.rc --- old/oneTBB-2021.7.0/src/tbbmalloc/tbbmalloc.rc 1970-01-01 01:00:00.000000000 +0100 +++ new/oneTBB-2021.8.0/src/tbbmalloc/tbbmalloc.rc 2022-12-22 16:39:46.000000000 +0100 @@ -0,0 +1,111 @@ +// 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. +// 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. + +// Microsoft Visual C++ generated resource script. +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include <winresrc.h> +#include "../../include/oneapi/tbb/version.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// manifest integration +#ifdef TBB_MANIFEST +#include "winuser.h" +2 RT_MANIFEST tbbmanifest.exe.manifest +#endif + +///////////////////////////////////////////////////////////////////////////// +// +// 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 + +//#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/src/tbbmalloc_proxy/CMakeLists.txt new/oneTBB-2021.8.0/src/tbbmalloc_proxy/CMakeLists.txt --- old/oneTBB-2021.7.0/src/tbbmalloc_proxy/CMakeLists.txt 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/src/tbbmalloc_proxy/CMakeLists.txt 2022-12-22 16:39:46.000000000 +0100 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/src/tbbmalloc_proxy/tbbmalloc_proxy.rc new/oneTBB-2021.8.0/src/tbbmalloc_proxy/tbbmalloc_proxy.rc --- old/oneTBB-2021.7.0/src/tbbmalloc_proxy/tbbmalloc_proxy.rc 1970-01-01 01:00:00.000000000 +0100 +++ new/oneTBB-2021.8.0/src/tbbmalloc_proxy/tbbmalloc_proxy.rc 2022-12-22 16:39:46.000000000 +0100 @@ -0,0 +1,111 @@ +// 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. +// 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. + +// Microsoft Visual C++ generated resource script. +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include <winresrc.h> +#include "../../include/oneapi/tbb/version.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#ifdef _WIN32 +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// manifest integration +#ifdef TBB_MANIFEST +#include "winuser.h" +2 RT_MANIFEST tbbmanifest.exe.manifest +#endif + +///////////////////////////////////////////////////////////////////////////// +// +// 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 + +//#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/test/conformance/conformance_concurrent_queue.cpp new/oneTBB-2021.8.0/test/conformance/conformance_concurrent_queue.cpp --- old/oneTBB-2021.7.0/test/conformance/conformance_concurrent_queue.cpp 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/test/conformance/conformance_concurrent_queue.cpp 2022-12-22 16:39:46.000000000 +0100 @@ -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<T>(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<T>( src_queue ); @@ -1585,3 +1585,95 @@ TEST_CASE("concurrent_bounded_queue iterator comparisons") { TestQueueIteratorComparisons<oneapi::tbb::concurrent_bounded_queue<int>>(); } + +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 <typename Container> +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 <template <class...> class Container> +void test_with_minimalistic_objects() { + // Test with MinimalisticObject and no pop operations + const std::size_t elements_count = 100; + { + Container<MinimalisticObject> default_container; + + for (std::size_t i = 0; i < elements_count; ++i) { + default_container.emplace(MinimalisticObject::flag{}); + } + test_basics(default_container, elements_count); + } + // Test with MoveAssignableMinimalisticObject with pop operation + { + Container<MoveAssignableMinimalisticObject> default_container; + + for (std::size_t i = 0; i < elements_count; ++i) { + default_container.emplace(MinimalisticObject::flag{}); + } + test_basics(default_container, elements_count); + + // Refill again + for (std::size_t i = 0; i < elements_count; ++i) { + default_container.emplace(MinimalisticObject::flag{}); + } + + MoveAssignableMinimalisticObject result(MinimalisticObject::flag{}); + + std::size_t element_counter = 0; + while (!default_container.empty()) { + CHECK(default_container.try_pop(result)); + ++element_counter; + } + + CHECK(element_counter == elements_count); + CHECK(default_container.empty()); + } +} + +//! \brief \ref requirement +TEST_CASE("Test with minimalistic object type") { + test_with_minimalistic_objects<oneapi::tbb::concurrent_queue>(); + test_with_minimalistic_objects<oneapi::tbb::concurrent_bounded_queue>(); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/test/tbb/test_concurrent_queue.cpp new/oneTBB-2021.8.0/test/tbb/test_concurrent_queue.cpp --- old/oneTBB-2021.7.0/test/tbb/test_concurrent_queue.cpp 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/test/tbb/test_concurrent_queue.cpp 2022-12-22 16:39:46.000000000 +0100 @@ -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. @@ -20,6 +20,7 @@ #include <common/custom_allocators.h> #include <tbb/concurrent_queue.h> +#include <unordered_set> //! \file test_concurrent_queue.cpp //! \brief Test for [containers.concurrent_queue containers.concurrent_bounded_queue] specification @@ -199,3 +200,84 @@ } #endif // TBB_USE_EXCEPTIONS + +struct TrackableItem { + static std::unordered_set<TrackableItem*> object_addresses; +#if TBB_USE_EXCEPTIONS + static std::size_t global_count_for_exceptions; +#endif + + TrackableItem() { +#if TBB_USE_EXCEPTIONS + if (global_count_for_exceptions++ % 3 == 0) throw 1; +#endif + bool res = object_addresses.emplace(this).second; + CHECK(res); + } + + ~TrackableItem() { + auto it = object_addresses.find(this); + CHECK(it != object_addresses.end()); + object_addresses.erase(it); + } +}; + +template <typename Container> +void fill_and_catch(Container& q, std::size_t elements_count) { + CHECK(TrackableItem::object_addresses.size() == 0); + for (std::size_t i = 0; i < elements_count; ++i) { +#if TBB_USE_EXCEPTIONS + try { +#endif + q.emplace(); +#if TBB_USE_EXCEPTIONS + } catch (int exception) { + CHECK(exception == 1); + } +#endif + } +#if TBB_USE_EXCEPTIONS + CHECK(TrackableItem::object_addresses.size() == 2 * elements_count / 3); +#else + CHECK(TrackableItem::object_addresses.size() == elements_count); +#endif +} + +std::unordered_set<TrackableItem*> TrackableItem::object_addresses; +#if TBB_USE_EXCEPTIONS +std::size_t TrackableItem::global_count_for_exceptions = 0; +#endif + +template <typename Container> +void test_tracking_dtors_on_clear() { + static_assert(std::is_same<typename Container::value_type, TrackableItem>::value, "Incorrect test setup"); + const std::size_t elements_count = 100000; + { + Container q; + fill_and_catch(q, elements_count); + + q.clear(); + + CHECK(q.empty()); + CHECK(TrackableItem::object_addresses.empty()); +#if TBB_USE_EXCEPTIONS + TrackableItem::global_count_for_exceptions = 0; +#endif + } + { + { + Container q; + fill_and_catch(q, elements_count); + } // Dtor of q would be called here + CHECK(TrackableItem::object_addresses.empty()); +#if TBB_USE_EXCEPTIONS + TrackableItem::global_count_for_exceptions = 0; +#endif + } +} + +//! \brief \ref regression \ref error_guessing +TEST_CASE("Test clear and dtor with TrackableItem") { + test_tracking_dtors_on_clear<oneapi::tbb::concurrent_queue<TrackableItem>>(); + test_tracking_dtors_on_clear<oneapi::tbb::concurrent_bounded_queue<TrackableItem>>(); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/test/tbb/test_numa_dist.cpp new/oneTBB-2021.8.0/test/tbb/test_numa_dist.cpp --- old/oneTBB-2021.7.0/test/tbb/test_numa_dist.cpp 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/test/tbb/test_numa_dist.cpp 2022-12-22 16:39:46.000000000 +0100 @@ -95,7 +95,7 @@ sb.wait(); } }, s); - for (const auto it : tls) { + for (const auto& it : tls) { validateProcgrp[it.first]++; } }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oneTBB-2021.7.0/test/tbb/test_partitioner.cpp new/oneTBB-2021.8.0/test/tbb/test_partitioner.cpp --- old/oneTBB-2021.7.0/test/tbb/test_partitioner.cpp 2022-10-07 16:34:12.000000000 +0200 +++ new/oneTBB-2021.8.0/test/tbb/test_partitioner.cpp 2022-12-22 16:39:46.000000000 +0100 @@ -1,5 +1,5 @@ /* - Copyright (c) 2021 Intel Corporation + Copyright (c) 2021-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 "tbb/parallel_for.h" #include "tbb/task_arena.h" #include "tbb/global_control.h" +#include "oneapi/tbb/mutex.h" #include "common/utils.h" #include "common/utils_concurrency_limit.h" @@ -28,6 +29,7 @@ #include <cstddef> #include <utility> #include <vector> +#include <algorithm> // std::min_element //! \file test_partitioner.cpp //! \brief Test for [internal] functionality @@ -138,3 +140,53 @@ task_affinity_retention::relaxed_test(); task_affinity_retention::strict_test(); } + +template <typename Range> +void test_custom_range(int diff_mult) { + int num_trials = 100; + + std::vector<std::vector<std::size_t>> results(num_trials); + oneapi::tbb::mutex results_mutex; + + for (int i = 0; i < num_trials; ++i) { + oneapi::tbb::parallel_for(Range(0, int(100 * utils::get_platform_max_threads()), 1), [&] (const Range& r) { + oneapi::tbb::mutex::scoped_lock lock(results_mutex); + results[i].push_back(r.size()); + }, oneapi::tbb::static_partitioner{}); + } + + for (auto& res : results) { + REQUIRE(res.size() == utils::get_platform_max_threads()); + + std::size_t min_size = *std::min_element(res.begin(), res.end()); + for (auto elem : res) { + REQUIRE(min_size * diff_mult + 2 >= elem); + } + } +} + +//! \brief \ref regression +TEST_CASE("Test partitioned tasks count and size for static_partitioner") { + class custom_range : public oneapi::tbb::blocked_range<int> { + using base_type = oneapi::tbb::blocked_range<int>; + public: + custom_range(int l, int r, int g) : base_type(l, r, g) {} + custom_range(const custom_range& r) : base_type(r) {} + + custom_range(custom_range& r, tbb::split) : base_type(r, tbb::split()) {} + }; + + test_custom_range<custom_range>(2); + + class custom_range_with_psplit : public oneapi::tbb::blocked_range<int> { + using base_type = oneapi::tbb::blocked_range<int>; + public: + custom_range_with_psplit(int l, int r, int g) : base_type(l, r, g) {} + custom_range_with_psplit(const custom_range_with_psplit& r) : base_type(r) {} + + custom_range_with_psplit(custom_range_with_psplit& r, tbb::split) : base_type(r, tbb::split()) {} + custom_range_with_psplit(custom_range_with_psplit& r, tbb::proportional_split& p) : base_type(r, p) {} + }; + + test_custom_range<custom_range_with_psplit>(1); +}