Template Class ReadOnlyDeviceMacroProperty

Class Documentation

template<typename T, unsigned int I = 1, unsigned int J = 1, unsigned int K = 1, unsigned int W = 1>
class ReadOnlyDeviceMacroProperty

This template class is used for conveniently converting a multi-dimensional pointer to an array Theoretically the compiler should be able to optimise away most of it at compile time

Public Functions

__device__ explicit ReadOnlyDeviceMacroProperty(T *_ptr, unsigned int *_rwf)

Constructor

Parameters:
  • _ptr – Pointer to buffer

  • _rwf – Pointer to read_write_flag

__device__ __forceinline__ ReadOnlyDeviceMacroProperty<T, J, K, W, 1> operator[](unsigned int i) const

Access the next dimension of the array

Throws:
  • exception::DeviceError – If i >= I.

  • exception::DeviceError – If template arguments I, J, K , W are all 1. Which denotes the macro property has no dimensions remaining to be indexed.

__device__ __forceinline__ operator T() const

Read-only access to the current element

Throws:

exception::DeviceError – If template arguments I, J, K , W are not all 1. Which denotes the macro property has dimensions remaining to be indexed.

Protected Functions

__device__ void setCheckReadFlag() const

Utility function for setting/checking read flag

__device__ void setCheckWriteFlag() const

Utility function for setting/checking write flag

Protected Attributes

T *ptr
unsigned int *read_write_flag

This flag is used by seatbelts to check for a read/atomic-write conflict Reading sets 1<<0 Writing sets 1<<1