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

[SYCL][Graph] Specify API for explicit update using indices #12486

Merged
merged 27 commits into from
Mar 27, 2024

Conversation

Bensuo
Copy link
Contributor

@Bensuo Bensuo commented Jan 24, 2024

  • Adds APIs to the specification for updating graph node arguments using explicit indices (from set_arg() etc.)
  • Also includes functionality for updating ND-range of kernel nodes
  • Note: Current design is only for kernel execution nodes

Implementation in #12840

Co-authored-by: Ewan Crawford ewan@codeplay.com
Co-authored-by: Pablo Reble pablo.reble@intel.com

- Adds an API to the spec for updating graph nodes using explicit indices
- Also includes functionality for updating ND-range of kernel nodes
- Note: Current design is only for kernel execution nodes
@EwanC EwanC requested a review from gmlueck January 26, 2024 08:53
Fix typo

Co-authored-by: Pablo Reble <pablo.reble@intel.com>
dm-vodopyanov pushed a commit that referenced this pull request Feb 13, 2024
The new entry-points added by
oneapi-src/unified-runtime#1089 are currently
unused by SYCL-Graph, but will be build upon later in
#12486
Copy link
Contributor

@gmlueck gmlueck left a comment

Choose a reason for hiding this comment

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

I think this generally looks good. I was torn as to whether it's worth having a class like dynamic_parameter at this point. I think a class like that will be useful when you add support for updating kernel arguments that are captured by a lambda, but you don't have that support yet.

A simpler solution for now would be to remove dynamic_parameter and instead add a member function on node like:

class node {
  template<typename T>
  void update_arg(int argIndex, T&& arg);

I do like the way you can use the same dynamic_parameter to update kernel arguments in several nodes. Obviously, you would lose this by removing dynamic_parameter. However, dynamic_paramter adds a lot of verbosity, and I'm not sure that outweighs this one use case.

If it were me, I think I would go with the simple solution for now and consider adding dynamic_parameter later when you have a solution for lambda arguments. However, I've also added comments below that are relevant if you decide to keep dynamic_parameter.

@Bensuo
Copy link
Contributor Author

Bensuo commented Feb 19, 2024

I think this generally looks good. I was torn as to whether it's worth having a class like dynamic_parameter at this point. I think a class like that will be useful when you add support for updating kernel arguments that are captured by a lambda, but you don't have that support yet.

A simpler solution for now would be to remove dynamic_parameter and instead add a member function on node like:

class node {
  template<typename T>
  void update_arg(int argIndex, T&& arg);

I do like the way you can use the same dynamic_parameter to update kernel arguments in several nodes. Obviously, you would lose this by removing dynamic_parameter. However, dynamic_paramter adds a lot of verbosity, and I'm not sure that outweighs this one use case.

If it were me, I think I would go with the simple solution for now and consider adding dynamic_parameter later when you have a solution for lambda arguments. However, I've also added comments below that are relevant if you decide to keep dynamic_parameter.

@gmlueck Thanks for your feedback!

The main advantage I see of having the dynamic_parameter class templated on the argument type is that it enables us to constrain and check the type when updating. If we don't we have only very limited information to check that the new value is valid for the type of the argument, most likely only the size of the argument for anything except accessors. Apart from what I see as a very niche case where maybe the user intentionally wants to swap a kernel arg of one type for one of identical size but different type, it seems a bit error prone without the type checking.

Coupled with the advantage of updating many nodes at once as you mentioned I think it's worth keeping this approach for now. I don't believe this is an unreasonable amount of verbosity compared to other comparable APIs.

- Add update_range node member function for updating using a sycl::range
- Swap parameter order when registering
- Clarify some wording
- Update wording of dynamic_parameter::update
- Move error on non-kernel node registration to add() since it is unimplementable in register
- User is not required to wait on previous graph submissions
- update() may perform a blocking wait if required.
Copy link
Contributor

@gmlueck gmlueck left a comment

Choose a reason for hiding this comment

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

This looks good! Just a couple small comments below.

- Minor formatting and wording changes
sarnex pushed a commit that referenced this pull request Mar 22, 2024
- Experimental implementation of explicit update with indices (based on
API in #12486 )
- New scheduler command for updating a command buffer command
- PI equivalents for new UR APIs
- E2E and Unit Tests

---------

Co-authored-by: Ewan Crawford <ewan@codeplay.com>
- Remove redundant "Note: " annotation.
- Avoid duplicating "Executable Graph Update" section name.
- Reference parameter name in entry-point error description
@EwanC
Copy link
Contributor

EwanC commented Mar 25, 2024

Taking this out of draft now that the implementation has been merged in #12840

@EwanC EwanC marked this pull request as ready for review March 25, 2024 08:26
@EwanC EwanC requested a review from a team as a code owner March 25, 2024 08:26
@EwanC
Copy link
Contributor

EwanC commented Mar 26, 2024

This looks good! Just a couple small comments below.

@gmlueck Can I confirm you're good to merge this? The implementation of the API defined in this PR is merged now and the comment threads here are addressed, so from my perspective it's good to go.

@gmlueck
Copy link
Contributor

gmlueck commented Mar 26, 2024

Can I confirm you're good to merge this? The implementation of the API defined in this PR is merged now and the comment threads here are addressed, so from my perspective it's good to go.

LGMT!

@EwanC
Copy link
Contributor

EwanC commented Mar 27, 2024

@intel/llvm-gatekeepers Can you merge this please, thanks

@sommerlukas sommerlukas merged commit d06724a into intel:sycl Mar 27, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants