-
Notifications
You must be signed in to change notification settings - Fork 20
Support 0-dimensional buffers, accessors and kernels #163
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a first pass, looks good, thanks! Since you mentioned that you'll have to do the s/sycl::/celerity::/
replacement again anyway, could you maybe do it as a separate commit to make reviewing easier?
2a31dad
to
1a8d067
Compare
033bcd6
to
b10c485
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more notes!
From live discussion with @PeterTh: I didn't read the SYCL spec for 0-dimensional accessors properly. It defines a reference-conversion operator and an assignment operator instead of /* Available only when: (AccessMode != access_mode::atomic && Dimensions == 0) */
operator reference() const;
/* Available only when: (AccessMode != access_mode::atomic && Dimensions == 0) */
const accessor& operator=(const value_type& other) const;
/* Available only when: (AccessMode != access_mode::atomic && Dimensions == 0) */
const accessor& operator=(value_type&& other) const; This allows an accessor to be used like a We could now either copy what SYCL does or break with the standard, but IMO we should have some form of Regarding buffer<int, 0> buf = 42;
q.submit([=](handler &cgh) {
accessor acc(buf, cgh, one_to_one(), read_only);
cgh.host_task(on_master_node, ...);
}); Edit: We're implementing both the SYCL API and our |
d275449
to
7d78046
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only looked at 22/44 files so far, but I'll probably not get to the rest soon so I'll post that part for now.
0e36e75
to
a546198
Compare
0632927
to
7465169
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but maybe run the GPUC2 benchmarks before merging and update the result files.
…s, do not specialize <0>
Co-authored-by: Philip Salzmann <philip.salzmann@uibk.ac.at>
…mensional accessors
1a4bf42
to
b3b9507
Compare
This PR implements support for 0-dimensional buffers, 0-dimensional global and local accessors as well as 0-dimensional kernels as proposed by the SYCL standard without relying on the feature being present in the SYCL implementation.
Most of the changed lines simply replace
sycl::{range,id}
withcelerity::{range,id}
. We need our own implementation here to support the 0-dimensional case independently from SYCL (in fact the new Celerity coordinate types can be arbitrary-dimensional, even though buffers and kernels are limited toDims <= 3
as before).0-dimensional accessors do not take range mappers on construction since every access must be an all-access anyway. To support the different signatures in CTAD the accessor type deduction logic was re-written from scratch.
The PR also gets rid of the broken backwards compatibility layer for
sycl::item
kernels.Open Question
In SYCL, 0-dimensional accessors do not have an
operator[](id<0>)
, but onlyShould we support this (and also maybe range-mappers on 0-dimensional accessors) as an extension to ease generic programming on buffer dimensionality?operator*()
.Edit: Yes we should.
Edit 2: Actually SYCL does not have pointer semantics but implicit conversions to reference-type for 0-dim accessors. We are currently undecided if we want to go the same route.
Edit 3: We are going to implement both, our sane API and also SYCL's for porting compatibility.