Skip to content

[SYCL][Graph] Error on invalid buffer behaviour #287

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

Merged
merged 12 commits into from
Aug 9, 2023

Conversation

Bensuo
Copy link
Collaborator

@Bensuo Bensuo commented Aug 2, 2023

  • Error for buffers with write back enabled.
  • Error for host accessors to buffers in use by a graph.
  • Implements property::graph::assume_data_outlives_buffer and associated check as described in this comment on the spec: [SYCL][Graph] Promote graph spec status to experimental intel/llvm#10473 (comment)
  • Tests added for these cases
  • Fixed E2E tests which were not compliant with these restrictions.
  • Fixes potential for circular references and unnecessary lifetime extension between queues and graph_impls.

@Bensuo Bensuo added the Graph Implementation Related to DPC++ implementation and testing label Aug 2, 2023
Copy link
Collaborator

@EwanC EwanC left a comment

Choose a reason for hiding this comment

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

This is all looking good, but I'll wait on the spec draft for assume_data_outlives_buffer before hitting approve to make sure my understanding aligns.

Copy link
Collaborator

@mfrancepillois mfrancepillois left a comment

Choose a reason for hiding this comment

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

LGTM.
@gmlueck mentioned in this comment you have tagged as reference to this PR: "Passing the property to begin_recording() is an assertion by the user that buffers may be safely recorded until the next call to end_recording() for this queue. "
Is there a reason not to implement this behaviour?

@Bensuo
Copy link
Collaborator Author

Bensuo commented Aug 3, 2023

"Passing the property to begin_recording() is an assertion by the user that buffers may be safely recorded until the next call to end_recording() for this queue. "
Is there a reason not to implement this behaviour?

This is also a problem that would affect the explicit API, if you add a node which uses buffers then delete the host data you have the same problem. So it seemed to me this would be better placed as a graph property.

Edit: Ah I see now that he has mentioned adding both. To me this seems unnecessary and a bit error prone, so I would be in favour of keeping on graph construction only.

@Bensuo Bensuo force-pushed the ben/buffer-invalid-behaviour branch from f85028d to 993c0f3 Compare August 3, 2023 15:07
mfrancepillois and others added 10 commits August 7, 2023 14:26
Removes the test-e2e dependency to graph_impl.hpp by changing the e2e test
to an unitests.
- Error for buffers with write back enabled.
- Error for host accessors to buffers in use by a graph.
- Unit tests added for these cases
- Fixed E2E tests which were not compliant with these restrictions.
- Add assume_data_outlives_buffer property
- Add check to disallow buffers with host data without this property
- Add a generic test for this.
- Update E2E tests which now require the property
- Use weak_ptrs in both classes to prevent circular references and unnecessary lifetime extensions
- Update unit tests for new properties
@Bensuo Bensuo force-pushed the ben/buffer-invalid-behaviour branch from 26e1db5 to d4e2858 Compare August 7, 2023 15:15
@mfrancepillois mfrancepillois force-pushed the sycl-graphs-improvements-fixes branch from 6af80ab to e578f69 Compare August 7, 2023 16:43
@EwanC EwanC merged commit 2d15596 into sycl-graphs-improvements-fixes Aug 9, 2023
EwanC added a commit that referenced this pull request Aug 9, 2023
* [SYCL][Graph] Makes command graph functions thread-safe (bugfix)

Removes the test-e2e dependency to graph_impl.hpp by changing the e2e test
to an unitests.

* [SYCL][Graph] Error on invalid buffer behaviour

- Error for buffers with write back enabled.
- Error for host accessors to buffers in use by a graph.
- Unit tests added for these cases
- Fixed E2E tests which were not compliant with these restrictions.

* [SYCL][Graph] Implement assume_data_outlives_buffer property

- Add assume_data_outlives_buffer property
- Add check to disallow buffers with host data without this property
- Add a generic test for this.
- Update E2E tests which now require the property

* Update symbol dumps

* [SYCL][Graph] Implement assume_buffer_outlives_graph property and checks

* [SYCL][Graph] Add E2E test for assume_buffer_outlives_graph property

* [SYCL][Graph] Fix circular reference between queue and graph_impl

- Use weak_ptrs in both classes to prevent circular references and unnecessary lifetime extensions
- Update unit tests for new properties

* [SYCL][Graph] Remove unnecessary test line

* [SYCL][Graph] Make graph use count in memobjects atomic

* [SYCL][Graph] Make markNoLongerBeingUsedInGraph() thread safe

---------

Co-authored-by: Maxime France-Pillois <maxime.francepillois@codeplay.com>
Co-authored-by: Ewan Crawford <ewan@codeplay.com>
EwanC added a commit that referenced this pull request Aug 10, 2023
* [SYCL][Graph] Makes command graph functions thread-safe (bugfix)

Removes the test-e2e dependency to graph_impl.hpp by changing the e2e test
to an unitests.

* [SYCL][Graph] Error on invalid buffer behaviour

- Error for buffers with write back enabled.
- Error for host accessors to buffers in use by a graph.
- Unit tests added for these cases
- Fixed E2E tests which were not compliant with these restrictions.

* [SYCL][Graph] Implement assume_data_outlives_buffer property

- Add assume_data_outlives_buffer property
- Add check to disallow buffers with host data without this property
- Add a generic test for this.
- Update E2E tests which now require the property

* Update symbol dumps

* [SYCL][Graph] Implement assume_buffer_outlives_graph property and checks

* [SYCL][Graph] Add E2E test for assume_buffer_outlives_graph property

* [SYCL][Graph] Fix circular reference between queue and graph_impl

- Use weak_ptrs in both classes to prevent circular references and unnecessary lifetime extensions
- Update unit tests for new properties

* [SYCL][Graph] Remove unnecessary test line

* [SYCL][Graph] Make graph use count in memobjects atomic

* [SYCL][Graph] Make markNoLongerBeingUsedInGraph() thread safe

---------

Co-authored-by: Maxime France-Pillois <maxime.francepillois@codeplay.com>
Co-authored-by: Ewan Crawford <ewan@codeplay.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick Graph Implementation Related to DPC++ implementation and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants