ConversionContext
Context object for maintaining state during StableHLO conversion.
This class manages SSA value names, type mapping, and MLIR code generation during the conversion process from ComputeGraph to StableHLO.
Constructors
Properties
Governs whether constant tensors are inlined as dense<...> or lifted into util.global module declarations. Default ConstantMaterializationPolicy.InlineAlways preserves historical behavior for every caller that constructs a context without naming a policy — the external path is strictly opt-in. See issue #523 for the architecture context.
Functions
Emit a comment with proper indentation
Emit a tensor_encoding diagnostic comment when spec carries a non-null tensorEncoding (set via sk.ainet.lang.tensor.ops.withTensorEncoding).
Emit a module-scope declaration (e.g. util.global private @w : ...).
Emit an operation with proper indentation
Get the complete generated MLIR content
Snapshot of every externalized constant registered during this conversion. Surfaced on StableHloModule.externalParameters.
Get input nodes for a given node from the graph
Return every module-scope declaration emitted so far. Used by StableHloConverter when assembling the final content.
Get the type mapper instance
Get the SSA value name for a node ID
Get the MLIR tensor type for an SSA value name, or null if the value was produced by a converter that did not record its type.
Generate the next temporary SSA value name
Register an externalized constant tensor. The converter records these alongside MLIR emission so a downstream packager (see PR C in issue #523) can write them into an IREE .irpa archive.
Set the graph reference for node lookups
Set the SSA value name for a node ID
Record the MLIR tensor type associated with an SSA value name.