DPC++ Runtime
Runtime libraries for oneAPI DPC++
cl::sycl::detail::LeavesCollection Class Reference

A wrapper for CircularBuffer class along with collection for host accessor's EmptyCommands. More...

#include <detail/scheduler/leaves_collection.hpp>


class  IteratorT

Public Types

using GenericCommandsT = CircularBuffer< Command * >
using HostAccessorCommandsT = std::list< EmptyCommand * >
using EnqueueListT = std::vector< Command * >
using AllocateDependencyF = std::function< void(Command *, Command *, MemObjRecord *, EnqueueListT &)>
using value_type = Command *
using pointer = value_type *
using const_pointer = const value_type *
using reference = value_type &
using const_reference = const value_type &
using iterator = IteratorT< false >
using const_iterator = IteratorT< true >

Public Member Functions

 LeavesCollection (MemObjRecord *Record, std::size_t GenericCommandsCapacity, AllocateDependencyF AllocateDependency)
iterator begin ()
iterator end ()
const_iterator cbegin () const
const_iterator cend () const
bool push_back (value_type Cmd, EnqueueListT &ToEnqueue)
 Returns true if insertion took place. Returns false otherwise. More...
size_t remove (value_type Cmd)
 Replacement for std::remove with subsequent call to erase(newEnd, end()). More...
std::vector< value_typetoVector () const
size_t genericCommandsCapacity () const
const GenericCommandsTgetGenericCommands () const
const HostAccessorCommandsT getHostAccessorCommands () const


class IteratorT< true >
class IteratorT< false >

Detailed Description

A wrapper for CircularBuffer class along with collection for host accessor's EmptyCommands.

This class is introduced to overcome the problem with a lot of host accessors for the same memory object. The problem arises even when all the host accessors are read-only and their ranges intersect somehow.

Inside the class there is a classical CircularBuffer for generic commands. Also, it contains proper data structures for storing host accessors' EmptyCommands. Cross-referencing data structures are employed for quick enough navigation amongst stored EmptyCommands. IteratorT subclass allows for iterating and dereferencing. Though, it's not guaranteed to work with std::remove as host accessors' commands are stored in a map. Hence, the LeavesCollection class provides a viable solution with its own remove method.

Definition at line 38 of file leaves_collection.hpp.

Member Typedef Documentation

◆ AllocateDependencyF

◆ const_iterator

◆ const_pointer

◆ const_reference

◆ EnqueueListT

Definition at line 42 of file leaves_collection.hpp.

◆ GenericCommandsT

◆ HostAccessorCommandsT

◆ iterator

◆ pointer

◆ reference

◆ value_type

Constructor & Destructor Documentation

◆ LeavesCollection()

cl::sycl::detail::LeavesCollection::LeavesCollection ( MemObjRecord Record,
std::size_t  GenericCommandsCapacity,
AllocateDependencyF  AllocateDependency 

Definition at line 59 of file leaves_collection.hpp.

Member Function Documentation

◆ begin()

iterator cl::sycl::detail::LeavesCollection::begin ( )

Definition at line 64 of file leaves_collection.hpp.

◆ cbegin()

const_iterator cl::sycl::detail::LeavesCollection::cbegin ( ) const

Definition at line 73 of file leaves_collection.hpp.

◆ cend()

const_iterator cl::sycl::detail::LeavesCollection::cend ( ) const

Definition at line 80 of file leaves_collection.hpp.

◆ end()

iterator cl::sycl::detail::LeavesCollection::end ( )

Definition at line 71 of file leaves_collection.hpp.

◆ genericCommandsCapacity()

size_t cl::sycl::detail::LeavesCollection::genericCommandsCapacity ( ) const

Definition at line 94 of file leaves_collection.hpp.

◆ getGenericCommands()

const GenericCommandsT& cl::sycl::detail::LeavesCollection::getGenericCommands ( ) const

Definition at line 98 of file leaves_collection.hpp.

◆ getHostAccessorCommands()

const HostAccessorCommandsT cl::sycl::detail::LeavesCollection::getHostAccessorCommands ( ) const

Definition at line 102 of file leaves_collection.hpp.

◆ push_back()

bool cl::sycl::detail::LeavesCollection::push_back ( value_type  Cmd,
EnqueueListT ToEnqueue 

Returns true if insertion took place. Returns false otherwise.

Definition at line 52 of file leaves_collection.cpp.

References cl::sycl::detail::isHostAccessorCmd().

◆ remove()

size_t cl::sycl::detail::LeavesCollection::remove ( value_type  Cmd)

Replacement for std::remove with subsequent call to erase(newEnd, end()).

This function is introduced here due to complexity of iterator.

number of removed elements

Definition at line 38 of file leaves_collection.cpp.

References cl::sycl::distance(), and cl::sycl::detail::isHostAccessorCmd().

Referenced by cl::sycl::detail::Scheduler::GraphBuilder::updateLeaves().

◆ toVector()

std::vector< LeavesCollection::value_type > cl::sycl::detail::LeavesCollection::toVector ( ) const

Definition at line 64 of file leaves_collection.cpp.

Friends And Related Function Documentation

◆ IteratorT< false >

friend class IteratorT< false >

Definition at line 156 of file leaves_collection.hpp.

◆ IteratorT< true >

friend class IteratorT< true >

Definition at line 155 of file leaves_collection.hpp.

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