63 std::function<void(uint32_t, uint32_t,
void*)>
pc_updater;
121 std::shared_ptr<std::thread> thread_pool =
nullptr;
134 std::chrono::milliseconds timeout { 0 };
185 template <
typename T>
188 execution_metadata[std::move(key)] = std::forward<T>(
value);
202 template <
typename T>
203 CastResult<T>
get(
const std::string& key)
const
205 auto it = execution_metadata.find(key);
207 if (it == execution_metadata.end()) {
208 CastResult<T> result;
209 result.error =
"ExecutionContext missing key: " + key;
213 return safe_any_cast<T>(it->second);
224 template <
typename T>
225 T
get_or(
const std::string& key,
const T& default_value)
const
227 auto it = execution_metadata.find(key);
229 if (it == execution_metadata.end())
230 return default_value;
232 return safe_any_cast<T>(it->second).value_or(default_value);
246 template <
typename T>
249 auto it = execution_metadata.find(key);
251 if (it == execution_metadata.end())
254 return safe_any_cast_or_throw<T>(it->second);
265 return execution_metadata.contains(key);
278 template <
typename T>
281 dependencies.emplace_back(
typeid(T));
297 pre_execution_hook = std::move(cb);
309 post_execution_hook = std::move(cb);
321 reconstruction_callback = std::move(cb);
@ Runtime
General runtime operations (default fallback)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
@ CUSTOM
User-defined analysis types.
std::function< void(std::any &)> OperationHookCallback
Callback type for pre/post operation hooks.
std::variant< std::monostate, ChainedParams, ChainedIndirectParams, DependencyParams > ExecutionParams
OperationType
Operation categories for organization and discovery.
ExecutionMode
Execution paradigms for operations.
@ SYNC
Synchronous execution.
@ CHAINED
Part of a sequential chain.
@ DEPENDENCY
Part of dependency graph.
@ CHAINED_INDIRECT
Chained dispatch where a GPU-written indirect buffer gates each pass's workgroup count.
@ ASYNC
Asynchronous execution.
@ PARALLEL
Parallel with other operations.
std::function< std::any(std::vector< std::vector< double > > &, std::any &)> ReconstructionCallback
Callback type for custom reconstruction logic.
std::optional< uint32_t > passes_per_batch
std::function< void(uint32_t, uint32_t, void *)> pc_updater
Parameters for ExecutionMode::CHAINED_INDIRECT.
std::function< void(uint32_t, void *)> pc_updater
std::optional< uint32_t > passes_per_batch
Parameters for ExecutionMode::CHAINED.
DependencyParams(const DependencyParams &)
std::vector< DependencyStage > stages
DependencyParams(DependencyParams &&) noexcept
Parameters for ExecutionMode::DEPENDENCY.
ExecutionContext & on_reconstruct(ReconstructionCallback cb)
Set reconstruction callback.
std::vector< std::type_index > dependencies
Operation dependencies required before execution.
CastResult< T > get(const std::string &key) const
Retrieve metadata value using safe casting.
ExecutionContext & on_pre(OperationHookCallback cb)
Set pre-execution hook.
ExecutionContext & set_mode(ExecutionMode m)
Set execution mode.
ExecutionContext & with_timeout(std::chrono::milliseconds duration)
Set execution timeout.
bool contains(const std::string &key) const
Check whether a metadata key exists.
ExecutionParams parameters
Optional parameters specific to the execution mode.
T get_or_throw(const std::string &key) const
Retrieve metadata value or throw if unavailable.
std::unordered_map< std::string, std::any > execution_metadata
Arbitrary metadata parameters used by operations.
ExecutionContext & on_post(OperationHookCallback cb)
Set post-execution hook.
T get_or(const std::string &key, const T &default_value) const
Retrieve metadata value or return a default.
ExecutionContext & depends_on()
Register dependency on a specific operation type.
ExecutionContext & set(std::string key, T &&value)
Insert or update metadata value.
Context information controlling how a compute operation executes.