Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview macros cleanup #1632

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions include/oneapi/tbb/detail/_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,12 @@
#include <android/api-level.h>
#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)
Expand Down
2 changes: 1 addition & 1 deletion include/oneapi/tbb/detail/_flow_graph_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
3 changes: 1 addition & 2 deletions python/tbb/api.i
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/tbb/arena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/tbb/arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ struct arena_base : padded<intrusive_list_node> {
//! Task pool for the tasks scheduled via tbb::resume() function.
task_stream<front_accessor> 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
Expand Down Expand Up @@ -423,7 +423,7 @@ class arena: public padded<arena_base>
template<task_stream_accessor_type accessor>
d1::task* get_stream_task(task_stream<accessor>& 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
Expand Down Expand Up @@ -576,7 +576,7 @@ inline d1::task* arena::get_stream_task(task_stream<accessor>& 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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/tbb/arena_slot.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/tbb/task.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/tbb/task_dispatcher.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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 ) {
Expand Down
5 changes: 2 additions & 3 deletions src/tbb/task_dispatcher.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -476,4 +476,3 @@ d1::task* task_dispatcher::local_wait_for_all(d1::task* t, Waiter& waiter) {
} // namespace tbb

#endif // _TBB_task_dispatcher_H

8 changes: 1 addition & 7 deletions test/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down