cuda::experimental::stf::logical_data

Defined in include/cuda/experimental/__stf/internal/logical_data.cuh

template<class T>
class logical_data : public cuda::experimental::stf::logical_data_untyped

Represents typed logical data.

Template Parameters

T – The type of the underlying data.

Symbol getter/setter

inline const ::std::string &get_symbol() const

Data interface getter

inline const data_interface &get_data_interface() const

Get common data associated with this object. The type must be user-specified and is checked dynamically.

tparam T

the type of common data, must be user-specified

template<typename T>
inline const T &common() const

Retrieves the physical data from this logical data for a given instance id

template<typename T>
inline decltype(auto) instance(instance_id_t instance_id) const

Retrieves the physical data from this logical data for the default instance

template<typename T>
inline decltype(auto) instance(task &tp) const

Get the data pace associated with a given instance

inline const data_instance &get_data_instance(instance_id_t instance_id) const
inline data_instance &get_data_instance(instance_id_t instance_id)

Reference count query and manipulation

inline bool has_ref() const
inline void add_ref()
inline void remove_ref()

Returns a dependency object for read/write/read and write access to this logical data.

return

task_dep_untyped The dependency object corresponding to this logical data

inline task_dep_untyped read(data_place dp = data_place::affine())
inline task_dep_untyped write(data_place dp = data_place::affine())
inline task_dep_untyped rw(data_place dp = data_place::affine())
inline task_dep_untyped relaxed(::std::shared_ptr<reduction_operator_base> op, data_place dp = data_place::affine())

Execution place getter

inline const shape_t &shape() const

Instance getter for a given instance or the default instance

inline decltype(auto) instance(instance_id_t instance_id)
inline decltype(auto) instance(task &tp)

Assign a symbolic name for this object

inline logical_data &set_symbol(::std::string str)

Select a custom allocator for this logical data

inline logical_data &set_allocator(block_allocator_untyped custom_allocator)

Get hash value

inline size_t hash() const

Return a task_dep<T> object for reading and/or writing this logical data.

tparam Pack

Additional parameter types for task_dep<T>’s constructor, if any

param pack

Additional arguments for task_dep<T>’s constructor, if any

return

task_dep<T> The object encapsulating access

template<typename ...Pack>
inline auto read(Pack&&... pack) const
template<typename ...Pack>
inline auto write(Pack&&... pack)
template<typename ...Pack>
inline auto rw(Pack&&... pack)
template<typename ...Pack>
inline auto relaxed(Pack&&... pack)
template<typename Op, typename ...Pack>
inline auto reduce(Op, no_init, Pack&&... pack)
template<typename Op, typename ...Pack>
inline auto reduce(Op, Pack&&... pack)

Public Types

using element_type = T

Alias for T

using shape_t = shape_of<T>

Alias for shape_of<T>

Public Functions

logical_data() = default

Default constructor.

inline logical_data(logical_data_untyped &&u)

Constructor from an untyped logical data.

Warning : no checks are done to ensure the type used to create the untyped logical data matches, it is the responsibility of the caller to ensure this is a valid conversion

template<typename U>
inline logical_data(backend_ctx_untyped ctx, ::std::shared_ptr<U> instance, data_place dp)

Constructor.

Template Parameters

U – Backend type

Parameters
  • ctx – Backend context

  • instance – Reference instance used for initializing this logical data

  • dp – Data place

  • data_prereq

inline void freeze(access_mode freeze_mode, data_place place = data_place::invalid())
template<typename T>
inline ::std::pair<T, event_list> get_frozen(task &fake_task, const data_place &dplace, access_mode m)
inline void unfreeze(task &fake_task, event_list prereqs = event_list())
inline void set_automatic_unfreeze(task &fake_task, bool flag)
inline ::std::pair<bool, access_mode> is_frozen() const

Indicates whether a logical data is frozen or not, and what is the corresponding mode.

inline void allocate(const data_place &memory_node, instance_id_t instance_id, ::std::ptrdiff_t &s, void **extra_args, event_list &prereqs)

Allocate memory for this logical data.

Parameters
  • ctx

  • memory_node

  • instance_id

  • s

  • extra_args

  • prereqs

inline void deallocate(const data_place &memory_node, instance_id_t instance_id, void *extra_args, event_list &prereqs)

Deallocate memory previously allocated with allocate

Parameters
  • ctx

  • memory_node

  • instance_id

  • extra_args

  • prereqs

inline void data_copy(const data_place &dst_node, instance_id_t dst_instance_id, const data_place &src_node, instance_id_t src_instance_id, event_list &prereqs)

Copy data.

Parameters
  • ctx

  • dst_node

  • dst_instance_id

  • src_node

  • src_instance_id

  • arg

  • prereqs

inline void write_back(const data_place &src_node, instance_id_t instance_id, event_list &prereqs)

Writes back data.

Parameters
  • ctx

  • src_node

  • instance_id

  • prereqs

inline instance_id_t find_unused_instance_id(const data_place &dplace)

Get the index of the first available instance_id.

Parameters

dplace

Returns

The found instance_id

inline instance_id_t find_instance_id(const data_place &dplace)

Get the index of the first used instance_id that matches the data place, or get a new one.

Parameters

dplace

Returns

The found instance_id

inline void release_instance_id(instance_id_t instance_id)

Make it possible to reuse an id.

Parameters

instance_id

inline const data_place &get_instance_dplace(instance_id_t instance_id) const

Get the data pace associated with a given instance.

Parameters

instance_id

Returns

const data_place&

inline bool has_interface() const

Returns true if the data interface of this object has been set.

inline bool is_void_interface() const

Returns true if the data is a void data interface.

inline void apply_redux_op(const data_place &memory_node, const exec_place &e_place, instance_id_t inout_instance_id, instance_id_t in_instance_id, event_list &prereqs)
inline void apply_redux_on_node(const data_place &memory_node, const exec_place &e_place, ::std::vector<instance_id_t> &ids, event_list &prereqs)
inline void reconstruct_after_redux(backend_ctx_untyped &bctx, instance_id_t instance_id, const exec_place &e_place, event_list &prereqs)
inline size_t get_data_instance_count() const
inline void enforce_msi_protocol(instance_id_t instance_id, access_mode mode, event_list &prereqs)
inline instance_id_t find_source_instance_id(instance_id_t dst_instance_id)
inline void set_write_back(bool flag)
inline void set_auto_dump(bool flag)
inline bool get_auto_dump() const
inline reserved::logical_data_state &get_state()
inline auto &get_ctx() const
inline bool is_initialized() const
inline bool operator==(const logical_data_untyped &other) const
inline auto &get_mutex()