-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in RefineNestedAccess
and SDFGState._read_and_write_sets()
#1643
Comments
SDFGState.read_and_write_sets()
SDFGState.read_and_write_sets()
SDFGState.read_and_write_sets()
RefineNestedAccess
RefineNestedAccess
RefineNestedAccess
and SDFGState._read_and_write_sets()
It turned out, it does not run, there was an error in the |
…t is maintained and when not. However, this has some consequences. I added a test, that shows that this leads, depending on the memlet configuration to different outcome of the transformation. Okay, it is only affects if the transformation can be applied or not, but still. This is also in line with my [issue#1643](spcl#1643) that shows that this is a problem.
See also commit e1f2bf6 for an example where this behaviour is kicking in. |
Prune connectors is one of the transformations that has repeatedly caused problems and I believe is not currently used because of it. Maybe we should deprecate or fix @phschaad ? |
Do you mean |
If PC is indeed the issue, I would vote for fixing since I understand that it still serves a purpose, but to be honest I am not very familiar with either PC or RNA.. |
@lukastruemper Has made some fixes to the transformation, he can probably give more insights. |
During my work on the [new map fusion](#1643) I discovered a bug in `SDFGState._read_and_write_set()`. Originally I solved it there, but it was decided to move it into its own PR. Lets look at the first, super silly example, that is not useful on its own. The main point here, is that the `data` attribute of the Memlet does not refer to the source of the connection but of the destination. ![test_1](https://github.com/user-attachments/assets/740ee4fc-cfe5-4844-a999-e316cb8f9c16) BTW: The Webviewer outputs something like `B[0] -> [0, 0]` however, the parser of the Memlet constructor does not understand this, it must be written as `B[0] -> 0, 0`, i.e. the second set of brackets must be omitted, this should be changed! From the above we would expect the following sets: - Reads: - `A`: `[Range (0, 0)]` - `B`: Should not be listed in this set, because it is fully read and written, thus it is excluded. - Writes - `B`: `[Range (0)]` - `C`: `[Range (0, 0), Range (1, 1)]` However, the current implementation gives us: - Reads: `{'A': [Range (0)], 'B': [Range (1, 1)]}` - Write: `{'B': [Range (0)], 'C': [Range (1, 1), Range (0)]}` The current behaviour is wrong because: - `A` is a `2x2` array, thus the read set should also have two dimensions. - `B` inside the read set, it is a scalar, but the range has two dimensions, furthermore, it is present at all. - `C` the first member of the write set (`Range(1, 1)`) is correct, while the second (`Range(0)`) is horrible wrong. The second example is even more simple. ![test_2](https://github.com/user-attachments/assets/da3d03af-6f10-411f-952e-ab057ed057c6) From the SDFG we expect the following sets: - Reads: - `A`: `[Range(0, 0)]` - Writes: - `B`: `[Range(0)]` It is important that in the above example `other_subset` is `None` and `data` is set to `A`, so it is not one of these "crazy" non standard Memlets we have seen in the first test. However, the current implementation gives us: - Reads: `{'A': [Range (0, 0)]}` - Writes: `{'B': [Range (0, 0)]}` This clearly shows, that whatever the implementation does is not correct.
During the implementation of the new MapFusion transformation it became necessary to reimplement
_read_and_write_sets()
there several bugs were discovered and fixed. However, one bug could not be fixed that is related to how the read set is cleaned.If the following patch is applied
then
tests/transformations/move_loop_into_map_test.py::MoveLoopIntoMapTest::test_apply_multiple_times
will fail with an invalid SDFG error. The bug is probably located somewhere insideRefineNestedAccess
.Another error that surfaces is in
tests/numpy/ufunc_support_test.py::test_ufunc_add_accumulate_simple
, however, it only surfaces if the config variablesoptimizer.automatic_simplification
andoptimizer.autooptimize
are set toTrue
.Since the regression test (see below) respect the bug it will also fail, in addition
tests/transformations/move_loop_into_map_test.py::MoveLoopIntoMapTest::test_more_than_a_map
will also fail, because now a transformation, that was previously classified as not applicable, became applicable (actually here I am not sure, but since my regression tests show that the old implementation is not correct, I am pretty positive).The text was updated successfully, but these errors were encountered: