Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add (non-)reproducer for einsum tag cycle #584

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

inducer
Copy link
Owner

@inducer inducer commented Feb 19, 2025

In https://notes.tiker.net/gd2gcUW3RSqMS_fPfM_RrA, @nicknytko reported a crash with the following traceback:

Traceback (most recent call last):
  File "/home/nnytko2/ceesd-nonlinear-solve/code/amg.py", line 508, in <module>
    mg = MultigridDGHierarchy(dcoll)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nnytko2/ceesd-nonlinear-solve/code/amg.py", line 435, in __init__
    next_level = self.levels[-1].coarsen()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nnytko2/ceesd-nonlinear-solve/code/amg.py", line 336, in coarsen
    Mc = actx.to_numpy(self.galerkin(self.M))
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nnytko2/emirge/arraycontext/arraycontext/impl/pytato/__init__.py", line 383, in to_numpy
    self._rec_map_container(_to_numpy, self.freeze(array)),
                                       ^^^^^^^^^^^^^^^^^^
  File "/home/nnytko2/emirge/arraycontext/arraycontext/impl/pytato/__init__.py", line 520, in freeze
    transformed_dag = self.transform_dag(normalized_expr)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nnytko2/emirge/meshmode/meshmode/array_context.py", line 1444, in transform_dag
    dag = unify_discretization_entity_tags(dag)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nnytko2/emirge/meshmode/meshmode/pytato_utils.py", line 108, in unify_discretization_entity_tags
    return pt.unify_axes_tags(expr,
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nnytko2/emirge/pytato/pytato/transform/metadata.py", line 776, in unify_axes_tags
    propagation_graph = undirected_graph_from_edges(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nnytko2/emirge/miniforge3/envs/ceesd/lib/python3.12/site-packages/pytools/graph.py", line 557, in undirected_graph_from_edges
    raise TypeError("Found loop in edges,"
TypeError: Found loop in edges, LHS, RHS = ax_2

This PR is an attempt to reproduce the issue, without success (but as you can see, I'm guessing at the details).

@nicknytko, is there anything essential missing from the test case?

cc @a-alveyblanc (as @nicknytko mentioned you were involved in the discussion). @nicknytko mentioned that you had a fix in grudge, but that may not be enough: no matter what the tagging situation is, the crash above should not happen.

@a-alveyblanc
Copy link
Contributor

IIRC, the error I saw had to do with missing axis tags not with a cycle but I could be mistaken. I'll take a closer look at this sometime today, thanks for the mention

@nicknytko
Copy link

IIRC, the error I saw had to do with missing axis tags not with a cycle but I could be mistaken. I'll take a closer look at this sometime today, thanks for the mention

Yep, this is different from what I was asking you about the other day, maybe I wasn’t super clear at yesterday’s meeting (sorry!)

I get this error when I compute galerkin products P^T A P, let me get a minimal example to repro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants