Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions adoc/headers/accessorHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ template <typename DataT, int Dimensions = 1,
: access_mode::read_write)>
class host_accessor {
public:
static constexpr int dimensions = Dimensions;
static constexpr sycl::access_mode access_mode = AccessMode;

using value_type = // const DataT for read-only accessors, DataT otherwise
__value_type__;
using reference = value_type&;
Expand Down
2 changes: 2 additions & 0 deletions adoc/headers/accessorLocal.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
namespace sycl {
template <typename DataT, int Dimensions = 1> class local_accessor {
public:
static constexpr int dimensions = Dimensions;

using value_type = DataT;
using reference = value_type&;
using const_reference = const DataT&;
Expand Down
5 changes: 5 additions & 0 deletions adoc/headers/accessorSampledImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ template <typename DataT, int Dimensions,
image_target AccessTarget = image_target::device>
class sampled_image_accessor {
public:
static constexpr int dimensions = Dimensions;
static constexpr image_target access_target = AccessTarget;

using value_type = const DataT;
using reference = const DataT&;
using const_reference = const DataT&;
Expand All @@ -33,6 +36,8 @@ class sampled_image_accessor {

template <typename DataT, int Dimensions> class host_sampled_image_accessor {
public:
static constexpr int dimensions = Dimensions;

using value_type = const DataT;
using reference = const DataT&;
using const_reference = const DataT&;
Expand Down
7 changes: 7 additions & 0 deletions adoc/headers/accessorUnsampledImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ template <typename DataT, int Dimensions, access_mode AccessMode,
image_target AccessTarget = image_target::device>
class unsampled_image_accessor {
public:
static constexpr int dimensions = Dimensions;
static constexpr sycl::access_mode access_mode = AccessMode;
static constexpr image_target access_target = AccessTarget;

using value_type = // const DataT for read-only accessors, DataT otherwise
__value_type__;
using reference = value_type&;
Expand Down Expand Up @@ -45,6 +49,9 @@ template <typename DataT, int Dimensions = 1,
: access_mode::read_write)>
class host_unsampled_image_accessor {
public:
static constexpr int dimensions = Dimensions;
static constexpr sycl::access_mode access_mode = AccessMode;

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