MU Library
mu::input_ptr< T > Class Template Reference

Pointer to a kernel input buffer. More...

#include <access.hpp>

Public Types

using element_type = T
 
using kernel_buffer_direction = detail::input_buffer_direction
 
using pointer = const T *
 

Public Member Functions

constexpr input_ptr () noexcept=default
 
constexpr input_ptr (const T *ptr) noexcept
 
constexpr operator pointer () const noexcept
 
constexpr const T & operator* () const noexcept
 
constexpr pointer operator-> () const noexcept
 
constexpr const T & operator[] (std::ptrdiff_t index) const noexcept
 

Detailed Description

template<typename T>
class mu::input_ptr< T >

Pointer to a kernel input buffer.

The typed Launcher treats the pointed-to contents as required when the kernel starts and does not synchronize them back to the host after it finishes. Only const element access is exposed so ordinary writes through this parameter are rejected by C++.

Launcher calls still pass the original raw pointer (or an NDArray whose data pointer is adapted by the MU entry wrapper); this type belongs in the kernel signature only. Declare it by value, not by reference.

Definition at line 42 of file access.hpp.

Member Typedef Documentation

◆ element_type

template<typename T >
using mu::input_ptr< T >::element_type = T

Definition at line 49 of file access.hpp.

◆ kernel_buffer_direction

Definition at line 50 of file access.hpp.

◆ pointer

template<typename T >
using mu::input_ptr< T >::pointer = const T*

Definition at line 51 of file access.hpp.

Constructor & Destructor Documentation

◆ input_ptr() [1/2]

template<typename T >
constexpr mu::input_ptr< T >::input_ptr ( )
constexprdefaultnoexcept

◆ input_ptr() [2/2]

template<typename T >
constexpr mu::input_ptr< T >::input_ptr ( const T *  ptr)
inlineconstexprnoexcept

Definition at line 54 of file access.hpp.

55  : ptr_(ptr)
56  {
57  }

Member Function Documentation

◆ operator pointer()

template<typename T >
constexpr mu::input_ptr< T >::operator pointer ( ) const
inlineconstexprnoexcept

Definition at line 59 of file access.hpp.

60  {
61  return ptr_;
62  }

◆ operator*()

template<typename T >
constexpr const T& mu::input_ptr< T >::operator* ( ) const
inlineconstexprnoexcept

Definition at line 64 of file access.hpp.

65  {
66  return *ptr_;
67  }

◆ operator->()

template<typename T >
constexpr pointer mu::input_ptr< T >::operator-> ( ) const
inlineconstexprnoexcept

Definition at line 69 of file access.hpp.

70  {
71  return ptr_;
72  }

◆ operator[]()

template<typename T >
constexpr const T& mu::input_ptr< T >::operator[] ( std::ptrdiff_t  index) const
inlineconstexprnoexcept

Definition at line 74 of file access.hpp.

75  {
76  return ptr_[index];
77  }

The documentation for this class was generated from the following file: