pub fn lower_compiled_to_stablehlo(
program: &CompiledGraph,
) -> Result<StableHloModule>Expand description
Lower a compiled graph to StableHLO MLIR text.
This is the preferred public lowering boundary for graph users. It consumes
the backend-neutral CompiledGraph view
directly and does not route through native Runtime
execution staging.
§Examples
use tenferro_runtime::{GraphCompiler, TracedTensor};
use tenferro_xla::lower_compiled_to_stablehlo;
let x = TracedTensor::from_vec_col_major(vec![1], vec![3.0_f64]).unwrap();
let mut compiler = GraphCompiler::new();
let y = x.neg().unwrap();
let program = compiler.compile(&y).unwrap();
let module = lower_compiled_to_stablehlo(&program).unwrap();
assert!(module.as_str().contains("stablehlo.negate"));§Errors
Returns Error::UnsupportedDType, Error::UnsupportedOp, or
Error::NonStaticShape for unsupported graph content, and
Error::InvalidProgram for inconsistent graph metadata.