From f8848a5c73ef75d79494a0c4d319432d3f61a327 Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Tue, 21 Jan 2025 05:46:31 -0800 Subject: [PATCH 01/12] Fix concepts present macro definition --- include/oneapi/tbb/detail/_config.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/oneapi/tbb/detail/_config.h b/include/oneapi/tbb/detail/_config.h index e676b1558b..6eaa1f2f23 100644 --- a/include/oneapi/tbb/detail/_config.h +++ b/include/oneapi/tbb/detail/_config.h @@ -233,10 +233,8 @@ #if __INTEL_COMPILER && (!_MSC_VER || __INTEL_CXX11_MOVE__) #define __TBB_CPP14_VARIABLE_TEMPLATES_PRESENT (__TBB_LANG >= 201402L) #define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (__INTEL_COMPILER > 2021 && __TBB_LANG >= 201703L) - #define __TBB_CPP20_CONCEPTS_PRESENT 0 // TODO: add a mechanism for future addition #elif __clang__ #define __TBB_CPP14_VARIABLE_TEMPLATES_PRESENT (__has_feature(cxx_variable_templates)) - #define __TBB_CPP20_CONCEPTS_PRESENT 0 // TODO: add a mechanism for future addition #ifdef __cpp_deduction_guides #define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (__cpp_deduction_guides >= 201611L) #else @@ -245,15 +243,12 @@ #elif __GNUC__ #define __TBB_CPP14_VARIABLE_TEMPLATES_PRESENT (__TBB_LANG >= 201402L && __TBB_GCC_VERSION >= 50000) #define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (__cpp_deduction_guides >= 201606L) - #define __TBB_CPP20_CONCEPTS_PRESENT (__TBB_LANG >= 201709L && __TBB_GCC_VERSION >= 100201) #elif _MSC_VER #define __TBB_CPP14_VARIABLE_TEMPLATES_PRESENT (_MSC_FULL_VER >= 190023918 && (!__INTEL_COMPILER || __INTEL_COMPILER >= 1700)) #define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (_MSC_VER >= 1914 && __TBB_LANG >= 201703L && (!__INTEL_COMPILER || __INTEL_COMPILER > 2021)) - #define __TBB_CPP20_CONCEPTS_PRESENT (_MSC_VER >= 1923 && __TBB_LANG >= 202002L) // TODO: INTEL_COMPILER? #else #define __TBB_CPP14_VARIABLE_TEMPLATES_PRESENT (__TBB_LANG >= 201402L) #define __TBB_CPP17_DEDUCTION_GUIDES_PRESENT (__TBB_LANG >= 201703L) - #define __TBB_CPP20_CONCEPTS_PRESENT (__TBB_LANG >= 202002L) #endif // GCC4.8 on RHEL7 does not support std::get_new_handler @@ -268,6 +263,12 @@ #define __TBB_CPP17_ALLOCATOR_IS_ALWAYS_EQUAL_PRESENT (__TBB_LANG >= 201703L) #define __TBB_CPP17_IS_SWAPPABLE_PRESENT (__TBB_LANG >= 201703L) +#if defined(__cpp_concepts) && defined(__cpp_lib_concepts) + #define __TBB_CPP20_CONCEPTS_PRESENT ((__cpp_concepts >= 201907L) && (__cpp_lib_concepts >= 202002L)) +#else + #define __TBB_CPP20_CONCEPTS_PRESENT 0 +#endif + #if defined(__cpp_impl_three_way_comparison) && defined(__cpp_lib_three_way_comparison) #define __TBB_CPP20_COMPARISONS_PRESENT ((__cpp_impl_three_way_comparison >= 201907L) && (__cpp_lib_three_way_comparison >= 201907L)) #else From a053b27206458850129c732d918021b201ea4d87 Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Tue, 21 Jan 2025 05:47:45 -0800 Subject: [PATCH 02/12] Fix dispatch macro in parallel_for_each --- include/oneapi/tbb/parallel_for_each.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/oneapi/tbb/parallel_for_each.h b/include/oneapi/tbb/parallel_for_each.h index 85c0269196..367be18adf 100644 --- a/include/oneapi/tbb/parallel_for_each.h +++ b/include/oneapi/tbb/parallel_for_each.h @@ -409,7 +409,7 @@ class parallel_for_body_wrapper { template using tag = typename std::iterator_traits::iterator_category; -#if __TBB_CPP20_PRESENT +#if __TBB_CPP20_CONCEPTS_PRESENT template struct move_iterator_dispatch_helper { using type = It; @@ -448,7 +448,7 @@ using iterator_tag_dispatch = typename std::input_iterator_tag >::type >::type; -#endif // __TBB_CPP20_PRESENT +#endif // __TBB_CPP20_CONCEPTS_PRESENT template using feeder_is_required = tbb::detail::void_t(), From f09d42fd811bc43529841dd55a1ca528f0878007 Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Tue, 21 Jan 2025 05:48:07 -0800 Subject: [PATCH 03/12] Fix copyrights --- include/oneapi/tbb/detail/_config.h | 2 +- include/oneapi/tbb/parallel_for_each.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/oneapi/tbb/detail/_config.h b/include/oneapi/tbb/detail/_config.h index 6eaa1f2f23..1dbdfbfe9d 100644 --- a/include/oneapi/tbb/detail/_config.h +++ b/include/oneapi/tbb/detail/_config.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2024 Intel Corporation + Copyright (c) 2005-2025 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 --git a/include/oneapi/tbb/parallel_for_each.h b/include/oneapi/tbb/parallel_for_each.h index 367be18adf..b64eb233ec 100644 --- a/include/oneapi/tbb/parallel_for_each.h +++ b/include/oneapi/tbb/parallel_for_each.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2024 Intel Corporation + Copyright (c) 2005-2025 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 360df76c06b54128ca8a98d692166db1d2de4f3e Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Tue, 21 Jan 2025 08:24:29 -0800 Subject: [PATCH 04/12] Fix inline namespace in Flow Graph --- include/oneapi/tbb/flow_graph.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/oneapi/tbb/flow_graph.h b/include/oneapi/tbb/flow_graph.h index 5b438faabf..42bbf88bfb 100644 --- a/include/oneapi/tbb/flow_graph.h +++ b/include/oneapi/tbb/flow_graph.h @@ -85,7 +85,7 @@ class continue_msg {}; } // namespace d2 #if __TBB_CPP20_CONCEPTS_PRESENT -namespace d0 { +inline namespace d0 { template concept node_body_return_type = std::same_as || @@ -127,7 +127,7 @@ template concept async_node_body = std::copy_constructible && std::invocable; -} // namespace d0 +} // inline namespace d0 #endif // __TBB_CPP20_CONCEPTS_PRESENT namespace d2 { From 5ff0ac4ba07b035f5f42a3c22a9f0b8e0a5ed235 Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Tue, 21 Jan 2025 08:24:55 -0800 Subject: [PATCH 05/12] Fix copyright in flow_graph.h --- include/oneapi/tbb/flow_graph.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/oneapi/tbb/flow_graph.h b/include/oneapi/tbb/flow_graph.h index 42bbf88bfb..3ace331c09 100644 --- a/include/oneapi/tbb/flow_graph.h +++ b/include/oneapi/tbb/flow_graph.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2024 Intel Corporation + Copyright (c) 2005-2025 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 3922015fff7daa03e16f426526d5b88dae6e4ea4 Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Tue, 21 Jan 2025 09:26:27 -0800 Subject: [PATCH 06/12] Fix parallel_scan on clang --- include/oneapi/tbb/parallel_scan.h | 4 ++-- test/common/concepts_common.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/oneapi/tbb/parallel_scan.h b/include/oneapi/tbb/parallel_scan.h index d624f7ebdb..8ef0777baa 100644 --- a/include/oneapi/tbb/parallel_scan.h +++ b/include/oneapi/tbb/parallel_scan.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2024 Intel Corporation + Copyright (c) 2005-2025 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ struct sum_node; #if __TBB_CPP20_CONCEPTS_PRESENT } // namespace d1 -namespace d0 { +inline namespace d0 { template concept parallel_scan_body = splittable && diff --git a/test/common/concepts_common.h b/test/common/concepts_common.h index 19c1ec649f..d490ed7963 100644 --- a/test/common/concepts_common.h +++ b/test/common/concepts_common.h @@ -385,7 +385,7 @@ struct ParallelScanFunction { T operator()( Dummy, const T& a, bool ) const requires (EnableFunctionCallOperator == State::incorrect_first_input) { return a; } T operator()( const Range&, Dummy, bool ) const requires (EnableFunctionCallOperator == State::incorrect_second_input) { return T{}; } T operator()( const Range&, const T& a, Dummy ) const requires (EnableFunctionCallOperator == State::incorrect_third_input) { return a; } - Dummy operator()( const Range&, const T& a, bool ) const requires (EnableFunctionCallOperator == State::incorrect_return_type) { return Dummy{}; } + Dummy operator()( const Range&, const T&, bool ) const requires (EnableFunctionCallOperator == State::incorrect_return_type) { return Dummy{}; } }; template using Correct = ParallelScanFunction; From 98120839833fcf7165c352268ef3fa11a6de7af5 Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Tue, 21 Jan 2025 09:27:29 -0800 Subject: [PATCH 07/12] Fix copyright for concepts_common --- test/common/concepts_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/common/concepts_common.h b/test/common/concepts_common.h index d490ed7963..dca9700d2d 100644 --- a/test/common/concepts_common.h +++ b/test/common/concepts_common.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2021 Intel Corporation + Copyright (c) 2021-2025 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 5f0d959975c31e6b05a83746f311885d8552f6db Mon Sep 17 00:00:00 2001 From: "Boyarinov, Konstantin" Date: Wed, 29 Jan 2025 14:18:19 +0200 Subject: [PATCH 08/12] Fix container_based_sequence on clang --- include/oneapi/tbb/detail/_range_common.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/include/oneapi/tbb/detail/_range_common.h b/include/oneapi/tbb/detail/_range_common.h index 1011f029df..ac219587d7 100644 --- a/include/oneapi/tbb/detail/_range_common.h +++ b/include/oneapi/tbb/detail/_range_common.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2021 Intel Corporation + Copyright (c) 2005-2025 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -102,20 +102,23 @@ concept tbb_range = std::copy_constructible && { range.is_divisible() } -> relaxed_convertible_to; }; +template +struct iterator_concept_helper; + +// New specializations should be added in case of using container_based_sequence with +// the new iterator tag types template -constexpr bool iterator_concept_helper( std::input_iterator_tag ) { - return std::input_iterator; -} +struct iterator_concept_helper { + static constexpr bool value = std::input_iterator; +}; template -constexpr bool iterator_concept_helper( std::random_access_iterator_tag ) { - return std::random_access_iterator; -} +struct iterator_concept_helper { + static constexpr bool value = std::random_access_iterator; +}; template -concept iterator_satisfies = requires (IteratorTag tag) { - requires iterator_concept_helper(tag); -}; +concept iterator_satisfies = iterator_concept_helper::value; template concept container_based_sequence = requires( Sequence& seq ) { From 03a9a7ea6093438969a008724f069008d121f9ee Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Thu, 30 Jan 2025 04:58:07 -0800 Subject: [PATCH 09/12] Disable concepts on Apple Clang --- include/oneapi/tbb/detail/_config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/oneapi/tbb/detail/_config.h b/include/oneapi/tbb/detail/_config.h index 1dbdfbfe9d..6e564df90a 100644 --- a/include/oneapi/tbb/detail/_config.h +++ b/include/oneapi/tbb/detail/_config.h @@ -263,7 +263,8 @@ #define __TBB_CPP17_ALLOCATOR_IS_ALWAYS_EQUAL_PRESENT (__TBB_LANG >= 201703L) #define __TBB_CPP17_IS_SWAPPABLE_PRESENT (__TBB_LANG >= 201703L) -#if defined(__cpp_concepts) && defined(__cpp_lib_concepts) +// TODO: fix concepts on Apple Clang or define the broken versions +#if !(__clang__ && __APPLE__) && defined(__cpp_concepts) && defined(__cpp_lib_concepts) #define __TBB_CPP20_CONCEPTS_PRESENT ((__cpp_concepts >= 201907L) && (__cpp_lib_concepts >= 202002L)) #else #define __TBB_CPP20_CONCEPTS_PRESENT 0 From fbcb55f7a76f6110518eeb88e0a01d3ef90797e1 Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Thu, 30 Jan 2025 05:06:38 -0800 Subject: [PATCH 10/12] Fix test_parallel_for_each --- test/tbb/test_parallel_for_each.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/tbb/test_parallel_for_each.cpp b/test/tbb/test_parallel_for_each.cpp index 3dfc107e91..9c9ac4fc6e 100644 --- a/test/tbb/test_parallel_for_each.cpp +++ b/test/tbb/test_parallel_for_each.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2023 Intel Corporation + Copyright (c) 2005-2025 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -270,10 +270,6 @@ TEST_CASE("parallel_for_each constraints") { test_pfor_each_body_constraints(); } -#endif // __TBB_CPP20_CONCEPTS_PRESENT - -#if __TBB_CPP20_PRESENT - struct no_copy_move { no_copy_move() = default; From f49ea9d144f849d78cc13a63e7e66f25ceea1d58 Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Thu, 30 Jan 2025 05:27:43 -0800 Subject: [PATCH 11/12] Fix macro in test --- test/tbb/test_parallel_for_each.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/tbb/test_parallel_for_each.cpp b/test/tbb/test_parallel_for_each.cpp index 9c9ac4fc6e..67a8a048d0 100644 --- a/test/tbb/test_parallel_for_each.cpp +++ b/test/tbb/test_parallel_for_each.cpp @@ -22,7 +22,7 @@ //! \file test_parallel_for_each.cpp //! \brief Test for [algorithms.parallel_for_each] -#if __TBB_CPP20_PRESENT +#if __TBB_CPP20_CONCEPTS_PRESENT // Fancy iterator type that models the C++20 iterator type // that defines the real iterator category using iterator_concept type // and iterator_category is always std::input_iterator_type @@ -119,7 +119,7 @@ struct cpp20_iterator { private: T* my_ptr = nullptr; }; // class cpp20_iterator -#endif // __TBB_CPP20_PRESENT +#endif // __TBB_CPP20_CONCEPTS_PRESENT //! Test forward access iterator support //! \brief \ref error_guessing \ref interface @@ -328,4 +328,4 @@ TEST_CASE("parallel_for_each with cpp20 iterator") { test_with_cpp20_iterator(); } -#endif // __TBB_CPP20_PRESENT +#endif // __TBB_CPP20_CONCEPTS_PRESENT From 0f4c36ed246fa6c23832ea856cd4bc55e909f908 Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Fri, 31 Jan 2025 01:01:48 -0800 Subject: [PATCH 12/12] Disable Clang completely, not only the apple one --- include/oneapi/tbb/detail/_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/oneapi/tbb/detail/_config.h b/include/oneapi/tbb/detail/_config.h index 6e564df90a..a898a3968a 100644 --- a/include/oneapi/tbb/detail/_config.h +++ b/include/oneapi/tbb/detail/_config.h @@ -263,8 +263,8 @@ #define __TBB_CPP17_ALLOCATOR_IS_ALWAYS_EQUAL_PRESENT (__TBB_LANG >= 201703L) #define __TBB_CPP17_IS_SWAPPABLE_PRESENT (__TBB_LANG >= 201703L) -// TODO: fix concepts on Apple Clang or define the broken versions -#if !(__clang__ && __APPLE__) && defined(__cpp_concepts) && defined(__cpp_lib_concepts) +// TODO: fix concepts on Clang or define the broken versions +#if !(__clang__) && defined(__cpp_concepts) && defined(__cpp_lib_concepts) #define __TBB_CPP20_CONCEPTS_PRESENT ((__cpp_concepts >= 201907L) && (__cpp_lib_concepts >= 202002L)) #else #define __TBB_CPP20_CONCEPTS_PRESENT 0