From 7723d66a57e3261647c1dce9eb4e6b4058ff920a Mon Sep 17 00:00:00 2001 From: Zentrik Date: Mon, 25 Mar 2024 20:38:45 +0000 Subject: [PATCH 01/56] Add building and testing of PGO+LTO LLVM and Julia --- pipelines/main/launch_unsigned_jobs.yml | 9 ++ .../main/platforms/build_linux.pgo_lto.arches | 8 + pipelines/main/platforms/build_linux.yml | 5 +- .../main/platforms/test_linux.pgo_lto.arches | 10 ++ pipelines/main/platforms/test_linux.yml | 9 +- utilities/build_julia.sh | 31 +++- utilities/pgo_script.jl | 146 ++++++++++++++++++ 7 files changed, 209 insertions(+), 9 deletions(-) create mode 100644 pipelines/main/platforms/build_linux.pgo_lto.arches create mode 100644 pipelines/main/platforms/test_linux.pgo_lto.arches create mode 100644 utilities/pgo_script.jl diff --git a/pipelines/main/launch_unsigned_jobs.yml b/pipelines/main/launch_unsigned_jobs.yml index c620c17ac..c9dca76b9 100644 --- a/pipelines/main/launch_unsigned_jobs.yml +++ b/pipelines/main/launch_unsigned_jobs.yml @@ -30,6 +30,11 @@ steps: bash .buildkite/utilities/arches_pipeline_upload.sh \ .buildkite/pipelines/main/platforms/build_linux.arches \ .buildkite/pipelines/main/platforms/build_linux.yml + GROUP="Build" \ + ALLOW_FAIL="false" \ + bash .buildkite/utilities/arches_pipeline_upload.sh \ + .buildkite/pipelines/main/platforms/build_linux.pgo_lto.arches \ + .buildkite/pipelines/main/platforms/build_linux.yml # Launch macOS packaging jobs GROUP="Build" \ ALLOW_FAIL="false" \ @@ -97,6 +102,10 @@ steps: bash .buildkite/utilities/arches_pipeline_upload.sh \ .buildkite/pipelines/main/platforms/test_linux.i686.arches \ .buildkite/pipelines/main/platforms/test_linux.i686.yml + GROUP="Test" \ + bash .buildkite/utilities/arches_pipeline_upload.sh \ + .buildkite/pipelines/main/platforms/test_linux.pgo_lto.arches \ + .buildkite/pipelines/main/platforms/test_linux.yml # Launch macOS test jobs GROUP="Test" \ bash .buildkite/utilities/arches_pipeline_upload.sh \ diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches new file mode 100644 index 000000000..36e4cf860 --- /dev/null +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -0,0 +1,8 @@ +# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH +package_linux x86_64-linux-gnu x86_64 x86_64 PGO+LTO JL_CFLAGS=-Werror,JL_CXXFLAGS=-Werror . v6.00 4dcde853eb5baaa0a8f087b633eaf955dc94b5dc + +# These special lines allow us to embed default values for the columns above. +# Any column without a default mapping here will simply substitute a `.` to the empty string + +# Builds should generally finish in much less time than this, but from-source builds can take longer +#default TIMEOUT 80 diff --git a/pipelines/main/platforms/build_linux.yml b/pipelines/main/platforms/build_linux.yml index e43eb1289..c0e433f2e 100644 --- a/pipelines/main/platforms/build_linux.yml +++ b/pipelines/main/platforms/build_linux.yml @@ -1,8 +1,8 @@ steps: - group: "${GROUP?}" steps: - - label: ":linux: build ${TRIPLET?}" - key: "build_${TRIPLET?}" + - label: ":linux: build ${TRIPLET?}${USE_JULIA_PGO_LTO-}" + key: "build_${TRIPLET?}${USE_JULIA_PGO_LTO-}" plugins: - JuliaCI/external-buildkite#v1: version: "./.buildkite-external-version" @@ -33,3 +33,4 @@ steps: TRIPLET: "${TRIPLET?}" MAKE_FLAGS: "${MAKE_FLAGS?}" ROOTFS_IMAGE_NAME: "${ROOTFS_IMAGE_NAME?}" + USE_JULIA_PGO_LTO: "${USE_JULIA_PGO_LTO}" diff --git a/pipelines/main/platforms/test_linux.pgo_lto.arches b/pipelines/main/platforms/test_linux.pgo_lto.arches new file mode 100644 index 000000000..634e149bf --- /dev/null +++ b/pipelines/main/platforms/test_linux.pgo_lto.arches @@ -0,0 +1,10 @@ +# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS TIMEOUT USE_RR USE_JULIA_PGO_LTO ROOTFS_TAG ROOTFS_HASH +tester_linux x86_64-linux-gnu x86_64 x86_64 . . PGO+LTO v6.00 770c0240be788cfeb9654e1980ea929d3ed98d1f + +# These special lines allow us to embed default values for the columns above. +# Any column without a default mapping here will simply substitute a `.` to the empty string + +# Most tests should finish within ~45 minutes, barring exceptionally slow hardware +# We double that to a default of 90 minutes, with an extra 45 minutes for cleanup, +# including things like `rr` trace compression, +#default TIMEOUT 135 diff --git a/pipelines/main/platforms/test_linux.yml b/pipelines/main/platforms/test_linux.yml index 5910133a8..9a9aab764 100644 --- a/pipelines/main/platforms/test_linux.yml +++ b/pipelines/main/platforms/test_linux.yml @@ -1,15 +1,15 @@ steps: - group: "${GROUP?}" steps: - - label: ":linux: test ${TRIPLET?}${USE_RR-}" - key: "test_${TRIPLET?}${USE_RR-}" + - label: ":linux: test ${TRIPLET?}${USE_RR-}${USE_JULIA_PGO_LTO-}" + key: "test_${TRIPLET?}${USE_RR-}${USE_JULIA_PGO_LTO-}" depends_on: - - "build_${TRIPLET?}" + - "build_${TRIPLET?}${USE_JULIA_PGO_LTO-}" plugins: - JuliaCI/coreupload#v2: core_pattern: "**/*.core" compressor: "zstd" - disabled: "${USE_RR?}" + disabled: "${USE_RR?}${USE_JULIA_PGO_LTO-}" create_bundle: "true" lldb_commands: - "bt all" @@ -41,3 +41,4 @@ steps: JULIA_SHELL: "/bin/bash" TRIPLET: "${TRIPLET?}" USE_RR: "${USE_RR?}" + USE_JULIA_PGO_LTO: "${USE_JULIA_PGO_LTO}" diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index e6519a26c..6ef4dbdc7 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -24,7 +24,6 @@ if [[ "${ROOTFS_IMAGE_NAME-}" == "llvm_passes" ]]; then contrib/download_cmake.sh fi -echo "--- Collect make options" # These are the flags we'll provide to `make` MFLAGS=() @@ -53,17 +52,43 @@ else fi MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) +if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then + MFLAGS+=( "STAGE2_BUILD=$PWD/usr" ) + + echo "--- Collect make options" + echo "Make Options:" + for FLAG in "${MFLAGS[@]}"; do + echo " -> ${FLAG}" + done + + echo "--- Build Julia Stage 1 - with instrumentation" + + cd contrib/pgo-lto + ${MAKE} "${MFLAGS[@]}" stage1 + + echo "--- Collecting Profile" + ${MAKE} clean-profiles + "./stage1.build/julia .buildkite/utilities/pgo_script.jl" +fi + # Finish off with any extra make flags from the `.arches` file MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) +echo "--- Collect make options" echo "Make Options:" for FLAG in "${MFLAGS[@]}"; do echo " -> ${FLAG}" done -echo "--- Build Julia" -${MAKE} "${MFLAGS[@]}" +if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then + echo "--- Build Julia Stage 2 - optimised" + ${MAKE} "${MFLAGS[@]}" stage2 + cd ../.. +else + echo "--- Build Julia" + ${MAKE} "${MFLAGS[@]}" +fi echo "--- Check that the working directory is clean" if [ -n "$(git status --short)" ]; then diff --git a/utilities/pgo_script.jl b/utilities/pgo_script.jl new file mode 100644 index 000000000..2fa447fb0 --- /dev/null +++ b/utilities/pgo_script.jl @@ -0,0 +1,146 @@ +using Pkg +Pkg.activate(; temp=true) +Pkg.add(url="https://github.com/JuliaCI/BaseBenchmarks.jl") +Pkg.add("DifferentialEquations") +Pkg.add("Test") +Pkg.add("LinearAlgebra") +Pkg.add("ThreadsX") +Pkg.add("Plots") + +using BaseBenchmarks, DifferentialEquations, Test, ThreadsX, LinearAlgebra, Plots + +BaseBenchmarks.load!("problem") + +using BaseBenchmarks.ProblemBenchmarks: MonteCarlo, Raytracer, JSONParse, PROBLEM_DATA_DIR +MonteCarlo.perf_euro_option_vec(10^4) +Raytracer.perf_raytrace(5, 256, 4) + +jstr = read(joinpath(PROBLEM_DATA_DIR, "test.json"), String) +JSONParse.perf_parse_json(jstr) + +# https://github.com/SciML/DifferentialEquations.jl/blob/master/test/default_ode_alg_test.jl + +f_2dlinear = (du, u, p, t) -> (@. du = p * u) +f_2dlinear_analytic = (u0, p, t) -> @. u0 * exp(p * t) +prob_ode_2Dlinear = ODEProblem(ODEFunction(f_2dlinear, analytic = f_2dlinear_analytic), + rand(4, 2), (0.0, 1.0), 1.01) + +alg, kwargs = default_algorithm(prob_ode_2Dlinear; dt = 1 // 2^(4)) +integ = init(prob_ode_2Dlinear; dt = 1 // 2^(4)) +sol = solve(prob_ode_2Dlinear; dt = 1 // 2^(4)) + +sol = solve(prob_ode_2Dlinear; reltol = 1e-1) + +sol = solve(prob_ode_2Dlinear; reltol = 1e-7) + +sol = solve(prob_ode_2Dlinear; alg_hints = [:stiff]) + +const linear_bigα = parse(BigFloat, "1.01") +f = (du, u, p, t) -> begin + for i in 1:length(u) + du[i] = linear_bigα * u[i] + end +end +(::typeof(f))(::Type{Val{:analytic}}, u0, p, t) = u0 * exp(linear_bigα * t) +prob_ode_bigfloat2Dlinear = ODEProblem(f, map(BigFloat, rand(4, 2)) .* ones(4, 2) / 2, + (0.0, 1.0)) + +sol = solve(prob_ode_bigfloat2Dlinear; dt = 1 // 2^(4)) + +# From OmniPackage.jl +function expm(A::AbstractMatrix{S}) where {S} + # omitted: matrix balancing, i.e., LAPACK.gebal! + nA = opnorm(A, 1) + ## For sufficiently small nA, use lower order Padé-Approximations + if (nA <= 2.1) + A2 = A * A + if nA > 0.95 + U = @evalpoly( + A2, + S(8821612800) * I, + S(302702400) * I, + S(2162160) * I, + S(3960) * I, + S(1) * I + ) + U = A * U + V = @evalpoly( + A2, + S(17643225600) * I, + S(2075673600) * I, + S(30270240) * I, + S(110880) * I, + S(90) * I + ) + elseif nA > 0.25 + U = @evalpoly(A2, S(8648640) * I, S(277200) * I, S(1512) * I, S(1) * I) + U = A * U + V = + @evalpoly(A2, S(17297280) * I, S(1995840) * I, S(25200) * I, S(56) * I) + elseif nA > 0.015 + U = @evalpoly(A2, S(15120) * I, S(420) * I, S(1) * I) + U = A * U + V = @evalpoly(A2, S(30240) * I, S(3360) * I, S(30) * I) + else + U = @evalpoly(A2, S(60) * I, S(1) * I) + U = A * U + V = @evalpoly(A2, S(120) * I, S(12) * I) + end + expA = (V - U) \ (V + U) + else + s = log2(nA / 5.4) # power of 2 later reversed by squaring + if s > 0 + si = ceil(Int, s) + A = A / S(exp2(si)) + end + + A2 = A * A + A4 = A2 * A2 + A6 = A2 * A4 + + U = + A6 * (S(1) * A6 + S(16380) * A4 + S(40840800) * A2) + + ( + S(33522128640) * A6 + S(10559470521600) * A4 + S(1187353796428800) * A2 + ) + + S(32382376266240000) * I + U = A * U + V = + A6 * (S(182) * A6 + S(960960) * A4 + S(1323241920) * A2) + + ( + S(670442572800) * A6 + + S(129060195264000) * A4 + + S(7771770303897600) * A2 + ) + + S(64764752532480000) * I + expA = (V - U) \ (V + U) + if s > 0 # squaring to reverse dividing by power of 2 + for t = 1:si + expA = expA * expA + end + end + end + expA +end + +function expwork(A) + B = expm(A) + C = similar(B) + for i = 0:7 + C .= A .* exp(-i) + B .+= expm(C) + end + return B +end + +expm_bench0(N = 2, iters = 100) = + ThreadsX.sum(1:iters) do _ + expwork(rand(N, N)) + end + +expm_bench0() + +# Plots.jl Example +x = range(0, 10, length=100) +y = sin.(x) +plot(x, y) \ No newline at end of file From 1b3e7065d223c9e78b7d4e494db84d4d42768ee9 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Mon, 25 Mar 2024 22:10:29 +0000 Subject: [PATCH 02/56] Fix run pgo_script command --- utilities/build_julia.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 6ef4dbdc7..55b283626 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -68,7 +68,7 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then echo "--- Collecting Profile" ${MAKE} clean-profiles - "./stage1.build/julia .buildkite/utilities/pgo_script.jl" + ./stage1.build/julia .buildkite/utilities/pgo_script.jl fi # Finish off with any extra make flags from the `.arches` file From add640c9d8cd844225c5cf8ce4a5f6e7163a450e Mon Sep 17 00:00:00 2001 From: Zentrik Date: Mon, 25 Mar 2024 22:11:25 +0000 Subject: [PATCH 03/56] Make pgo script a bit quicker Now takes ~10 minutes. Precompiling OrdinaryDiffEq takes 367s and Plots 135s. Actually running the script takes 1-2 minutes. --- utilities/pgo_script.jl | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/utilities/pgo_script.jl b/utilities/pgo_script.jl index 2fa447fb0..1dd69705b 100644 --- a/utilities/pgo_script.jl +++ b/utilities/pgo_script.jl @@ -1,13 +1,13 @@ using Pkg Pkg.activate(; temp=true) Pkg.add(url="https://github.com/JuliaCI/BaseBenchmarks.jl") -Pkg.add("DifferentialEquations") +Pkg.add("OrdinaryDiffEq") Pkg.add("Test") Pkg.add("LinearAlgebra") Pkg.add("ThreadsX") Pkg.add("Plots") -using BaseBenchmarks, DifferentialEquations, Test, ThreadsX, LinearAlgebra, Plots +using BaseBenchmarks, OrdinaryDiffEq, Test, ThreadsX, LinearAlgebra, Plots BaseBenchmarks.load!("problem") @@ -25,15 +25,9 @@ f_2dlinear_analytic = (u0, p, t) -> @. u0 * exp(p * t) prob_ode_2Dlinear = ODEProblem(ODEFunction(f_2dlinear, analytic = f_2dlinear_analytic), rand(4, 2), (0.0, 1.0), 1.01) -alg, kwargs = default_algorithm(prob_ode_2Dlinear; dt = 1 // 2^(4)) -integ = init(prob_ode_2Dlinear; dt = 1 // 2^(4)) -sol = solve(prob_ode_2Dlinear; dt = 1 // 2^(4)) +sol = solve(prob_ode_2Dlinear, Tsit5(); dt = 1 // 2^(4)) -sol = solve(prob_ode_2Dlinear; reltol = 1e-1) - -sol = solve(prob_ode_2Dlinear; reltol = 1e-7) - -sol = solve(prob_ode_2Dlinear; alg_hints = [:stiff]) +sol = solve(prob_ode_2Dlinear, Rosenbrock23()) const linear_bigα = parse(BigFloat, "1.01") f = (du, u, p, t) -> begin @@ -45,7 +39,7 @@ end prob_ode_bigfloat2Dlinear = ODEProblem(f, map(BigFloat, rand(4, 2)) .* ones(4, 2) / 2, (0.0, 1.0)) -sol = solve(prob_ode_bigfloat2Dlinear; dt = 1 // 2^(4)) +sol = solve(prob_ode_bigfloat2Dlinear, Tsit5(); dt = 1 // 2^(4)) # From OmniPackage.jl function expm(A::AbstractMatrix{S}) where {S} From e0fcd80ab82eea823598d954c24b259554e88081 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Mon, 25 Mar 2024 22:19:33 +0000 Subject: [PATCH 04/56] Fix lto build directory Not really sure why this works, but it seems to. --- utilities/build_julia.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 55b283626..3c216017d 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -53,7 +53,7 @@ fi MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then - MFLAGS+=( "STAGE2_BUILD=$PWD/usr" ) + MFLAGS+=( "STAGE2_BUILD=$PWD" ) echo "--- Collect make options" echo "Make Options:" From 4fafdc104464197fc9f8280aee95b7900598e6e2 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Mon, 25 Mar 2024 23:02:54 +0000 Subject: [PATCH 05/56] Fix upload name for lto binary --- utilities/build_envs.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utilities/build_envs.sh b/utilities/build_envs.sh index 72cd14939..7b6cd17fb 100755 --- a/utilities/build_envs.sh +++ b/utilities/build_envs.sh @@ -218,6 +218,9 @@ fi # This is the "main" filename that is used. We technically don't need this for uploading, # but it's very convenient for shuttling binaries between buildkite steps. export UPLOAD_FILENAME="julia-${TAR_VERSION?}-${OS?}-${ARCH?}" +if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then + UPLOAD_FILENAME="${UPLOAD_FILENAME}-${USE_JULIA_PGO_LTO}" +fi echo "--- Print the full and short commit hashes" echo "The full commit is: ${LONG_COMMIT}" From 8dec66b95c43c611987757ab62ee704c241ccd18 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 10:53:54 +0000 Subject: [PATCH 06/56] Use profile from building julia for PGO I think 0f8bae0bb67a44f14de0593599c4e9744b6371b7 might have slowed down the binary. At least locally this seems to be roughly the same as using pgo_script prior to 0f8bae0bb67a44f14de0593599c4e9744b6371b7. I have 7 binaries locally and cannot work out why some are slower than others but I think this should be good enough. --- utilities/build_julia.sh | 7 +- utilities/pgo_script.jl | 140 --------------------------------------- 2 files changed, 4 insertions(+), 143 deletions(-) delete mode 100644 utilities/pgo_script.jl diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 3c216017d..817740859 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -66,9 +66,10 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then cd contrib/pgo-lto ${MAKE} "${MFLAGS[@]}" stage1 - echo "--- Collecting Profile" - ${MAKE} clean-profiles - ./stage1.build/julia .buildkite/utilities/pgo_script.jl + # We use profile from building stage1 + # echo "--- Collecting Profile" + # ${MAKE} clean-profiles + # ./stage1.build/julia .buildkite/utilities/pgo_script.jl fi # Finish off with any extra make flags from the `.arches` file diff --git a/utilities/pgo_script.jl b/utilities/pgo_script.jl deleted file mode 100644 index 1dd69705b..000000000 --- a/utilities/pgo_script.jl +++ /dev/null @@ -1,140 +0,0 @@ -using Pkg -Pkg.activate(; temp=true) -Pkg.add(url="https://github.com/JuliaCI/BaseBenchmarks.jl") -Pkg.add("OrdinaryDiffEq") -Pkg.add("Test") -Pkg.add("LinearAlgebra") -Pkg.add("ThreadsX") -Pkg.add("Plots") - -using BaseBenchmarks, OrdinaryDiffEq, Test, ThreadsX, LinearAlgebra, Plots - -BaseBenchmarks.load!("problem") - -using BaseBenchmarks.ProblemBenchmarks: MonteCarlo, Raytracer, JSONParse, PROBLEM_DATA_DIR -MonteCarlo.perf_euro_option_vec(10^4) -Raytracer.perf_raytrace(5, 256, 4) - -jstr = read(joinpath(PROBLEM_DATA_DIR, "test.json"), String) -JSONParse.perf_parse_json(jstr) - -# https://github.com/SciML/DifferentialEquations.jl/blob/master/test/default_ode_alg_test.jl - -f_2dlinear = (du, u, p, t) -> (@. du = p * u) -f_2dlinear_analytic = (u0, p, t) -> @. u0 * exp(p * t) -prob_ode_2Dlinear = ODEProblem(ODEFunction(f_2dlinear, analytic = f_2dlinear_analytic), - rand(4, 2), (0.0, 1.0), 1.01) - -sol = solve(prob_ode_2Dlinear, Tsit5(); dt = 1 // 2^(4)) - -sol = solve(prob_ode_2Dlinear, Rosenbrock23()) - -const linear_bigα = parse(BigFloat, "1.01") -f = (du, u, p, t) -> begin - for i in 1:length(u) - du[i] = linear_bigα * u[i] - end -end -(::typeof(f))(::Type{Val{:analytic}}, u0, p, t) = u0 * exp(linear_bigα * t) -prob_ode_bigfloat2Dlinear = ODEProblem(f, map(BigFloat, rand(4, 2)) .* ones(4, 2) / 2, - (0.0, 1.0)) - -sol = solve(prob_ode_bigfloat2Dlinear, Tsit5(); dt = 1 // 2^(4)) - -# From OmniPackage.jl -function expm(A::AbstractMatrix{S}) where {S} - # omitted: matrix balancing, i.e., LAPACK.gebal! - nA = opnorm(A, 1) - ## For sufficiently small nA, use lower order Padé-Approximations - if (nA <= 2.1) - A2 = A * A - if nA > 0.95 - U = @evalpoly( - A2, - S(8821612800) * I, - S(302702400) * I, - S(2162160) * I, - S(3960) * I, - S(1) * I - ) - U = A * U - V = @evalpoly( - A2, - S(17643225600) * I, - S(2075673600) * I, - S(30270240) * I, - S(110880) * I, - S(90) * I - ) - elseif nA > 0.25 - U = @evalpoly(A2, S(8648640) * I, S(277200) * I, S(1512) * I, S(1) * I) - U = A * U - V = - @evalpoly(A2, S(17297280) * I, S(1995840) * I, S(25200) * I, S(56) * I) - elseif nA > 0.015 - U = @evalpoly(A2, S(15120) * I, S(420) * I, S(1) * I) - U = A * U - V = @evalpoly(A2, S(30240) * I, S(3360) * I, S(30) * I) - else - U = @evalpoly(A2, S(60) * I, S(1) * I) - U = A * U - V = @evalpoly(A2, S(120) * I, S(12) * I) - end - expA = (V - U) \ (V + U) - else - s = log2(nA / 5.4) # power of 2 later reversed by squaring - if s > 0 - si = ceil(Int, s) - A = A / S(exp2(si)) - end - - A2 = A * A - A4 = A2 * A2 - A6 = A2 * A4 - - U = - A6 * (S(1) * A6 + S(16380) * A4 + S(40840800) * A2) + - ( - S(33522128640) * A6 + S(10559470521600) * A4 + S(1187353796428800) * A2 - ) + - S(32382376266240000) * I - U = A * U - V = - A6 * (S(182) * A6 + S(960960) * A4 + S(1323241920) * A2) + - ( - S(670442572800) * A6 + - S(129060195264000) * A4 + - S(7771770303897600) * A2 - ) + - S(64764752532480000) * I - expA = (V - U) \ (V + U) - if s > 0 # squaring to reverse dividing by power of 2 - for t = 1:si - expA = expA * expA - end - end - end - expA -end - -function expwork(A) - B = expm(A) - C = similar(B) - for i = 0:7 - C .= A .* exp(-i) - B .+= expm(C) - end - return B -end - -expm_bench0(N = 2, iters = 100) = - ThreadsX.sum(1:iters) do _ - expwork(rand(N, N)) - end - -expm_bench0() - -# Plots.jl Example -x = range(0, 10, length=100) -y = sin.(x) -plot(x, y) \ No newline at end of file From 04bc679a1ddd6e561b281d8e6146733fb8981a67 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 11:15:39 +0000 Subject: [PATCH 07/56] Replace + with - character in .arches file Buildkite was complaining about non-alphanumeric character --- pipelines/main/platforms/build_linux.pgo_lto.arches | 2 +- pipelines/main/platforms/test_linux.pgo_lto.arches | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 36e4cf860..16e362fd9 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ # ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -package_linux x86_64-linux-gnu x86_64 x86_64 PGO+LTO JL_CFLAGS=-Werror,JL_CXXFLAGS=-Werror . v6.00 4dcde853eb5baaa0a8f087b633eaf955dc94b5dc +package_linux x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror,JL_CXXFLAGS=-Werror . v6.00 4dcde853eb5baaa0a8f087b633eaf955dc94b5dc # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string diff --git a/pipelines/main/platforms/test_linux.pgo_lto.arches b/pipelines/main/platforms/test_linux.pgo_lto.arches index 634e149bf..8b41e6c2b 100644 --- a/pipelines/main/platforms/test_linux.pgo_lto.arches +++ b/pipelines/main/platforms/test_linux.pgo_lto.arches @@ -1,5 +1,5 @@ # ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS TIMEOUT USE_RR USE_JULIA_PGO_LTO ROOTFS_TAG ROOTFS_HASH -tester_linux x86_64-linux-gnu x86_64 x86_64 . . PGO+LTO v6.00 770c0240be788cfeb9654e1980ea929d3ed98d1f +tester_linux x86_64-linux-gnu x86_64 x86_64 . . PGO_LTO v6.00 770c0240be788cfeb9654e1980ea929d3ed98d1f # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string From 4a944cda37e6653c19dd9a2de37d4b08103656e5 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 19:59:58 +0000 Subject: [PATCH 08/56] Add -m64 as a flag to clang Hopefully this fixes the error as I have no idea how to debug this --- utilities/build_julia.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 817740859..c0a843fed 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -54,6 +54,7 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) + MFLAGS+= ( "SANITIZE_OPTS=-m64 " ) echo "--- Collect make options" echo "Make Options:" From c24698b4255d22c31134955d09db528401963e5d Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 20:14:35 +0000 Subject: [PATCH 09/56] Print patchelf config log if make fails --- utilities/build_julia.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index c0a843fed..ab22c8445 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -65,7 +65,7 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then echo "--- Build Julia Stage 1 - with instrumentation" cd contrib/pgo-lto - ${MAKE} "${MFLAGS[@]}" stage1 + ${MAKE} "${MFLAGS[@]}" stage1 || cat $PWD/stage1.build/deps/patchelf-0.18.0/config.log && exit $? # We use profile from building stage1 # echo "--- Collecting Profile" From cc7a072934f2c52890328d955078e571de98c63b Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 20:21:00 +0000 Subject: [PATCH 10/56] Fix typo --- utilities/build_julia.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index ab22c8445..6734c311a 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -54,7 +54,7 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - MFLAGS+= ( "SANITIZE_OPTS=-m64 " ) + MFLAGS+=( "SANITIZE_OPTS=-m64 " ) echo "--- Collect make options" echo "Make Options:" From 657bdf7071b7a24a86b16e964d8b8501fd2872e4 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 21:29:24 +0000 Subject: [PATCH 11/56] Try finding correct gcc - taken from CLANGSA_CXXFLAGS in julia Makefile --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 6734c311a..d8827b00b 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -54,7 +54,7 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - MFLAGS+=( "SANITIZE_OPTS=-m64 " ) + MFLAGS+=( "SANITIZE_OPTS=-m64 --gcc-toolchain=$(LANG=C cc -print-search-dirs | grep '^install: ' | sed -e "s/^install: //")/../../../.." ) echo "--- Collect make options" echo "Make Options:" @@ -65,7 +65,7 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then echo "--- Build Julia Stage 1 - with instrumentation" cd contrib/pgo-lto - ${MAKE} "${MFLAGS[@]}" stage1 || cat $PWD/stage1.build/deps/patchelf-0.18.0/config.log && exit $? + ${MAKE} "${MFLAGS[@]}" stage1 || cat $PWD/stage1.build/deps/patchelf-0.18.0/config.log && exit 1 # We use profile from building stage1 # echo "--- Collecting Profile" From f907ba9404d2ab39c3e66d3cbfb3600d1dc12824 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 21:37:27 +0000 Subject: [PATCH 12/56] Specify gcc version exactly --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index d8827b00b..36e925d95 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -54,7 +54,7 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - MFLAGS+=( "SANITIZE_OPTS=-m64 --gcc-toolchain=$(LANG=C cc -print-search-dirs | grep '^install: ' | sed -e "s/^install: //")/../../../.." ) + MFLAGS+=( "SANITIZE_OPTS=-m64 --gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/9" ) echo "--- Collect make options" echo "Make Options:" @@ -65,7 +65,7 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then echo "--- Build Julia Stage 1 - with instrumentation" cd contrib/pgo-lto - ${MAKE} "${MFLAGS[@]}" stage1 || cat $PWD/stage1.build/deps/patchelf-0.18.0/config.log && exit 1 + ${MAKE} "${MFLAGS[@]}" stage1 # We use profile from building stage1 # echo "--- Collecting Profile" From 682b02e3cd90e8c135d1341073c3a37a747096d6 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 21:44:57 +0000 Subject: [PATCH 13/56] Try different path --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 36e925d95..5f844ac24 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -54,7 +54,7 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - MFLAGS+=( "SANITIZE_OPTS=-m64 --gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/9" ) + MFLAGS+=( "SANITIZE_OPTS=-m64 --gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9" ) echo "--- Collect make options" echo "Make Options:" @@ -65,7 +65,7 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then echo "--- Build Julia Stage 1 - with instrumentation" cd contrib/pgo-lto - ${MAKE} "${MFLAGS[@]}" stage1 + ${MAKE} "${MFLAGS[@]}" stage1 || cat $PWD/stage1.build/deps/patchelf-0.18.0/config.log && exit 1 # We use profile from building stage1 # echo "--- Collecting Profile" From 657b390dd872c39ffb100385062adbb59b80b079 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 21:50:06 +0000 Subject: [PATCH 14/56] Try different path + pass into flags used for building not just config --- utilities/build_julia.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 5f844ac24..b88275045 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -54,7 +54,9 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - MFLAGS+=( "SANITIZE_OPTS=-m64 --gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9" ) + MFLAGS+=( "SANITIZE_OPTS=-m64 --gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) + CFLAGS+=( "--gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) + CXXFLAGS+=( "--gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) echo "--- Collect make options" echo "Make Options:" From 3c409bad7d508ed8ec66a724d6baecf2e8111fc7 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 21:59:42 +0000 Subject: [PATCH 15/56] Specify CFLAGS and CXXFLAGS properly --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index b88275045..71ddbed59 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -55,8 +55,8 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) MFLAGS+=( "SANITIZE_OPTS=-m64 --gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) - CFLAGS+=( "--gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) - CXXFLAGS+=( "--gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) + MFLAGS+=( "CFLAGS+=--gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) + MFLAGS+=( "CXXFLAGS+=--gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) echo "--- Collect make options" echo "Make Options:" From f7fcaf1147d248a63ca60bdb43ad51e650d2a537 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 26 Mar 2024 23:16:27 +0000 Subject: [PATCH 16/56] Remove hardcoded gcc install dir --- utilities/build_julia.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 71ddbed59..61cf5b394 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -54,9 +54,10 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - MFLAGS+=( "SANITIZE_OPTS=-m64 --gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) - MFLAGS+=( "CFLAGS+=--gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) - MFLAGS+=( "CXXFLAGS+=--gcc-install-dir=/usr/local/lib/gcc/x86_64-linux-gnu/9.1.0" ) + GCCFLAG=--gcc-install-dir=$(LANG=C cc -print-search-dirs | grep '^install: ' | sed -e "s/^install: //") + MFLAGS+=( "SANITIZE_OPTS=$GCCFLAG" ) + MFLAGS+=( "CFLAGS+=$GCCFLAG" ) + MFLAGS+=( "CXXFLAGS+=$GCCFLAG" ) echo "--- Collect make options" echo "Make Options:" From aaf61c78c01c00af101d1819099ae4c7f20b7985 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Wed, 27 Mar 2024 01:16:15 +0000 Subject: [PATCH 17/56] Upload profile data so builds can be reproduced --- utilities/build_julia.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 61cf5b394..f0c237dee 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -126,3 +126,8 @@ fi echo "--- Upload build artifacts to buildkite" buildkite-agent artifact upload "${UPLOAD_FILENAME}.tar.gz" + +# Upload the profile data to allow for reproducible builds +if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then + buildkite-agent artifact upload "contrib/pgo-lto/profiles/merged.prof" +fi From 3a22736d32e8a00bef3c64c2d47524867a3a09e9 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Fri, 29 Mar 2024 14:01:09 +0000 Subject: [PATCH 18/56] Switch rootfs image to llvm_passes This seems to be what the form source builds use, though they seem to have been failing for the last year. Not sure if I still need to specify `--gcc-install-dir`. --- pipelines/main/platforms/build_linux.pgo_lto.arches | 2 +- utilities/build_julia.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 16e362fd9..af030c5d6 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ # ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -package_linux x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror,JL_CXXFLAGS=-Werror . v6.00 4dcde853eb5baaa0a8f087b633eaf955dc94b5dc +llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror,JL_CXXFLAGS=-Werror . v6.00 4dcde853eb5baaa0a8f087b633eaf955dc94b5dc # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index f0c237dee..504903482 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -54,10 +54,10 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - GCCFLAG=--gcc-install-dir=$(LANG=C cc -print-search-dirs | grep '^install: ' | sed -e "s/^install: //") - MFLAGS+=( "SANITIZE_OPTS=$GCCFLAG" ) - MFLAGS+=( "CFLAGS+=$GCCFLAG" ) - MFLAGS+=( "CXXFLAGS+=$GCCFLAG" ) + # GCCFLAG=--gcc-install-dir=$(LANG=C cc -print-search-dirs | grep '^install: ' | sed -e "s/^install: //") + # MFLAGS+=( "SANITIZE_OPTS=$GCCFLAG" ) + # MFLAGS+=( "CFLAGS+=$GCCFLAG" ) + # MFLAGS+=( "CXXFLAGS+=$GCCFLAG" ) echo "--- Collect make options" echo "Make Options:" From 0b7d70e2e29eee47bd5ec352eac93e995e34964f Mon Sep 17 00:00:00 2001 From: Zentrik Date: Fri, 29 Mar 2024 14:07:43 +0000 Subject: [PATCH 19/56] Add back gcc install dir for sanitize opts This gets passed to patch elf's configure step --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 504903482..26656ae75 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -54,8 +54,8 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - # GCCFLAG=--gcc-install-dir=$(LANG=C cc -print-search-dirs | grep '^install: ' | sed -e "s/^install: //") - # MFLAGS+=( "SANITIZE_OPTS=$GCCFLAG" ) + GCCFLAG=--gcc-install-dir=$(LANG=C cc -print-search-dirs | grep '^install: ' | sed -e "s/^install: //") + MFLAGS+=( "SANITIZE_OPTS=$GCCFLAG" ) # MFLAGS+=( "CFLAGS+=$GCCFLAG" ) # MFLAGS+=( "CXXFLAGS+=$GCCFLAG" ) From 45c520cf0e65e66f35fb7d43909afcd0b161a58b Mon Sep 17 00:00:00 2001 From: Zentrik Date: Fri, 29 Mar 2024 14:18:45 +0000 Subject: [PATCH 20/56] Add back gc install dir everywhere --- utilities/build_julia.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 26656ae75..84a50d7c0 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -56,8 +56,8 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) GCCFLAG=--gcc-install-dir=$(LANG=C cc -print-search-dirs | grep '^install: ' | sed -e "s/^install: //") MFLAGS+=( "SANITIZE_OPTS=$GCCFLAG" ) - # MFLAGS+=( "CFLAGS+=$GCCFLAG" ) - # MFLAGS+=( "CXXFLAGS+=$GCCFLAG" ) + MFLAGS+=( "CFLAGS+=$GCCFLAG" ) + MFLAGS+=( "CXXFLAGS+=$GCCFLAG" ) echo "--- Collect make options" echo "Make Options:" @@ -68,7 +68,7 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then echo "--- Build Julia Stage 1 - with instrumentation" cd contrib/pgo-lto - ${MAKE} "${MFLAGS[@]}" stage1 || cat $PWD/stage1.build/deps/patchelf-0.18.0/config.log && exit 1 + ${MAKE} "${MFLAGS[@]}" stage1 # We use profile from building stage1 # echo "--- Collecting Profile" From 7e2256b6f67d9a141d23c55dc0dac993d25a79ae Mon Sep 17 00:00:00 2001 From: Zentrik Date: Fri, 29 Mar 2024 15:05:56 +0000 Subject: [PATCH 21/56] Update rootfs_hash I don't think ROOTFS_IMAGE_NAME actually does anything on its own --- pipelines/main/platforms/build_linux.pgo_lto.arches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index af030c5d6..126aacc68 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ # ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror,JL_CXXFLAGS=-Werror . v6.00 4dcde853eb5baaa0a8f087b633eaf955dc94b5dc +llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror,JL_CXXFLAGS=-Werror . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string From 2fe728a4b7cc697481c51d1daa8a6560c68d6119 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Fri, 29 Mar 2024 16:08:03 +0000 Subject: [PATCH 22/56] Stop clang throwing error on unused function in crc32 Not sure why gcc doesn't. --- pipelines/main/platforms/build_linux.pgo_lto.arches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 126aacc68..1cd2732ec 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ # ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror,JL_CXXFLAGS=-Werror . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 +llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror -Wno-error=unused-function,JL_CXXFLAGS=-Werror -Wno-error=unused-function . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string From 75e32b888f45b6c365363ee399ac109e57138399 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Fri, 29 Mar 2024 16:13:00 +0000 Subject: [PATCH 23/56] Fix --- pipelines/main/platforms/build_linux.pgo_lto.arches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 1cd2732ec..1dbee19a1 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ # ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror -Wno-error=unused-function,JL_CXXFLAGS=-Werror -Wno-error=unused-function . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 +llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS="-Werror -Wno-error=unused-function",JL_CXXFLAGS="-Werror -Wno-error=unused-function" . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string From 1d142de938f2200c6c74489fe3ab4f313335d075 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Fri, 29 Mar 2024 17:23:04 +0000 Subject: [PATCH 24/56] Revert "Fix" This reverts commit c2ebde3a057ec197abb1015ba4f306a8bfe28c71. --- pipelines/main/platforms/build_linux.pgo_lto.arches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 1dbee19a1..1cd2732ec 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ # ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS="-Werror -Wno-error=unused-function",JL_CXXFLAGS="-Werror -Wno-error=unused-function" . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 +llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror -Wno-error=unused-function,JL_CXXFLAGS=-Werror -Wno-error=unused-function . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string From 83c8607632972701456ba2d72fdd88e15c90e07f Mon Sep 17 00:00:00 2001 From: Zentrik Date: Fri, 29 Mar 2024 17:23:06 +0000 Subject: [PATCH 25/56] Revert "Stop clang throwing error on unused function in crc32" This reverts commit a5d1274d575e959c2ed604a4662b0530f0b7894b. --- pipelines/main/platforms/build_linux.pgo_lto.arches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 1cd2732ec..126aacc68 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ # ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror -Wno-error=unused-function,JL_CXXFLAGS=-Werror -Wno-error=unused-function . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 +llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror,JL_CXXFLAGS=-Werror . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string From 07fa39efee66d288e48918c820feac425579a79b Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sun, 21 Apr 2024 12:59:48 +0100 Subject: [PATCH 26/56] Remove `-Werror` till https://github.com/JuliaLang/julia/pull/53897 merges --- pipelines/main/platforms/build_linux.pgo_lto.arches | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 126aacc68..26c650349 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ -# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO JL_CFLAGS=-Werror,JL_CXXFLAGS=-Werror . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 +# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH +llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO . . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string From 3703bd81ceca5badf75a1ddcdf619e720bbe5dcd Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sun, 21 Apr 2024 13:00:32 +0100 Subject: [PATCH 27/56] Clean up GCCFLAG should no longer be required now that we use the llvmpasses image --- utilities/build_julia.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 84a50d7c0..9b9645668 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -54,10 +54,6 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - GCCFLAG=--gcc-install-dir=$(LANG=C cc -print-search-dirs | grep '^install: ' | sed -e "s/^install: //") - MFLAGS+=( "SANITIZE_OPTS=$GCCFLAG" ) - MFLAGS+=( "CFLAGS+=$GCCFLAG" ) - MFLAGS+=( "CXXFLAGS+=$GCCFLAG" ) echo "--- Collect make options" echo "Make Options:" @@ -69,11 +65,7 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then cd contrib/pgo-lto ${MAKE} "${MFLAGS[@]}" stage1 - - # We use profile from building stage1 - # echo "--- Collecting Profile" - # ${MAKE} clean-profiles - # ./stage1.build/julia .buildkite/utilities/pgo_script.jl + # Building stage1 collects profiling data which we use instead of collecting our own fi # Finish off with any extra make flags from the `.arches` file From 60baf582807b8aa19d66d00cf00888cc3dacff8e Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sun, 21 Apr 2024 14:43:21 +0100 Subject: [PATCH 28/56] Try to fix downloading pgo binary when testing --- utilities/test_julia.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/test_julia.sh b/utilities/test_julia.sh index 07a99d5a0..aab5babfd 100755 --- a/utilities/test_julia.sh +++ b/utilities/test_julia.sh @@ -21,7 +21,7 @@ if [[ ! -d "${JULIA_INSTALL_DIR}/bin" ]]; then # first, however in the event of a soft-fail test, we can re-run a test after a successful # upload has occured. echo "--- Download build artifacts" - buildkite-agent artifact download --step "build_${TRIPLET}" "${UPLOAD_FILENAME}.tar.gz" . + buildkite-agent artifact download --step "build_${TRIPLET}${USE_JULIA_PGO_LTO-}" "${UPLOAD_FILENAME}.tar.gz" . echo "--- Extract build artifacts" tar xzf "${UPLOAD_FILENAME}.tar.gz" "${JULIA_INSTALL_DIR}/" From 4f1c0c825cbb265355c2f70f765dafbde0871a3f Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 13 Jul 2024 11:34:48 +0100 Subject: [PATCH 29/56] Add comment --- pipelines/main/launch_unsigned_jobs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/pipelines/main/launch_unsigned_jobs.yml b/pipelines/main/launch_unsigned_jobs.yml index c9dca76b9..b98d77b74 100644 --- a/pipelines/main/launch_unsigned_jobs.yml +++ b/pipelines/main/launch_unsigned_jobs.yml @@ -30,6 +30,7 @@ steps: bash .buildkite/utilities/arches_pipeline_upload.sh \ .buildkite/pipelines/main/platforms/build_linux.arches \ .buildkite/pipelines/main/platforms/build_linux.yml + # Launch Linux PGO LTO build jobs GROUP="Build" \ ALLOW_FAIL="false" \ bash .buildkite/utilities/arches_pipeline_upload.sh \ From 13d94477b1df7ced7a2d90752a9abdc103fb39f1 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 13 Jul 2024 11:36:22 +0100 Subject: [PATCH 30/56] Tabs to spaces --- pipelines/main/launch_unsigned_jobs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/main/launch_unsigned_jobs.yml b/pipelines/main/launch_unsigned_jobs.yml index b98d77b74..3da8c9d67 100644 --- a/pipelines/main/launch_unsigned_jobs.yml +++ b/pipelines/main/launch_unsigned_jobs.yml @@ -30,7 +30,7 @@ steps: bash .buildkite/utilities/arches_pipeline_upload.sh \ .buildkite/pipelines/main/platforms/build_linux.arches \ .buildkite/pipelines/main/platforms/build_linux.yml - # Launch Linux PGO LTO build jobs + # Launch Linux PGO LTO build jobs GROUP="Build" \ ALLOW_FAIL="false" \ bash .buildkite/utilities/arches_pipeline_upload.sh \ From c669dbaf76e31f5277372187ec68b7e8883e4f74 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Thu, 22 Aug 2024 20:44:05 +0100 Subject: [PATCH 31/56] Copy cleanup from https://github.com/JuliaCI/julia-buildkite/pull/345/commits/ba182b0007008b9df543edec3409a1c9d385f9c8 --- pipelines/main/launch_unsigned_jobs.yml | 3 ++- pipelines/main/platforms/build_linux.pgo_lto.arches | 4 ++-- pipelines/main/platforms/build_linux.yml | 4 ++-- pipelines/main/platforms/test_linux.pgo_lto.arches | 2 +- pipelines/main/platforms/test_linux.yml | 9 ++++----- utilities/build_envs.sh | 3 --- utilities/build_julia.sh | 2 +- utilities/extract_triplet.sh | 3 +++ utilities/test_julia.sh | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pipelines/main/launch_unsigned_jobs.yml b/pipelines/main/launch_unsigned_jobs.yml index 3da8c9d67..f04ce1bba 100644 --- a/pipelines/main/launch_unsigned_jobs.yml +++ b/pipelines/main/launch_unsigned_jobs.yml @@ -30,7 +30,7 @@ steps: bash .buildkite/utilities/arches_pipeline_upload.sh \ .buildkite/pipelines/main/platforms/build_linux.arches \ .buildkite/pipelines/main/platforms/build_linux.yml - # Launch Linux PGO LTO build jobs + # Launch Linux PGO+LTO build jobs GROUP="Build" \ ALLOW_FAIL="false" \ bash .buildkite/utilities/arches_pipeline_upload.sh \ @@ -103,6 +103,7 @@ steps: bash .buildkite/utilities/arches_pipeline_upload.sh \ .buildkite/pipelines/main/platforms/test_linux.i686.arches \ .buildkite/pipelines/main/platforms/test_linux.i686.yml + # Launch Linux PGO+LTO test jobs GROUP="Test" \ bash .buildkite/utilities/arches_pipeline_upload.sh \ .buildkite/pipelines/main/platforms/test_linux.pgo_lto.arches \ diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 26c650349..5fc400dce 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ -# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu x86_64 x86_64 PGO_LTO . . v6.00 0badf5d8794e21a03ac2ff2d46c1ab538ac02571 +# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH +llvm_passes x86_64-linux-gnu-pgo-lto x86_64 x86_64 PGO_LTO LDFLAGS+=-Wl,--undefined-version . v7.6 ebdfa2d40c0e27842cccbfdd43710144f9adf9d8 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string diff --git a/pipelines/main/platforms/build_linux.yml b/pipelines/main/platforms/build_linux.yml index c0e433f2e..d51f69702 100644 --- a/pipelines/main/platforms/build_linux.yml +++ b/pipelines/main/platforms/build_linux.yml @@ -1,8 +1,8 @@ steps: - group: "${GROUP?}" steps: - - label: ":linux: build ${TRIPLET?}${USE_JULIA_PGO_LTO-}" - key: "build_${TRIPLET?}${USE_JULIA_PGO_LTO-}" + - label: ":linux: build ${TRIPLET?}" + key: "build_${TRIPLET?}" plugins: - JuliaCI/external-buildkite#v1: version: "./.buildkite-external-version" diff --git a/pipelines/main/platforms/test_linux.pgo_lto.arches b/pipelines/main/platforms/test_linux.pgo_lto.arches index 8b41e6c2b..fe2b96081 100644 --- a/pipelines/main/platforms/test_linux.pgo_lto.arches +++ b/pipelines/main/platforms/test_linux.pgo_lto.arches @@ -1,5 +1,5 @@ # ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS TIMEOUT USE_RR USE_JULIA_PGO_LTO ROOTFS_TAG ROOTFS_HASH -tester_linux x86_64-linux-gnu x86_64 x86_64 . . PGO_LTO v6.00 770c0240be788cfeb9654e1980ea929d3ed98d1f +tester_linux x86_64-linux-gnu-pgo-lto x86_64 x86_64 . . PGO_LTO v6.00 770c0240be788cfeb9654e1980ea929d3ed98d1f # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string diff --git a/pipelines/main/platforms/test_linux.yml b/pipelines/main/platforms/test_linux.yml index 9a9aab764..5910133a8 100644 --- a/pipelines/main/platforms/test_linux.yml +++ b/pipelines/main/platforms/test_linux.yml @@ -1,15 +1,15 @@ steps: - group: "${GROUP?}" steps: - - label: ":linux: test ${TRIPLET?}${USE_RR-}${USE_JULIA_PGO_LTO-}" - key: "test_${TRIPLET?}${USE_RR-}${USE_JULIA_PGO_LTO-}" + - label: ":linux: test ${TRIPLET?}${USE_RR-}" + key: "test_${TRIPLET?}${USE_RR-}" depends_on: - - "build_${TRIPLET?}${USE_JULIA_PGO_LTO-}" + - "build_${TRIPLET?}" plugins: - JuliaCI/coreupload#v2: core_pattern: "**/*.core" compressor: "zstd" - disabled: "${USE_RR?}${USE_JULIA_PGO_LTO-}" + disabled: "${USE_RR?}" create_bundle: "true" lldb_commands: - "bt all" @@ -41,4 +41,3 @@ steps: JULIA_SHELL: "/bin/bash" TRIPLET: "${TRIPLET?}" USE_RR: "${USE_RR?}" - USE_JULIA_PGO_LTO: "${USE_JULIA_PGO_LTO}" diff --git a/utilities/build_envs.sh b/utilities/build_envs.sh index 7b6cd17fb..72cd14939 100755 --- a/utilities/build_envs.sh +++ b/utilities/build_envs.sh @@ -218,9 +218,6 @@ fi # This is the "main" filename that is used. We technically don't need this for uploading, # but it's very convenient for shuttling binaries between buildkite steps. export UPLOAD_FILENAME="julia-${TAR_VERSION?}-${OS?}-${ARCH?}" -if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then - UPLOAD_FILENAME="${UPLOAD_FILENAME}-${USE_JULIA_PGO_LTO}" -fi echo "--- Print the full and short commit hashes" echo "The full commit is: ${LONG_COMMIT}" diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 9b9645668..c977ab8e2 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -78,7 +78,7 @@ for FLAG in "${MFLAGS[@]}"; do done if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then - echo "--- Build Julia Stage 2 - optimised" + echo "--- Build Julia Stage 2 - PGO + LTO optimised" ${MAKE} "${MFLAGS[@]}" stage2 cd ../.. diff --git a/utilities/extract_triplet.sh b/utilities/extract_triplet.sh index 216a000e1..072a24de1 100755 --- a/utilities/extract_triplet.sh +++ b/utilities/extract_triplet.sh @@ -26,6 +26,9 @@ case "${TRIPLET}" in *-gnunogpl) # builds that use `USE_GPL_LIBS=0` OS="linuxnogpl" ;; + *-gnu-pgo-lto-bolt) # PGO + LTO + BOLT builds + OS="linuxpgoltobolt" + ;; *-musl) OS="musl" ;; diff --git a/utilities/test_julia.sh b/utilities/test_julia.sh index aab5babfd..07a99d5a0 100755 --- a/utilities/test_julia.sh +++ b/utilities/test_julia.sh @@ -21,7 +21,7 @@ if [[ ! -d "${JULIA_INSTALL_DIR}/bin" ]]; then # first, however in the event of a soft-fail test, we can re-run a test after a successful # upload has occured. echo "--- Download build artifacts" - buildkite-agent artifact download --step "build_${TRIPLET}${USE_JULIA_PGO_LTO-}" "${UPLOAD_FILENAME}.tar.gz" . + buildkite-agent artifact download --step "build_${TRIPLET}" "${UPLOAD_FILENAME}.tar.gz" . echo "--- Extract build artifacts" tar xzf "${UPLOAD_FILENAME}.tar.gz" "${JULIA_INSTALL_DIR}/" From 0408a2f5e575c2ed9cedcdbbb69692d768698850 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Thu, 22 Aug 2024 20:49:45 +0100 Subject: [PATCH 32/56] Workaround parser disliking + --- pipelines/main/platforms/build_linux.pgo_lto.arches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 5fc400dce..7e49846b1 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ # ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu-pgo-lto x86_64 x86_64 PGO_LTO LDFLAGS+=-Wl,--undefined-version . v7.6 ebdfa2d40c0e27842cccbfdd43710144f9adf9d8 +llvm_passes x86_64-linux-gnu-pgo-lto x86_64 x86_64 PGO_LTO LDFLAGS=-Wl,--undefined-version . v7.6 ebdfa2d40c0e27842cccbfdd43710144f9adf9d8 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simply substitute a `.` to the empty string From eda42b739f7f2e0098dfc4e3483444c0d33dcb06 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Thu, 22 Aug 2024 20:55:11 +0100 Subject: [PATCH 33/56] Fix triplet extraction --- utilities/extract_triplet.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/extract_triplet.sh b/utilities/extract_triplet.sh index 072a24de1..620b16367 100755 --- a/utilities/extract_triplet.sh +++ b/utilities/extract_triplet.sh @@ -26,8 +26,8 @@ case "${TRIPLET}" in *-gnunogpl) # builds that use `USE_GPL_LIBS=0` OS="linuxnogpl" ;; - *-gnu-pgo-lto-bolt) # PGO + LTO + BOLT builds - OS="linuxpgoltobolt" + *-gnu-pgo-lto) # PGO + LTO builds + OS="linuxpgolto" ;; *-musl) OS="musl" From 5f6fe68dbcccab5045608b47d7c7bfdcb98d44e1 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Thu, 22 Aug 2024 21:11:37 +0100 Subject: [PATCH 34/56] Include make flags from .arches for stage 1 --- pipelines/main/platforms/build_linux.pgo_lto.arches | 2 +- utilities/build_julia.sh | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 7e49846b1..456afe39b 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -2,7 +2,7 @@ llvm_passes x86_64-linux-gnu-pgo-lto x86_64 x86_64 PGO_LTO LDFLAGS=-Wl,--undefined-version . v7.6 ebdfa2d40c0e27842cccbfdd43710144f9adf9d8 # These special lines allow us to embed default values for the columns above. -# Any column without a default mapping here will simply substitute a `.` to the empty string +# Any column without a default mapping here will simplpy substitute a `.` to the empty string # Builds should generally finish in much less time than this, but from-source builds can take longer #default TIMEOUT 80 diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index c977ab8e2..358b384ce 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -51,6 +51,8 @@ else MFLAGS+=( "TAGGED_RELEASE_BANNER=Official https://julialang.org/ release" ) fi MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) +# Finish off with any extra make flags from the `.arches` file +MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) @@ -68,9 +70,6 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then # Building stage1 collects profiling data which we use instead of collecting our own fi -# Finish off with any extra make flags from the `.arches` file -MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) - echo "--- Collect make options" echo "Make Options:" for FLAG in "${MFLAGS[@]}"; do From 2d1ba85fff6175dfb6fc094d5ee4ddfe611df492 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Thu, 22 Aug 2024 21:49:39 +0100 Subject: [PATCH 35/56] Hack in LDFLAGS --- pipelines/main/platforms/build_linux.pgo_lto.arches | 4 ++-- utilities/build_julia.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 456afe39b..b5a68be2a 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ -# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu-pgo-lto x86_64 x86_64 PGO_LTO LDFLAGS=-Wl,--undefined-version . v7.6 ebdfa2d40c0e27842cccbfdd43710144f9adf9d8 +# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH +llvm_passes x86_64-linux-gnu-pgo-lto x86_64 x86_64 PGO_LTO . . v7.6 ebdfa2d40c0e27842cccbfdd43710144f9adf9d8 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simplpy substitute a `.` to the empty string diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 358b384ce..9c9a89dc6 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -56,6 +56,7 @@ MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) + MFLAGS+=( "LDFLAGS=-Wl,--undefined-version" ) echo "--- Collect make options" echo "Make Options:" From 81196b0ec56df57ff7cf5c236f1765906b63407b Mon Sep 17 00:00:00 2001 From: Zentrik Date: Thu, 22 Aug 2024 23:16:47 +0100 Subject: [PATCH 36/56] Be more targeted with LDFLAGS --- utilities/build_julia.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 9c9a89dc6..06e14bcfa 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -56,7 +56,6 @@ MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - MFLAGS+=( "LDFLAGS=-Wl,--undefined-version" ) echo "--- Collect make options" echo "Make Options:" @@ -67,7 +66,7 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then echo "--- Build Julia Stage 1 - with instrumentation" cd contrib/pgo-lto - ${MAKE} "${MFLAGS[@]}" stage1 + ${MAKE} "${MFLAGS[@]}" LDFLAGS=-Wl,--undefined-version stage1 # Workaround https://github.com/JuliaLang/julia/issues/54533 # Building stage1 collects profiling data which we use instead of collecting our own fi @@ -79,7 +78,7 @@ done if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then echo "--- Build Julia Stage 2 - PGO + LTO optimised" - ${MAKE} "${MFLAGS[@]}" stage2 + ${MAKE} "${MFLAGS[@]}" LDFLAGS=-Wl,--undefined-version stage2 cd ../.. else From 62cebafc926773490830ec2c655cdb2abd062ee3 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Fri, 23 Aug 2024 21:20:22 +0100 Subject: [PATCH 37/56] Try to prevent `binary-dist` from rebuilding sysimg.ji --- utilities/build_julia.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 06e14bcfa..49a68055c 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -65,8 +65,7 @@ if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then echo "--- Build Julia Stage 1 - with instrumentation" - cd contrib/pgo-lto - ${MAKE} "${MFLAGS[@]}" LDFLAGS=-Wl,--undefined-version stage1 # Workaround https://github.com/JuliaLang/julia/issues/54533 + ${MAKE} -C contrib/pgo-lto "${MFLAGS[@]}" LDFLAGS=-Wl,--undefined-version stage1 # Workaround https://github.com/JuliaLang/julia/issues/54533 # Building stage1 collects profiling data which we use instead of collecting our own fi @@ -78,9 +77,7 @@ done if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then echo "--- Build Julia Stage 2 - PGO + LTO optimised" - ${MAKE} "${MFLAGS[@]}" LDFLAGS=-Wl,--undefined-version stage2 - - cd ../.. + ${MAKE} -C contrib/pgo-lto "${MFLAGS[@]}" LDFLAGS=-Wl,--undefined-version stage2 else echo "--- Build Julia" ${MAKE} "${MFLAGS[@]}" From eaabb50dcc5ff5ee6b8a66822afa95f81cac7f4f Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 08:28:53 +0100 Subject: [PATCH 38/56] Try again --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 49a68055c..e7d171b9c 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -102,10 +102,10 @@ ${JULIA_EXE} -e "import Test; Test.@test Sys.ARCH == :${ARCH:?}" ${JULIA_EXE} -e "import Test; Test.@test Sys.WORD_SIZE == ${EXPECTED_WORD_SIZE:?}" echo "--- Show build stats" -${MAKE} "${MFLAGS[@]}" build-stats +${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 build-stats echo "--- Create build artifacts" -${MAKE} "${MFLAGS[@]}" binary-dist +${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 binary-dist # Rename the build artifact in case we want to name it differently, as is the case on `musl`. if [[ "${JULIA_BINARYDIST_FILENAME}.tar.gz" != "${UPLOAD_FILENAME}.tar.gz" ]]; then From 05efb044fb0494841e7580252f7299cbbfe0e410 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 09:58:07 +0100 Subject: [PATCH 39/56] Try again --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index e7d171b9c..0037a2e6b 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -102,10 +102,10 @@ ${JULIA_EXE} -e "import Test; Test.@test Sys.ARCH == :${ARCH:?}" ${JULIA_EXE} -e "import Test; Test.@test Sys.WORD_SIZE == ${EXPECTED_WORD_SIZE:?}" echo "--- Show build stats" -${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 build-stats +${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" build-stats echo "--- Create build artifacts" -${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 binary-dist +${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" binary-dist # Rename the build artifact in case we want to name it differently, as is the case on `musl`. if [[ "${JULIA_BINARYDIST_FILENAME}.tar.gz" != "${UPLOAD_FILENAME}.tar.gz" ]]; then From df416264a2ba13f1015fe2d129f7d1815922de2c Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 11:53:39 +0100 Subject: [PATCH 40/56] Try again --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 0037a2e6b..9a6160d05 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -102,10 +102,10 @@ ${JULIA_EXE} -e "import Test; Test.@test Sys.ARCH == :${ARCH:?}" ${JULIA_EXE} -e "import Test; Test.@test Sys.WORD_SIZE == ${EXPECTED_WORD_SIZE:?}" echo "--- Show build stats" -${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" build-stats +${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=contrib/pgo-lto/stage0.build/clang CXX=contrib/pgo-lto/stage0.build/clang++ LD=contrib/pgo-lto/stage0.build/ld.lld AR=contrib/pgo-lto/stage0.build/llvm-ar RANLIB=contrib/pgo-lto/stage0.build/llvm-ranlib build-stats echo "--- Create build artifacts" -${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" binary-dist +${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=contrib/pgo-lto/stage0.build/clang CXX=contrib/pgo-lto/stage0.build/clang++ LD=contrib/pgo-lto/stage0.build/ld.lld AR=contrib/pgo-lto/stage0.build/llvm-ar RANLIB=contrib/pgo-lto/stage0.build/llvm-ranlib binary-dist # Rename the build artifact in case we want to name it differently, as is the case on `musl`. if [[ "${JULIA_BINARYDIST_FILENAME}.tar.gz" != "${UPLOAD_FILENAME}.tar.gz" ]]; then From 63b21a33397a1c850da50dad39f5c04058ac6167 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 12:53:31 +0100 Subject: [PATCH 41/56] Try again --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 9a6160d05..ff63ed805 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -102,10 +102,10 @@ ${JULIA_EXE} -e "import Test; Test.@test Sys.ARCH == :${ARCH:?}" ${JULIA_EXE} -e "import Test; Test.@test Sys.WORD_SIZE == ${EXPECTED_WORD_SIZE:?}" echo "--- Show build stats" -${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=contrib/pgo-lto/stage0.build/clang CXX=contrib/pgo-lto/stage0.build/clang++ LD=contrib/pgo-lto/stage0.build/ld.lld AR=contrib/pgo-lto/stage0.build/llvm-ar RANLIB=contrib/pgo-lto/stage0.build/llvm-ranlib build-stats +${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=contrib/pgo-lto/stage0.build/usr/tools/clang CXX=contrib/pgo-lto/stage0.build/usr/tools/clang++ LD=contrib/pgo-lto/stage0.build/usr/tools/ld.lld AR=contrib/pgo-lto/stage0.build/usr/tools/llvm-ar RANLIB=contrib/pgo-lto/stage0.build/usr/tools/llvm-ranlib build-stats echo "--- Create build artifacts" -${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=contrib/pgo-lto/stage0.build/clang CXX=contrib/pgo-lto/stage0.build/clang++ LD=contrib/pgo-lto/stage0.build/ld.lld AR=contrib/pgo-lto/stage0.build/llvm-ar RANLIB=contrib/pgo-lto/stage0.build/llvm-ranlib binary-dist +${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=contrib/pgo-lto/stage0.build/usr/tools/clang CXX=contrib/pgo-lto/stage0.build/usr/tools/clang++ LD=contrib/pgo-lto/stage0.build/usr/tools/ld.lld AR=contrib/pgo-lto/stage0.build/usr/tools/llvm-ar RANLIB=contrib/pgo-lto/stage0.build/usr/tools/llvm-ranlib binary-dist # Rename the build artifact in case we want to name it differently, as is the case on `musl`. if [[ "${JULIA_BINARYDIST_FILENAME}.tar.gz" != "${UPLOAD_FILENAME}.tar.gz" ]]; then From 214bb07ce12b06a2580e842b3b477f187674c08e Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 14:04:40 +0100 Subject: [PATCH 42/56] Try again --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index ff63ed805..6edec810e 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -102,10 +102,10 @@ ${JULIA_EXE} -e "import Test; Test.@test Sys.ARCH == :${ARCH:?}" ${JULIA_EXE} -e "import Test; Test.@test Sys.WORD_SIZE == ${EXPECTED_WORD_SIZE:?}" echo "--- Show build stats" -${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=contrib/pgo-lto/stage0.build/usr/tools/clang CXX=contrib/pgo-lto/stage0.build/usr/tools/clang++ LD=contrib/pgo-lto/stage0.build/usr/tools/ld.lld AR=contrib/pgo-lto/stage0.build/usr/tools/llvm-ar RANLIB=contrib/pgo-lto/stage0.build/usr/tools/llvm-ranlib build-stats +${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=$PWD/contrib/pgo-lto/stage0.build/usr/tools/clang CXX=$PWD/contrib/pgo-lto/stage0.build/usr/tools/clang++ LD=$PWD/contrib/pgo-lto/stage0.build/usr/tools/ld.lld AR=$PWD/contrib/pgo-lto/stage0.build/usr/tools/llvm-ar RANLIB=$PWD/contrib/pgo-lto/stage0.build/usr/tools/llvm-ranlib build-stats echo "--- Create build artifacts" -${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=contrib/pgo-lto/stage0.build/usr/tools/clang CXX=contrib/pgo-lto/stage0.build/usr/tools/clang++ LD=contrib/pgo-lto/stage0.build/usr/tools/ld.lld AR=contrib/pgo-lto/stage0.build/usr/tools/llvm-ar RANLIB=contrib/pgo-lto/stage0.build/usr/tools/llvm-ranlib binary-dist +${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=$PWD/contrib/pgo-lto/stage0.build/usr/tools/clang CXX=$PWD/contrib/pgo-lto/stage0.build/usr/tools/clang++ LD=$PWD/contrib/pgo-lto/stage0.build/usr/tools/ld.lld AR=$PWD/contrib/pgo-lto/stage0.build/usr/tools/llvm-ar RANLIB=$PWD/contrib/pgo-lto/stage0.build/usr/tools/llvm-ranlib binary-dist # Rename the build artifact in case we want to name it differently, as is the case on `musl`. if [[ "${JULIA_BINARYDIST_FILENAME}.tar.gz" != "${UPLOAD_FILENAME}.tar.gz" ]]; then From 0de5f4654383f5b74365b13f4627e113b871bff9 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 22:12:04 +0100 Subject: [PATCH 43/56] Test fix --- .../main/platforms/build_linux.pgo_lto.arches | 4 +-- utilities/build_julia.sh | 31 ++++++------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index b5a68be2a..4b26e44d9 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ -# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu-pgo-lto x86_64 x86_64 PGO_LTO . . v7.6 ebdfa2d40c0e27842cccbfdd43710144f9adf9d8 +# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH +llvm_passes x86_64-linux-gnu-pgo-lto x86_64 x86_64 PGO_LTO -C contrib/pgo-lto . v7.6 ebdfa2d40c0e27842cccbfdd43710144f9adf9d8 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simplpy substitute a `.` to the empty string diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 6edec810e..47d05ba4b 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -19,11 +19,16 @@ ld -v echo buildkite-agent --version +git remote add test https://github.com/Zentrik/julia +git fetch test +git switch fix-pgo + if [[ "${ROOTFS_IMAGE_NAME-}" == "llvm_passes" ]]; then echo "--- Update CMake" contrib/download_cmake.sh fi +echo "--- Collect make options" # These are the flags we'll provide to `make` MFLAGS=() @@ -51,37 +56,21 @@ else MFLAGS+=( "TAGGED_RELEASE_BANNER=Official https://julialang.org/ release" ) fi MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) + # Finish off with any extra make flags from the `.arches` file MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "STAGE2_BUILD=$PWD" ) - - echo "--- Collect make options" - echo "Make Options:" - for FLAG in "${MFLAGS[@]}"; do - echo " -> ${FLAG}" - done - - echo "--- Build Julia Stage 1 - with instrumentation" - - ${MAKE} -C contrib/pgo-lto "${MFLAGS[@]}" LDFLAGS=-Wl,--undefined-version stage1 # Workaround https://github.com/JuliaLang/julia/issues/54533 - # Building stage1 collects profiling data which we use instead of collecting our own fi -echo "--- Collect make options" echo "Make Options:" for FLAG in "${MFLAGS[@]}"; do echo " -> ${FLAG}" done -if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then - echo "--- Build Julia Stage 2 - PGO + LTO optimised" - ${MAKE} -C contrib/pgo-lto "${MFLAGS[@]}" LDFLAGS=-Wl,--undefined-version stage2 -else - echo "--- Build Julia" - ${MAKE} "${MFLAGS[@]}" -fi +echo "--- Build Julia" +${MAKE} "${MFLAGS[@]}" echo "--- Check that the working directory is clean" if [ -n "$(git status --short)" ]; then @@ -102,10 +91,10 @@ ${JULIA_EXE} -e "import Test; Test.@test Sys.ARCH == :${ARCH:?}" ${JULIA_EXE} -e "import Test; Test.@test Sys.WORD_SIZE == ${EXPECTED_WORD_SIZE:?}" echo "--- Show build stats" -${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=$PWD/contrib/pgo-lto/stage0.build/usr/tools/clang CXX=$PWD/contrib/pgo-lto/stage0.build/usr/tools/clang++ LD=$PWD/contrib/pgo-lto/stage0.build/usr/tools/ld.lld AR=$PWD/contrib/pgo-lto/stage0.build/usr/tools/llvm-ar RANLIB=$PWD/contrib/pgo-lto/stage0.build/usr/tools/llvm-ranlib build-stats +${MAKE} build-stats echo "--- Create build artifacts" -${MAKE} "${MFLAGS[@]}" USE_BINARYBUILDER_LLVM=0 LDFLAGS="-Wl,--undefined-version -fuse-ld=lld" CC=$PWD/contrib/pgo-lto/stage0.build/usr/tools/clang CXX=$PWD/contrib/pgo-lto/stage0.build/usr/tools/clang++ LD=$PWD/contrib/pgo-lto/stage0.build/usr/tools/ld.lld AR=$PWD/contrib/pgo-lto/stage0.build/usr/tools/llvm-ar RANLIB=$PWD/contrib/pgo-lto/stage0.build/usr/tools/llvm-ranlib binary-dist +${MAKE} binary-dist # Rename the build artifact in case we want to name it differently, as is the case on `musl`. if [[ "${JULIA_BINARYDIST_FILENAME}.tar.gz" != "${UPLOAD_FILENAME}.tar.gz" ]]; then From 4b7099c127b2ea6643b1fa090a18f4f9cfec56d4 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 22:22:20 +0100 Subject: [PATCH 44/56] Try again --- pipelines/main/platforms/build_linux.pgo_lto.arches | 4 ++-- utilities/build_julia.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pipelines/main/platforms/build_linux.pgo_lto.arches b/pipelines/main/platforms/build_linux.pgo_lto.arches index 4b26e44d9..baa63a32f 100644 --- a/pipelines/main/platforms/build_linux.pgo_lto.arches +++ b/pipelines/main/platforms/build_linux.pgo_lto.arches @@ -1,5 +1,5 @@ -# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH -llvm_passes x86_64-linux-gnu-pgo-lto x86_64 x86_64 PGO_LTO -C contrib/pgo-lto . v7.6 ebdfa2d40c0e27842cccbfdd43710144f9adf9d8 +# ROOTFS_IMAGE_NAME TRIPLET ARCH ARCH_ROOTFS USE_JULIA_PGO_LTO MAKE_FLAGS TIMEOUT ROOTFS_TAG ROOTFS_HASH +llvm_passes x86_64-linux-gnu-pgo-lto x86_64 x86_64 PGO_LTO . . v7.6 ebdfa2d40c0e27842cccbfdd43710144f9adf9d8 # These special lines allow us to embed default values for the columns above. # Any column without a default mapping here will simplpy substitute a `.` to the empty string diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 47d05ba4b..174677730 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -61,7 +61,7 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then - MFLAGS+=( "STAGE2_BUILD=$PWD" ) + MFLAGS+=( "-C contrib/pgo-lto STAGE2_BUILD=$PWD" ) fi echo "Make Options:" From aa3e34cc4b412b4e342c5f959fae716efcffb4f6 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 22:33:25 +0100 Subject: [PATCH 45/56] Fix again --- utilities/build_julia.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 174677730..aa0d50458 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -61,7 +61,8 @@ MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then - MFLAGS+=( "-C contrib/pgo-lto STAGE2_BUILD=$PWD" ) + MFLAGS+=( "-C contrib/pgo-lto" ) + MFLAGS+=( "STAGE2_BUILD=$PWD" ) fi echo "Make Options:" From ea9a02f8a13f4d2504206690f46852dcf000a007 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 22:38:35 +0100 Subject: [PATCH 46/56] Retrigger --- utilities/build_julia.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index aa0d50458..e31e97908 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -57,14 +57,14 @@ else fi MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) -# Finish off with any extra make flags from the `.arches` file -MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) - if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then MFLAGS+=( "-C contrib/pgo-lto" ) MFLAGS+=( "STAGE2_BUILD=$PWD" ) fi +# Finish off with any extra make flags from the `.arches` file +MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) + echo "Make Options:" for FLAG in "${MFLAGS[@]}"; do echo " -> ${FLAG}" From 482f04a9171580832cd1f79253e9346a08953c54 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 22:44:15 +0100 Subject: [PATCH 47/56] Try again --- utilities/build_julia.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index e31e97908..0348e8a04 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -32,6 +32,11 @@ echo "--- Collect make options" # These are the flags we'll provide to `make` MFLAGS=() +if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then + MFLAGS+=( "-C contrib/pgo-lto" ) + MFLAGS+=( "STAGE2_BUILD=$PWD" ) +fi + # If we have the option, let's use `--output-sync` if ${MAKE} --help | grep output-sync >/dev/null 2>/dev/null; then MFLAGS+=( "--output-sync" ) @@ -57,11 +62,6 @@ else fi MFLAGS+=( "JULIA_CPU_TARGET=${JULIA_CPU_TARGET}" ) -if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then - MFLAGS+=( "-C contrib/pgo-lto" ) - MFLAGS+=( "STAGE2_BUILD=$PWD" ) -fi - # Finish off with any extra make flags from the `.arches` file MFLAGS+=( $(tr "," " " <<<"${MAKE_FLAGS}") ) From d165dc59864777278485907f3bffc3be57ea8c20 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 22:48:35 +0100 Subject: [PATCH 48/56] Try again --- utilities/build_julia.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 0348e8a04..2452ab32e 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -33,7 +33,6 @@ echo "--- Collect make options" MFLAGS=() if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then - MFLAGS+=( "-C contrib/pgo-lto" ) MFLAGS+=( "STAGE2_BUILD=$PWD" ) fi @@ -71,7 +70,7 @@ for FLAG in "${MFLAGS[@]}"; do done echo "--- Build Julia" -${MAKE} "${MFLAGS[@]}" +${MAKE} -C contrib/pgo-lto "${MFLAGS[@]}" echo "--- Check that the working directory is clean" if [ -n "$(git status --short)" ]; then From 6595ba2cc42e2e961054bf5b46897ffdc3df142d Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sat, 24 Aug 2024 23:53:10 +0100 Subject: [PATCH 49/56] Fix again --- utilities/build_julia.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 2452ab32e..5194e37a0 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -33,6 +33,7 @@ echo "--- Collect make options" MFLAGS=() if [[ ! -z "${USE_JULIA_PGO_LTO-}" ]]; then + MFLAGS+=( "-Ccontrib/pgo-lto" ) MFLAGS+=( "STAGE2_BUILD=$PWD" ) fi @@ -70,7 +71,7 @@ for FLAG in "${MFLAGS[@]}"; do done echo "--- Build Julia" -${MAKE} -C contrib/pgo-lto "${MFLAGS[@]}" +${MAKE} "${MFLAGS[@]}" echo "--- Check that the working directory is clean" if [ -n "$(git status --short)" ]; then From 8dc52bde109c90c63924a506ad44f643c7c3795f Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sun, 25 Aug 2024 00:18:22 +0100 Subject: [PATCH 50/56] Fix up --- utilities/build_julia.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 5194e37a0..6c07e25e7 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -73,6 +73,7 @@ done echo "--- Build Julia" ${MAKE} "${MFLAGS[@]}" + echo "--- Check that the working directory is clean" if [ -n "$(git status --short)" ]; then echo "ERROR: The working directory is dirty." >&2 @@ -92,10 +93,10 @@ ${JULIA_EXE} -e "import Test; Test.@test Sys.ARCH == :${ARCH:?}" ${JULIA_EXE} -e "import Test; Test.@test Sys.WORD_SIZE == ${EXPECTED_WORD_SIZE:?}" echo "--- Show build stats" -${MAKE} build-stats +${MAKE} "${MFLAGS[@]}" build-stats echo "--- Create build artifacts" -${MAKE} binary-dist +${MAKE} "${MFLAGS[@]}" binary-dist # Rename the build artifact in case we want to name it differently, as is the case on `musl`. if [[ "${JULIA_BINARYDIST_FILENAME}.tar.gz" != "${UPLOAD_FILENAME}.tar.gz" ]]; then From b4a1a2f783f22c61cd8aebb282519c533f90469c Mon Sep 17 00:00:00 2001 From: Zentrik Date: Sun, 25 Aug 2024 09:10:54 +0100 Subject: [PATCH 51/56] Rebuild --- utilities/build_julia.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 6c07e25e7..6d444ef4c 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -19,8 +19,8 @@ ld -v echo buildkite-agent --version -git remote add test https://github.com/Zentrik/julia -git fetch test +git remote add fork https://github.com/Zentrik/julia +git fetch fork git switch fix-pgo if [[ "${ROOTFS_IMAGE_NAME-}" == "llvm_passes" ]]; then From faa645de6f4f78152640c6a274fbd112d01cac95 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Mon, 9 Sep 2024 21:27:45 +0100 Subject: [PATCH 52/56] Switch back to official Julia Repo --- utilities/build_julia.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 6d444ef4c..8bd27e95e 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -19,10 +19,6 @@ ld -v echo buildkite-agent --version -git remote add fork https://github.com/Zentrik/julia -git fetch fork -git switch fix-pgo - if [[ "${ROOTFS_IMAGE_NAME-}" == "llvm_passes" ]]; then echo "--- Update CMake" contrib/download_cmake.sh From a6d823db9c6be0a1ca1b4cd67f2801d0266fc67e Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 10 Sep 2024 20:15:49 +0100 Subject: [PATCH 53/56] Try fix for lld not being installed into usr/tools --- utilities/build_julia.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 8bd27e95e..5168b64d8 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -19,6 +19,10 @@ ld -v echo buildkite-agent --version +git remote add fork https://github.com/Zentrik/julia +git fetch fork +git switch fix-installing-lld + if [[ "${ROOTFS_IMAGE_NAME-}" == "llvm_passes" ]]; then echo "--- Update CMake" contrib/download_cmake.sh From a51739bea88537da21d2e6028cfb94d88c72382b Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 10 Sep 2024 20:39:03 +0100 Subject: [PATCH 54/56] Hopefully correct fix --- utilities/build_julia.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 5168b64d8..54bfa9e8a 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -21,7 +21,7 @@ buildkite-agent --version git remote add fork https://github.com/Zentrik/julia git fetch fork -git switch fix-installing-lld +git switch fix-installing-lld2 if [[ "${ROOTFS_IMAGE_NAME-}" == "llvm_passes" ]]; then echo "--- Update CMake" From 173d95e1874d44829667920c3bd1b54d514e89fc Mon Sep 17 00:00:00 2001 From: Zentrik Date: Tue, 10 Sep 2024 20:53:34 +0100 Subject: [PATCH 55/56] Retrigger --- utilities/build_julia.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index 54bfa9e8a..c4ac3d578 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -21,7 +21,7 @@ buildkite-agent --version git remote add fork https://github.com/Zentrik/julia git fetch fork -git switch fix-installing-lld2 +git switch fix-installing-lld2 if [[ "${ROOTFS_IMAGE_NAME-}" == "llvm_passes" ]]; then echo "--- Update CMake" From 399ae7e42ea6217b4a004f8f122148ba4a5b2b23 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Wed, 11 Sep 2024 11:56:35 +0100 Subject: [PATCH 56/56] Switch back to Julia repo --- utilities/build_julia.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/utilities/build_julia.sh b/utilities/build_julia.sh index c4ac3d578..8bd27e95e 100755 --- a/utilities/build_julia.sh +++ b/utilities/build_julia.sh @@ -19,10 +19,6 @@ ld -v echo buildkite-agent --version -git remote add fork https://github.com/Zentrik/julia -git fetch fork -git switch fix-installing-lld2 - if [[ "${ROOTFS_IMAGE_NAME-}" == "llvm_passes" ]]; then echo "--- Update CMake" contrib/download_cmake.sh