-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Improve scalability in task_group #1310
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: pavelkumbrasev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
Co-authored-by: Konstantin Boyarinov <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
Co-authored-by: Ilya Isaev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
d8b5874
to
22918c4
Compare
include/oneapi/tbb/task_group.h
Outdated
template<typename F> | ||
class function_task : public task { | ||
const F m_func; | ||
class task_group_continuation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it called continuation, while it is clearly does the reference management only?
Continuation has always been a task that executes after its child tasks have been completed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code will be executed after all the children tasks so technically it is still a continuation :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I get it right, you suggesting to call the first task a "task" and all the tasks that will execute after it a "continuation". Right? Sounds bad to me...
I agree that it can be a name for a local variable, but I don't think it can be a name for the whole class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider to rename into distributed_reference_counter
Signed-off-by: pavelkumbrasev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
0beca21
to
f00a27c
Compare
Signed-off-by: pavelkumbrasev <[email protected]>
f00a27c
to
0e7b969
Compare
Signed-off-by: pavelkumbrasev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
Co-authored-by: Ilya Isaev <[email protected]>
Signed-off-by: pavelkumbrasev <[email protected]>
Description
task_group has a flat reference counting scheme i.e., there is a central reference counter where all the created tasks should increase/decrease reference during execution.
This approach works fine while tasks are big and submitted from small number of threads (<8).
When multiple threads will start tree-like algorithm with a lot of tasks the overall performance of the application will drastically degrade with increasing number of threads due to huge synchronization cost.
This patch introduce tree-like scheme in task_group i.e., if nesting is detected continuation will be created and nested tasks will work with reference counter of this newly created continuation instead task_group reference counter.
This process of continuation creation will repeat itself each time nesting is detected.
Fixes #313
Type of change
Choose one or multiple, leave empty if none of the other choices apply
Add a respective label(s) to PR if you have permissions
Tests
Documentation
Breaks backward compatibility
Notify the following users
@vossmjp
Other information