Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyester causes significant TTFX due to dependency on CPUSummary.num_threads() #95

Closed
Krastanov opened this issue Dec 27, 2022 · 3 comments · Fixed by JuliaSIMD/PolyesterWeave.jl#7 or #96

Comments

@Krastanov
Copy link
Contributor

The pkgimages support was merged into julia today: JuliaLang/julia#47184

Even with that improvement, libraries that depend on Polyester see significant TTFX unless they run with julia -tauto. For instance consider the following library that depends on Polyester:

@time @eval QuantumClifford._precompile_() # a typical task used as a precompile directive

#with -tauto
0.037428 seconds (40.73 k allocations: ...)

#with Threads.nthreads() != Sys.CPU_THREADS
3.068928 seconds (4.78 M allocations: ...)

The reason for this seems to be that CPUSummary redefines num_threads in its __init__ call as discussed in these issues:

My question is What is a reasonable path forward for improving this in Polyester? Is one of the following reasonable:

Is not using CPUSummary in Polyester an option? I suspect the goal is to have compile-time constants when deciding on number of threads, but I do not know whether that is possible without CPUSummary.

Is it possible to improve CPUSummary to avoid this issue?

@chriselrod
Copy link
Member

Yeah, I suggest switching to Threads.nthreads instead.
PRs welcome. :)

@chriselrod
Copy link
Member

CPUSummary.num_threads should be deprecated.

@Krastanov
Copy link
Contributor Author

A first attempt at such a pull request is submitted (links above in this thread)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants