You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The root cause is that the dependency matrix for the loops in g is I I, which is treated same as = = in legality check. An I dependence is used to fill a direction vector if its length is less than the depth of the loop nest.
In this case, since the alias check results in MayAlias, DependenceInfo skips the analysis and returns a default Dependence object, whose Levels is always 0.
In this case, exchanging the j- and k-loop fails because the IR structure is currently unsupported. However, it should be rejected by dependence reason, because that exchange changes the order of addition of float values.
For safety, I think I dependencies should be replaced with *
The text was updated successfully, but these errors were encountered:
LoopInterchange pads the end of the direction vector with `I` when the
Levels value of a Dependence object is less than the depth of the loop
nest. However, `I` dependencies were treated the same as `=` in
subsequent processes, which is incorrect. For example,
DependenceAnalysis currently returns a default Dependence object when
AliasAnalysis results in MayAlias. In such a case, the direction vector
should be like `[* * ... *]`. However, because the Levels value of
default Dependence object is 0, therefore LoopInterchange generated a
direction vector like `[I I ... I]`, leading to unsafe interchanges.
This patch fixes the issue by replacing `I` with `*`. As far as I
understand, this change doesn't prevent any legal interchanges that were
applied before this patch.
Fixesllvm#140238
LoopInterchange pads the end of the direction vector with `I` when the
Levels value of a Dependence object is less than the depth of the loop
nest. However, `I` dependencies were treated the same as `=` in
subsequent processes, which is incorrect. For example,
DependenceAnalysis currently returns a default Dependence object when
AliasAnalysis results in MayAlias. In such a case, the direction vector
should be like `[* * ... *]`. However, because the Levels value of
default Dependence object is 0, therefore LoopInterchange generated a
direction vector like `[I I ... I]`, leading to unsafe interchanges.
This patch fixes the issue by replacing `I` with `*`. As far as I
understand, this change doesn't prevent any legal interchanges that were
applied before this patch.
Fixesllvm#140238
Uh oh!
There was an error while loading. Please reload this page.
Input:
godbolt: https://godbolt.org/z/dq6Kad14a
The root cause is that the dependency matrix for the loops in
g
isI I
, which is treated same as= =
in legality check. AnI
dependence is used to fill a direction vector if its length is less than the depth of the loop nest.llvm-project/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
Lines 212 to 214 in 9f77c26
In this case, since the alias check results in MayAlias, DependenceInfo skips the analysis and returns a default Dependence object, whose
Levels
is always 0.llvm-project/llvm/lib/Analysis/DependenceAnalysis.cpp
Lines 3605 to 3609 in b712590
A similar problem occurs when the dimension of arrays used in the target loops is less than the depth of the loop nest, such as in the following case
godbolt: https://godbolt.org/z/Yss6oe3eb
In this case, exchanging the j- and k-loop fails because the IR structure is currently unsupported. However, it should be rejected by dependence reason, because that exchange changes the order of addition of float values.
For safety, I think
I
dependencies should be replaced with*
The text was updated successfully, but these errors were encountered: