isl_aff.c:5204: map is not single-valued

20 views
Skip to first unread message

Michael Kruse

unread,
Apr 5, 2026, 9:00:55 PM (4 days ago) Apr 5
to isl Development
Hi,

this is a report derived from a crash in Polly:
https://github.com/llvm/llvm-project/issues/190459

isl_pw_multi_aff_from_set reports "map is not single-valued" on a map
that is single-valued.

The map is:

[p_0] -> { MemRef0[i0] : (i0 = 64 + 8p_0 and p_0 < 0) or (exists (e0 =
floor((-8p_0 + i0)/64): 64e0 = -8p_0 + i0 and i0 >= 0 and i0 <= 24)) }

which is equivalent to

[p_0] -> {
MemRef0[0] : (p_0) mod 8 = 0;
MemRef0[8] : (7 + p_0) mod 8 = 0;
MemRef0[16] : (6 + p_0) mod 8 = 0;
MemRef0[24] : (5 + p_0) mod 8 = 0;
MemRef0[32] : (4 + p_0) mod 8 = 0;
MemRef0[40] : (3 + p_0) mod 8 = 0;
MemRef0[48] : (2 + p_0) mod 8 = 0;
MemRef0[56] : (1 + p_0) mod 8 = 0
}

Whether it is reported as "single-valued" depends on which previous
(logically read-only) operations were applied to the set. In the
attached isltrace.c `-DFIX_CRASH` enables such code.

```
$ gcc isltrace.c -I ~/src/isl/include -I
~/build/isl/release_cmake/include ~/build/isl/release_cmake/libisl.a
-o isltrace -lgmp && ./isltrace
### ISL version : isl-0.27-358-g73247f6c-GMP-cmake
### at generation: isl-0.27-89-gdc16f8e3-IMath-32
Crash expected here:
../../../src/isl/isl_aff.c:5204: map is not single-valued
Aborted (core dumped)

$ gcc isltrace.c -I ~/src/isl/include -I
~/build/isl/release_cmake/include ~/build/isl/release_cmake/libisl.a
-o isltrace -DFIX_CRASH -lgmp
$ ./isltrace
$ gcc isltrace.c -I ~/src/isl/include -I
~/build/isl/release_cmake/include ~/build/isl/release_cmake/libisl.a
-o isltrace -DFIX_CRASH -lgmp && ./isltrace
### ISL version : isl-0.27-358-g73247f6c-GMP-cmake
### at generation: isl-0.27-89-gdc16f8e3-IMath-32
Crash expected here:
Not crashed?
```
```

The crash reduces to the attached isltrace-reduced.c

```
gcc isltrace-reduced.c -I ~/src/isl/include -I
~/build/isl/release_cmake/include ~/build/isl/release_cmake/libisl.a
-o isltrace -lgmp && ./isltrace
### ISL version : isl-0.27-358-g73247f6c-GMP-cmake
### at generation: isl-0.27-89-gdc16f8e3-IMath-32
Crash expected here:
../../../src/isl/isl_aff.c:5204: map is not single-valued
Aborted (core dumped)
```

I do not know which call within the FIX_CRASH region changes the
behavior. My best guess so far is that some function after some
analysis sets a flag on a copy of the set which should be logically
transparent, but isl_pw_multi_aff_from_set/ forgets to run that
analysis beforehand.

Michael

--
Tardyzentrismus verboten!
isltrace.c
isltrace-reduced.c

Sven Verdoolaege

unread,
Apr 6, 2026, 9:08:01 AM (3 days ago) Apr 6
to re...@meinersbur.de, isl Development
On Mon, Apr 06, 2026 at 03:00:14AM +0200, Michael Kruse wrote:
> Hi,
>
> this is a report derived from a crash in Polly:
> https://github.com/llvm/llvm-project/issues/190459
>
> isl_pw_multi_aff_from_set reports "map is not single-valued" on a map
> that is single-valued.
>
> The map is:
>
> [p_0] -> { MemRef0[i0] : (i0 = 64 + 8p_0 and p_0 < 0) or (exists (e0 =
> floor((-8p_0 + i0)/64): 64e0 = -8p_0 + i0 and i0 >= 0 and i0 <= 24)) }
>
> which is equivalent to
>
> [p_0] -> {
> MemRef0[0] : (p_0) mod 8 = 0;
> MemRef0[8] : (7 + p_0) mod 8 = 0;
> MemRef0[16] : (6 + p_0) mod 8 = 0;
> MemRef0[24] : (5 + p_0) mod 8 = 0;
> MemRef0[32] : (4 + p_0) mod 8 = 0;
> MemRef0[40] : (3 + p_0) mod 8 = 0;
> MemRef0[48] : (2 + p_0) mod 8 = 0;
> MemRef0[56] : (1 + p_0) mod 8 = 0
> }

I don't quite understand.
Clearly, these two sets are not equivalent.
The first can contain negative elements, e.g.,
[p_0] -> { MemRef0[i0 = -8] : p_0 = -9 }.

Also, the first is _not_ a singleton. For example, for p_0 = -16,
it contains

[p_0] -> { MemRef0[i0 = 0] : p_0 = -16; MemRef0[i0 = -64] : p_0 = -16 }


> Whether it is reported as "single-valued" depends on which previous
> (logically read-only) operations were applied to the set. In the
> attached isltrace.c `-DFIX_CRASH` enables such code.

Are you saying that the set above is incorrectly considered
to be a singleton in the `-DFIX_CRASH` case?

skimo

Sven Verdoolaege

unread,
Apr 6, 2026, 9:24:01 AM (3 days ago) Apr 6
to re...@meinersbur.de, isl Development
On Mon, Apr 06, 2026 at 03:07:56PM +0200, 'Sven Verdoolaege' via isl Development wrote:
> Are you saying that the set above is incorrectly considered
> to be a singleton in the `-DFIX_CRASH` case?

With `-DFIX_CRASH`, isl_pw_multi_aff_from_set is called on
the set

[p_0] -> { MemRef0[i0] : (exists (e0 = floor((-8p_0 + i0)/64): 64e0 = -8p_0 + i0 and i0 >= 32 and i0 <= 56)) or (exists (e0 = floor((-8p_0 + i0)/64): 64e0 = -8p_0 + i0 and i0 >= 0 and i0 <= 24)) }

This one _is_ a singleton.

skimo
Reply all
Reply to author
Forward
0 new messages