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

Improvements for task_group API #1498

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Improve readability
Signed-off-by: pavelkumbrasev <pavel.kumbrasev@intel.com>
pavelkumbrasev committed Aug 29, 2024
commit 369a5f599e9212c63519e509aad1e2aac6a501fb
21 changes: 10 additions & 11 deletions include/oneapi/tbb/detail/_task_handle.h
Original file line number Diff line number Diff line change
@@ -88,24 +88,23 @@ class task_handle_task : public d1::task {
}

void add_predecessor(task_handle_task& predecessor) {
if (m_continuation == nullptr) {
d1::small_object_allocator alloc;
m_continuation = alloc.new_object<continuation_vertex>(this, m_ctx, alloc);
}
m_continuation->reserve();
predecessor.m_wait_tree_vertex_successors.push_front(m_continuation);
this->add_dependency(predecessor);
}

void add_successor(task_handle_task& successor) {
if (successor.m_continuation == nullptr) {
successor.add_dependency(*this);
}

private:
void add_dependency(task_handle_task& dependency) {
if (m_continuation == nullptr) {
d1::small_object_allocator alloc;
successor.m_continuation = alloc.new_object<continuation_vertex>(&successor, successor.m_ctx, alloc);
m_continuation = alloc.new_object<continuation_vertex>(this, m_ctx, alloc);
}
successor.m_continuation->reserve();
m_wait_tree_vertex_successors.push_front(successor.m_continuation);
m_continuation->reserve();
dependency.m_wait_tree_vertex_successors.push_front(m_continuation);
}

private:
void release_successors() {
if (!m_wait_tree_vertex_successors.empty()) {
for (auto successor : m_wait_tree_vertex_successors) {