Skip to content

Commit 4e0dfb0

Browse files
Respond to review notes and try to fix codspeed crash
1 parent d1a9f04 commit 4e0dfb0

18 files changed

Lines changed: 130 additions & 115 deletions

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
- run: |
6868
export UV_PROJECT_ENVIRONMENT="${pythonLocation}"
6969
uv sync --extra test --locked
70-
- uses: CodSpeedHQ/action@v4.3.1
70+
- uses: CodSpeedHQ/action@v4.11.1
7171
with:
7272
token: ${{ secrets.CODSPEED_TOKEN }}
7373
# allow updating snapshots due to indeterministic benchmarks

Cargo.lock

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

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ ordered-float = "5"
3636
uuid = { version = "1.18", features = ["v4"] }
3737
rayon = "1.11"
3838
base64 = "0.22.1"
39-
tempfile = "3.24.0"
4039

4140
# Use patched version of egglog in experimental
4241
[patch.'https://github.com/egraphs-good/egglog']

docs/explanation/2026_02_containers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ GradientBending_distributed = gradient_egraph.extract(GradientBending)
435435
FunctionBending_distributed
436436
```
437437

438-
We now have an expression that is mainly a sum of products, a multivariate polyonimal.
438+
We now have an expression that is mainly a sum of products, a multivariate polynomial.
439439

440440
For some sense of their size, the `FunctionBending` has initial cost of 401 and the `GradientBending` has 20,570.
441441
This cost is produced by the Egglog extractor, corresponding roughly to one node per op like `*` and one per variable as a tree.

python/egglog/builtins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ def dict(cls, *keys_and_values: object) -> PyObject: ...
12071207

12081208

12091209
@function(builtin=True, egg_fn="py-eval")
1210-
def py_eval(code: StringLike, globals: object = PyObject.dict(), locals: object = PyObject.dict()) -> PyObject: ...
1210+
def py_eval(code: StringLike, globals_: object = PyObject.dict(), locals_: object = PyObject.dict()) -> PyObject: ...
12111211

12121212

12131213
class PyObjectFunction(Protocol):
@@ -1226,7 +1226,7 @@ def py_eval_fn(fn: Callable) -> PyObjectFunction:
12261226

12271227

12281228
@function(builtin=True, egg_fn="py-exec")
1229-
def py_exec(code: StringLike, globals: object = PyObject.dict(), locals: object = PyObject.dict()) -> PyObject:
1229+
def py_exec(code: StringLike, globals_: object = PyObject.dict(), locals_: object = PyObject.dict()) -> PyObject:
12301230
"""
12311231
Copies the locals, execs the Python code, and returns the locals with any updates.
12321232
"""

python/egglog/conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ def resolve_literal(
228228
if isinstance(arg, RuntimeExpr) and tp.matches_just({}, arg.__egg_typed_expr__.tp):
229229
return arg
230230
tp_just = tp.to_just()
231-
arg_type = resolve_type(arg)
232231
if arg is DUMMY_VALUE:
233232
return RuntimeExpr.__from_values__(decls(), TypedExprDecl(tp_just, DummyDecl()))
233+
arg_type = resolve_type(arg)
234234
if (conversion := _lookup_conversion(arg_type, tp_just)) is not None:
235235
with with_type_args(tp_just.args, decls):
236236
return conversion[1](arg)

python/egglog/declarations.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,11 @@ class EGraphDecl:
377377
def __hash__(self) -> int:
378378
return hash((
379379
type(self),
380-
tuple(self.let_bindings.items()),
381-
tuple((value, tp, exprs) for value, (tp, exprs) in self.e_classes.items()),
382-
tuple(self.sets.items()),
380+
frozenset(self.let_bindings.items()),
381+
frozenset((value, tp, exprs) for value, (tp, exprs) in self.e_classes.items()),
382+
frozenset(self.sets.items()),
383383
self.expr_actions,
384-
tuple(self.costs.items()),
384+
frozenset(self.costs.items()),
385385
self.subsumed,
386386
))
387387

@@ -509,7 +509,7 @@ def to_grounded(expr: ExprDecl) -> ExprDecl:
509509
)
510510
actions.extend(ChangeDecl(tp, cast("CallDecl", to_grounded(call)), "subsume") for tp, call in self.subsumed)
511511

512-
# Now add any remaining call s that weren't part of any other actions
512+
# Now add any remaining calls that weren't part of any other actions
513513
actions.extend(
514514
ExprActionDecl(TypedExprDecl(tp, to_grounded(expr)))
515515
for (tp, expr) in single_e_class_calls

python/egglog/deconstruct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def _deconstruct_call_decl(
189189
), arg_exprs
190190
egg_bound = (
191191
JustTypeRef(call.callable.ident, call.bound_tp_params)
192-
if isinstance(call.callable, (ClassMethodRef, MethodRef, InitRef)) and call.bound_tp_params
192+
if isinstance(call.callable, (ClassMethodRef, MethodRef)) and call.bound_tp_params
193193
else None
194194
)
195195

python/egglog/egraph_state.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class EGraphState:
8383

8484
def copy(self) -> EGraphState:
8585
"""
86-
Returns a copy of the state. Th egraph reference is kept the same. Used for pushing/popping.
86+
Returns a copy of the state. The egraph reference is kept the same. Used for pushing/popping.
8787
"""
8888
return EGraphState(
8989
egraph=self.egraph,
@@ -802,7 +802,7 @@ def value_to_expr(self, tp: JustTypeRef, value: bindings.Value) -> ExprDecl: #
802802
def _unstable_fn_value_to_expr(
803803
self, name: str, partial_args: list[bindings.Value], return_tp: JustTypeRef, _arg_types: list[JustTypeRef]
804804
) -> PartialCallDecl:
805-
# Similar to FromEggState::from_call but accepts partial list of args and returns in values
805+
# Similar to FromEggState::from_call but reconstructs a partial application from serialized values.
806806
# Find first callable ref whose return type matches and fill in arg types.
807807
for callable_ref in self.egg_fn_to_callable_refs[name]:
808808
signature = self.__egg_decls__.get_callable_decl(callable_ref).signature

python/egglog/exp/array_api_jit.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ def jit(
3737
try:
3838
return cast("X", egraph.extract(fn_program.as_py_object).value)
3939
except bindings.EggSmolError as e:
40-
e.add_note(f"Failed to get py object from {egraph.extract(fn_program)}")
40+
try:
41+
debug_program = egraph.extract(fn_program)
42+
except bindings.EggSmolError:
43+
debug_program = fn_program
44+
e.add_note(f"Failed to get py object from {debug_program}")
4145
raise
4246

4347

0 commit comments

Comments
 (0)