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

Add static constexpr members dimensions, access_mode and access_target to accessor class spec #656

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lbushi25
Copy link

@lbushi25 lbushi25 commented Nov 7, 2024

This PR addresses #270. It follows in the footsteps of #351.
I think this will require CTS changes as well but I can't add the label myself.

@CLAassistant
Copy link

CLAassistant commented Nov 7, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@keryell keryell left a comment

Choose a reason for hiding this comment

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

That looks like a good starting point.

@lbushi25 lbushi25 marked this pull request as ready for review November 14, 2024 06:40
@keryell keryell added this to the SYCL Next milestone Dec 5, 2024
@keryell
Copy link
Member

keryell commented Dec 5, 2024

For dimensions we could use mdspan equivalent https://en.cppreference.com/w/cpp/container/mdspan/extents/rank but unfortunately it relies on C++23 constexpr static access through this.

Copy link
Contributor

@gmlueck gmlueck left a comment

Choose a reason for hiding this comment

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

I think we should also add these static constexpr members to the other forms of accessors for consistency:

And also in these deprecated accessor specializations:

@@ -31,6 +31,10 @@ template <typename DataT, int Dimensions = 1,
access::placeholder isPlaceholder = access::placeholder::false_t>
class accessor {
public:
static constexpr int dimensions = Dimensions;
static constexpr sycl::access_mode access_mode = AccessMode;
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that the sycl:: namespace is not strictly necessary here. It could be like this:

static constexpr access_mode access_mode = AccessMode;

But maybe the sycl:: is better for clarity anyway.

I was concerned at first that this definition of access_mode will shadow the type sycl::access_mode for any code inside this class. I think this will not affect the specification, though, because none of the member function parameter or return types use access_mode. Of course, implementations will likely need to change because they undoubtedly use the access_mode type in their implementations. I think that is OK, though. Raising the shadowing issue here, though, in case others see some problem.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if shadowing is a problem or not, but if it is then I think we already have it, because multi_ptr defines:

static constexpr access::address_space address_space = Space;

I'm just pointing that out because if we decide to do something different here, we may need to revisit multi_ptr.

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.

5 participants