class
SushiBLAS::Engine
Owns one task graph with its scratch pool, recorder, tensor factory and random stream, and runs the graph.
- Declared in
include/SushiBLAS/engine.hpp
See also
include/SushiBLAS/README.md
Public member functions
explicit Engine(SushiRuntime::Execution::RuntimeContext &context, Core::Layout layout=Core::Layout::ROW_MAJOR)Builds an engine on a runtime context.
Parameters
contextMust outlive the engine and every tensor it creates.
layoutThe memory layout of tensors this engine creates.
Engine(const Engine &)=deleteEngine & operator=(const Engine &)=deleteEngine(Engine &&)=deleteEngine & operator=(Engine &&)=delete~Engine()=defaultTaskRecorder & get_recorder() noexceptReturns the recorder every operation view of this engine records through.
TensorFactory & get_tensor_factory() noexceptReturns the factory create_tensor forwards to.
RngStream & get_rng() noexceptReturns the random stream every RandomOps view of this engine draws from.
See also
include/SushiBLAS/engine/README.md
ScratchPool & get_scratch_pool() noexceptReturns the pool tasks recorded through this engine lease device scratch from.
See also
include/SushiBLAS/engine/README.md
SushiRuntime::Execution::RuntimeContext & get_context() noexceptReturns the runtime context the engine was built on.
void set_mode(ExecutionMode mode) noexceptSets the execution mode of every operation recorded from now on.
ExecutionMode get_mode() const noexceptReturns the execution mode operations are recorded under.
Core::Layout get_layout() const noexceptReturns the memory layout of tensors this engine creates.
void execute()Compiles the graph recorded through get_recorder(), runs it and returns when every task has finished.
Precondition
No thread is recording on this engine.
Tensor create_tensor(std::initializer_list< int64_t > dims, Core::DataType dtype=Core::DataType::FLOAT32, SushiRuntime::API::Residency residency=SushiRuntime::API::Residency::Shared, std::size_t device_index=0)Creates a tensor from a brace list of dimensions.
Parameters
device_indexDevice queue that owns the allocation.
Returns
A tensor without storage when a dimension is 0.
Exceptions
std::runtime_erroras TensorFactory::create states.
Tensor create_tensor(SushiRuntime::span< const int64_t > dims, Core::DataType dtype=Core::DataType::FLOAT32, SushiRuntime::API::Residency residency=SushiRuntime::API::Residency::Shared, std::size_t device_index=0)Creates a tensor whose dimensions are known only at run time.
Parameters
device_indexDevice queue that owns the allocation.
Returns
A tensor without storage when a dimension is 0.
Exceptions
std::runtime_erroras TensorFactory::create states.

