ConversionContext

class ConversionContext(typeMapper: TypeMapper, graph: ComputeGraph? = null)(source)

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

Link copied to clipboard
constructor(typeMapper: TypeMapper, graph: ComputeGraph? = null)

Functions

Link copied to clipboard
fun clear()

Clear all state (useful for testing)

Link copied to clipboard
fun emitComment(comment: String)

Emit a comment with proper indentation

Link copied to clipboard
fun emitLine(line: String)

Emit a line of MLIR code with proper indentation

Link copied to clipboard
fun emitOperation(operation: String)

Emit an operation with proper indentation

Link copied to clipboard

Get the complete generated MLIR content

Link copied to clipboard

Get input nodes for a given node from the graph

Link copied to clipboard

Get the type mapper instance

Link copied to clipboard
fun getValueName(nodeId: String): String?

Get the SSA value name for a node ID

Link copied to clipboard

Generate the next temporary SSA value name

Link copied to clipboard

Set the graph reference for node lookups

Link copied to clipboard
fun setValueName(nodeId: String, valueName: String)

Set the SSA value name for a node ID