nkdsl.SymbolicCompiler¶
- class SymbolicCompiler(*, pipeline=None, lowerer_registry=None, operator_lowering_registry=None, artifact_store=None, options=None, backend_preference=None, cache_enabled=None, deduplicate_connected_components=None, operator_lowering=None)[source]¶
Orchestrates the symbolic operator compilation pipeline.
The compiler accepts a symbolic operator (an
AbstractSymbolicOperator), runs it through the registered pass pipeline, optionally resolves a cache hit, and, on a miss, invokes the appropriate lowerer to produce a concrete executable operator instance.Typical usage:
from nkdsl import SymbolicCompiler compiler = SymbolicCompiler() compiled_op = compiler.compile_operator(my_symbolic_op) xp, mels = compiled_op.get_conn_padded(x_batch)
- Parameters:
pipeline (SymbolicPassPipeline | None) – Pass pipeline to use. Defaults to
default_symbolic_pass_pipeline().lowerer_registry (SymbolicLowererRegistry | None) – Lowerer registry. Defaults to
default_symbolic_lowerer_registry().operator_lowering_registry (SymbolicOperatorLoweringRegistry | None) – Registry mapping operator-lowering names to target classes and connection methods. Defaults to
default_symbolic_operator_lowering_registry().artifact_store (AbstractSymbolicArtifactStore | None) – Artifact cache store. Defaults to the module-level shared
default_symbolic_artifact_store().options (SymbolicCompilerOptions | None) – Compiler options. Defaults to
SymbolicCompilerOptionswith all defaults.deduplicate_connected_components (bool | None) – Convenience override for
options.deduplicate_connected_components.operator_lowering (str | None) – Convenience override for
options.operator_lowering.backend_preference (str | None)
cache_enabled (bool | None)
- __init__(*, pipeline=None, lowerer_registry=None, operator_lowering_registry=None, artifact_store=None, options=None, backend_preference=None, cache_enabled=None, deduplicate_connected_components=None, operator_lowering=None)[source]¶
- Parameters:
pipeline (SymbolicPassPipeline | None)
lowerer_registry (SymbolicLowererRegistry | None)
operator_lowering_registry (SymbolicOperatorLoweringRegistry | None)
artifact_store (AbstractSymbolicArtifactStore | None)
options (SymbolicCompilerOptions | None)
backend_preference (str | None)
cache_enabled (bool | None)
deduplicate_connected_components (bool | None)
operator_lowering (str | None)
- Return type:
None
Methods
__init__(*[, pipeline, lowerer_registry, ...])clear_cache()Clears all entries from the artifact store.
compile(operator, *[, options, metadata])Compiles a symbolic operator to a
SymbolicCompiledArtifact.compile_operator(operator, *[, options, ...])Compiles a symbolic operator and returns the executable operator directly.
Attributes
cache_sizeReturns the number of cached artifacts.
lowerer_namesReturns registered lowerer names.
operator_lowering_namesReturns registered operator-lowering target names.
pass_namesReturns the full ordered pass name sequence.