From 72f8a106c357de6819e07352e88e49148c8c9546 Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Sat, 8 Feb 2025 12:28:49 +1100 Subject: [PATCH 1/2] Updating binding version to fix MMTk CI (#57298) Updating mmtk-julia version to include https://github.com/mmtk/mmtk-julia/pull/228 and fix the MMTk CI. I've also changed the allocation profiler tests to skip all tests instead of just a few since I've seen some spurious errors - they should all be related though, we need to make sure the profiler accounts for fastpath allocation (see https://github.com/JuliaLang/julia/issues/57103) This should fix https://github.com/JuliaLang/julia/issues/57306. --- Makefile | 18 ++++++++++++++++++ deps/checksums/mmtk_julia | 4 ++++ deps/mmtk_julia.mk | 19 +++++++++++++++++++ deps/mmtk_julia.version | 6 +++--- stdlib/Profile/test/allocs.jl | 19 ++++++++----------- 5 files changed, 52 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index b193b3849c6aa..0f1e8c45edf40 100644 --- a/Makefile +++ b/Makefile @@ -282,8 +282,26 @@ endif endif ifneq (${MMTK_PLAN},None) +# Make sure we use the right version of $MMTK_PLAN, $MMTK_MOVING and $MMTK_BUILD +# if we use the BinaryBuilder version of mmtk-julia +ifeq ($(USE_BINARYBUILDER_MMTK_JULIA),1) +ifeq (${MMTK_PLAN},Immix) +LIB_PATH_PLAN = immix +else ifeq (${MMTK_PLAN},StickyImmix) +LIB_PATH_PLAN = sticky +endif + +ifeq ($(MMTK_MOVING), 0) +LIB_PATH_MOVING := non_moving +else +LIB_PATH_MOVING := moving +endif + +JL_PRIVATE_LIBS-0 += $(LIB_PATH_PLAN)/$(LIB_PATH_MOVING)/$(MMTK_BUILD)/libmmtk_julia +else JL_PRIVATE_LIBS-0 += libmmtk_julia endif +endif # Note that we disable MSYS2's path munging here, as otherwise # it replaces our `:`-separated list as a `;`-separated one. diff --git a/deps/checksums/mmtk_julia b/deps/checksums/mmtk_julia index 098937aea1991..4ccc7b407cb60 100644 --- a/deps/checksums/mmtk_julia +++ b/deps/checksums/mmtk_julia @@ -8,3 +8,7 @@ mmtk_julia-c9e046baf3a0d52fe75d6c8b28f6afd69b045d95.tar.gz/md5/73a8fbea71edce30a mmtk_julia-c9e046baf3a0d52fe75d6c8b28f6afd69b045d95.tar.gz/sha512/374848b7696b565dea66daa208830581f92c1fcb0138e7a7ab88564402e94bc79c54b6ed370ec68473e31e2bd411bf82c97793796c31d39aafbbfffea9c05588 mmtk_julia.v0.30.4+0.x86_64-linux-gnu.tar.gz/md5/8cdeb14fd69945f64308be49f6912f9c mmtk_julia.v0.30.4+0.x86_64-linux-gnu.tar.gz/sha512/3692502f65dec8c0971b56b9bf8178641892b390d520cbcd69880d75b7500e6341534d87882246e68998f590f824ec54c18f4b8fb4aa09b8f313de065c48450e +mmtk_julia-10ad6638b69b31a97a844f2f4e651e5ccea4e298.tar.gz/md5/59ed2c0e0b48673988a40527907f13ae +mmtk_julia-10ad6638b69b31a97a844f2f4e651e5ccea4e298.tar.gz/sha512/d0988c37e82b8d481753f4ce83f38ba11276af3dafa8f65ee2c51122fce0dab056a65b3029cb255732226cc28d1a02e607bdaac91a02c0fd6a9fcfae834fee8c +mmtk_julia.v0.30.5+1.x86_64-linux-gnu.tar.gz/md5/4d12d64754bb5c61e86e97e88bcf7912 +mmtk_julia.v0.30.5+1.x86_64-linux-gnu.tar.gz/sha512/0d619f00fd644338ca1ca2582b20e41db702dff8e0c338c093b2759b54379ba26ae7e0181c64931a45ebd5c3995540e535c248df9b986e73b18b65a39c5d78d2 diff --git a/deps/mmtk_julia.mk b/deps/mmtk_julia.mk index 424113fd4164c..1dc59749a00b5 100644 --- a/deps/mmtk_julia.mk +++ b/deps/mmtk_julia.mk @@ -75,6 +75,25 @@ endif # MMTK_JULIA_DIR else # We are building using the BinaryBuilder version of the binding +# This will download all the versions of the binding that are available in the BinaryBuilder $(eval $(call bb-install,mmtk_julia,MMTK_JULIA,false)) +# Make sure we use the right version of $MMTK_PLAN, $MMTK_MOVING and $MMTK_BUILD +ifeq (${MMTK_PLAN},Immix) +LIB_PATH_PLAN = immix +else ifeq (${MMTK_PLAN},StickyImmix) +LIB_PATH_PLAN = sticky +endif + +ifeq ($(MMTK_MOVING), 0) +LIB_PATH_MOVING := non_moving +else +LIB_PATH_MOVING := moving +endif + +version-check-mmtk_julia: $(BUILDROOT)/usr/lib/libmmtk_julia.so + +$(BUILDROOT)/usr/lib/libmmtk_julia.so: get-mmtk_julia + @ln -sf $(BUILDROOT)/usr/lib/$(LIB_PATH_PLAN)/$(LIB_PATH_MOVING)/$(MMTK_BUILD)/libmmtk_julia.so $@ + endif # USE_BINARYBUILDER_MMTK_JULIA diff --git a/deps/mmtk_julia.version b/deps/mmtk_julia.version index 684197bbe3e4e..530b6d9ed81e1 100644 --- a/deps/mmtk_julia.version +++ b/deps/mmtk_julia.version @@ -1,6 +1,6 @@ MMTK_JULIA_BRANCH = master -MMTK_JULIA_SHA1 = c9e046baf3a0d52fe75d6c8b28f6afd69b045d95 +MMTK_JULIA_SHA1 = 10ad6638b69b31a97a844f2f4e651e5ccea4e298 MMTK_JULIA_GIT_URL := https://github.com/mmtk/mmtk-julia.git -MMTK_JULIA_TAR_URL = https://github.com/mmtk/mmtk-julia/archive/refs/tags/v0.30.4.tar.gz -MMTK_JULIA_JLL_VER := 0.30.4+0 +MMTK_JULIA_TAR_URL = https://github.com/mmtk/mmtk-julia/archive/refs/tags/v0.30.5.tar.gz +MMTK_JULIA_JLL_VER := 0.30.5+1 MMTK_JULIA_JLL_NAME := mmtk_julia diff --git a/stdlib/Profile/test/allocs.jl b/stdlib/Profile/test/allocs.jl index 5607783c782f9..8f6539e0baed6 100644 --- a/stdlib/Profile/test/allocs.jl +++ b/stdlib/Profile/test/allocs.jl @@ -8,6 +8,11 @@ let iobuf = IOBuffer() end end +# Issue #57103: This test does not work with MMTk because of fastpath +# allocation which never calls the allocation profiler. +# TODO: We should port these observability tools (e.g. allocation +# profiler and heap snapshot) to MMTk +@static if Base.USING_STOCK_GC @testset "alloc profiler doesn't segfault" begin res = Allocs.@profile sample_rate=1.0 begin # test the allocations during compilation @@ -73,14 +78,8 @@ end @test length(first_alloc.stacktrace) > 0 @test length(string(first_alloc.type)) > 0 - # Issue #57103: This test does not work with MMTk because of fastpath - # allocation which never calls the allocation profiler. - # TODO: We should port these observability tools (e.g. allocation - # profiler and heap snapshot) to MMTk - @static if Base.USING_STOCK_GC - @testset for type in (Task, Vector{Float64},) - @test length(filter(a->a.type <: type, profile.allocs)) >= NUM_TASKS - end + @testset for type in (Task, Vector{Float64},) + @test length(filter(a->a.type <: type, profile.allocs)) >= NUM_TASKS end # TODO: it would be nice to assert that these tasks @@ -149,8 +148,6 @@ end @test length([a for a in prof.allocs if a.type == String]) >= 1 end -# FIXME: Issue #57103 disabling test for MMTk. -@static if Base.USING_STOCK_GC @testset "alloc profiler catches allocs from codegen" begin @eval begin struct MyType x::Int; y::Int end @@ -170,7 +167,6 @@ end @test length(prof.allocs) >= 1 @test length([a for a in prof.allocs if a.type == MyType]) >= 1 end -end @testset "alloc profiler catches allocs from buffer resize" begin f(a) = for _ in 1:100; push!(a, 1); end @@ -187,3 +183,4 @@ end @test length([a for a in prof.allocs if a.type === Allocs.BufferType]) == 1 @test length([a for a in prof.allocs if a.type === Memory{Int}]) >= 2 end +end From baf8124d9d004c6c255134ce6206875d1df92618 Mon Sep 17 00:00:00 2001 From: Sam Schweigel <33556084+xal-0@users.noreply.github.com> Date: Fri, 7 Feb 2025 18:02:46 -0800 Subject: [PATCH 2/2] Always add the frame-pointer=all attribute (#57209) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At some point LLVM on MacOS started doing frame pointer optimization by default. We should ask for a frame pointer on every function, on all platforms. Prior to this change, on `1.11.3+0.aarch64.apple.darwin14`: ``` julia> @code_native ((x,y) -> Core.Intrinsics.add_float(x,y))(1.0,2.0) .section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl "_julia_#1_678" ; -- Begin function julia_#1_678 .p2align 2 "_julia_#1_678": ; @"julia_#1_678" ; Function Signature: var"#1"(Float64, Float64) ; ┌ @ REPL[1]:1 within `#1` ; %bb.0: ; %top ; │ @ REPL[1] within `#1` ;DEBUG_VALUE: #1:x <- $d0 ;DEBUG_VALUE: #1:x <- $d0 ;DEBUG_VALUE: #1:y <- $d1 ;DEBUG_VALUE: #1:y <- $d1 ; │ @ REPL[1]:1 within `#1` fadd d0, d0, d1 ret ; └ ; -- End function .section __DATA,__const .p2align 3, 0x0 ; @"+Core.Float64#680" "l_+Core.Float64#680": .quad "l_+Core.Float64#680.jit" .set "l_+Core.Float64#680.jit", 5490712608 .subsections_via_symbols ``` Prior to this change, on `1.11.3+0.aarch64.linux.gnu`: ``` julia> @code_native ((x,y) -> Core.Intrinsics.add_float(x,y))(1.0,2.0) .text .file "#1" .globl "julia_#1_656" // -- Begin function julia_#1_656 .p2align 2 .type "julia_#1_656",@function "julia_#1_656": // @"julia_#1_656" ; Function Signature: var"#1"(Float64, Float64) ; ┌ @ REPL[1]:1 within `#1` // %bb.0: // %top ; │ @ REPL[1] within `#1` //DEBUG_VALUE: #1:x <- $d0 //DEBUG_VALUE: #1:x <- $d0 //DEBUG_VALUE: #1:y <- $d1 //DEBUG_VALUE: #1:y <- $d1 stp x29, x30, [sp, #-16]! // 16-byte Folded Spill mov x29, sp ; │ @ REPL[1]:1 within `#1` fadd d0, d0, d1 ldp x29, x30, [sp], #16 // 16-byte Folded Reload ret .Lfunc_end0: .size "julia_#1_656", .Lfunc_end0-"julia_#1_656" ; └ // -- End function .type ".L+Core.Float64#658",@object // @"+Core.Float64#658" .section .rodata,"a",@progbits .p2align 3, 0x0 ".L+Core.Float64#658": .xword ".L+Core.Float64#658.jit" .size ".L+Core.Float64#658", 8 .set ".L+Core.Float64#658.jit", 278205186835760 .size ".L+Core.Float64#658.jit", 8 .section ".note.GNU-stack","",@progbits ``` --- src/codegen.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/codegen.cpp b/src/codegen.cpp index 5507bd7bad801..16cedabed107a 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -83,20 +83,6 @@ using namespace llvm; -static bool jl_fpo_disabled(const Triple &TT) { -#ifdef JL_DISABLE_FPO - return true; -#endif -#ifdef _COMPILER_MSAN_ENABLED_ - // MSAN doesn't support FPO - return true; -#endif - if (TT.isOSLinux() || TT.isOSWindows() || TT.isOSFreeBSD() || TT.isOSOpenBSD()) { - return true; - } - return false; -} - static bool jl_floattemp_var_needed(const Triple &TT) { #ifdef JL_NEED_FLOATTEMP_VAR return true; @@ -2970,8 +2956,7 @@ void jl_init_function(Function *F, const Triple &TT) JL_NOTSAFEPOINT if (TT.isOSWindows() && TT.getArch() == Triple::x86_64) { attr.addUWTableAttr(llvm::UWTableKind::Default); // force NeedsWinEH } - if (jl_fpo_disabled(TT)) - attr.addAttribute("frame-pointer", "all"); + attr.addAttribute("frame-pointer", "all"); if (!TT.isOSWindows()) { #if !defined(_COMPILER_ASAN_ENABLED_) // ASAN won't like us accessing undefined memory causing spurious issues,