Skip to content
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
2,800 changes: 56 additions & 2,744 deletions .basedpyright/baseline.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
# loopy
"InameStr": "obj:loopy.typing.InameStr",
"InameStrSet": "obj:loopy.typing.InameStrSet",
"ToInameStrSetConvertible": "obj:loopy.typing.ToInameStrSetConvertible",
"KernelIname": "obj:loopy.kernel.data.Iname",
"LoopNestTree": "obj:loopy.schedule.tools.LoopNestTree",
"LoopTree": "obj:loopy.schedule.tools.LoopTree",
Expand Down
8 changes: 4 additions & 4 deletions doc/ref_kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ Values of domain parameters arise from
Iname Implementation Tags
^^^^^^^^^^^^^^^^^^^^^^^^^

=============================== ====================================================
=============================== ======================================================
Tag Meaning
=============================== ====================================================
=============================== ======================================================
``None`` | ``"for"`` Sequential loop
``"ord"`` Forced-order sequential loop
``"l.N"`` Local (intra-group) axis N ("local")
Expand All @@ -205,8 +205,8 @@ Tag Meaning
``"ilp"`` | ``"ilp.unr"`` Unroll using instruction-level parallelism
``"ilp.seq"`` Realize parallel iname as innermost loop
``"like.INAME"`` Can be used when tagging inames to tag like another
``"unused.g"`` | ``"unused.l"`` Can be to tag as the next unused group/local axis
=============================== ====================================================
``"unused.g"`` | ``"unused.l"`` Can be used to tag as the next unused group/local axis
=============================== ======================================================

(Throughout this table, `N` must be replaced by an actual, zero-based number.)

Expand Down
42 changes: 17 additions & 25 deletions loopy/isl_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""isl helpers"""

from __future__ import annotations


Expand Down Expand Up @@ -50,13 +51,14 @@

if len(pieces) == 0:
raise RuntimeError("PwAff does not have any pieces")

if len(pieces) > 1:
_, first_aff = pieces[0]
for _, other_aff in pieces[1:]:
if not first_aff.plain_is_equal(other_aff):
raise NotImplementedError("only single-valued piecewise affine "
"expressions are supported here--encountered "
"multi-valued expression '%s'" % pw_aff)
f"multi-valued expression '{pw_aff}'")

return first_aff

Expand All @@ -65,34 +67,24 @@

# {{{ make_slab

def make_slab(space, iname, start, stop, iname_multiplier=1):
def make_slab(space: isl.Space,
iname: str | tuple[dim_type, int],
start: isl.Aff | isl.PwAff | ArithmeticExpression,
stop: isl.Aff | isl.PwAff | ArithmeticExpression,
iname_multiplier: int = 1) -> isl.BasicSet:
"""
Returns an instance of :class:`islpy._isl.BasicSet`, which satisfies the
constraint ``start <= iname_multiplier*iname < stop``.

:arg space: An instance of :class:`islpy._isl.Space`.

:arg iname:

Either an instance of :class:`str` as a name of the ``iname`` or a
:arg iname: Either an instance of :class:`str` as a name of the ``iname`` or a
tuple of ``(iname_dt, iname_dx)`` indicating the *iname* in the space.

:arg start:

An instance of :class:`int` or an instance of
:class:`islpy._isl.Aff` indicating the lower bound of
``iname_multiplier*iname``(inclusive).

:arg stop:

An instance of :class:`int` or an instance of
:class:`islpy._isl.Aff` indicating the upper bound of
``iname_multiplier*iname``.

:arg iname_multiplier:

A strictly positive :class:`int` denoting *iname*'s coefficient in the
above inequality expression.
:arg start: An instance of :class:`int` or an instance of :class:`islpy._isl.Aff`
indicating the lower bound of ``iname_multiplier*iname``(inclusive).
:arg stop: An instance of :class:`int` or an instance of :class:`islpy._isl.Aff`
indicating the upper bound of ``iname_multiplier*iname``.
:arg iname_multiplier: A strictly positive :class:`int` denoting *iname*'s
coefficient in the above inequality expression.
"""
zero = isl.Aff.zero_on_domain(space)

Expand Down Expand Up @@ -195,7 +187,7 @@
if i == j:
continue

if aff_i.gist(dom_j).is_equal(aff_j):

Check warning on line 190 in loopy/isl_helpers.py

View workflow job for this annotation

GitHub Actions / Conda Pytest Twice (for cache behavior)

Aff.is_equal with implicit conversion of self to PwAff is deprecated and will stop working in 2026. Explicitly convert to PwAff, using .to_pw_aff().

Check warning on line 190 in loopy/isl_helpers.py

View workflow job for this annotation

GitHub Actions / Conda Pytest Twice (for cache behavior)

Aff.is_equal with implicit conversion of self to PwAff is deprecated and will stop working in 2026. Explicitly convert to PwAff, using .to_pw_aff().

Check warning on line 190 in loopy/isl_helpers.py

View workflow job for this annotation

GitHub Actions / Conda Pytest (macos-latest)

Aff.is_equal with implicit conversion of self to PwAff is deprecated and will stop working in 2026. Explicitly convert to PwAff, using .to_pw_aff().

Check warning on line 190 in loopy/isl_helpers.py

View workflow job for this annotation

GitHub Actions / Conda Pytest (macos-latest)

Aff.is_equal with implicit conversion of self to PwAff is deprecated and will stop working in 2026. Explicitly convert to PwAff, using .to_pw_aff().

Check warning on line 190 in loopy/isl_helpers.py

View workflow job for this annotation

GitHub Actions / Conda Pytest (macos-latest)

Aff.is_equal with implicit conversion of self to PwAff is deprecated and will stop working in 2026. Explicitly convert to PwAff, using .to_pw_aff().

Check warning on line 190 in loopy/isl_helpers.py

View workflow job for this annotation

GitHub Actions / Conda Pytest (macos-latest)

Aff.is_equal with implicit conversion of self to PwAff is deprecated and will stop working in 2026. Explicitly convert to PwAff, using .to_pw_aff().

Check warning on line 190 in loopy/isl_helpers.py

View workflow job for this annotation

GitHub Actions / Conda Pytest (macos-latest)

Aff.is_equal with implicit conversion of self to PwAff is deprecated and will stop working in 2026. Explicitly convert to PwAff, using .to_pw_aff().

Check warning on line 190 in loopy/isl_helpers.py

View workflow job for this annotation

GitHub Actions / Conda Pytest (macos-latest)

Aff.is_equal with implicit conversion of self to PwAff is deprecated and will stop working in 2026. Explicitly convert to PwAff, using .to_pw_aff().

Check warning on line 190 in loopy/isl_helpers.py

View workflow job for this annotation

GitHub Actions / Conda Pytest (macos-latest)

Aff.is_equal with implicit conversion of self to PwAff is deprecated and will stop working in 2026. Explicitly convert to PwAff, using .to_pw_aff().

Check warning on line 190 in loopy/isl_helpers.py

View workflow job for this annotation

GitHub Actions / Conda Pytest (macos-latest)

Aff.is_equal with implicit conversion of self to PwAff is deprecated and will stop working in 2026. Explicitly convert to PwAff, using .to_pw_aff().
# aff_i is sufficient to cover aff_j, eliminate aff_j
new_pieces = pieces[:]
if i < j:
Expand Down Expand Up @@ -245,8 +237,8 @@
if len(pieces) == 1:
(_, result), = pieces
if constants_only and not result.is_cst():
raise StaticValueFindingError("a numeric %s was not found for PwAff '%s'"
% (what, pw_aff))
raise StaticValueFindingError(
f"a numeric {what} was not found for PwAff '{pw_aff}'")
return result

from pytools import flatten, memoize
Expand Down
4 changes: 2 additions & 2 deletions loopy/kernel/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def parse_tag(tag: ToInameTagConvertible) -> Tag | None:
return tag

if not isinstance(tag, str):
raise ValueError("cannot parse tag: %s" % tag)
raise ValueError(f"cannot parse tag: {tag!r}")

if tag == "for":
return None
Expand Down Expand Up @@ -342,7 +342,7 @@ def parse_tag(tag: ToInameTagConvertible) -> Tag | None:
else:
return LocalInameTag(int(axis))
else:
raise ValueError("cannot parse tag: %s" % tag)
raise ValueError(f"cannot parse tag: {tag!r}")

# }}}

Expand Down
1 change: 1 addition & 0 deletions loopy/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ def parse_stack_match(smatch: ToStackMatchConvertible) -> ConcreteStackMatch:

if isinstance(smatch, ConcreteStackMatch):
return smatch

if isinstance(smatch, MatchExpressionBase):
return ConcreteStackMatch(
StackItemMatchComponent(
Expand Down
Loading
Loading