diff --git a/hydro_lang/src/compile/built.rs b/hydro_lang/src/compile/built.rs index 6935c2abcc70..8f4dc09b22cb 100644 --- a/hydro_lang/src/compile/built.rs +++ b/hydro_lang/src/compile/built.rs @@ -50,7 +50,7 @@ impl<'a> BuiltFlow<'a> { } /// Serialize the IR as JSON. - #[cfg(feature = "runtime_support")] + #[cfg(feature = "viz")] pub fn ir_json(&self) -> Result { super::ir::serialize_dedup_shared(|| serde_json::to_string_pretty(&self.ir)) } diff --git a/hydro_lang/src/viz/api.rs b/hydro_lang/src/viz/api.rs index d9cdb3b41c52..39a9533109ed 100644 --- a/hydro_lang/src/viz/api.rs +++ b/hydro_lang/src/viz/api.rs @@ -40,6 +40,11 @@ impl<'a> GraphApi<'a> { crate::viz::config::GraphType::Mermaid => render_hydro_ir_mermaid(self.ir, config), crate::viz::config::GraphType::Dot => render_hydro_ir_dot(self.ir, config), crate::viz::config::GraphType::Json => render_hydro_ir_json(self.ir, config), + crate::viz::config::GraphType::Ir => { + crate::compile::ir::serialize_dedup_shared(|| { + serde_json::to_string_pretty(self.ir).expect("failed to serialize IR") + }) + } } } diff --git a/hydro_lang/src/viz/config.rs b/hydro_lang/src/viz/config.rs index cab480942b75..da5e8ae5e518 100644 --- a/hydro_lang/src/viz/config.rs +++ b/hydro_lang/src/viz/config.rs @@ -9,6 +9,8 @@ pub enum GraphType { Dot, /// JSON format for Hydroscope interactive viewer. Json, + /// Serialized IR JSON for standalone coordination analysis. + Ir, } impl GraphType { @@ -18,6 +20,7 @@ impl GraphType { GraphType::Mermaid => "mmd", GraphType::Dot => "dot", GraphType::Json => "json", + GraphType::Ir => "ir.json", } } }