cuda::experimental::stf::logical_data_untyped#

class logical_data_untyped#

Base class of all logical_data<T> types.

It does not “know” the type of the data, so most of the time it’s best to use logical_data<T>. Use logical_data_untyped only in special circumstances.

Subclassed by cuda::experimental::stf::logical_data< T >

Constructors

logical_data_untyped() = default#

Constructs a new logical_data_untyped object with the provided context, backend, memory_node, symbol, and data prerequisites.

The constructor initializes this with the provided context, backend, data place, and symbol. If memory_node is invalid, the constructor returns early without creating a data instance. Otherwise, it sets up the data instance, pins the host memory if required, and initializes the MSI status and prerequisite events.

Parameters:
  • ctx – A context

  • backend – A shared_ptr to the data_interface object underlying the data, must be non-null

  • memory_node – initial data location

inline logical_data_untyped(
::std::shared_ptr<reserved::logical_data_untyped_impl> p
)#

Constructs a new logical_data_untyped object with the provided context, backend, memory_node, symbol, and data prerequisites.

The constructor initializes this with the provided context, backend, data place, and symbol. If memory_node is invalid, the constructor returns early without creating a data instance. Otherwise, it sets up the data instance, pins the host memory if required, and initializes the MSI status and prerequisite events.

Parameters:
  • ctx – A context

  • backend – A shared_ptr to the data_interface object underlying the data, must be non-null

  • memory_node – initial data location

inline logical_data_untyped(
backend_ctx_untyped ctx,
::std::shared_ptr<data_interface> backend,
const data_place &memory_node
)#

Constructs a new logical_data_untyped object with the provided context, backend, memory_node, symbol, and data prerequisites.

The constructor initializes this with the provided context, backend, data place, and symbol. If memory_node is invalid, the constructor returns early without creating a data instance. Otherwise, it sets up the data instance, pins the host memory if required, and initializes the MSI status and prerequisite events.

Parameters:
  • ctx – A context

  • backend – A shared_ptr to the data_interface object underlying the data, must be non-null

  • memory_node – initial data location

Symbol getter/setter

inline const ::std::string &get_symbol() const#
inline void set_symbol(::std::string str)#

allocator setter

inline void set_allocator(block_allocator_untyped a)#

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
)#
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)#
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()
)#

Public Functions

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 &unfreeze_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 size_t hash() const#
inline void set_write_back(bool flag)#
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()#
inline int get_unique_id() const#

Friends

inline friend ::std::shared_ptr<void> pack_state(
const logical_data_untyped &d
)#
inline friend logical_data_untyped unpack_state(
const ::std::shared_ptr<void> &p
)#