DPC++ graph scheduler class. More...
#include <detail/scheduler/scheduler.hpp>
Classes | |
class | GraphBuilder |
Graph builder class. More... | |
struct | GraphBuildResult |
class | GraphProcessor |
Graph Processor provides interfaces for enqueueing commands and their dependencies to the underlying runtime. More... | |
Public Member Functions | |
EventImplPtr | addCG (std::unique_ptr< detail::CG > CommandGroup, const QueueImplPtr &Queue, sycl::detail::pi::PiExtCommandBuffer CommandBuffer=nullptr, const std::vector< sycl::detail::pi::PiExtSyncPoint > &Dependencies={}) |
Registers a command group, and adds it to the dependency graph. More... | |
EventImplPtr | addCopyBack (Requirement *Req) |
Registers a command group, that copies most recent memory to the memory pointed by the requirement. More... | |
void | waitForEvent (const EventImplPtr &Event, bool *Success=nullptr) |
Waits for the event. More... | |
bool | removeMemoryObject (detail::SYCLMemObjI *MemObj, bool StrictLock=true) |
Removes buffer from the graph. More... | |
EventImplPtr | addHostAccessor (Requirement *Req) |
Adds nodes to the graph, that update the requirement with the pointer to the host memory. More... | |
void | releaseHostAccessor (Requirement *Req) |
Unblocks operations with the memory object. More... | |
QueueImplPtr | getDefaultHostQueue () |
const QueueImplPtr & | getDefaultHostQueue () const |
void | deferMemObjRelease (const std::shared_ptr< detail::SYCLMemObjI > &MemObj) |
void | startFusion (QueueImplPtr Queue) |
void | cleanUpCmdFusion (sycl::detail::queue_impl *Queue) |
void | cancelFusion (QueueImplPtr Queue) |
EventImplPtr | completeFusion (QueueImplPtr Queue, const property_list &) |
bool | isInFusionMode (QueueIdT Queue) |
Scheduler () | |
~Scheduler () | |
void | releaseResources (BlockingT Blocking=BlockingT::BLOCKING) |
bool | isDeferredMemObjectsEmpty () |
void | enqueueCommandForCG (EventImplPtr NewEvent, std::vector< Command * > &AuxilaryCmds, BlockingT Blocking=NON_BLOCKING) |
EventImplPtr | addCommandGraphUpdate (ext::oneapi::experimental::detail::exec_graph_impl *Graph, std::vector< std::shared_ptr< ext::oneapi::experimental::detail::node_impl >> Nodes, const QueueImplPtr &Queue, std::vector< Requirement * > Requirements, std::vector< detail::EventImplPtr > &Events) |
Adds a command buffer update operation to the execution graph. More... | |
Static Public Member Functions | |
static Scheduler & | getInstance () |
static bool | isInstanceAlive () |
static MemObjRecord * | getMemObjRecord (const Requirement *const Req) |
static bool | areEventsSafeForSchedulerBypass (const std::vector< sycl::event > &DepEvents, ContextImplPtr Context) |
static bool | areEventsSafeForSchedulerBypass (const std::vector< EventImplPtr > &DepEvents, ContextImplPtr Context) |
Protected Types | |
using | RWLockT = std::shared_timed_mutex |
using | ReadLockT = std::shared_lock< RWLockT > |
using | WriteLockT = std::unique_lock< RWLockT > |
Protected Member Functions | |
WriteLockT | acquireWriteLock () |
Provides exclusive access to std::shared_timed_mutex object with deadlock avoidance. More... | |
WriteLockT | acquireFusionWriteLock () |
Provides exclusive access to std::shared_timed_mutex object with deadlock avoidance to the Fusion map. More... | |
ReadLockT | acquireReadLock () |
Provides shared access to std::shared_timed_mutex object with deadlock avoidance. More... | |
ReadLockT | acquireFusionReadLock () |
Provides shared access to std::shared_timed_mutex object with deadlock avoidance to the Fusion map. More... | |
void | cleanupCommands (const std::vector< Command * > &Cmds) |
void | NotifyHostTaskCompletion (Command *Cmd) |
void | cleanupDeferredMemObjects (BlockingT Blocking) |
void | takeAuxiliaryResources (const EventImplPtr &Dst, const EventImplPtr &Src) |
Assign Src's auxiliary resources to Dst . More... | |
void | registerAuxiliaryResources (EventImplPtr &Event, std::vector< std::shared_ptr< const void >> Resources) |
void | cleanupAuxiliaryResources (BlockingT Blocking) |
void | waitForRecordToFinish (MemObjRecord *Record, ReadLockT &GraphReadLock) |
This function waits on all of the graph leaves which somehow use the memory object which is represented by Record . More... | |
bool | checkLeavesCompletion (MemObjRecord *Record) |
Static Protected Member Functions | |
static void | enqueueLeavesOfReqUnlocked (const Requirement *const Req, ReadLockT &GraphReadLock, std::vector< Command * > &ToCleanUp) |
static void | enqueueUnblockedCommands (const std::vector< EventImplPtr > &CmdsToEnqueue, ReadLockT &GraphReadLock, std::vector< Command * > &ToCleanUp) |
Protected Attributes | |
GraphBuilder | MGraphBuilder |
RWLockT | MGraphLock |
RWLockT | MFusionMapLock |
std::vector< Command * > | MDeferredCleanupCommands |
std::mutex | MDeferredCleanupMutex |
std::vector< std::shared_ptr< SYCLMemObjI > > | MDeferredMemObjRelease |
std::mutex | MDeferredMemReleaseMutex |
std::unordered_map< EventImplPtr, std::vector< std::shared_ptr< const void > > > | MAuxiliaryResources |
std::mutex | MAuxiliaryResourcesMutex |
QueueImplPtr | DefaultHostQueue |
Friends | |
class | Command |
class | DispatchHostTask |
class | queue_impl |
class | event_impl |
class | ::MockScheduler |
DPC++ graph scheduler class.
The Scheduler is a part of DPC++ RT which ensures correct execution of command groups. To achieve this Scheduler manages acyclic dependency graph (which can have independent sub-graphs) that consists of several types of nodes that represent specific commands:
As the main input Scheduler takes a command group and returns an event representing it, so it can be waited on later. When a new command group comes, Scheduler adds one or more nodes to the graph depending on the command groups' requirements. For example, if a new command group is submitted to the SYCL context which has the latest data for all the requirements, Scheduler adds a new "Execute command group" command making it dependent on all commands affecting new command group's requirements. But if one of the requirements has no up-to-date instance in the context which the command group is submitted to, Scheduler additionally inserts copy memory command (together with allocate memory command if needed).
A simple graph looks like:
Where nodes represent commands and edges represent dependencies between them. There are three commands connected by arrows which mean that before executing second command group the first one must be executed. Also before executing the first command group memory allocation must be performed.
At some point Scheduler enqueues commands to the underlying devices. To do this, Scheduler performs topological sort to get the order in which commands should be enqueued. For example, the following graph (D depends on B and C, B and C depends on A) will be enqueued in the following order:
The Scheduler is split up into two parts: graph builder and graph processor.
To build dependencies, Scheduler needs to memorize memory objects and commands that modify them.
To detect that two command groups access the same memory object and create a dependency between them, Scheduler needs to store information about the memory object.
To ensure thread safe execution of methods, Scheduler provides access to the graph that's guarded by a read-write mutex (analog of shared mutex from C++17).
A read-write mutex allows concurrent access to read-only operations, while write operations require exclusive access.
All the methods of GraphBuilder lock the mutex in write mode because these methods can modify the graph. Methods of GraphProcessor lock the mutex in read mode as they are not modifying the graph.
There are two sources of errors that needs to be handled in Scheduler:
If an error occurs during command enqueue process, the Command::enqueue method returns the faulty command. Scheduler then reschedules the command and all dependent commands (if any).
An error with command processing can happen in underlying runtime, in this case Scheduler is notified asynchronously (using callback mechanism) what triggers rescheduling.
Definition at line 367 of file scheduler.hpp.
|
protected |
Definition at line 503 of file scheduler.hpp.
|
protected |
Definition at line 502 of file scheduler.hpp.
|
protected |
Definition at line 504 of file scheduler.hpp.
sycl::_V1::detail::Scheduler::Scheduler | ( | ) |
Definition at line 397 of file scheduler.cpp.
References DefaultHostQueue, sycl::_V1::detail::device_impl::getHostDeviceImpl(), sycl::_V1::detail::getSyclObjImpl(), and queue_impl.
sycl::_V1::detail::Scheduler::~Scheduler | ( | ) |
Definition at line 407 of file scheduler.cpp.
References DefaultHostQueue.
|
inlineprotected |
Provides shared access to std::shared_timed_mutex object with deadlock avoidance to the Fusion map.
Definition at line 550 of file scheduler.hpp.
References MFusionMapLock.
Referenced by isInFusionMode().
|
inlineprotected |
Provides exclusive access to std::shared_timed_mutex object with deadlock avoidance to the Fusion map.
Definition at line 527 of file scheduler.hpp.
References MFusionMapLock.
Referenced by cancelFusion(), cleanUpCmdFusion(), completeFusion(), and startFusion().
|
inlineprotected |
Provides shared access to std::shared_timed_mutex object with deadlock avoidance.
Definition at line 546 of file scheduler.hpp.
References MGraphLock.
Referenced by addCommandGraphUpdate(), addCopyBack(), addHostAccessor(), enqueueCommandForCG(), NotifyHostTaskCompletion(), releaseHostAccessor(), and waitForEvent().
|
inlineprotected |
Provides exclusive access to std::shared_timed_mutex object with deadlock avoidance.
Definition at line 508 of file scheduler.hpp.
References MGraphLock.
Referenced by addCG(), addCommandGraphUpdate(), addCopyBack(), addHostAccessor(), cancelFusion(), completeFusion(), removeMemoryObject(), and startFusion().
EventImplPtr sycl::_V1::detail::Scheduler::addCG | ( | std::unique_ptr< detail::CG > | CommandGroup, |
const QueueImplPtr & | Queue, | ||
sycl::detail::pi::PiExtCommandBuffer | CommandBuffer = nullptr , |
||
const std::vector< sycl::detail::pi::PiExtSyncPoint > & | Dependencies = {} |
||
) |
Registers a command group, and adds it to the dependency graph.
It's called by SYCL's queue.submit.
CommandGroup | is a unique_ptr to a command group to be added. |
Queue | Queue that is registering the command-group. |
CommandBuffer | Optional command buffer to enqueue to instead of directly to the queue. |
Dependencies | Optional list of dependency sync points when enqueuing to a command buffer. |
Definition at line 95 of file scheduler.cpp.
References acquireWriteLock(), sycl::_V1::detail::Scheduler::GraphBuilder::addCG(), sycl::_V1::detail::Scheduler::GraphBuilder::addCGUpdateHost(), sycl::_V1::detail::CG::CodeplayHostTask, DefaultHostQueue, enqueueCommandForCG(), sycl::_V1::detail::Command::getEvent(), sycl::_V1::detail::CGExecKernel::getStreams(), sycl::_V1::detail::CG::Kernel, MGraphBuilder, registerAuxiliaryResources(), and sycl::_V1::detail::CG::UpdateHost.
EventImplPtr sycl::_V1::detail::Scheduler::addCommandGraphUpdate | ( | ext::oneapi::experimental::detail::exec_graph_impl * | Graph, |
std::vector< std::shared_ptr< ext::oneapi::experimental::detail::node_impl >> | Nodes, | ||
const QueueImplPtr & | Queue, | ||
std::vector< Requirement * > | Requirements, | ||
std::vector< detail::EventImplPtr > & | Events | ||
) |
Adds a command buffer update operation to the execution graph.
This is required when buffers/accessors are updated to ensure that the memory has been allocated when updating.
Graph | The executable graph to be updated. |
Nodes | The list of Nodes which are to be updated in the graph. |
Requirements | List of accessor requirements for this update. |
Events | List of events that this update operation depends on |
Definition at line 674 of file scheduler.cpp.
References acquireReadLock(), acquireWriteLock(), sycl::_V1::detail::Scheduler::GraphBuilder::addCommandGraphUpdate(), cleanupCommands(), sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand(), sycl::_V1::detail::Command::getEvent(), MGraphBuilder, sycl::_V1::detail::EnqueueResultT::MResult, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueFailed.
EventImplPtr sycl::_V1::detail::Scheduler::addCopyBack | ( | Requirement * | Req | ) |
Registers a command group, that copies most recent memory to the memory pointed by the requirement.
Req | is a requirement that points to the memory where data is needed. |
Definition at line 223 of file scheduler.cpp.
References acquireReadLock(), acquireWriteLock(), sycl::_V1::detail::Scheduler::GraphBuilder::addCopyBack(), cleanupCommands(), sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand(), sycl::_V1::detail::Command::getEvent(), sycl::_V1::detail::Command::getQueue(), MGraphBuilder, sycl::_V1::detail::EnqueueResultT::MResult, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueFailed.
Referenced by sycl::_V1::detail::SYCLMemObjT::updateHostMemory().
EventImplPtr sycl::_V1::detail::Scheduler::addHostAccessor | ( | Requirement * | Req | ) |
Adds nodes to the graph, that update the requirement with the pointer to the host memory.
Assumes the host pointer contains the latest data. New operations with the same memory object that have side effects are blocked until releaseHostAccessor(Requirement *Req) is callled.
Req | is the requirement to be updated. |
Definition at line 307 of file scheduler.cpp.
References acquireReadLock(), acquireWriteLock(), sycl::_V1::detail::Scheduler::GraphBuilder::addHostAccessor(), cleanupCommands(), sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand(), sycl::_V1::detail::Command::getEvent(), MGraphBuilder, sycl::_V1::detail::EnqueueResultT::MResult, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueFailed.
Referenced by sycl::_V1::detail::addHostAccessorAndWait().
|
static |
Definition at line 752 of file scheduler.cpp.
References all_of().
|
static |
Definition at line 742 of file scheduler.cpp.
References all_of().
Referenced by sycl::_V1::detail::queue_impl::submitMemOpHelper().
void sycl::_V1::detail::Scheduler::cancelFusion | ( | QueueImplPtr | Queue | ) |
Definition at line 621 of file scheduler.cpp.
References acquireFusionWriteLock(), acquireWriteLock(), sycl::_V1::detail::Scheduler::GraphBuilder::cancelFusion(), enqueueCommandForCG(), and MGraphBuilder.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::addCG(), sycl::_V1::detail::fusion_wrapper_impl::cancel_fusion(), sycl::_V1::detail::Scheduler::GraphBuilder::completeFusion(), and sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand().
|
protected |
Definition at line 29 of file scheduler.cpp.
References sycl::_V1::detail::Command::ALLOCA, sycl::_V1::detail::Command::ALLOCA_SUB_BUF, sycl::_V1::detail::Command::getEvent(), sycl::_V1::detail::Command::getType(), sycl::_V1::detail::MemObjRecord::MReadLeaves, and sycl::_V1::detail::MemObjRecord::MWriteLeaves.
Referenced by cleanupDeferredMemObjects().
|
protected |
Definition at line 593 of file scheduler.cpp.
References sycl::_V1::detail::BLOCKING, MAuxiliaryResources, and MAuxiliaryResourcesMutex.
Referenced by cleanupCommands(), and releaseResources().
void sycl::_V1::detail::Scheduler::cleanUpCmdFusion | ( | sycl::detail::queue_impl * | Queue | ) |
Definition at line 614 of file scheduler.cpp.
References acquireFusionWriteLock(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanUpCmdFusion(), and MGraphBuilder.
Referenced by sycl::_V1::detail::queue_impl::cleanup_fusion_cmd(), and sycl::_V1::detail::Scheduler::GraphBuilder::startFusion().
|
protected |
Definition at line 432 of file scheduler.cpp.
References cleanupAuxiliaryResources(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommand(), cleanupDeferredMemObjects(), MDeferredCleanupCommands, MDeferredCleanupMutex, MGraphBuilder, MGraphLock, and sycl::_V1::detail::NON_BLOCKING.
Referenced by addCommandGraphUpdate(), addCopyBack(), addHostAccessor(), enqueueCommandForCG(), NotifyHostTaskCompletion(), releaseHostAccessor(), releaseResources(), and waitForEvent().
|
protected |
Definition at line 514 of file scheduler.cpp.
References sycl::_V1::detail::BLOCKING, checkLeavesCompletion(), sycl::_V1::detail::Scheduler::GraphBuilder::getMemObjRecord(), isDeferredMemObjectsEmpty(), MDeferredMemObjRelease, MDeferredMemReleaseMutex, MGraphBuilder, MGraphLock, and removeMemoryObject().
Referenced by cleanupCommands(), deferMemObjRelease(), and releaseResources().
EventImplPtr sycl::_V1::detail::Scheduler::completeFusion | ( | QueueImplPtr | Queue, |
const property_list & | PropList | ||
) |
Definition at line 631 of file scheduler.cpp.
References acquireFusionWriteLock(), acquireWriteLock(), sycl::_V1::detail::Scheduler::GraphBuilder::completeFusion(), enqueueCommandForCG(), and MGraphBuilder.
Referenced by sycl::_V1::detail::fusion_wrapper_impl::complete_fusion().
void sycl::_V1::detail::Scheduler::deferMemObjRelease | ( | const std::shared_ptr< detail::SYCLMemObjI > & | MemObj | ) |
Definition at line 501 of file scheduler.cpp.
References cleanupDeferredMemObjects(), MDeferredMemObjRelease, MDeferredMemReleaseMutex, and sycl::_V1::detail::NON_BLOCKING.
Referenced by sycl::_V1::detail::SYCLMemObjT::detachMemoryObject().
void sycl::_V1::detail::Scheduler::enqueueCommandForCG | ( | EventImplPtr | NewEvent, |
std::vector< Command * > & | AuxilaryCmds, | ||
BlockingT | Blocking = NON_BLOCKING |
||
) |
Definition at line 166 of file scheduler.cpp.
References acquireReadLock(), cleanupCommands(), sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand(), sycl::_V1::detail::Command::MDeps, sycl::_V1::detail::EnqueueResultT::MResult, sycl::_V1::detail::Command::MUsers, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueFailed.
Referenced by addCG(), cancelFusion(), completeFusion(), sycl::_V1::detail::getOrWaitEvents(), and sycl::_V1::detail::Command::getPiEventsBlocking().
|
staticprotected |
Definition at line 362 of file scheduler.cpp.
References sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand(), sycl::_V1::detail::MemObjRecord::MReadLeaves, sycl::_V1::detail::SYCLMemObjI::MRecord, sycl::_V1::detail::EnqueueResultT::MResult, sycl::_V1::detail::AccessorImplHost::MSYCLMemObj, sycl::_V1::detail::MemObjRecord::MWriteLeaves, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueFailed.
Referenced by releaseHostAccessor().
|
staticprotected |
Definition at line 381 of file scheduler.cpp.
References sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand(), sycl::_V1::detail::EnqueueResultT::MResult, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueFailed.
Referenced by NotifyHostTaskCompletion().
|
inline |
Definition at line 453 of file scheduler.hpp.
References DefaultHostQueue.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::addCopyBack(), sycl::_V1::detail::Scheduler::GraphBuilder::addHostAccessor(), sycl::_V1::detail::Scheduler::GraphBuilder::connectDepEvent(), and sycl::_V1::detail::event_impl::ensureContextInitialized().
|
inline |
Definition at line 455 of file scheduler.hpp.
References DefaultHostQueue.
|
static |
Definition at line 261 of file scheduler.cpp.
References sycl::_V1::detail::GlobalHandler::getScheduler(), and sycl::_V1::detail::GlobalHandler::instance().
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::addCopyBack(), sycl::_V1::detail::Scheduler::GraphBuilder::addHostAccessor(), sycl::_V1::detail::addHostAccessorAndWait(), sycl::_V1::detail::fusion_wrapper_impl::cancel_fusion(), sycl::_V1::detail::queue_impl::cleanup_fusion_cmd(), sycl::_V1::detail::fusion_wrapper_impl::complete_fusion(), sycl::_V1::detail::Scheduler::GraphBuilder::connectDepEvent(), sycl::_V1::detail::SYCLMemObjT::detachMemoryObject(), sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand(), sycl::_V1::detail::event_impl::ensureContextInitialized(), sycl::_V1::detail::getOrWaitEvents(), sycl::_V1::detail::Command::getPiEventsBlocking(), sycl::_V1::detail::queue_impl::is_in_fusion_mode(), sycl::_V1::detail::DispatchHostTask::operator()(), sycl::_V1::detail::Command::processDepEvent(), sycl::_V1::detail::fusion_wrapper_impl::start_fusion(), sycl::_V1::detail::SYCLMemObjT::updateHostMemory(), sycl::_V1::detail::event_impl::wait(), and sycl::_V1::detail::AccessorImplHost::~AccessorImplHost().
|
static |
Definition at line 428 of file scheduler.cpp.
References sycl::_V1::detail::SYCLMemObjI::MRecord, and sycl::_V1::detail::AccessorImplHost::MSYCLMemObj.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::addCopyBack(), sycl::_V1::detail::Scheduler::GraphBuilder::findDepForRecord(), and sycl::_V1::detail::Scheduler::GraphBuilder::getOrInsertMemObjRecord().
|
inline |
Definition at line 509 of file scheduler.cpp.
References MDeferredMemObjRelease, and MDeferredMemReleaseMutex.
Referenced by cleanupDeferredMemObjects(), and releaseResources().
bool sycl::_V1::detail::Scheduler::isInFusionMode | ( | QueueIdT | Queue | ) |
Definition at line 645 of file scheduler.cpp.
References acquireFusionReadLock(), sycl::_V1::detail::Scheduler::GraphBuilder::isInFusionMode(), and MGraphBuilder.
Referenced by sycl::_V1::detail::Scheduler::GraphBuilder::addCG(), sycl::_V1::detail::Scheduler::GraphBuilder::cancelFusion(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanUpCmdFusion(), sycl::_V1::detail::Scheduler::GraphBuilder::completeFusion(), and sycl::_V1::detail::queue_impl::is_in_fusion_mode().
|
static |
Definition at line 265 of file scheduler.cpp.
References sycl::_V1::detail::GlobalHandler::instance(), and sycl::_V1::detail::GlobalHandler::isSchedulerAlive().
Referenced by sycl::_V1::detail::queue_impl::cleanup_fusion_cmd().
|
protected |
Definition at line 472 of file scheduler.cpp.
References acquireReadLock(), cleanupCommands(), enqueueUnblockedCommands(), sycl::_V1::detail::Command::getEvent(), sycl::_V1::detail::Command::MBlockedUsers, sycl::_V1::detail::Command::MBlockedUsersMutex, sycl::_V1::detail::Command::MDeps, sycl::_V1::detail::Command::MLeafCounter, and sycl::_V1::detail::Command::MMarkedForCleanup.
Referenced by sycl::_V1::detail::DispatchHostTask::operator()().
|
protected |
Definition at line 586 of file scheduler.cpp.
References MAuxiliaryResources, MAuxiliaryResourcesMutex, and sycl::_V1::detail::registerAuxiliaryResourcesNoLock().
Referenced by addCG().
void sycl::_V1::detail::Scheduler::releaseHostAccessor | ( | Requirement * | Req | ) |
Unblocks operations with the memory object.
Req | is a requirement that points to the memory object being unblocked. |
Definition at line 346 of file scheduler.cpp.
References acquireReadLock(), cleanupCommands(), enqueueLeavesOfReqUnlocked(), sycl::_V1::detail::AccessorImplHost::MBlockedCmd, sycl::_V1::detail::Command::MEnqueueStatus, and sycl::_V1::detail::EnqueueResultT::SyclEnqueueReady.
Referenced by sycl::_V1::detail::AccessorImplHost::~AccessorImplHost().
void sycl::_V1::detail::Scheduler::releaseResources | ( | BlockingT | Blocking = BlockingT::BLOCKING | ) |
Definition at line 409 of file scheduler.cpp.
References sycl::_V1::detail::BLOCKING, cleanupAuxiliaryResources(), cleanupCommands(), cleanupDeferredMemObjects(), and isDeferredMemObjectsEmpty().
bool sycl::_V1::detail::Scheduler::removeMemoryObject | ( | detail::SYCLMemObjI * | MemObj, |
bool | StrictLock = true |
||
) |
Removes buffer from the graph.
The lifetime of memory object descriptor begins when the first command group that uses the memory object is submitted and ends when "removeMemoryObject(...)" method is called which means there will be no command group that uses the memory object. When removeMemoryObject is called Scheduler will enqueue and wait on all release commands associated with the memory object, which effectively guarantees that all commands accessing the memory object are complete and then the resources allocated for the memory object are freed. Then all the commands affecting the memory object are removed.
This member function is used by buffer and image.
MemObj | is a memory object that points to the buffer being removed. |
StrictLock | WA, is a flag used to identify if strict read and write lock are allowed or not. Default value is always applied in buffer_impl destructor. StrictLock == false is introduced for cleanupDeferredMemObjects to avoid blocking mem object release that may lead to dead lock. |
Definition at line 279 of file scheduler.cpp.
References acquireWriteLock(), sycl::_V1::detail::Scheduler::GraphBuilder::cleanupCommandsForRecord(), sycl::_V1::detail::Scheduler::GraphBuilder::decrementLeafCountersForRecord(), sycl::_V1::detail::Scheduler::GraphBuilder::getMemObjRecord(), MGraphBuilder, MGraphLock, sycl::_V1::detail::Scheduler::GraphBuilder::removeRecordForMemObj(), and waitForRecordToFinish().
Referenced by cleanupDeferredMemObjects(), and sycl::_V1::detail::SYCLMemObjT::updateHostMemory().
void sycl::_V1::detail::Scheduler::startFusion | ( | QueueImplPtr | Queue | ) |
Definition at line 608 of file scheduler.cpp.
References acquireFusionWriteLock(), acquireWriteLock(), MGraphBuilder, and sycl::_V1::detail::Scheduler::GraphBuilder::startFusion().
Referenced by sycl::_V1::detail::fusion_wrapper_impl::start_fusion().
|
protected |
Assign Src's
auxiliary resources to Dst
.
Definition at line 574 of file scheduler.cpp.
References MAuxiliaryResources, MAuxiliaryResourcesMutex, and sycl::_V1::detail::registerAuxiliaryResourcesNoLock().
void sycl::_V1::detail::Scheduler::waitForEvent | ( | const EventImplPtr & | Event, |
bool * | Success = nullptr |
||
) |
Waits for the event.
This operation is blocking. For eager execution mode this method invokes corresponding function of device API.
Event | is a pointer to event to wait on. |
Success | is an optional parameter that, when set to a non-null pointer, indicates that failure is a valid outcome for this wait (e.g., in case of a non-blocking read from a pipe), and the value it's pointing to is then set according to the outcome. |
Definition at line 269 of file scheduler.cpp.
References acquireReadLock(), cleanupCommands(), and sycl::_V1::detail::Scheduler::GraphProcessor::waitForEvent().
Referenced by sycl::_V1::detail::event_impl::wait().
|
protected |
This function waits on all of the graph leaves which somehow use the memory object which is represented by Record
.
The function is called upon destruction of memory buffer.
Record | memory record to await graph leaves of to finish |
GraphReadLock | locked graph read lock |
GraphReadLock will be unlocked/locked as needed. Upon return from the function, GraphReadLock will be left in locked state.
Definition at line 45 of file scheduler.cpp.
References sycl::_V1::detail::Scheduler::GraphProcessor::enqueueCommand(), sycl::_V1::detail::Command::getEvent(), sycl::_V1::detail::AllocaCommandBase::getReleaseCmd(), sycl::_V1::detail::MemObjRecord::MAllocaCommands, sycl::_V1::detail::MemObjRecord::MReadLeaves, sycl::_V1::detail::EnqueueResultT::MResult, sycl::_V1::detail::MemObjRecord::MWriteLeaves, sycl::_V1::detail::Command::resolveReleaseDependencies(), sycl::_V1::detail::EnqueueResultT::SyclEnqueueFailed, and sycl::_V1::detail::Scheduler::GraphProcessor::waitForEvent().
Referenced by removeMemoryObject().
|
friend |
Definition at line 975 of file scheduler.hpp.
|
friend |
Definition at line 971 of file scheduler.hpp.
|
friend |
Definition at line 972 of file scheduler.hpp.
|
friend |
Definition at line 974 of file scheduler.hpp.
|
friend |
Definition at line 973 of file scheduler.hpp.
Referenced by Scheduler().
|
protected |
Definition at line 969 of file scheduler.hpp.
Referenced by addCG(), getDefaultHostQueue(), Scheduler(), and ~Scheduler().
|
protected |
Definition at line 966 of file scheduler.hpp.
Referenced by cleanupAuxiliaryResources(), registerAuxiliaryResources(), and takeAuxiliaryResources().
|
protected |
Definition at line 967 of file scheduler.hpp.
Referenced by cleanupAuxiliaryResources(), registerAuxiliaryResources(), and takeAuxiliaryResources().
|
protected |
Definition at line 959 of file scheduler.hpp.
Referenced by cleanupCommands().
|
protected |
Definition at line 960 of file scheduler.hpp.
Referenced by cleanupCommands().
|
protected |
Definition at line 962 of file scheduler.hpp.
Referenced by cleanupDeferredMemObjects(), deferMemObjRelease(), and isDeferredMemObjectsEmpty().
|
protected |
Definition at line 963 of file scheduler.hpp.
Referenced by cleanupDeferredMemObjects(), deferMemObjRelease(), and isDeferredMemObjectsEmpty().
|
protected |
Definition at line 957 of file scheduler.hpp.
Referenced by acquireFusionReadLock(), and acquireFusionWriteLock().
|
protected |
Definition at line 955 of file scheduler.hpp.
Referenced by addCG(), addCommandGraphUpdate(), addCopyBack(), addHostAccessor(), cancelFusion(), cleanUpCmdFusion(), cleanupCommands(), cleanupDeferredMemObjects(), completeFusion(), isInFusionMode(), sycl::_V1::detail::Command::processDepEvent(), removeMemoryObject(), and startFusion().
|
protected |
Definition at line 956 of file scheduler.hpp.
Referenced by acquireReadLock(), acquireWriteLock(), cleanupCommands(), cleanupDeferredMemObjects(), and removeMemoryObject().