neuralqx.experimental.operators.symbolic.compiler package¶
Symbolic operator compiler package.
- class SymbolicCompiler(*, pipeline=None, lowerer_registry=None, artifact_store=None, options=None)¶
Bases:
objectOrchestrates 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 concreteComputationalJaxOperator.Typical usage:
from neuralqx.experimental.operators.symbolic 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 todefault_symbolic_pass_pipeline().lowerer_registry (
SymbolicLowererRegistry|None) – Lowerer registry. Defaults todefault_symbolic_lowerer_registry().artifact_store (
AbstractSymbolicArtifactStore|None) – Artifact cache store. Defaults to the module-level shareddefault_symbolic_artifact_store().options (
SymbolicCompilerOptions|None) – Compiler options. Defaults toSymbolicCompilerOptionswith all defaults.
- compile_symbolic_operator(operator, *, options=None, metadata=None)¶
Module-level convenience function for one-shot symbolic compilation.
Uses the module-level shared
SymbolicCompilerinstance (lazily created). The shared compiler reuses the global in-process artifact cache.- Parameters:
- Return type:
- Returns:
Executable
ComputationalJaxOperator.
Example:
from neuralqx.experimental.operators.symbolic import compile_symbolic_operator compiled_op = compile_symbolic_operator(my_symbolic_op) xp, mels = compiled_op.get_conn_padded(x_batch)
- class SymbolicCompilerOptions(backend_preference='auto', enable_fusion=True, strict_validation=True, cache_enabled=True, cache_namespace='nqx_symbolic_v1', debug_flags=<factory>)¶
Bases:
objectStatic and runtime controls for symbolic compiler execution.
- backend_preference¶
Preferred lowering backend (currently only
jaxis supported,autoresolves tojax).
- enable_fusion¶
Whether fusion-planning passes are enabled.
- strict_validation¶
Whether validation passes fail hard on errors.
- cache_enabled¶
Whether compiled artifacts are cached in-process.
- cache_namespace¶
Namespace string used in cache-key generation.
- debug_flags¶
Optional debug / instrumentation flags.
- class SymbolicCompiledArtifact(operator_name, backend, lowerer_name, compiled_operator, cache_key=None, pass_reports=<factory>, metadata=<factory>)¶
Bases:
objectCompilation artifact produced by the symbolic compiler pipeline.
- operator_name¶
Source operator name.
- backend¶
Selected backend name.
- lowerer_name¶
Lowerer identifier used for code generation.
- compiled_operator¶
Executable compiled operator object.
- cache_key¶
Optional compilation cache key.
- pass_reports¶
Ordered tuple of pass-execution reports.
- metadata¶
Optional artifact metadata.
- class SymbolicCompilationContext(*, operator, ir, options, metadata=None)¶
Bases:
objectHolds per-compilation mutable state across pipeline stages.
The context is created by the compiler, mutated in-place by passes and lowerers, and finally read when packaging the compiled artifact.
- Parameters:
operator (
Any) – Source symbolic operator.ir (
SymbolicOperatorIR) – Symbolic operator IR extracted from the operator.options (
SymbolicCompilerOptions) – Effective compiler options.metadata (
Mapping[str,Any] |None) – Optional extra context metadata.
- class SymbolicCacheKey(token, namespace)¶
Bases:
objectImmutable cache key for compiled symbolic operator artifacts.
- class SymbolicCompilationSignature(operator_ir_fingerprint, backend_target, hilbert_size, dtype_str, options_signature=<factory>)¶
Bases:
objectDeterministic compilation signature for cache-key generation.
- operator_ir_fingerprint¶
Stable digest of the operator IR.
- backend_target¶
Resolved backend name.
- hilbert_size¶
Hilbert space size.
- dtype_str¶
Matrix-element dtype string.
- options_signature¶
Static compiler-options signature.
- default_symbolic_pass_pipeline()¶
Builds the default two-stage symbolic compiler pass pipeline.
- Pre-cache passes (run on every
compile()call): SymbolicValidationPass- validates IR symbol scopes and update-op parameters.SymbolicNormalizationPass- computes the IR fingerprint and resolves the target backend.
- Post-cache passes (run only on cache misses):
SymbolicFanoutAnalysisPass- derives per-term fanout bounds and the total padded output size.SymbolicFusionPass- groups terms into fusion-compatible clusters for the lowerer.
- Return type:
- Returns:
Configured
SymbolicPassPipeline.
- Pre-cache passes (run on every
- default_symbolic_lowerer_registry()¶
Builds the default symbolic lowerer registry.
Currently registers only the JAX backend lowerer (
JAXSymbolicLowerer).- Return type:
- Returns:
Configured
SymbolicLowererRegistry.
- default_symbolic_artifact_store()¶
Returns the module-level shared in-memory artifact store.
The store is lazily created and reused across compiler instances in the same process. Call
InMemorySymbolicArtifactStore.clear()to evict all compiled artifacts if needed.- Return type:
- Returns:
Shared
InMemorySymbolicArtifactStore.
Subpackages¶
- neuralqx.experimental.operators.symbolic.compiler.cache package
- neuralqx.experimental.operators.symbolic.compiler.core package
- neuralqx.experimental.operators.symbolic.compiler.core.artifact module
- neuralqx.experimental.operators.symbolic.compiler.core.context module
- neuralqx.experimental.operators.symbolic.compiler.core.options module
- neuralqx.experimental.operators.symbolic.compiler.core.pass_report module
- neuralqx.experimental.operators.symbolic.compiler.core.pipeline module
- neuralqx.experimental.operators.symbolic.compiler.core.signature module
- neuralqx.experimental.operators.symbolic.compiler.lowering package
- neuralqx.experimental.operators.symbolic.compiler.passes package
- neuralqx.experimental.operators.symbolic.compiler.passes.analysis module
- neuralqx.experimental.operators.symbolic.compiler.passes.base module
- neuralqx.experimental.operators.symbolic.compiler.passes.fusion module
- neuralqx.experimental.operators.symbolic.compiler.passes.normalization module
- neuralqx.experimental.operators.symbolic.compiler.passes.validation module