docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
node_dispatcher_registry.h File Reference

Registry system for dispatchers and library node dispatchers. More...

Go to the source code of this file.

Classes

class  sdfg::codegen::NodeDispatcherRegistry
class  sdfg::codegen::MapDispatcherRegistry
 Registry for map-specific dispatchers based on schedule type. More...
class  sdfg::codegen::ReduceDispatcherRegistry
 Registry for reduce-specific dispatchers based on schedule type. More...
class  sdfg::codegen::LibraryNodeDispatcherRegistry
 Registry for library node dispatchers. More...

Namespaces

namespace  sdfg
namespace  sdfg::codegen

Typedefs

using sdfg::codegen::NodeDispatcherFn
using sdfg::codegen::MapDispatcherFn
using sdfg::codegen::ReduceDispatcherFn
using sdfg::codegen::LibraryNodeDispatcherFn

Functions

std::unique_ptr< NodeDispatcher > sdfg::codegen::create_dispatcher (LanguageExtension &language_extension, StructuredSDFG &sdfg, analysis::AnalysisManager &analysis_manager, structured_control_flow::ControlFlowNode &node, InstrumentationPlan &instrumentation_plan, ArgCapturePlan &arg_capture_plan)
void sdfg::codegen::register_default_dispatchers ()

Detailed Description

Registry system for dispatchers and library node dispatchers.

This file defines registry classes for dispatchers, allowing dynamic registration and lookup of code generation handlers for different node types and library nodes.

Dispatcher Registries

The registry system provides three main registries:

  1. NodeDispatcherRegistry: Maps control flow node types to dispatchers
  2. MapDispatcherRegistry: Maps map schedule types to specialized dispatchers
  3. LibraryNodeDispatcherRegistry: Maps library node codes to dispatchers

Each registry follows the singleton pattern and provides thread-safe registration and lookup of factory functions.

Library Node Dispatchers

Library node dispatchers generate code for specific library operations. Each library node code (e.g., "GEMM", "Memcpy") can be registered with a custom dispatcher that knows how to generate the appropriate library call or implementation.

Example

Registering a library node dispatcher:

LibraryNodeDispatcherRegistry::instance().register_library_node_dispatcher(
"GEMM",
[](LanguageExtension& lang, const Function& func,
const data_flow::DataFlowGraph& dfg, const data_flow::LibraryNode& node) {
return std::make_unique<GemmDispatcher>(lang, func, dfg, node);
}
);
See also
node_dispatcher.h for the base dispatcher class
block_dispatcher.h for LibraryNodeDispatcher base class