inducer / inducer/loopy

LoopyKeyBuilder: hash for BasicSet differs for objects that compare equal

Open
#912 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
636
Forks
81
Avg merge
1d 19h
Merged PRs (30d)
7

Description

```python
import islpy as isl

a=isl.BasicSet("[im_w, im_h, nimgs, nfeats] -> { : im_w >= 7 and im_h >= 7 and nimgs >= 0 and nfeats > 0 }")

b=isl.BasicSet("[nfeats, nimgs, im_h, im_w] -> { : nfeats > 0 and nimgs >= 0 and im_h >= 7 and im_w >= 7 }")

from loopy.tools import LoopyKeyBuilder

assert a == b
assert LoopyKeyBuilder()(a) == LoopyKeyBuilder()(b)
```

```console
$ python set.py
Traceback (most recent call last):
File "/Users/mdiener/Work/e12test/loopy/set.py", line 12, in
assert LoopyKeyBuilder()(a) == LoopyKeyBuilder()(b)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
```

The same issue exists with `hash()`, as well as `Set`(including `Set.get_hash`).

cc: #576, #828, https://github.com/inducer/islpy/issues/89

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with loopy.tools.LoopyKeyBuilder and inspect how it hashes isl.BasicSet and Set objects, including Set.get_hash; the supplied reproducer shows the failing case. Compare the hash paths for equal objects and use that reproducer to verify that equal BasicSet and Set values produce equal hashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.