Fix: error with slice when using descript_scheduler#27
Fix: error with slice when using descript_scheduler#27yadej wants to merge 9 commits intoxtc-tools:mainfrom
Conversation
|
Cool ! Do you want to dig into the bug (probably in descript.py) and fix it in the same PR ? It could be a good exercise to discover XTC deeper. If you prefer, I can do it. |
|
I want to try to fix it |
ebd6146 to
98b2aff
Compare
src/xtc/schedules/descript.py
Outdated
| new_interchange = [] | ||
| for loop_name in sched.interchange: | ||
| if not loop_name in sched.splits_to_sizes: | ||
| loop_name = re.sub(r"\[.*?\]$", "", loop_name) |
There was a problem hiding this comment.
Here you recover the abstract axis from the split declaration using the naming convention, am I right ? Why is it not in splits_to_sizes ?
There was a problem hiding this comment.
When we create a inner_nest from the split the head of the interchange will be [i[0]] and [i[1]] for the 2 split and if we use splits_to_sizes on those slice there will be no i[0] or i[1] since it is only in the first splits_to_sizes slice
There was a problem hiding this comment.
Actually, you've put your finger on a misconception that I introduced (see my comment on my PR). Thank you !
In fact, I added these heads because in MLIR, the split cuts the linalg operator but doesn't materialize the loops, so this head corrects the behavior. But this should be handled at the MLIR backend level, not at the abstract/descript schedule level. At this point, I think we need to remove this head mechanism which is really error-prone.
There was a problem hiding this comment.
Now that part is done on mlir backend instead of descript
src/xtc/schedules/descript.py
Outdated
| self._check_tiling_consistency() | ||
| self._check_sizes() | ||
|
|
||
| def remove_excess_interchange(self): |
There was a problem hiding this comment.
If I understand well, the point here is to express "i, j[X], k" as "i, j, k" ?
There was a problem hiding this comment.
Once they are created, we should not change the names, because they identify uniquely a loop. In this case, the problem is deeper : this loop should not exist (see my other comment).
98b2aff to
3ab1ee6
Compare
| continue | ||
| loop_name_no_root = loop_name.rsplit("/", 1)[-1] | ||
| loop_name_no_root = loop_name_no_root.split("[")[0] | ||
| loop_name = root + "/" + loop_name_no_root |
There was a problem hiding this comment.
Do I keep that to have the node name such as __node0__/J[0]/J or do I change it to __node0__/J[0]/J[0] but I will need to change most mlir splitting test
There was a problem hiding this comment.
No __node0__/J[0]/J is fine. But you need to build the name from the root + abstract axis, not from the split name (we want this algorithm to work even if name conventions change).
Besides could you please use ROOT_SEP instead of literal '/' ?
There was a problem hiding this comment.
I replaced the '/' with ROOT_SEP and put that in itf.schd.scheduler and added a constant SPLIT_LEFT_SEP for "[" and SPLIT_RIGHT_SEP for "]"
There was a problem hiding this comment.
I found a way to build the name with root and abstract axis without passing via string splitting
src/xtc/schedules/descript.py
Outdated
| f"Axis {axis_name} is scheduled twice (or more)." | ||
| ) | ||
| for loop_name in interchange: | ||
| loop_name = re.sub(r"\[.*?\]$", "", loop_name) |
There was a problem hiding this comment.
Same remark as above. We don't want to rely on naming conventions.
src/xtc/schedules/descript.py
Outdated
|
|
||
| # Recursively interpret the nested schedule | ||
| inner_nest = self._interpret_spec(item.body, new_root_name, head=[axis_name]) | ||
| inner_nest = self._interpret_spec(item.body, new_root_name, head=[new_dim_name]) |
There was a problem hiding this comment.
It seems to me that the parameter head is now useless. Do you agree ?
There was a problem hiding this comment.
Yes now the parameter head is removed
descript_scheduler - Remove test slice file bug since its fix - Add test to descript_scheduler with slice
in _interpret_spec in descript - Remove head from _interpret_spec in descript - Add Constant name SPLIT_LEFT_SEP for [ and SPLIT_RIGHT_SEP for ]
0120f52 to
97e5311
Compare
Add a minimal failing example for descript_scheduler
Discussion of the error is in that issue #26