Skip to content

Conversation

kboyarinov
Copy link
Contributor

Description

Add RFC describing the semantics for concrete task_group dynamic dependencies APIs

Fixes # - issue number(s) if exists

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

  • bug fix - change that fixes an issue
  • new feature - change that adds functionality
  • tests - change in tests
  • infrastructure - change in infrastructure and CI
  • documentation - documentation update

Tests

  • added - required for new features and some bug fixes
  • not needed

Documentation

  • updated in # - add PR number
  • needs to be updated
  • not needed

Breaks backward compatibility

  • Yes
  • No
  • Unknown

Notify the following users

List users with @ to send notifications

Other information

vossmjp and others added 30 commits December 4, 2024 17:34
Co-authored-by: Aleksei Fedotov <aleksei.fedotov@intel.com>
Co-authored-by: Aleksei Fedotov <aleksei.fedotov@intel.com>
Co-authored-by: Aleksei Fedotov <aleksei.fedotov@intel.com>
Co-authored-by: Aleksei Fedotov <aleksei.fedotov@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Alexandra <alexandra.epanchinzeva@intel.com>
Co-authored-by: Alexey Kukanov <alexey.kukanov@intel.com>
Co-authored-by: Konstantin Boyarinov <konstantin.boyarinov@intel.com>
* Remove concrete proposals from the RFC

* Apply review comments
Comment on lines 828 to 831
// Number of elements in the grid on each level of division
// On the first level - 4 subtasks total (2 on each dimension)
// on the second level - 16 subtasks total (4 on each dimension), etc.
std::size_t n_grid = (2 << n_division);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems from the description, depending on the value of n_division, which I assume could be any value from a natural number set, the n_grid variable should been having values equal to the power of two, i.e. 2, 4, 8, 16, 32, etc. However, the description says they are 4, 16, 64, 256, and so on.
So what are the values that n_grid variable can store?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n_grid stores the number of elements in each dimension of the grid on the particular level of division.
So, the previous version of the implementation is not correct:) Thanks for catching that!

During the first division, we have 2x2 grid of subtasks (n_grid = 2). On the second - 4x4 (n_grid = 4).
I have rewritten this part and corrected the comment

Comment on lines 130 to 134
Alternative approach is to keep tracking ``current`` and ``target`` together after transferring. This requires introducing a special state
of ``task_tracker` - a kind of `proxy` state. If the executing task calls `transfer_successors_to` from the body, all trackers, initially created
to track this task are changing the state to `proxy`.
Tracker to the ``current`` and ``target`` are sharing the single merged list of successors if ``current`` tracker is in `proxy` state.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my point of view, introducing another entity for essentially the same thing from the user-perspective complicates the design. The user will need to keep them separate in mind and remember what they are good for and what they are not.

As far as I understand, implementation-wise task_tracker represents this kind of shared-ownership, as it still needs to have a pointer to representation of at least the task state and the list of successors shared among task_tracker instances pointing to the same task. In this sense, it differs from the task_handle only in impossibility to be submitted for execution.
To avoid possible confusion about acting on moved task_handle, can we just deprecate the move semantics and add only lvalue signatures? After all, the same function object can be submitted several times into task_group.

Copy link
Contributor

@akukanov akukanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the detailed proposal now looks good to me.

akukanov
akukanov previously approved these changes Jul 21, 2025
Copy link
Contributor

@aleksei-fedotov aleksei-fedotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Found a couple of possible discrepancies due to recent renamings.

Co-authored-by: Aleksei Fedotov <aleksei.fedotov@intel.com>
@kboyarinov kboyarinov dismissed stale reviews from aleksei-fedotov and akukanov via ce61e41 July 24, 2025 14:39
vossmjp
vossmjp previously approved these changes Jul 24, 2025
Copy link
Contributor

@vossmjp vossmjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

That said, I think there should be a link to the sub-RFC from the main RFC. README.md is automatically previewed in github and so it may be easy to overlook the extended_semantics.md if a link does not appear in README.md. I'd suggest putting it immediately before the Open Questions section.

@kboyarinov
Copy link
Contributor Author

Looks good to me.

That said, I think there should be a link to the sub-RFC from the main RFC. README.md is automatically previewed in github and so it may be easy to overlook the extended_semantics.md if a link does not appear in README.md. I'd suggest putting it immediately before the Open Questions section.

Thanks for catching that. Applied.

I think we will need to think on how to merge README.md and extended_semantics.md while moving to experimental since most of API from README.md were renamed, the semantic has changed and most of the open questions are resolved in extended_semantics.md or not relevant at all any more.

Copy link
Contributor

@aleksei-fedotov aleksei-fedotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more approve to be able to merge the PR.

@kboyarinov kboyarinov merged commit 42cafa5 into master Jul 25, 2025
29 checks passed
@kboyarinov kboyarinov deleted the dev/kboyarinov/tg-rfc-dynamic-dependencies-r2 branch July 25, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants