Florian Hahn via llvm-dev
2021-Feb-18 18:24 UTC
[llvm-dev] [LAI] Question about getDependences
Hi,> On 18 Feb 2021, at 18:17, Dangeti Tharun kumar via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, > > I am using LAI->getDependences(), It returns a vector of Dependence objects in a Loop. > If the loop is un-analyzable or parallel, an empty list is returned. > > for example: > > Loop A: > for (int i = 0; i < N; i ++) { > a[i] = c[i] + d[i]; > b[i] = c[i] * d[i]; > } > Loop B: > for (int i = 0; i < N; i++) { > a[b[i]] = c[i] + d[i]; > c[i] = c[i - 1] + 1; > } > > Loop A is parallel and Loop B has non-simple dependences(LAI bails out) for both the cases we get an empty set of dependences. > > Is there an API that can tell if LAI was successful in dependence computation?I think canVectorizeMemory should do what you want (possibly in combination with getMaxSafeDepDistBytes Cheers, Florian -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210218/047ca96e/attachment.html>
Dangeti Tharun kumar via llvm-dev
2021-Feb-18 18:57 UTC
[llvm-dev] [LAI] Question about getDependences
Hi Florian, Thanks for the reply. We have tried a condition like this: *if (LAI.getMaxSafeDepDistBytes() == -1ULL && !LAI.canVectorizeMemory()) {* * print("Unknown dependences in loop");* * return false;* *}* Looks like *LAI.getMaxSafeDepDistBytes() *is *not always *capturing the distance for non-vectorizable loops. This example from TSVC, is not vectorizable but dependences are analyzable. for (int i = 1; i < LEN_1D - 1; i++) { a[i] = b[i - 1] + c[i] * d[i]; b[i] = b[i + 1] - e[i] * d[i]; } * LAI.getMaxSafeDepDistBytes() is : (ULL)-1* * LAI.canVectroizeMemory is : false* Any more suggestions would be appreciated. :) On Thu, Feb 18, 2021 at 11:54 PM Florian Hahn <florian_hahn at apple.com> wrote:> Hi, > > On 18 Feb 2021, at 18:17, Dangeti Tharun kumar via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > Hi, > > I am using LAI->getDependences(), It returns a vector of Dependence > objects in a Loop. > If the loop is un-analyzable or parallel, an empty list is returned. > > *for example:* > > *Loop A:* > for (int i = 0; i < N; i ++) { > a[i] = c[i] + d[i]; > b[i] = c[i] * d[i]; > } > *Loop B:* > for (int i = 0; i < N; i++) { > a[b[i]] = c[i] + d[i]; > c[i] = c[i - 1] + 1; > } > > Loop A is parallel and Loop B has non-simple dependences(LAI bails out) > for both the cases we get an empty set of dependences. > > Is there an API that can tell if LAI was successful in dependence > computation? > > > I think canVectorizeMemory should do what you want (possibly in > combination with getMaxSafeDepDistBytes > > Cheers, > Florian >-- Regards, DTharun -- Disclaimer:- This footer text is to convey that this email is sent by one of the users of IITH. So, do not mark it as SPAM. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210219/ff176c29/attachment.html>