Skip to main content

class accessor<DataT, Dims, Mode, celerity::target::host_task>

Declaration

template <typename DataT, int Dims, access_mode Mode>
class accessor<DataT, Dims, Mode, celerity::target::host_task> { /* full declaration omitted */ };

Template Parameters

DataT
int Dims
access_mode Mode

Member Variables

subrange<Dims> m_accessed_buffer_subrange
id<Dims> m_allocation_offset
range<Dims> m_allocation_range = detail::zeros
range<Dims> m_buffer_range = detail::zeros
DataT* m_host_ptr = nullptr
detail::oob_bounding_box* m_oob_indices = nullptr
DataT m_oob_fallback_value = type-parameter-0-0{}
static std::mutex m_oob_mutex

Member Function Overview

  • accessor(accessor<DataT, Dims, Mode, celerity::target::host_task> &&) noexcept
  • template <typename Functor, access_mode TagMode, access_mode TagModeNoInit>
    accessor(const buffer<DataT, Dims> & buff, handler & cgh, const Functor & rmfn, detail::access_tag<TagMode, TagModeNoInit, target::host_task>, const property_list &)
  • template <typename Functor, access_mode TagMode, access_mode M = Mode, typename = std::enable_if_t<detail::access::mode_traits::is_producer(M)>>
    accessor(const buffer<DataT, Dims> & buff, handler & cgh, const Functor & rmfn, detail::access_tag<TagMode, Mode, target::host_task>, const property::no_init &)
  • template <typename Functor, access_mode TagModeNoInit>
    accessor(const buffer<DataT, Dims> & buff, handler & cgh, const Functor & rmfn, detail::access_tag<Mode, TagModeNoInit, target::host_task>)
  • template <typename Functor>
    accessor(const buffer<DataT, Dims> & buff, handler & cgh, const Functor & rmfn)
  • template <access_mode TagMode, access_mode TagModeNoInit, int D = Dims, std::enable_if_t<D == 0, int> = 0>
    accessor(buffer<DataT, Dims> & buff, handler & cgh, detail::access_tag<TagMode, TagModeNoInit, target::host_task> tag, const property_list & prop_list)
  • template <access_mode TagMode, int D = Dims, std::enable_if_t<D == 0, int> = 0>
    accessor(buffer<DataT, Dims> & buff, handler & cgh, detail::access_tag<TagMode, Mode, target::host_task> tag, const property::no_init & no_init)
  • template <access_mode TagModeNoInit, int D = Dims, std::enable_if_t<D == 0, int> = 0>
    accessor(buffer<DataT, Dims> & buff, handler & cgh, detail::access_tag<Mode, TagModeNoInit, target::host_task> tag)
  • template <int D = Dims, std::enable_if_t<D == 0, int> = 0>
    accessor(buffer<DataT, Dims> & buff, handler & cgh)
  • template <typename Functor, access_mode TagMode, access_mode M = Mode, typename = std::enable_if_t<detail::access::mode_traits::is_producer(M)>>
    accessor(buffer<DataT, Dims> & buff, handler & cgh, const Functor & rmfn, detail::access_tag<TagMode, Mode, target::host_task>, const property::no_init &)
  • template <typename Functor, access_mode TagModeNoInit>
    accessor(buffer<DataT, Dims> & buff, handler & cgh, const Functor & rmfn, detail::access_tag<Mode, TagModeNoInit, target::host_task>)
  • template <typename Functor>
    accessor(buffer<DataT, Dims> & buff, handler & cgh, const Functor & rmfn)
  • accessor() noexcept
  • accessor(const accessor<DataT, Dims, Mode, celerity::target::host_task> & other)
  • template <int KernelDims>
    get_allocation_window(const partition<KernelDims> & part) const → buffer_allocation_window<DataT, Dims>
  • get_pointer() const → DataT *
  • template <access_mode M = Mode, std::enable_if_t<Dims == 0 && detail::access::mode_traits::is_producer(M), int> = 0>
    operator DataT &() const
  • template <access_mode M = Mode, std::enable_if_t<Dims == 0 && detail::access::mode_traits::is_pure_consumer(M), int> = 0>
    operator const DataT &() const
  • template <access_mode M = Mode>
    operator*() const → std::enable_if_t<Dims == 0 && detail::access::mode_traits::is_producer(M), DataT &>
  • template <access_mode M = Mode>
    operator*() const → std::enable_if_t<Dims == 0 && detail::access::mode_traits::is_pure_consumer(M), const DataT &>
  • template <access_mode M = Mode>
    operator->() const → std::enable_if_t<Dims == 0 && detail::access::mode_traits::is_pure_consumer(M), const DataT *>
  • template <access_mode M = Mode>
    operator->() const → std::enable_if_t<Dims == 0 && detail::access::mode_traits::is_producer(M), DataT *>
  • operator=(const accessor<DataT, Dims, Mode, celerity::target::host_task> & other) → accessor<DataT, Dims, Mode, celerity::target::host_task> &
  • operator=(accessor<DataT, Dims, Mode, celerity::target::host_task> &&) noexcept → accessor<DataT, Dims, Mode, celerity::target::host_task> &
  • template <int D = Dims, std::enable_if_t<D == 0, int> = 0>
    operator=(const DataT & other) const → const accessor<DataT, Dims, Mode, celerity::target::host_task> &
  • template <int D = Dims, std::enable_if_t<D == 0, int> = 0>
    operator=(DataT && other) const → const accessor<DataT, Dims, Mode, celerity::target::host_task> &
  • template <access_mode M = Mode>
    operator[](const id<Dims> & index) const → std::enable_if_t<detail::access::mode_traits::is_producer(M), DataT &>
  • template <access_mode M = Mode>
    operator[](const id<Dims> & index) const → std::enable_if_t<detail::access::mode_traits::is_pure_consumer(M), const DataT &>
  • template <int D = Dims, std::enable_if_t<(D > 0), int> = 0>
    operator[](size_t index) const → decltype(auto)
  • template <target Target = target::host_task, typename Functor>
    accessor(ctor_internal_tag, const buffer<DataT, Dims> & buff, handler & cgh, const Functor & rmfn)
  • accessor(subrange<Dims> accessed_buffer_subrange, DataT * ptr, const id<Dims> & allocation_offset, const range<Dims> & allocation_range, const range<Dims> & buffer_range)
  • accessor(const subrange<Dims> & accessed_buffer_subrange, detail::hydration_id hid, const id<Dims> & allocation_offset, const range<Dims> & allocation_range, range<Dims> buffer_range)
  • copy_and_hydrate(const accessor<DataT, Dims, Mode, celerity::target::host_task> & other) → void
  • get_linear_offset(const id<Dims> & index) const → size_t

