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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions adoc/headers/accessorBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.

static constexpr target access_target = AccessTarget;

using value_type = // const DataT for read-only accessors, DataT otherwise
__value_type__;
using reference = value_type&;
Expand Down