Skip to content

Commit

Permalink
Manually rebuild pkgimage
Browse files Browse the repository at this point in the history
This prevents it from rebuilding other stuff like libjulia-codegen which depends on libjulia-internal and so libjulia-codegen loses it's instrumentation.
  • Loading branch information
Zentrik committed Apr 19, 2024
1 parent 04d92ad commit d440da2
Show file tree
Hide file tree
Showing 11 changed files with 3,416 additions and 7 deletions.
8 changes: 8 additions & 0 deletions cmp_instructions.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
avg_instructions(b) = BenchmarkTools.LinuxPerf.scaledcount(b.linux_perf_stats.threads[1]["instructions"]) / b.params.evals
p_i = Dict(x[1]=>avg_instructions(x[2]) for x in pr_perf["inference"]["allinference"])
m_i = Dict(x[1]=>avg_instructions(x[2]) for x in master_perf["inference"]["allinference"])

Dict(key=>(p_i[key] - m_i[key]) / m_i[key]*100 for key in keys(p_i))


Dict(x[1]=>avg_instructions(x[2]) for x in filter(x->x[2] isa BenchmarkTools.Trial, collect(pr_bit_hash)))
4 changes: 2 additions & 2 deletions contrib/bolt/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
profiles-bolt
bolt.build
profiles-bolt*
bolt.build*
toolchain

bolt
Expand Down
6 changes: 2 additions & 4 deletions contrib/bolt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ JULIA_ROOT:=$(CURDIR)/../..
LLVM_BOLT:=$(STAGE0_BINARIES)llvm-bolt
LLVM_MERGEFDATA:=$(STAGE0_BINARIES)merge-fdata

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

# TODO: Fixup Message
Expand Down Expand Up @@ -85,9 +84,8 @@ bolt_instrument: copy_originals
touch $@
@echo $(AFTER_INSTRUMENT_MESSAGE)
# TODO: Seems to be rebuilding sysimage as well unnecessarily
pkgimage: stage1
$(MAKE) -C $(STAGE1_BUILD) stdlibs-cache-release
$(MAKE) -C $(STAGE1_BUILD) -f pkgimage.mk release
merge_data: bolt_instrument
for file in $(FILES_TO_OPTIMIZE); do \
Expand Down
380 changes: 380 additions & 0 deletions contrib/bolt/script-45395.jl

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions contrib/pgo-lto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ LLVM_OBJCOPY:=$(STAGE0_TOOLS)llvm-objcopy
# When building a single libLLVM.so we need to increase -vp-counters-per-site
# significantly
COUNTERS_PER_SITE:=6
# Note: profile counters are not atomic by default, https://discourse.llvm.org/t/profile-guided-optimization-pgo-related-questions-and-suggestions/75232/5

AFTER_STAGE1_MESSAGE:='Run `make clean-profiles` to start with a clean slate. $\
Then run Julia to collect realistic profile data, for example: `$(STAGE1_BUILD)/julia -O3 -e $\
Expand Down
6 changes: 6 additions & 0 deletions ctl_fd.fifo
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
enable
disable
enable
enable
disable
enable
1 change: 1 addition & 0 deletions pr_bit_hash.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pr_bit_hash2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ libjulia-internal-debug libjulia-internal-release: $(PUBLIC_HEADER_TARGETS)

$(build_shlibdir)/libjulia-codegen.$(JL_MAJOR_MINOR_SHLIB_EXT): $(BUILDDIR)/julia.expmap $(CODEGEN_OBJS) $(BUILDDIR)/support/libsupport.a $(build_shlibdir)/libjulia-internal.$(JL_MAJOR_MINOR_SHLIB_EXT)
@$(call PRINT_LINK, $(CXXLD) $(call IMPLIB_FLAGS,$@) $(JCXXFLAGS) $(JL_CXXFLAGS) $(CXXLDFLAGS) $(SHIPFLAGS) $(CODEGEN_OBJS) $(RPATH_LIB) -o $@ \
$(JLDFLAGS) $(JLIBLDFLAGS) $(CG_RELEASE_LIBS) $(call SONAME_FLAGS,libjulia-codegen.$(JL_MAJOR_SHLIB_EXT)))
$(JLDFLAGS) $(BOLT_LDFLAGS) $(JLIBLDFLAGS) $(CG_RELEASE_LIBS) $(call SONAME_FLAGS,libjulia-codegen.$(JL_MAJOR_SHLIB_EXT)))
@$(INSTALL_NAME_CMD)libjulia-codegen.$(SHLIB_EXT) $@
$(DSYMUTIL) $@

Expand Down
26 changes: 26 additions & 0 deletions test.html

Large diffs are not rendered by default.

Loading

0 comments on commit d440da2

Please sign in to comment.