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] Add explicit update API to graph spec #77

Closed
wants to merge 4 commits into from

Conversation

Bensuo
Copy link
Collaborator

@Bensuo Bensuo commented Feb 13, 2023

  • Add an explicit update API to the graph specification.

Based on feedback from the specification PR. Originally we had argued for a more detailed API where the user would get information about parameters and then set them on the graph. This is similar to how things are done in CUDA but when actually developing the API in that direction it became clear there were numerous issues:

  • When users would query information about parameters we would be unable to provide them actual information about the type of a buffer or USM allocation. Users could compare pointer values for USM to let them find out which parameter they actually want to update but this does not work for buffers because we would only have access to the syclMemObjT which carries no information other than the size of the buffer. CUDA deals purely in pointers so this is less of an issue.
  • Likely the user would be required to do some kind of bookkeeping to keep track of what parameter is what.
  • However, in CUDA users explicitly set parameters in an array and CUDA guarantees and requires that that order be maintained when getting or updating parameters. In SYCL we cannot guarantee the order of lambda captures which makes book keeping for the user very difficult if not impossible.

The original suggestion on the specification PR is seen in this PR as it avoids the user having to book keep (other than to keep the original parameters around).

I don't believe supporting updating scalar parameters captured by SYCL kernels is possible here though. Since ultimately the type information is lost and we will almost certainly need to take a copy of the scalar data in the implementation in future we would have no basis for comparison. However, since these parameters are considered to be captured by value in command group scope and are not a formal concept in SYCL, I don't believe this is an issue.

I've marked this PR as a draft for now to facilitate discussion about the approach taken.

@Bensuo Bensuo added the Graph Specification Extension Specification related label Feb 13, 2023
@Bensuo Bensuo marked this pull request as draft February 13, 2023 12:32
@Bensuo Bensuo changed the title Draft: [SYCL] Add explicit update API to graph spec [SYCL] Add explicit update API to graph spec Feb 13, 2023
@EwanC EwanC marked this pull request as ready for review March 7, 2023 12:53
Since the individual update function is only applicable to
buffers and USM allocations, rename it `update_memory_parameter()`
and elaborate on why it isn't possible to update scalar parameters.
@EwanC EwanC marked this pull request as draft March 22, 2023 16:57
@Bensuo Bensuo added the Spec Revision 2 Targetting the second revision of the specification label Mar 23, 2023
@Bensuo Bensuo requested a review from reble March 30, 2023 09:57
@Bensuo Bensuo marked this pull request as ready for review April 7, 2023 09:51
Exceptions:

* Throws synchronously with error code `invalid` if `from` is not found within the graph
or if `to` is not compatible with `from`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to specify what incompatible entails here? I feel like this statement is very generic.

@github-actions
Copy link

This pull request is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be automatically closed in 30 days.

@Bensuo
Copy link
Collaborator Author

Bensuo commented Jan 8, 2024

Closing in favour of #340

@Bensuo Bensuo closed this Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Graph Specification Extension Specification related Spec Revision 2 Targetting the second revision of the specification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants