-
Notifications
You must be signed in to change notification settings - Fork 26
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
Support for SYCL's basic and nd-range kernels #1070
Merged
Merged
Conversation
This file contains 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
…e same and deeper scopes.
…ary to define a kernel.
pieter-bos
reviewed
Oct 11, 2023
pieter-bos
approved these changes
Oct 20, 2023
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 pull request adds support for SYCL's basic and nd-range kernels.
It supports the creation of new kernels with SYCL's
submit
method:Internally this block of code transformed into a class with a run method with a parallel block inside it, which holds the lambda function and contract written in the
parallel_for
parameters. Thensycl::event myEvent
is assigned to an instance of the newly created class and is forked. This creates the following AST (after the language-specific rewrite pass):In SYCL, the host code does not wait on the submitted kernel to end before continuing. Therefore, the class containing the generated parellel block is forked. And when
myEvent.wait()
is called, which makes the host wait on the kernel code to end, the class instance is joined.The methods of SYCL's
item
andnd_item
which return the current (linear) thread id and range make use of the methods and their contracts inside thesycl.hpp
header file.Examples / tests for SYCL's kernels can be found in
examples/concepts/sycl/kernels/
andtest/main/vct/test/integration/examples/SYCLSpec.scala
.Lambda functions are only allowed in SYCL methods, if they are used anywhere else in C++ VerCors will throw an error.
To check if the kernel ranges are good, pre-conditions are added above the run method to check them (for example, for nd_ranges the global range should be divisible by the local range).
The comments on the previous pull request have also been addressed. The implementation of namespaces has changed, as I realized I only needed to be able to resolve methods inside them: now in the parsing stage the methods nested inside one or more namespaces get the names of the namespaces added in front of their name. This means that in the resolution stage, the methods can just be found by checking for a matching name, instead of the nested search it was before.