Skip to content

Commit

Permalink
restore loop inference fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Jul 18, 2024
1 parent a83410f commit bfd22a5
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions arraycontext/impl/pyopencl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,33 @@ def transform_loopy_program(self, t_unit):
"to create this kernel?")

all_inames = default_entrypoint.all_inames()

# FIXME: This could be much smarter.
inner_iname = None

if "i0" in all_inames:
# import with underscore to avoid DeprecationWarning
# from arraycontext.metadata import _FirstAxisIsElementsTag
from meshmode.transform_metadata import FirstAxisIsElementsTag

if (len(default_entrypoint.instructions) == 1
and isinstance(default_entrypoint.instructions[0], lp.Assignment)
and any(isinstance(tag, FirstAxisIsElementsTag)
# FIXME: Firedrake branch lacks kernel tags
for tag in getattr(default_entrypoint, "tags", ()))):
stmt, = default_entrypoint.instructions

out_inames = [v.name for v in stmt.assignee.index_tuple]
assert out_inames
outer_iname = out_inames[0]
if len(out_inames) >= 2:
inner_iname = out_inames[1]

elif "iel" in all_inames:
outer_iname = "iel"

if "idof" in all_inames:
inner_iname = "idof"

elif "i0" in all_inames:
outer_iname = "i0"

if "i1" in all_inames:
Expand Down

0 comments on commit bfd22a5

Please sign in to comment.