Skip to content

Commit dbc9ade

Browse files
Try fixing bug to avoid second eval
1 parent 19ed5d7 commit dbc9ade

4 files changed

Lines changed: 23 additions & 32 deletions

File tree

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ opentelemetry_sdk = "0.28"
2323
# egglog-core-relations = { path = "../egg-smol/core-relations" }
2424
# egglog-ast = { path = "../egg-smol/egglog-ast" }
2525
# egglog-reports = { path = "../egg-smol/egglog-reports" }
26-
egglog = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "multiset-changes", default-features = false }
27-
egglog-ast = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "multiset-changes" }
28-
egglog-core-relations = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "multiset-changes" }
29-
egglog-reports = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "multiset-changes" }
30-
egglog-bridge = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "multiset-changes" }
26+
egglog = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "fix-container-fn-bug", default-features = false }
27+
egglog-ast = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "fix-container-fn-bug" }
28+
egglog-core-relations = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "fix-container-fn-bug" }
29+
egglog-reports = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "fix-container-fn-bug" }
30+
egglog-bridge = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "fix-container-fn-bug" }
3131

3232

3333
egglog-experimental = { git = "https://github.com/egraphs-good/egglog-experimental", branch = "main", default-features = false }
@@ -52,11 +52,11 @@ base64 = "0.22.1"
5252
# egglog-reports = { path = "../egg-smol/egglog-reports" }
5353
# egglog-bridge = { path = "../egg-smol/egglog-bridge" }
5454

55-
egglog = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "multiset-changes" }
56-
egglog-ast = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "multiset-changes" }
57-
egglog-core-relations = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "multiset-changes" }
58-
egglog-bridge = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "multiset-changes" }
59-
egglog-reports = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "multiset-changes" }
55+
egglog = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "fix-container-fn-bug" }
56+
egglog-ast = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "fix-container-fn-bug" }
57+
egglog-core-relations = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "fix-container-fn-bug" }
58+
egglog-bridge = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "fix-container-fn-bug" }
59+
egglog-reports = { git = "https://github.com/saulshanabrook/egg-smol.git", branch = "fix-container-fn-bug" }
6060

6161
# enable debug symbols for easier profiling
6262
[profile.release]

python/egglog/exp/array_api.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2792,18 +2792,9 @@ def try_evaling(expr: ExprWithValue[T_co]) -> T_co:
27922792
egraph = _get_current_egraph()
27932793
egraph.register(expr) # type: ignore[arg-type]
27942794
egraph.run(array_api_schedule)
2795-
extracted_expr = egraph.extract(expr) # type: ignore[call-overload]
2795+
return egraph.extract(expr).value # type: ignore[call-overload]
27962796

2797-
with _TRACER.start_as_current_span("try_evaling second"):
2798-
new_egraph = EGraph()
2799-
# The fresh e-graph needs the extracted expression registered before the schedule runs,
2800-
# otherwise the simplification rules never see it.
2801-
new_egraph.register(extracted_expr)
2802-
new_egraph.run(array_api_schedule)
2803-
return new_egraph.extract(extracted_expr).value
28042797

2805-
2806-
##
28072798
# Polynomials
28082799
##
28092800

src/freeze.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ impl FrozenEGraph {
3434
pub fn from_egraph(egraph: &EGraph) -> FrozenEGraph {
3535
let mut functions = IndexMap::new();
3636
for fname in egraph.get_function_names() {
37-
let func = egraph.get_function(&fname).unwrap();
3837
let mut rows = Vec::new();
39-
egraph.function_for_each(func, |row| {
38+
egraph.function_for_each(&fname, |row| {
4039
let frozen_row = FrozenRow {
4140
subsumed: row.subsumed,
4241
inputs: row.vals[..row.vals.len() - 1]
@@ -47,7 +46,8 @@ impl FrozenEGraph {
4746
output: Value(*row.vals.last().unwrap()),
4847
};
4948
rows.push(frozen_row);
50-
});
49+
}).unwrap();
50+
let func = egraph.get_function(&fname).unwrap();
5151
let frozen_function = FrozenFunction {
5252
input_sorts: func
5353
.schema()

0 commit comments

Comments
 (0)