remove a bunch of 'skip GC threads' checks since they now have tasks#55160
Merged
remove a bunch of 'skip GC threads' checks since they now have tasks#55160
Conversation
8babca2 to
758b3ad
Compare
758b3ad to
57e33d5
Compare
kpamnany
reviewed
Jul 23, 2024
Member
kpamnany
left a comment
There was a problem hiding this comment.
I don't think CI tests either of these so we need to manually check. I suggest running one of the multithreaded GC benchmarks with the concurrent sweep thread enabled, and insert ccalls to jl_live_tasks() and jl_print_task_backtraces(1) somewhere in the middle.
Member
Author
TestFrom GCBenchmarks: include(joinpath("..", "..", "..", "util", "utils.jl"))
module BinaryTreeImmutable
# Adopted from
# https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/binarytrees.html#binarytrees
using Base.Threads
using Printf
struct Node
l::Union{Nothing, Node}
r::Union{Nothing, Node}
end
function make(n::Int)
return n === 0 ? Node(nothing, nothing) : Node(make(n-1), make(n-1))
end
function check(node::Node)
return 1 + (node.l === nothing ? 0 : check(node.l) + check(node.r))
end
function dummy_task()
while true
tasks = @ccall jl_live_tasks()::Any
@show tasks
@ccall jl_print_task_backtraces(1::Cint)::Cvoid
sleep(100)
end
end
function binary_trees(io, n::Int)
@printf io "stretch tree of depth %jd\t check: %jd\n" n+1 check(make(n+1))
Threads.@spawn dummy_task()
long_tree = make(n)
minDepth = 4
resultSize = div((n - minDepth), 2) + 1
results = Vector{String}(undef, resultSize)
Threads.@threads for depth in minDepth:2:n
c = 0
niter = 1 << (n - depth + minDepth)
for _ in 1:niter
c += check(make(depth))
end
index = div((depth - minDepth),2) + 1
results[index] = @sprintf "%jd\t trees of depth %jd\t check: %jd\n" niter depth c
end
for i in results
write(io, i)
end
@printf io "long lived tree of depth %jd\t check: %jd\n" n check(long_tree)
end
end #module
using .BinaryTreeImmutable
@gctime BinaryTreeImmutable.binary_trees(devnull, 21)CommandOutput |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GC threads now have tasks (since #53815).