From 16579891698c047798c4991037a7a32f4001ef64 Mon Sep 17 00:00:00 2001 From: kboyarinov Date: Tue, 11 Feb 2025 03:44:49 -0800 Subject: [PATCH] Cleanup preview macros --- include/oneapi/tbb/detail/_config.h | 7 ++++--- include/oneapi/tbb/detail/_flow_graph_impl.h | 2 +- python/tbb/api.i | 3 +-- src/tbb/arena.cpp | 6 +++--- src/tbb/arena.h | 8 ++++---- src/tbb/arena_slot.h | 8 ++++---- src/tbb/task.cpp | 4 ++-- src/tbb/task_dispatcher.cpp | 6 +++--- src/tbb/task_dispatcher.h | 5 ++--- test/common/config.h | 8 +------- 10 files changed, 25 insertions(+), 32 deletions(-) diff --git a/include/oneapi/tbb/detail/_config.h b/include/oneapi/tbb/detail/_config.h index 1bcd75fe97..854f13b568 100644 --- a/include/oneapi/tbb/detail/_config.h +++ b/include/oneapi/tbb/detail/_config.h @@ -513,11 +513,12 @@ #include #endif +#ifndef __TBB_CRITICAL_TASKS +#define __TBB_CRITICAL_TASKS 1 +#endif + #define __TBB_PREVIEW_MESSAGE_BASED_KEY_MATCHING (TBB_PREVIEW_FLOW_GRAPH_FEATURES) -#ifndef __TBB_PREVIEW_CRITICAL_TASKS -#define __TBB_PREVIEW_CRITICAL_TASKS 1 -#endif #ifndef __TBB_PREVIEW_FLOW_GRAPH_NODE_SET #define __TBB_PREVIEW_FLOW_GRAPH_NODE_SET (TBB_PREVIEW_FLOW_GRAPH_FEATURES) diff --git a/include/oneapi/tbb/detail/_flow_graph_impl.h b/include/oneapi/tbb/detail/_flow_graph_impl.h index a5408adf4a..8eb5e5ecab 100644 --- a/include/oneapi/tbb/detail/_flow_graph_impl.h +++ b/include/oneapi/tbb/detail/_flow_graph_impl.h @@ -546,7 +546,7 @@ inline void spawn_in_graph_arena(graph& g, graph_task& arena_task) { __TBB_ASSERT(g.my_task_arena && g.my_task_arena->is_active(), nullptr); submit( *gt, *g.my_task_arena, *g.my_context -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS , /*as_critical=*/false #endif ); diff --git a/python/tbb/api.i b/python/tbb/api.i index 0cd6526efc..8e57098f13 100644 --- a/python/tbb/api.i +++ b/python/tbb/api.i @@ -1,6 +1,6 @@ %pythonbegin %{ # -# Copyright (c) 2016-2021 Intel Corporation +# Copyright (c) 2016-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. @@ -34,7 +34,6 @@ __all__ = ["task_arena", #endif %{ -#define TBB_PREVIEW_WAITING_FOR_WORKERS 1 #include "tbb/task_arena.h" #include "tbb/task_group.h" #include "tbb/global_control.h" diff --git a/src/tbb/arena.cpp b/src/tbb/arena.cpp index eb91ddf510..74c0829f2c 100644 --- a/src/tbb/arena.cpp +++ b/src/tbb/arena.cpp @@ -277,7 +277,7 @@ arena::arena(threading_control* control, unsigned num_slots, unsigned num_reserv } my_fifo_task_stream.initialize(my_num_slots); my_resume_task_stream.initialize(my_num_slots); -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS my_critical_task_stream.initialize(my_num_slots); #endif my_mandatory_requests = 0; @@ -337,7 +337,7 @@ void arena::free_arena () { my_co_cache.cleanup(); my_default_ctx->~task_group_context(); cache_aligned_deallocate(my_default_ctx); -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS __TBB_ASSERT( my_critical_task_stream.empty(), "Not all critical tasks were executed"); #endif // Clear enfources synchronization with observe(false) @@ -375,7 +375,7 @@ bool arena::has_tasks() { tasks_are_available = !my_slots[k].is_empty(); } tasks_are_available = tasks_are_available || has_enqueued_tasks() || !my_resume_task_stream.empty(); -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS tasks_are_available = tasks_are_available || !my_critical_task_stream.empty(); #endif return tasks_are_available; diff --git a/src/tbb/arena.h b/src/tbb/arena.h index 71aba8fa86..ce4072e361 100644 --- a/src/tbb/arena.h +++ b/src/tbb/arena.h @@ -274,7 +274,7 @@ struct arena_base : padded { //! Task pool for the tasks scheduled via tbb::resume() function. task_stream my_resume_task_stream; // heavy use in stealing loop -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS //! Task pool for the tasks with critical property set. /** Critical tasks are scheduled for execution ahead of other sources (including local task pool and even bypassed tasks) unless the thread already executes a critical task in an outer @@ -423,7 +423,7 @@ class arena: public padded template d1::task* get_stream_task(task_stream& stream, unsigned& hint); -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS //! Tries to find a critical task in global critical task stream d1::task* get_critical_task(unsigned& hint, isolation_type isolation); #endif @@ -576,7 +576,7 @@ inline d1::task* arena::get_stream_task(task_stream& stream, unsigned& return stream.pop(subsequent_lane_selector(hint)); } -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS // Retrieves critical task respecting isolation level, if provided. The rule is: // 1) If no outer critical task and no isolation => take any critical task // 2) If working on an outer critical task and no isolation => cannot take any critical task @@ -593,7 +593,7 @@ inline d1::task* arena::get_critical_task(unsigned& hint, isolation_type isolati return my_critical_task_stream.pop(preceding_lane_selector(hint)); } } -#endif // __TBB_PREVIEW_CRITICAL_TASKS +#endif // __TBB_CRITICAL_TASKS } // namespace r1 } // namespace detail diff --git a/src/tbb/arena_slot.h b/src/tbb/arena_slot.h index c526e47433..ab585768be 100644 --- a/src/tbb/arena_slot.h +++ b/src/tbb/arena_slot.h @@ -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. @@ -65,7 +65,7 @@ struct alignas(max_nfs_size) arena_slot_private_state { /** Modified by the owner thread (during these operations). **/ unsigned hint_for_fifo_stream; -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS //! Similar to 'hint_for_fifo_stream' but for critical tasks. unsigned hint_for_critical_stream; #endif @@ -188,12 +188,12 @@ class arena_slot : private arena_slot_shared_state, private arena_slot_private_s #if __TBB_RESUMABLE_TASKS hint_for_resume_stream = h; #endif -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS hint_for_critical_stream = h; #endif } -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS unsigned& critical_hint() { return hint_for_critical_stream; } diff --git a/src/tbb/task.cpp b/src/tbb/task.cpp index 84b4278f0a..46bc1befe5 100644 --- a/src/tbb/task.cpp +++ b/src/tbb/task.cpp @@ -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. @@ -59,7 +59,7 @@ void resume(suspend_point_type* sp) { // The target is not in the process of executing critical task, so the resume task is not critical. a.my_resume_task_stream.push(&sp->m_resume_task, random_lane_selector(sp->m_random)); } else { - #if __TBB_PREVIEW_CRITICAL_TASKS + #if __TBB_CRITICAL_TASKS // The target is in the process of executing critical task, so the resume task is critical. a.my_critical_task_stream.push(&sp->m_resume_task, random_lane_selector(sp->m_random)); #endif diff --git a/src/tbb/task_dispatcher.cpp b/src/tbb/task_dispatcher.cpp index 5ea7d3f534..7bca0b03b3 100644 --- a/src/tbb/task_dispatcher.cpp +++ b/src/tbb/task_dispatcher.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2020-2022 Intel Corporation + Copyright (c) 2020-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. @@ -89,7 +89,7 @@ void __TBB_EXPORTED_FUNC submit(d1::task& t, d1::task_group_context& ctx, arena* if ( tls.is_attached_to(a) ) { arena_slot* slot = tls.my_arena_slot; -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS if( as_critical ) { a->my_critical_task_stream.push( &t, subsequent_lane_selector(slot->critical_hint()) ); } else @@ -99,7 +99,7 @@ void __TBB_EXPORTED_FUNC submit(d1::task& t, d1::task_group_context& ctx, arena* } } else { random_lane_selector lane_selector{tls.my_random}; -#if !__TBB_PREVIEW_CRITICAL_TASKS +#if !__TBB_CRITICAL_TASKS suppress_unused_warning(as_critical); #else if ( as_critical ) { diff --git a/src/tbb/task_dispatcher.h b/src/tbb/task_dispatcher.h index c818934e5a..505c4ddc1c 100644 --- a/src/tbb/task_dispatcher.h +++ b/src/tbb/task_dispatcher.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2020-2024 Intel Corporation + Copyright (c) 2020-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. @@ -403,7 +403,7 @@ inline void task_dispatcher::recall_point() { } #endif /* __TBB_RESUMABLE_TASKS */ -#if __TBB_PREVIEW_CRITICAL_TASKS +#if __TBB_CRITICAL_TASKS inline d1::task* task_dispatcher::get_critical_task(d1::task* t, execution_data_ext& ed, isolation_type isolation, bool critical_allowed) { __TBB_ASSERT( critical_allowed || !m_properties.critical_task_allowed, nullptr ); @@ -476,4 +476,3 @@ d1::task* task_dispatcher::local_wait_for_all(d1::task* t, Waiter& waiter) { } // namespace tbb #endif // _TBB_task_dispatcher_H - diff --git a/test/common/config.h b/test/common/config.h index d2a8396c33..dbc1fe3f4a 100644 --- a/test/common/config.h +++ b/test/common/config.h @@ -18,12 +18,9 @@ #define __TBB_test_common_config_H #if __TBB_CPF_BUILD -#ifndef TBB_PREVIEW_FLOW_GRAPH_FEATURES +#ifndef TBB_PREVIEW_FLOW_GRAPH_FEATURES #define TBB_PREVIEW_FLOW_GRAPH_FEATURES 1 #endif -#ifndef TBB_PREVIEW_ALGORITHM_TRACE -#define TBB_PREVIEW_ALGORITHM_TRACE 1 -#endif #ifndef TBB_DEPRECATED_LIMITER_NODE_CONSTRUCTOR #define TBB_DEPRECATED_LIMITER_NODE_CONSTRUCTOR 1 #endif @@ -33,9 +30,6 @@ #ifndef TBB_PREVIEW_CONCURRENT_LRU_CACHE #define TBB_PREVIEW_CONCURRENT_LRU_CACHE 1 #endif -#ifndef TBB_PREVIEW_VARIADIC_PARALLEL_INVOKE -#define TBB_PREVIEW_VARIADIC_PARALLEL_INVOKE 1 -#endif #ifndef TBB_PREVIEW_ISOLATED_TASK_GROUP #define TBB_PREVIEW_ISOLATED_TASK_GROUP 1 #endif