feat(hydro_lang): ungate ir_json from runtime_support#2855
Draft
jhellerstein wants to merge 3 commits into
Draft
feat(hydro_lang): ungate ir_json from runtime_support#2855jhellerstein wants to merge 3 commits into
jhellerstein wants to merge 3 commits into
Conversation
ir_json() only needs serde_json, not the full runtime (dfir_rs). Gate it on the serde_json optional dep directly so it's available whenever any feature enables serde_json (viz, maelstrom_runtime, trybuild, or runtime_support).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the feature gating for BuiltFlow::ir_json() so that JSON IR serialization is available whenever serde_json is enabled, rather than requiring the heavier runtime_support feature (and its dfir_rs dependency).
Changes:
- Switch
BuiltFlow::ir_json()to be#[cfg(feature = "serde_json")]instead of#[cfg(feature = "runtime_support")].
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
shadaj
reviewed
May 8, 2026
Deploying hydro with
|
| Latest commit: |
09a3ba2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ee06d864.hydroflow.pages.dev |
| Branch Preview URL: | https://ungate-ir-json.hydroflow.pages.dev |
Add IrJson variant to GraphType enum so paxos and map_reduce examples can output serialized IR via --graph ir-json. Extract ir_to_json() helper in compile::ir for shared use by BuiltFlow::ir_json() and GraphApi::render(). Also adds a paxos_ir_json snapshot test in paxos_bench.
450c398 to
ecdbbe1
Compare
Comment on lines
+261
to
+263
| let json = hydro_lang::compile::ir::serialize_dedup_shared(|| { | ||
| serde_json::to_string_pretty(built.ir()).unwrap() | ||
| }); |
| /// Serialize a slice of [`HydroRoot`]s to a JSON string with shared-node deduplication. | ||
| #[cfg(feature = "viz")] | ||
| pub fn ir_to_json(ir: &[HydroRoot]) -> Result<String, serde_json::Error> { | ||
| serialize_dedup_shared(|| serde_json::to_string(ir)) |
Comment on lines
+43
to
+45
| crate::viz::config::GraphType::IrJson => { | ||
| crate::compile::ir::ir_to_json(self.ir).expect("failed to serialize IR to JSON") | ||
| } |
a15a670 to
e70eab6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tiny change: ir_json() only needs serde_json, not the full runtime (dfir_rs). Gate it on the viz dep which enables serde_json.