isl_basic_set_get_hash not in headers

19 views
Skip to first unread message

Matthias Diener

unread,
Jul 12, 2023, 2:03:29 PM7/12/23
to isl Development
Hello, 

I recently noticed that isl_basic_set_get_hash is not exposed in ISL's header files, in contrast to isl_set_get_hash and isl_union_set_get_hash. Is this intentional?

There are potential external users that could benefit from it, see e.g. https://github.com/inducer/islpy/issues/102

Thank you,
Matthias

Sven Verdoolaege

unread,
Jul 12, 2023, 2:52:24 PM7/12/23
to Matthias Diener, isl Development
On Wed, Jul 12, 2023 at 10:55:00AM -0700, Matthias Diener wrote:
> Hello,
>
> I recently noticed that isl_basic_set_get_hash is not exposed in ISL's
> header files, in contrast to isl_set_get_hash and isl_union_set_get_hash.
> Is this intentional?

It looks like isl_set_get_hash and isl_union_set_get_hash were exposed
by mistake since these functions are not documented.

I think this has come up before, but I can't find it in the archives.

In any case, these functions are probably not very useful.
The hash value depends on the representation of the set and
the representation of the set may change through operations
on _other_ sets (that just happen to be partially the same).

skimo

Matthias Diener

unread,
Jul 13, 2023, 12:42:37 PM7/13/23
to sven.ver...@gmail.com, isl Development
On Wed, Jul 12, 2023 at 1:52 PM Sven Verdoolaege
<sven.ver...@telenet.be> wrote:
>
> On Wed, Jul 12, 2023 at 10:55:00AM -0700, Matthias Diener wrote:
> > Hello,
> >
> > I recently noticed that isl_basic_set_get_hash is not exposed in ISL's
> > header files, in contrast to isl_set_get_hash and isl_union_set_get_hash.
> > Is this intentional?
>
> In any case, these functions are probably not very useful.
> The hash value depends on the representation of the set and
> the representation of the set may change through operations
> on _other_ sets (that just happen to be partially the same).

Thank you for the clarification. Do you happen to have a short example
that illustrates this hash change?
Also, does this affect other hashing functions, e.g. for maps?

Matthias

Sven Verdoolaege

unread,
Jul 14, 2023, 1:51:23 PM7/14/23
to Matthias Diener, isl Development
If you run something like the following using the python bindings

import isl
s1 = isl.set("{ [i=4:5] : i mod 3 <= 1 and i = i }")
s2 = isl.set("{ [i=15:] : i mod 3 <= 1 }")
s3 = s1.union(s2)
print(s1)
print(s3.affine_hull())
print(s1)

then you'll see that the first print(s1) prints

{ [i] : 4 <= i <= 5 and 3*floor((i)/3) >= -1 + i }

while the second prints

{ [i = 4] }

The hash values are pretty much guaranteed to be different.

> Also, does this affect other hashing functions, e.g. for maps?

I guess isl_id_get_hash and isl_val_get_hash should be pretty stable.
For all other objects, the hash value may change.

skimo
Reply all
Reply to author
Forward
0 new messages