Member Functions

accessor(accessor<
         DataT,
         Dims,
         Mode,
         celerity::target::host_task>&&) noexcept

Parameters

accessor<DataT, Dims, Mode, celerity::target::host_task>&&

template <typename Functor,
          access_mode TagMode,
          access_mode TagModeNoInit>
accessor(const buffer<DataT, Dims>& buff,
         handler& cgh,
         const Functor& rmfn,
         detail::access_tag<TagMode,
                            TagModeNoInit,
                            target::host_task>,
         const property_list&)

Template Parameters

Functor
access_mode TagMode
access_mode TagModeNoInit

Parameters

const buffer<DataT, Dims>& buff
handler& cgh
const Functor& rmfn
detail::access_tag<TagMode, TagModeNoInit, target::host_task>
const property_list&

template <typename Functor,
          access_mode TagMode,
          access_mode M = Mode,
          typename = std::enable_if_t<
              detail::access::mode_traits::
                  is_producer(M)>>
accessor(const buffer<DataT, Dims>& buff,
         handler& cgh,
         const Functor& rmfn,
         detail::access_tag<TagMode,
                            Mode,
                            target::host_task>,
         const property::no_init&)

Description

TODO: As of ComputeCpp 2.5.0 they do not support no_init prop, hence this constructor is needed along with discard deduction guide. but once they do this should be replace for a constructor that takes a prop list as an argument.

Template Parameters

Functor
access_mode TagMode
access_mode M = Mode
= std::enable_if_t<detail::access::mode_traits::is_producer(M)>

Parameters

const buffer<DataT, Dims>& buff
handler& cgh
const Functor& rmfn
detail:: access_tag<TagMode, Mode, target::host_task>
const property::no_init&

template <typename Functor,
          access_mode TagModeNoInit>
accessor(const buffer<DataT, Dims>& buff,
         handler& cgh,
         const Functor& rmfn,
         detail::access_tag<Mode,
                            TagModeNoInit,
                            target::host_task>)

Template Parameters

Functor
access_mode TagModeNoInit

Parameters

const buffer<DataT, Dims>& buff
handler& cgh
const Functor& rmfn
detail::access_tag<Mode, TagModeNoInit, target::host_task>

template <typename Functor>
accessor(const buffer<DataT, Dims>& buff,
         handler& cgh,
         const Functor& rmfn)

Template Parameters

Functor

Parameters

const buffer<DataT, Dims>& buff
handler& cgh
const Functor& rmfn

template <access_mode TagMode,
          access_mode TagModeNoInit,
          int D = Dims,
          std::enable_if_t<D == 0, int> = 0>
accessor(
    buffer<DataT, Dims>& buff,
    handler& cgh,
    detail::access_tag<TagMode,
                       TagModeNoInit,
                       target::host_task> tag,
    const property_list& prop_list)

