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

Restore loop inference fallback #269

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ implementations for:
- Profiling

``arraycontext`` started life as an array abstraction for use with the
`meshmode <https://documen.tician.de/meshmode/>`__ unstrucuted discretization
`meshmode <https://documen.tician.de/meshmode/>`__ unstructured discretization
package.

Distributed under the MIT license.
Expand Down
24 changes: 23 additions & 1 deletion arraycontext/impl/pyopencl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,31 @@ def transform_loopy_program(self, t_unit):

all_inames = default_entrypoint.all_inames()

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

if "i0" in all_inames:
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
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ git+https://github.com/inducer/islpy.git#egg=islpy

git+https://github.com/inducer/loopy.git#egg=loopy
git+https://github.com/inducer/pytato.git#egg=pytato

git+https://github.com/inducer/meshmode.git#egg=meshmode
Loading