Expose buffer page size as property for concurrent kernel buffer access#513
Merged
Conversation
Collaborator
Author
|
@hipSYCL-ci-bot test. |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the page size property to make the buffer page size user configurable:
In hipSYCL terminology, a page represents a multidimensional chunk of memory (potentially strided) for which the runtime manages data state individually. hipSYCL pages are somewhat inspired by, but unrelated to OS virtual memory pages.
A buffer consists in general of multiple pages. The page size therefore controls the granularity of data management within a buffer.
See here for more information on the hipSYCL memory model:
https://github.com/illuhad/hipSYCL/blob/develop/doc/runtime-spec.md#data-state-tracking-and-pages
In short, this allows the user to depart from the classical SYCL memory model where (apart from two read accesses) no two kernels can access the same buffer concurrently.
In the hipSYCL model, concurrent kernels operating on the same buffer are allowed if the hipSYCL memory pages that are accessed by the two kernels do not intersect.
By default, the page size equals the buffer size to comply with the SYCL spec and forbid concurrent kernels operating on the same buffer. If the user sets a smaller page size using the buffer property, concurrent kernels are possible as long as two kernels don't access the same pages.
This PR therefore allows concurrent kernels operating on the same buffer using an intuitive code pattern like this:
In this example, the two kernels have no dependencies on each other in the DAG because they access different pages, so there is no data access conflict.
This can be useful for: