[Libclc-dev] clang SVN r303370 broke libclc

Jan Vesely via Libclc-dev libclc-dev at lists.llvm.org
Mon Jul 3 12:08:09 PDT 2017


On Mon, 2017-07-03 at 00:23 +0000, Liu, Yaxun (Sam) wrote:
> There are some recent changes about address space mapping in Clang
> for amdgcn target for better support C++ based kernel languages.
> 
> Currently, the constructor of AMDGPUTargetInfo does not initialize
> AddrSpaceMap. Instead, it is initialized by virtual member
> adjust(LangOptions &Opts) since the address space mapping of amdgcn
> target depends on language.
> 
> For backward compatibility, I can let constructor of AMDGPUTargetInfo
> initialize AddrSpaceMap to the old value. Hopefully this can fix the
> regression.

Hi,

what's the expected situation going forward? will there be one
addrspacemap for all languages, or per language maps (set using
adjust())?
it'd be nice if we could adapt clover now and future proof it before
llvm 5 comes out.

Jan

> 
> Thanks.
> 
> Sam
> 
> -----Original Message-----
> From: Aaron Watry [mailto:awatry at gmail.com] 
> Sent: Saturday, July 01, 2017 12:48 PM
> To: Jan Vesely <jan.vesely at rutgers.edu>
> Cc: Liu, Yaxun (Sam) <Yaxun.Liu at amd.com>; Michel Dänzer <michel at daenzer.net>; libclc-dev at lists.llvm.org
> Subject: Re: [Libclc-dev] clang SVN r303370 broke libclc
> 
> On Fri, Jun 30, 2017 at 11:10 AM, Jan Vesely via Libclc-dev <libclc-dev at lists.llvm.org> wrote:
> > On Wed, 2017-06-28 at 22:04 +0000, Liu, Yaxun (Sam) wrote:
> > > Hi Jan,
> > > 
> > > What's the command to generate html like http://paul.rutgers.edu/~jv3 
> > > 56/piglit/radeon-latest-5/problems.html with accumulated results?
> > > 
> > > I used  ./piglit summary html summary/turks_cl results/turks_cl_* but 
> > > it only generates html with one result, which makes comparison of 
> > > different runs difficult.
> > 
> > there needs to be multiple directories with results in 'results/'
> > directory.
> > another problem might be that piglit does not overwrite existing 
> > summaries (you should see an error message when that happens) so you 
> > might be stuck with the first one you generated.
> > ./piglit summary html summary/out results/* --overwrite
> > 
> > > 
> > > BTW I suspect the regression was due to 
> > > mesa/src/gallium/state_trackers/clover/llvm/codegen/common.cpp, line
> > > 131:
> > > 
> > >                if (address_space ==
> > > address_spaces[clang::LangAS::opencl_local
> > >                                                    -
> > > compat::lang_as_offset]) {
> > > 
> > > After my change, this is no longer valid way to get target address 
> > > space. Should be:
> > > 
> > >                if (address_space ==
> > > address_spaces[clang::LangAS::opencl_local]) {
> > 
> > compat::lang_as_offset is 0 for llvm >= 5 so those two statements 
> > should be identical. Am I missing something?
> > 
> 
> Now that I finally got my debugger setup working again, I can say that 'address_spaces', which is fetched by
> c.getTarget().getAddressSpaceMap() in common.cpp:make_kernel_args, is an empty collection which points to 'DefaultAddrSpaceMap' from clang/lib/basic/TargetInfo.cpp
> 
> It seems like the clang target that clover is using doesn't have an address space map initialized at all at this time...  I'm not sure if that's because we're setting up the clang instance incorrectly (wrong triple), or if that map is just never initialized in the AMDGPU
> target(s) in LLVM.  I've found the AMDGPUAS struct in AMDGPU.h which contains the address space mappings that are shared among subtargets and the getAMDGPUAS(Triple) function in AMDGPUBaseInfo.cpp, but I'm not sure where that information gets copied over to something that's returned by TargetInfo.getAddressSpaceMap().  Hopefully someone who knows that code better than I can tell me if I'm missing something.
> 
> --Aaron
> 
> 
> 
> > thanks for working on this.
> > Jan
> > 
> > > 
> > > However I am not sure if there is other changes need to be made.
> > > 
> > > Thanks.
> > > 
> > > Sam
> > > 
> > > -----Original Message-----
> > > From: Jan Vesely [mailto:jv356 at scarletmail.rutgers.edu] On Behalf Of 
> > > Jan Vesely
> > > Sent: Tuesday, June 27, 2017 12:17 PM
> > > To: Liu, Yaxun (Sam) <Yaxun.Liu at amd.com>; Michel Dänzer 
> > > <michel at daenzer.net>
> > > Cc: libclc-dev at lists.llvm.org
> > > Subject: Re: [Libclc-dev] clang SVN r303370 broke libclc
> > > 
> > > On Tue, 2017-06-27 at 14:42 +0000, Liu, Yaxun (Sam) wrote:
> > > > I am trying to build mesa with opencl enabled on Ubuntu 16.04 so 
> > > > that I can reproduce the issue, however I got some issue. After I 
> > > > build and install it, I cannot see the OpenCL icd for mesa under 
> > > > /etc/OpenCL/vendors.
> > > > 
> > > > Here is the command I use to build mesa:
> > > > 
> > > > ./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu 
> > > > --with- llvm-prefix=/usr/llvm/x86_64-linux-gnu --enable-glx-tls 
> > > > --enable- texture-float --disable-xvmc --disable-nine 
> > > > --with-gallium- drivers=radeonsi,swrast --with-dri-drivers= 
> > > > --with-egl- platforms=x11,drm --enable-gles1 --enable-gles2 
> > > > -enable-opencl CXXFLAGS="-O2" CFLAGS="-O2"
> > > > make
> > > > sudo make install
> > > > 
> > > > Can someone take a look if I missed something? Thanks.
> > > 
> > > I think you need --enable-opencl_icd as well, otherwise mesa provides 
> > > the root opencl library (LD_PRELOAD, or LD_LIBRARY_PATH should be 
> > > enough to make it work even without icd)
> > > 
> > > > 
> > > > BTW my email was always bounced back from libclc-dev at lists.llvm.org.
> > > > I tried to subscribe to it for several times but never got response.
> > > > Can someone pass my email to the mailing list?
> > > 
> > > no idea how to do that.
> > > AFAIK, Tom Stellard is the official maintainer of libclc. He might know better.
> > > 
> > > regards,
> > > Jan
> > > 
> > > > 
> > > > Thanks.
> > > > 
> > > > Sam
> > > > 
> > > > -----Original Message-----
> > > > From: Liu, Yaxun (Sam)
> > > > Sent: Thursday, June 22, 2017 4:39 PM
> > > > To: 'Jan Vesely' <jan.vesely at rutgers.edu>; Michel Dänzer 
> > > > <michel at daenzer.net>
> > > > Cc: libclc-dev at lists.llvm.org
> > > > Subject: RE: [Libclc-dev] clang SVN r303370 broke libclc
> > > > 
> > > > Sorry for the delay. I am still working on it. I think the failure was due to some kernel argument metadata change.
> > > > 
> > > > Sam
> > > > 
> > > > -----Original Message-----
> > > > From: Jan Vesely [mailto:jv356 at scarletmail.rutgers.edu] On Behalf 
> > > > Of Jan Vesely
> > > > Sent: Thursday, June 22, 2017 11:31 AM
> > > > To: Liu, Yaxun (Sam) <Yaxun.Liu at amd.com>; Michel Dänzer 
> > > > <michel at daenzer.net>
> > > > Cc: libclc-dev at lists.llvm.org
> > > > Subject: Re: [Libclc-dev] clang SVN r303370 broke libclc
> > > > 
> > > > Hi Sam,
> > > > 
> > > > is there any progress on this regression? I still see the test failing on my machine.
> > > > 
> > > > thanks,
> > > > Jan
> > > > 
> > > > On Thu, 2017-05-25 at 10:18 -0400, Jan Vesely wrote:
> > > > > you can find the tests here:
> > > > > https://piglit.freedesktop.org/
> > > > > 
> > > > > it's fairly straightforward to setup. my run cmdline is:
> > > > > 
> > > > > OCL_ICD_VENDORS=/etc/OpenCL/vendors/mesa-git.icd python3 ./piglit 
> > > > > run tests/cl.py -o results/turks_cl_`date`
> > > > > 
> > > > > the to generate html report I run:
> > > > > 
> > > > > ./piglit summary html summary/turks_cl results/turks_cl_*
> > > > > 
> > > > > it looks like this:
> > > > > http://paul.rutgers.edu/~jv356/piglit/radeon-latest-5/problems.ht
> > > > > ml
> > > > > 
> > > > > Jan
> > > > > 
> > > > > just fyi the 'set kernel argument for array' test is also local 
> > > > > memory related.
> > > > > 
> > > > > On Thu, 2017-05-25 at 14:10 +0000, Liu, Yaxun (Sam) wrote:
> > > > > > Is these tests part of libclc? How do I run them?
> > > > > > 
> > > > > > Sam
> > > > > > 
> > > > > > -----Original Message-----
> > > > > > From: Michel Dänzer [mailto:michel at daenzer.net]
> > > > > > Sent: Thursday, May 25, 2017 3:46 AM
> > > > > > To: Jan Vesely <jan.vesely at rutgers.edu>; Liu, Yaxun (Sam) 
> > > > > > <Yaxun.Liu at amd.com>
> > > > > > Cc: libclc-dev at lists.llvm.org
> > > > > > Subject: Re: [Libclc-dev] clang SVN r303370 broke libclc
> > > > > > 
> > > > > > On 25/05/17 06:14 AM, Jan Vesely via Libclc-dev wrote:
> > > > > > > On Wed, 2017-05-24 at 16:22 -0400, Jan Vesely wrote:
> > > > > > > > On Wed, 2017-05-24 at 18:13 +0900, Michel Dänzer via Libclc-dev wrote:
> > > > > > > > > On 24/05/17 01:19 AM, Liu, Yaxun (Sam) wrote:
> > > > > > > > > > I have fixed the issue by
> > > > > > > > > > https://reviews.llvm.org/rL303644
> > > > > > > > > 
> > > > > > > > > Seems to work fine, thanks!
> > > > > > > > 
> > > > > > > > also seems to fix most of EG 670 opencl regressions.
> > > > > > > 
> > > > > > > while at the same time it introduces regression in "set 
> > > > > > > kernel argument for array" subtest on Turks.
> > > > > > 
> > > > > > Actually, I'm also seeing that test and a bunch of local atomic 
> > > > > > tests fail. Reverting both of Sam's patches and rebuilding 
> > > > > > libclc and Mesa fixes them. Not sure why I wasn't seeing these 
> > > > > > failures before, but it looks like there's still an issue here.
> > > > > > 
> > > > > > 
> > > > > > --
> > > > > > Earthling Michel Dänzer               |               http://www.amd.com
> > > > > > Libre software enthusiast             |             Mesa and X developer
> > > > > > 
> > > 
> > > --
> > > Jan Vesely <jan.vesely at rutgers.edu>
> > 
> > _______________________________________________
> > Libclc-dev mailing list
> > Libclc-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev
> > 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20170703/05176ccf/attachment.sig>


More information about the Libclc-dev mailing list