Template Parameters

access_mode TagMode
access_mode TagModeNoInit
int D = Dims
std::enable_if_t<D == 0, int> = 0

Parameters

buffer<DataT, Dims>& buff
handler& cgh
detail::access_tag<TagMode, TagModeNoInit, target::host_task> tag
const property_list& prop_list

template <access_mode TagMode,
          int D = Dims,
          std::enable_if_t<D == 0, int> = 0>
accessor(
    buffer<DataT, Dims>& buff,
    handler& cgh,
    detail::access_tag<TagMode,
                       Mode,
                       target::host_task> tag,
    const property::no_init& no_init)

Template Parameters

access_mode TagMode
int D = Dims
std::enable_if_t<D == 0, int> = 0

Parameters

buffer<DataT, Dims>& buff
handler& cgh
detail:: access_tag<TagMode, Mode, target::host_task> tag
const property::no_init& no_init

template <access_mode TagModeNoInit,
          int D = Dims,
          std::enable_if_t<D == 0, int> = 0>
accessor(
    buffer<DataT, Dims>& buff,
    handler& cgh,
    detail::access_tag<Mode,
                       TagModeNoInit,
                       target::host_task> tag)

Template Parameters

access_mode TagModeNoInit
int D = Dims
std::enable_if_t<D == 0, int> = 0

Parameters

buffer<DataT, Dims>& buff
handler& cgh
detail::access_tag<Mode, TagModeNoInit, target::host_task> tag

template <int D = Dims,
          std::enable_if_t<D == 0, int> = 0>
accessor(buffer<DataT, Dims>& buff, handler& cgh)

Template Parameters

int D = Dims
std::enable_if_t<D == 0, int> = 0

Parameters

buffer<DataT, Dims>& buff
handler& cgh

template <typename Functor,
          access_mode TagMode,
          access_mode M = Mode,
          typename = std::enable_if_t<
              detail::access::mode_traits::
                  is_producer(M)>>
accessor(buffer<DataT, Dims>& buff,
         handler& cgh,
         const Functor& rmfn,
         detail::access_tag<TagMode,
                            Mode,
                            target::host_task>,
         const property::no_init&)

Description

TODO: As of ComputeCpp 2.5.0 they do not support no_init prop, hence this constructor is needed along with discard deduction guide. but once they do this should be replace for a constructor that takes a prop list as an argument.

Template Parameters

Functor
access_mode TagMode
access_mode M = Mode
= std::enable_if_t<detail::access::mode_traits::is_producer(M)>

Parameters

buffer<DataT, Dims>& buff
handler& cgh
const Functor& rmfn
detail:: access_tag<TagMode, Mode, target::host_task>
const property::no_init&

template <typename Functor,
          access_mode TagModeNoInit>
accessor(buffer<DataT, Dims>& buff,
         handler& cgh,
         const Functor& rmfn,
         detail::access_tag<Mode,
                            TagModeNoInit,
                            target::host_task>)

Template Parameters

Functor
access_mode TagModeNoInit

Parameters

buffer<DataT, Dims>& buff
handler& cgh
const Functor& rmfn
detail::access_tag<Mode, TagModeNoInit, target::host_task>

template <typename Functor>
accessor(buffer<DataT, Dims>& buff,
         handler& cgh,
         const Functor& rmfn)

Template Parameters

Functor

Parameters

buffer<DataT, Dims>& buff
handler& cgh
const Functor& rmfn

accessor() noexcept


accessor(
    const accessor<DataT,
                   Dims,
                   Mode,
                   celerity::target::host_task>&
        other)

Parameters

const accessor<DataT, Dims, Mode, celerity::target::host_task>& other

template <int KernelDims>
buffer_allocation_window<DataT, Dims>
get_allocation_window(
    const partition<KernelDims>& part) const

Description

Returns a pointer to the buffer allocation local to this node along with a description how this potentially smaller allocation maps to the underlying virtual buffer and the partition available in the current host task. Accessing the returned allocation outside the window will lead to undefined results.

Template Parameters

int KernelDims

Parameters

const partition<KernelDims>& part

DataT* get_pointer() const

Description

Returns a pointer to the underlying buffer.

Since the physical (or "backing") buffer underlying a Celerity buffer might have a different size, it is not always safe to return a pointer, as the stride might not be what is expected. However, it is always possible to get a pointer if the full buffer is being accessed. This API will be deprecated and subsequently removed in a future version.


template <
    access_mode M = Mode,
    std::enable_if_t<
        Dims == 0 && detail::access::mode_traits::
                         is_producer(M),
        int> = 0>
inline operator DataT&() const

Template Parameters

access_mode M = Mode
std::enable_if_t<Dims == 0 && detail::access::mode_traits::is_producer(M), int> = 0

