-
Notifications
You must be signed in to change notification settings - Fork 652
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
RemoveSingleIterationLoop crashes trying to simplify a mod 0
affine expression
#9244
Comments
It looks more complicated than all the cases I've seen before. Could you elaborate how the IR is generated? What's the original IR (maybe at Linalg level) and the configurations? |
That code is generated after applying peeling to the original loop. In particular, it's from |
Peeling on wrong loops might breaks the assumption in |
Sorry, I thought it was obvious but it's actually not! I tried The loop before peeling is the following. It looks like a valid loop to peel to me:
|
Sorry for the confusion.. I meant that if it can get reproduced through E.g., what's the IR before and after peeling. What loops are we target on for peeling? It looks like the peeling transform is applied on distributed loops. I'd expect it happens on the second tiling level. It would be clearer to me if you can provide the commit and IR dumps. We can also chat through VC if there are many details. |
(Begin soap box) The use of For purpose of prototyping might be worth just dropping this pass and seeing if things work. (worst case for development purposes add a flag that guards this pass usage, and leave it default true) |
I'm also attaching the output of print-ir-after-all. If you want to reproduce it yourself, you can pull https://github.com/dcaballe/iree/tree/peeling for IREE and https://github.com/dcaballe/llvm-project/tree/peeling for third-party/llvm. If I remove
If I enable peeling, more tests are crashing with:
But I'm not sure if this happens because |
That particular pass needs to look at the
Strange. Didnt know that the
Yeah this seems related to |
The loop looks fine. There are actually no requirements for the loop itself. Any loop can be peeled. (Unless every iteration is already a full iteration, then we may not do anything, I forgot...) After the peeling, we try to simplify An affine expression that has a The loop peeling replaces the upper bound of the loop with a new bound. If we have many constant parts in the computation, this new bound can be very simple. In the general case, with an SSA value step (like we have it here), it can get pretty complex. The upper bound is computed in
|
The
You can search for 'Peel' in this dump. Peeling generates:
Let's replace:
However, when we instantiate the map, |
There are in fact no The |
I think I know why. There are issues in I dont find the documentation yet. I feel that it means unknown when setting the values to zeros. In this case, we should do nothing when they are zeros. This should fix the issue: #9258 For more exploration, I'd suggest to disable the pass in the pipeline. |
) The workgroup count is set to zero when we're not able to infer the bounds. Fixes #9244
RemoveSingleIterationLoop crashes when analyzing the last loop in the function above (
scf.for %arg0 = %5 to %c4 step %4
).alwaysRunsFirstIteration
utility invokessubstituteMin
which tries to simplify the affine expression() -> (8 mod 0)
. Themod 0
expression is not properly handled and compilation crashes with:The text was updated successfully, but these errors were encountered: