XVector
xvec::Context Class Reference

RAII wrapper for xvecExecutionContextTag. More...

#include <xvec_context.hpp>

Public Member Functions

 Context (uint32_t deviceId)
 Create an execution context using the embedded production kernel. More...
 
virtual ~Context ()
 
 Context (Context &&other) noexcept
 
Context & operator= (Context &&other) noexcept
 
 Context (const Context &)=delete
 
Context & operator= (const Context &)=delete
 
xvecExecutionContextTag * handle () const noexcept
 Get the underlying C API handle. More...
 
void setProperty (const std::string &key, const std::string &value)
 Set a context property. More...
 
std::string getProperty (const std::string &key) const
 Get a context property. More...
 
std::optional< std::string > tryGetProperty (const std::string &key) const
 Try to get a context property. More...
 
void resetVpe ()
 Reset the VPE SRAM allocator state. More...
 

Static Public Member Functions

static uint32_t getNumDevices ()
 Get the number of available devices. More...
 

Detailed Description

RAII wrapper for xvecExecutionContextTag.

Manages the lifetime of an execution context. The context is created in the constructor and destroyed in the destructor. Supports move semantics but not copying.

Destroy all index and buffer wrappers using this context before destroying it. See Index resource lifetime for device-memory ownership.

Definition at line 67 of file xvec_context.hpp.

Constructor & Destructor Documentation

◆ Context() [1/3]

xvec::Context::Context ( uint32_t  deviceId)
explicit

Create an execution context using the embedded production kernel.

Parameters
deviceIdTarget device identifier.
Exceptions
xvec::Errorif context creation fails.

◆ ~Context()

virtual xvec::Context::~Context ( )
virtual

◆ Context() [2/3]

xvec::Context::Context ( Context &&  other)
noexcept

◆ Context() [3/3]

xvec::Context::Context ( const Context &  )
delete

Member Function Documentation

◆ getNumDevices()

static uint32_t xvec::Context::getNumDevices ( )
static

Get the number of available devices.

Returns
Number of devices.
Exceptions
xvec::Errorif the query fails.

◆ getProperty()

std::string xvec::Context::getProperty ( const std::string &  key) const

Get a context property.

Parameters
keyProperty name.
Returns
Property value.
Exceptions
xvec::Errorif the property does not exist or on failure.

◆ handle()

xvecExecutionContextTag* xvec::Context::handle ( ) const
noexcept

Get the underlying C API handle.

Use this to pass the context to C API functions that are not yet wrapped.

◆ operator=() [1/2]

Context& xvec::Context::operator= ( const Context &  )
delete

◆ operator=() [2/2]

Context& xvec::Context::operator= ( Context &&  other)
noexcept

◆ resetVpe()

void xvec::Context::resetVpe ( )

Reset the VPE SRAM allocator state.

Clears SRAM buffer allocation state across all subsystems. Must be called before executing kernels that use VpeContext.

Exceptions
xvec::Erroron failure.
Warning
Must NOT be called while device kernels are actively using VpeContext.

◆ setProperty()

void xvec::Context::setProperty ( const std::string &  key,
const std::string &  value 
)

Set a context property.

Parameters
keyProperty name.
valueProperty value as a string.
Exceptions
xvec::Erroron failure.

◆ tryGetProperty()

std::optional<std::string> xvec::Context::tryGetProperty ( const std::string &  key) const

Try to get a context property.

Parameters
keyProperty name.
Returns
Property value if found, std::nullopt otherwise.
Exceptions
xvec::Erroron failure (other than not-found).

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