[llvm] r367443 - [AMDGPU] Fix for vectorizer crash with pointers of different size

Mekhanoshin, Stanislav via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 11:45:25 PDT 2019


OK, I did some experiments. Looks like checking the pointer size is a safe thing. I will prepare a patch shortly.
As a next step that should be possible to change the bitwidth of PtrDelta traveling down the recursion if it fits the new size. This will be a little tricky though.


--

Stas

-----Original Message-----
From: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com<mailto:Stanislav%20Mekhanoshin%20%3cStanislav.Mekhanoshin at amd.com%3e>>
To: Artem Belevich <tra at google.com<mailto:Artem%20Belevich%20%3ctra at google.com%3e>>
Cc: "Arsenault, Matthew" <Matthew.Arsenault at amd.com<mailto:%22Arsenault,%20Matthew%22%20%3cMatthew.Arsenault at amd.com%3e>>, benny.kra at gmail.com <benny.kra at gmail.com<mailto:%22benny.kra at gmail.com%22%20%3cbenny.kra at gmail.com%3e>>, llvm-commits at lists.llvm.org <llvm-commits at lists.llvm.org<mailto:%22llvm-commits at lists.llvm.org%22%20%3cllvm-commits at lists.llvm.org%3e>>
Subject: Re: [llvm] r367443 - [AMDGPU] Fix for vectorizer crash with pointers of different size
Date: Thu, 01 Aug 2019 11:35:10 -0700

The problem is that is fixes compiler crash, correctness was always before performance right?
Can you bear with me for few more hours?


--

Stas

-----Original Message-----
From: Artem Belevich <tra at google.com<mailto:Artem%20Belevich%20%3ctra at google.com%3e>>
To: "Mekhanoshin, Stanislav" <Stanislav.Mekhanoshin at amd.com<mailto:%22Mekhanoshin,%20Stanislav%22%20%3cStanislav.Mekhanoshin at amd.com%3e>>
Cc: "Arsenault, Matthew" <Matthew.Arsenault at amd.com<mailto:%22Arsenault,%20Matthew%22%20%3cMatthew.Arsenault at amd.com%3e>>, benny.kra at gmail.com <benny.kra at gmail.com<mailto:%22benny.kra at gmail.com%22%20%3cbenny.kra at gmail.com%3e>>, llvm-commits at lists.llvm.org <llvm-commits at lists.llvm.org<mailto:%22llvm-commits at lists.llvm.org%22%20%3cllvm-commits at lists.llvm.org%3e>>
Subject: Re: [llvm] r367443 - [AMDGPU] Fix for vectorizer crash with pointers of different size
Date: Thu, 01 Aug 2019 11:33:35 -0700

[CAUTION: External Email]
Can you revert the change while you're looking for a better solution? This patch has a noticeable negative impact on performance of GPU code we use.

Thank you,
--Artem

On Thu, Aug 1, 2019 at 11:14 AM Mekhanoshin, Stanislav via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> wrote:
In your case search ends before pointers change address space. They all come to the same root casted pointer "%alloc16 = addrspacecast i8* %alloc1 to i8 addrspace(1)*". In the failing case which was fixed one of the pointers has addrspacecast stripped while the search was still in progress, which has caused the problem.

I am looking if I can find a better cutoff criteria. Size is one of such possible criteria, but I want to look into this a little more.


--

Stas

-----Original Message-----
From: Benjamin Kramer <benny.kra at gmail.com<mailto:Benjamin%20Kramer%20%3cbenny.kra at gmail.com%3e>>
To: "Arsenault, Matthew" <Matthew.Arsenault at amd.com<mailto:%22Arsenault,%20Matthew%22%20%3cMatthew.Arsenault at amd.com%3e>>
Cc: "Mekhanoshin, Stanislav" <Stanislav.Mekhanoshin at amd.com<mailto:%22Mekhanoshin,%20Stanislav%22%20%3cStanislav.Mekhanoshin at amd.com%3e>>, llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits%20%3cllvm-commits at lists.llvm.org%3e>>
Subject: Re: [llvm] r367443 - [AMDGPU] Fix for vectorizer crash with pointers of different size
Date: Thu, 01 Aug 2019 16:53:43 +0200

[CAUTION: External Email]
Currently not at my workstation, attached is a test case that I scraped from the logs. This should have a <4 x float> load & store and scalar arithmetic after going through LoadStoreVectorizer.

On Thu, Aug 1, 2019 at 3:14 PM Arsenault, Matthew <Matthew.Arsenault at amd.com<mailto:Matthew.Arsenault at amd.com>> wrote:




This is too aggressive, it will prevent any pointer pair that's addrspacecast'ed from ever being recognized as consecutive. What's the reason for not checking the size? I'm seeing regressions where pointers are getting loaded from memory and then casted to the right addresspace.

- Ben

Do you have an example where this matters? I would expect any cases that are vectorizable and involve an addrspacecast would be taken care of by InferAddressSpaces, so the vectorizer doesn’t need to worry about them.

_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190801/5b60115d/attachment.html>


More information about the llvm-commits mailing list