template <
    access_mode M = Mode,
    std::enable_if_t<
        Dims == 0 && detail::access::mode_traits::
                         is_pure_consumer(M),
        int> = 0>
inline operator const DataT&() const

Template Parameters

access_mode M = Mode
std::enable_if_t<Dims == 0 && detail::access::mode_traits::is_pure_consumer(M), int> = 0

template <access_mode M = Mode>
inline std::enable_if_t<
    Dims == 0 &&
        detail::access::mode_traits::is_producer(
            M),
    DataT&>
operator*() const

Template Parameters

access_mode M = Mode

template <access_mode M = Mode>
inline std::enable_if_t<
    Dims == 0 && detail::access::mode_traits::
                     is_pure_consumer(M),
    const DataT&>
operator*() const

Template Parameters

access_mode M = Mode

template <access_mode M = Mode>
inline std::enable_if_t<
    Dims == 0 && detail::access::mode_traits::
                     is_pure_consumer(M),
    const DataT*>
operator->() const

Template Parameters

access_mode M = Mode

template <access_mode M = Mode>
inline std::enable_if_t<
    Dims == 0 &&
        detail::access::mode_traits::is_producer(
            M),
    DataT*>
operator->() const

Template Parameters

access_mode M = Mode

accessor<DataT,
         Dims,
         Mode,
         celerity::target::host_task>&
operator=(
    const accessor<DataT,
                   Dims,
                   Mode,
                   celerity::target::host_task>&
        other)

Parameters

const accessor<DataT, Dims, Mode, celerity::target::host_task>& other

accessor<DataT,
         Dims,
         Mode,
         celerity::target::host_task>&
operator=(accessor<
          DataT,
          Dims,
          Mode,
          celerity::target::host_task>&&) noexcept

Parameters

accessor<DataT, Dims, Mode, celerity::target::host_task>&&

template <int D = Dims,
          std::enable_if_t<D == 0, int> = 0>
const accessor<DataT,
               Dims,
               Mode,
               celerity::target::host_task>&
operator=(const DataT& other) const

Template Parameters

int D = Dims
std::enable_if_t<D == 0, int> = 0

Parameters

const DataT& other

template <int D = Dims,
          std::enable_if_t<D == 0, int> = 0>
const accessor<DataT,
               Dims,
               Mode,
               celerity::target::host_task>&
operator=(DataT&& other) const

Template Parameters

int D = Dims
std::enable_if_t<D == 0, int> = 0

Parameters

DataT&& other

template <access_mode M = Mode>
inline std::enable_if_t<
    detail::access::mode_traits::is_producer(M),
    DataT&>
operator[](const id<Dims>& index) const

Template Parameters

access_mode M = Mode

Parameters

const id<Dims>& index

template <access_mode M = Mode>
inline std::enable_if_t<
    detail::access::mode_traits::is_pure_consumer(
        M),
    const DataT&>
operator[](const id<Dims>& index) const

Template Parameters

access_mode M = Mode

Parameters

const id<Dims>& index

template <int D = Dims,
          std::enable_if_t<(D > 0), int> = 0>
inline decltype(auto) operator[](
    size_t index) const

Template Parameters

int D = Dims
std::enable_if_t<(D > 0), int> = 0

Parameters

size_t index

template <target Target = target::host_task,
          typename Functor>
accessor(ctor_internal_tag,
         const buffer<DataT, Dims>& buff,
         handler& cgh,
         const Functor& rmfn)

Template Parameters

target Target = target::host_task
Functor

Parameters

ctor_internal_tag
const buffer<DataT, Dims>& buff
handler& cgh
const Functor& rmfn

accessor(subrange<Dims> accessed_buffer_subrange,
         DataT* ptr,
         const id<Dims>& allocation_offset,
         const range<Dims>& allocation_range,
         const range<Dims>& buffer_range)

Parameters

subrange<Dims> accessed_buffer_subrange
DataT* ptr
const id<Dims>& allocation_offset
const range<Dims>& allocation_range
const range<Dims>& buffer_range

accessor(const subrange<Dims>&
             accessed_buffer_subrange,
         detail::hydration_id hid,
         const id<Dims>& allocation_offset,
         const range<Dims>& allocation_range,
         range<Dims> buffer_range)

Parameters

const subrange<Dims>& accessed_buffer_subrange
detail::hydration_id hid
const id<Dims>& allocation_offset
const range<Dims>& allocation_range
range<Dims> buffer_range

void copy_and_hydrate(
    const accessor<DataT,
                   Dims,
                   Mode,
                   celerity::target::host_task>&
        other)

Parameters

const accessor<DataT, Dims, Mode, celerity::target::host_task>& other

size_t get_linear_offset(
    const id<Dims>& index) const

Parameters

const id<Dims>& index