Skip to content
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

USE_POLLY_ACC : Remove dependency on CUDA headerfiles and link libjulia to libGPURuntime #22036

Merged
merged 8 commits into from
Jun 13, 2017
Prev Previous commit
Next Next commit
Removed handling SHLIB_EXT for Windows and updated comment
  • Loading branch information
singam-sanjay committed May 24, 2017
commit 727e37f81aaa8c0107418559c4dfbd7b792194a6
6 changes: 1 addition & 5 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,8 @@ ifneq ($(OS), WINNT)
@ln -sf libjulia-debug.$(JL_MAJOR_MINOR_SHLIB_EXT) $(build_shlibdir)/libjulia-debug.$(SHLIB_EXT)
endif
ifeq ($(USE_POLLY_ACC), 1)
# Place libGPURuntime to be accessible under libjulia's RPATH
ifeq ($(OS), WINNT)
@cp $(shell $(LLVM_CONFIG_HOST) --libdir)/libGPURuntime.dll $(build_shlibdir)
else
# Place libGPURuntime such that it's accessible under libjulia's RPATH
@cp $(shell $(LLVM_CONFIG_HOST) --libdir)/libGPURuntime.$(SHLIB_EXT) $(build_shlibdir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need the conditional here, since $(SHLIB_EXT) will be dll on Windows

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grep SHLIB_EXT= -Rsn gave me this,

contrib/fixup-libgfortran.sh:21:    SHLIB_EXT="so"
contrib/fixup-libgfortran.sh:23:    SHLIB_EXT="dylib"
contrib/fixup-libgfortran.sh:27:    SHLIB_EXT="so"

So, I thought I had to handle the case for Windows. Anyways, I doubt that fixup-libgfortran.sh is setting the SHLIB_EXT used in src/Makefile. How is it getting set then ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHLIB_EXT is set somewhere around line 500 of Make.inc. Make.inc is the file that defines the standard stuff that's used in all of the various makefiles, SHLIB_EXT being one example.

In this case, the variable is set using the eager resolution assignment operator, :=. Regular = does lazy resolution in Make. It also has a space before the assignment. So grepping with a trailing = won't find it. Just now I found it with sift -e '\bSHLIB_EXT\s*[:?]?=' -n Make.inc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't the right target for this - LLVM should be responsible for installing this library if it's part of the public interface

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libGPURuntime is a part of Polly and not LLVM, therefore LLVM will not handling it.

if it's part of the public interface

what is a "public interface" ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean if this library is meant to be linked to externally, and isn't just a temporary byproduct of the polly build process, then polly's build system should be installing it when you do make install on polly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libGPURuntime is installed into usr/lib when Julia's using an LLVM build in deps/scratch, but needs to be copied when an external LLVM build is being used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where would it get installed for an external LLVM build? wouldn't it be in the same place as the rest of the llvm-config -L linking flags already cover?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lt would be available in llvm-config --libdir.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm copying it from --libdir. libGPURuntime.so would be first written to usr/lib by LLVM_INSTALL and be overwritten with the same content by this copy command.

@cp $(shell $(LLVM_CONFIG_HOST) --libdir)/libGPURuntime.$(SHLIB_EXT) $(build_shlibdir)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't the target for libGPURuntime, this is the target for libjulia-debug, so why is it being copied in this step? and for external-llvm builds, why does it need to be copied at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libGPURuntime.so is required to run the PTX code generated by Polly-ACC, therefore has to be accessible to libjulia.so or libjulia-debug.so's RPATH. Previously, I managed this by hard-coding the location of the library through the -rpath, which was discouraged by @vtjnash in this comment.

This meant that I had to place libGPURuntime.so into a directory covered by the default RPATH, $ORIGIN:$ORIGIN/julia. So, I'm copying libGPURuntime to usr/lib ($ORIGIN w.r.t. libjulia*.so).

and for external-llvm builds, why does it need to be copied at all?

All libraries are installed in usr/lib only when using an internal-llvm build. So it has to be copied in case of external-llvm builds.

this isn't the target for libGPURuntime, this is the target for libjulia-debug, so why is it being copied in this step?

Actually, it has to be copied into usr/lib for both libjulia and libjulia-debug. I made a mistake by not adding the copy command in the case of libjulia also. I'll add a libGPURuntime target and make both libjulia and libjulia-target depend on it.

endif
endif
$(DSYMUTIL) $@

Expand Down