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 2020] Add accessor simplifications/deduction guides, host_accessor #490

Merged
merged 3 commits into from
Mar 16, 2021

Conversation

illuhad
Copy link
Collaborator

@illuhad illuhad commented Mar 16, 2021

(cc @tomdeakin)

Initial implementation of

  • Accessor simplifications, deduction guides and no_init property
  • host_accessor (partial implementation)
  • Redesigned property_list which was required by the new accessor interface.

Allows code patterns such as

q.submit([&](sycl::handler& cgh){
  // read-write default for non-const buffer type
  sycl::accessor acc{buff, cgh};
  // Using deduction guides and no_init property
  sycl::accessor acc2{buff, cgh, sycl::read_only, sycl::no_init};
});
sycl::host_accessor hacc{buff, sycl::read_only};

Note: This PR does not yet contain additional changes/additions to the members of accessors, such as the iterator interface.

The only thing I'm not sure about is the pattern:

sycl::buffer<int> buff {...};
// construct read-only accessor
sycl::accessor<const int> acc{buff};

I think originally the intent was to allow this pattern in order to make read-write/read-only expressible only with accessor const-ness, but I don't see how the interface in the spec allows for that, and the wording in the spec appears pretty vague to me.
The spec hardcodes that the buffer arguments to the accessor<T> constructors is of type buffer<T>.

We would need additional accessor(buffer<std::remove_const_t<T>>&) constructors to make constructing accessor<const T> from buffer<T> work, which the spec does not seem to anticipate (which would also double the number of constructors because we don't have enough yet ;-) )

@illuhad illuhad force-pushed the feature/sycl-2020/accessor-simplfications branch from 9b27f47 to cb15688 Compare March 16, 2021 00:57
@illuhad
Copy link
Collaborator Author

illuhad commented Mar 16, 2021

@hipSYCL-ci-bot test again

@illuhad illuhad merged commit c01207f into develop Mar 16, 2021
@illuhad illuhad deleted the feature/sycl-2020/accessor-simplfications branch March 16, 2021 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant