How to define a UnionMap using modulos with parameter

14 views
Skip to first unread message

Pedro Silvestre

unread,
Nov 15, 2023, 1:27:34 PM11/15/23
to isl Development
Hello,

First off, let me express my gratitude for all the work put into isl. It really is a very impressive project.

I'm using isl through islpy, where I am attempting to define a UnionMap that uses a parameter as the right-hand-side argument to modulos, however, it seems that this is not possible as it is rejected. 

This works:
    >>> isl.UnionMap.read_from_str(isl.Context(), "[A] -> {S0[a] -> S1[(a+1)%3]}")
    UnionMap("[A] -> { S0[a] -> S1[o0] : (-1 - a + o0) mod 3 = 0 and 0 <= o0 <= 2 }")

But this does not:
    >>> isl.UnionMap.read_from_str(isl.Context(), "[A] -> {S0[a] -> S1[(a+1) mod A]}")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    islpy._isl.Error: call to isl_union_map_read_from_str failed: syntax error in     /project/isl/isl_stream.c:149

I'm wondering if this is a limitation of isl, or if there is some workaround I can use to achieve the desired formula. Thank you for any help in advance and excuse my formatting, as I am not too familiar with dev mailing lists.

Cheers,
Pedro

Sven Verdoolaege

unread,
Nov 15, 2023, 3:43:03 PM11/15/23
to Pedro Silvestre, isl Development
On Wed, Nov 15, 2023 at 06:30:29AM -0800, Pedro Silvestre wrote:
> But this does not:
> >>> isl.UnionMap.read_from_str(isl.Context(), "[A] -> {S0[a] ->
> S1[(a+1) mod A]}")

This is not a (quasi-)affine expression, so it cannot be represented by isl.

skimo
Reply all
Reply to author
Forward
0 new messages