Skip to content

Commit

Permalink
Only BOLT libLLVM
Browse files Browse the repository at this point in the history
TODO: remove BOLTLDFLAGS and BOLTCXXFLAGS, we can just add them straight to llvm's flags once I copy over clang detection.
  • Loading branch information
Zentrik committed Apr 4, 2024
1 parent a4f3bf6 commit 0bb57ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions contrib/bolt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LLVM_BOLT:=$(STAGE0_TOOLS)llvm-bolt
LLVM_MERGEFDATA:=$(STAGE0_TOOLS)merge-fdata

# TODO: work out why libjulia-codegen.so doesn't produce a profile.
SYMLINKS_TO_OPTIMIZE := libLLVM.so libjulia-internal.so # If you update this, you need to add BOLTLDFLAGS and BOLTCXXFLAGS to the build of your new file.
SYMLINKS_TO_OPTIMIZE := libLLVM.so # If you update this, you need to add BOLTLDFLAGS and BOLTCXXFLAGS to the build of your new file.
FILES_TO_OPTIMIZE := $(shell for file in $(SYMLINKS_TO_OPTIMIZE); do readlink $(STAGE1_BUILD)/usr/lib/$$file; done)

# TODO: Fixup Message
Expand All @@ -38,9 +38,8 @@ stage0: | $(STAGE0_BUILD)
touch $@
# Build with --emit-relocs, binary builder doesn't do this so we need to build LLVM for now.
# -fno-reorder-blocks-and-partition is needed on gcc >= 8, remove the flag on clang as unsupported and unnecessary.
# Manually skip package image creation and sysimg creation - we want to profile all julia code that gets compiled.
# We no longer want to do above, fix it
# -fno-reorder-blocks-and-partition is needed on gcc >= 8.
# Manually skip package image creation so that we can profile building it
$(STAGE1_BUILD): stage0
stage1: export USE_BINARYBUILDER_LLVM=0
stage1: | $(STAGE1_BUILD)
Expand All @@ -53,7 +52,7 @@ copy_originals: stage1
done && \
touch $@
bolt_instrument: move_originals
bolt_instrument: copy_originals
for file in $(FILES_TO_OPTIMIZE); do \
abs_file=$(STAGE1_BUILD)/usr/lib/$$file; \
$(LLVM_BOLT) "$$abs_file.original" -o $$abs_file --instrument --instrumentation-file-append-pid --instrumentation-file="$(PROFILE_DIR)/$$file-prof" --thread-count=4 -no-huge-pages; \
Expand All @@ -75,7 +74,7 @@ merge_data: stage1
# Settings taken from https://github.com/rust-lang/rust/blob/master/src/tools/opt-dist/src/bolt.rs
# TODO: Use the new changes in https://github.com/rust-lang/rust/pull/119418/files once we get to LLVM 17/18
bolt: merge_data
bolt: copy_originals
for file in $(FILES_TO_OPTIMIZE); do \
abs_file=$(STAGE1_BUILD)/usr/lib/$$file; \
$(LLVM_BOLT) "$$abs_file.original" -data "$(PROFILE_DIR)/$$file-prof.merged.fdata" -o $$abs_file \
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ $(BUILDDIR)/julia.expmap: $(SRCDIR)/julia.expmap.in
-e "s/@LLVM_SHLIB_SYMBOL_VERSION@/$(LLVM_SHLIB_SYMBOL_VERSION)/"

$(build_shlibdir)/libjulia-internal.$(JL_MAJOR_MINOR_SHLIB_EXT): $(BUILDDIR)/julia.expmap $(OBJS) $(BUILDDIR)/flisp/libflisp.a $(BUILDDIR)/support/libsupport.a $(LIBUV)
@$(call PRINT_LINK, $(CXXLD) $(call IMPLIB_FLAGS,$@) $(JCXXFLAGS) $(JL_CXXFLAGS) $(CXXLDFLAGS) $(SHIPFLAGS) $(BOLTCXXFLAGS) $(OBJS) $(RPATH_LIB) -o $@ \
$(JLDFLAGS) $(BOLTLDFLAGS) $(JLIBLDFLAGS) $(RT_RELEASE_LIBS) $(call SONAME_FLAGS,libjulia-internal.$(JL_MAJOR_SHLIB_EXT)))
@$(call PRINT_LINK, $(CXXLD) $(call IMPLIB_FLAGS,$@) $(JCXXFLAGS) $(JL_CXXFLAGS) $(CXXLDFLAGS) $(SHIPFLAGS) $(OBJS) $(RPATH_LIB) -o $@ \
$(JLDFLAGS) $(JLIBLDFLAGS) $(RT_RELEASE_LIBS) $(call SONAME_FLAGS,libjulia-internal.$(JL_MAJOR_SHLIB_EXT)))
@$(INSTALL_NAME_CMD)libjulia-internal.$(SHLIB_EXT) $@
$(DSYMUTIL) $@

Expand Down

0 comments on commit 0bb57ec

Please sign in to comment.