rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rexlib::command Class Reference

Specification of work to be executed on a command_queue. More...

#include <rexlib/core/hardware/command.hpp>

Public Member Functions

 command () noexcept
 Construct a command with no program and empty bindings.
 
 command (std::shared_ptr< const program > program) noexcept
 Construct a command associated with the given program.
 
 command (const command &other)
 
 command (command &&other) noexcept
 
command & operator= (const command &other)
 
command & operator= (command &&other) noexcept
 
command & bind_outputs (std::vector< std::shared_ptr< buffer > > outputs) noexcept
 Bind the output buffers for this command.
 
command & bind_inputs (std::vector< std::shared_ptr< const buffer > > inputs) noexcept
 Bind the input buffers for this command.
 
command & bind_scratch (std::vector< std::shared_ptr< buffer > > scratch) noexcept
 Bind the scratch buffers for this command.
 
command & bind_dependencies (std::vector< command_token > dependencies) noexcept
 Bind the commands this command has to run after.
 
const std::shared_ptr< const program > & get_program () const noexcept
 Get the program associated with this command.
 
span< const std::shared_ptr< buffer > > get_outputs () const noexcept
 Get the bound output buffers.
 
span< const std::shared_ptr< const buffer > > get_inputs () const noexcept
 Get the bound input buffers.
 
span< const std::shared_ptr< buffer > > get_scratch () const noexcept
 Get the bound scratch buffers.
 
span< const command_token > get_dependencies () const noexcept
 Get the bound dependencies.
 

Detailed Description

Specification of work to be executed on a command_queue.

A command binds a program to its operands (outputs, inputs, and scratch buffers) and to the commands it has to run after, and is passed to command_queue::submit for execution. It offers a fluent interface for binding them, allowing the binding calls to be chained in a single expression.

A command owns what is bound to it. The buffers and the tokens stay alive for as long as the command does.

Constructor & Destructor Documentation

◆ command()

rexlib::command::command ( std::shared_ptr< const program >  program)
explicitnoexcept

Construct a command associated with the given program.

Bindings are initially empty; use bind_outputs, bind_inputs, bind_scratch and bind_dependencies to populate them before submission.

Parameters
programThe program to execute. May be nullptr, but command_queue::submit requires a non-null program.

Member Function Documentation

◆ bind_dependencies()

command & rexlib::command::bind_dependencies ( std::vector< command_token >  dependencies)
noexcept

Bind the commands this command has to run after.

Replaces the dependencies bound before.

Parameters
dependenciesTokens of the commands to run after. May be empty. An empty token is allowed and adds nothing.
Returns
Reference to *this to allow method chaining.

◆ bind_inputs()

command & rexlib::command::bind_inputs ( std::vector< std::shared_ptr< const buffer > >  inputs)
noexcept

Bind the input buffers for this command.

Replaces the input buffers bound before.

Parameters
inputsThe input buffer handles. May be empty.
Returns
Reference to *this to allow method chaining.

◆ bind_outputs()

command & rexlib::command::bind_outputs ( std::vector< std::shared_ptr< buffer > >  outputs)
noexcept

Bind the output buffers for this command.

Replaces the output buffers bound before.

Parameters
outputsThe output buffer handles. May be empty.
Returns
Reference to *this to allow method chaining.

◆ bind_scratch()

command & rexlib::command::bind_scratch ( std::vector< std::shared_ptr< buffer > >  scratch)
noexcept

Bind the scratch buffers for this command.

Scratch buffers provide temporary workspace required by the program (see program::get_scratch_requirements). They must be bound in the same order as the requirements returned by that method.

Replaces the scratch buffers bound before.

Parameters
scratchThe scratch buffer handles. May be empty if the program has no scratch requirements.
Returns
Reference to *this to allow method chaining.

◆ get_dependencies()

span< const command_token > rexlib::command::get_dependencies ( ) const
noexcept

Get the bound dependencies.

Returns
Span over the tokens of the commands to run after; empty if none were bound. Valid until they are bound again or the command is destroyed.

◆ get_inputs()

span< const std::shared_ptr< const buffer > > rexlib::command::get_inputs ( ) const
noexcept

Get the bound input buffers.

Returns
Span over the input buffer handles this command holds; empty if none were bound. Valid until they are bound again or the command is destroyed.

◆ get_outputs()

span< const std::shared_ptr< buffer > > rexlib::command::get_outputs ( ) const
noexcept

Get the bound output buffers.

Returns
Span over the output buffer handles this command holds; empty if none were bound. Valid until they are bound again or the command is destroyed.

◆ get_program()

const std::shared_ptr< const program > & rexlib::command::get_program ( ) const
noexcept

Get the program associated with this command.

Returns
The program, or nullptr if no program was set.

◆ get_scratch()

span< const std::shared_ptr< buffer > > rexlib::command::get_scratch ( ) const
noexcept

Get the bound scratch buffers.

Returns
Span over the scratch buffer handles this command holds; empty if none were bound. Valid until they are bound again or the command is destroyed.

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