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

Implements a reindexing transformation #636

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ jobs:
( test_py_project )
( test_py_project )

pytest_with_barvinok:
name: Conda Pytest with Barvinok
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Main Script"
run: |
CONDA_ENVIRONMENT=.test-conda-env-py3.yml
echo "- barvinok" >> "$CONDA_ENVIRONMENT"
curl -L -O https://tiker.net/ci-support-v0
. ./ci-support-v0
build_py_project_in_conda_env
test_py_project

examples:
name: Conda Examples
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions doc/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,13 @@ Here's a Bibtex entry for your convenience::
doi = "{10.1145/2627373.2627387}",
}

References
==========

.. [Seghir_2006] Seghir and Loechner, Proceedings of the 2006 International
Conference on Compilers, Architecture and Synthesis for Embedded systems,
`(DOI) <https://doi.org/10.1145/1176760.1176771>`__

Getting help
============

Expand Down
2 changes: 2 additions & 0 deletions doc/ref_transform.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Influencing data access

.. autofunction:: allocate_temporaries_for_base_storage

.. automodule:: loopy.transform.reindex

Padding Data
------------

Expand Down
4 changes: 4 additions & 0 deletions loopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
from loopy.transform.fusion import fuse_kernels
from loopy.transform.concatenate import concatenate_arrays

from loopy.transform.reindex import reindex_temporary_using_seghir_loechner_scheme

from loopy.transform.arithmetic import (
fold_constants,
collect_common_factors_on_increment)
Expand Down Expand Up @@ -239,6 +241,8 @@

"fold_constants", "collect_common_factors_on_increment",

"reindex_temporary_using_seghir_loechner_scheme",

"split_array_axis", "split_array_dim", "split_arg_axis",
"find_padding_multiple", "add_padding",

Expand Down
28 changes: 27 additions & 1 deletion loopy/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"""


from typing import ClassVar, Tuple
from typing import ClassVar, Tuple, Union
from functools import reduce, cached_property
from sys import intern
import re
Expand Down Expand Up @@ -69,6 +69,7 @@
from loopy.diagnostic import LoopyError
from loopy.diagnostic import (ExpressionToAffineConversionError,
UnableToDetermineAccessRangeError)
from loopy.typing import ExpressionT


__doc__ = """
Expand Down Expand Up @@ -2792,4 +2793,29 @@ def is_tuple_of_expressions_equal(a, b):

# }}}


def _is_isl_set_universe(isl_set: Union[isl.BasicSet, isl.Set]):
if isinstance(isl_set, isl.BasicSet):
return isl_set.is_universe()
else:
assert isinstance(isl_set, isl.Set)
return isl_set.complement().is_empty()


def pw_qpolynomial_to_expr(pw_qpoly: isl.PwQPolynomial
) -> ExpressionT:
from pymbolic.primitives import If

result = 0

for bset, qpoly in reversed(pw_qpoly.get_pieces()):
if _is_isl_set_universe(bset):
result = qpolynomial_to_expr(qpoly)
else:
result = If(set_to_cond_expr(bset),
qpolynomial_to_expr(qpoly),
result)

return result

# vim: foldmethod=marker
Loading