Commit 9367864
authored
Fix: Memlets in StripMining transformation (spcl#2118)
**Bug Description:**
To put it simple, the `StripMining` transformation essentially performs
tiling- that is, it adds a **new outer** map which encloses
an existing one, where the new map runs over chunks (=tiles) of the
original iteration space, while the inner map handles
individual elements inside each chunk. The inner map is the original
map, where the range just go adapted.
Now, the new (outer) map needs to be connected to the original one, and
the dataflow between them must be captured correctly.
This essentially involves analyzing which parts of a data descriptor
should flow for each chunk. For the sake of simplicity, one
can think of this process as: copying an existing memlet (flowing to and
from the original inner map) and update it to create
the correct memlets between the two maps. The screenshots below help
visualize this - you can clearly see the similarity
between the two highlighted memlets.
However, this copying step is problematic when an `other_subset` is
present - in such cases, it should be explicitly set to `None` for
the newly created memlet. Otherwise there can be a dimensionality
mismatch between the two subsets leading to an invalid SDFG.
**Fix Description**
Set the `other_subset` to `None` for memlets created between the two
maps. Additionally, a test case has been added which now passes and
would have failed before this fix.
**Failing Example**
After the fix, ```[0] -> A[block_i : Min(63, block_i + 31) + 1]``` in
the right image will become
```A[block_i : Min(63, block_i + 31) + 1]```.
<p float="left">
<img width="45%" src="https://github.com/user-attachments/assets/33c14e92-43c6-4d93-a77e-87691fa8f9b8" />
<img width="45%" src="https://github.com/user-attachments/assets/76b7f030-91c6-424d-a91b-3ba9df710840" />
</p>1 parent 16a159b commit 9367864
2 files changed
Lines changed: 57 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| 400 | + | |
400 | 401 | | |
401 | 402 | | |
402 | 403 | | |
| |||
442 | 443 | | |
443 | 444 | | |
444 | 445 | | |
| 446 | + | |
445 | 447 | | |
446 | 448 | | |
447 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
0 commit comments