Why is a staggering 30% of the CPU profile not accounted for?

How come that 30% (on the right-hand side) of the CPU performance profile here is not accounted for?

This is in the preview version of the (VS) Code Julia extension, with Julia 1.9.0-rc2, on Linux.

This seems reproducible so far, so here’s a script if someone wants to reproduce:

# Might be too small, some runs fail with Tulip's ITERATION_LIMIT
setprecision(BigFloat, 6 * 2^7)

import FindMinimaxPolynomial, Tulip, MathOptInterface
const FMP = FindMinimaxPolynomial
const MMX = FMP.Minimax
const mmx = MMX.minimax_polynomial
const MOI = MathOptInterface

function make_lp()
  lp = Tulip.Optimizer{BigFloat}()
  MOI.set(lp, MOI.RawOptimizerAttribute("IPM_IterationsLimit"), 2000)
  MOI.set(lp, MOI.RawOptimizerAttribute("Presolve_Level"), 0)
  lp
end

monomials_4_odd = 1:2:7
itv_sin = (big"0.1", big"0.2");
@profview mmx(
  make_lp,
  sin,
  (itv_sin,),
  monomials_4_odd,
);
@profview mmx(
  make_lp,
  sin,
  (itv_sin,),
  monomials_4_odd,
);

I used the development version of the FindMinimaxPolynomial package, commit 0161913770ed36a5ca79f87be7dc8c99bfc10800 on the main branch. EDIT: a new version, v0.2.1, is now registered with the general registry, adding the package is enough.

EDIT: increasing the n parameter with Profile.init doesn’t help.

1 Like

Recently I encountered a similar profile. In my case the missing portion was C calls (hidden by default) that for some reason were not attached to where I would think they should be.

1 Like

Thanks! Executing the following after the code in the original post makes it clear that the “not accounted for” samples were spent mostly in the GMP (GNU Multiple Precision) C library:

view_profile(C = true)

It’s too bad that the call graph is incorrect though, with the libgmp calls belonging to root directly. It would be nice to know where were the calls made from. The GMP calls in question were all architecture-specific (AMD-specific) calls, so I guess GMP does some kind of runtime dispatch which confuses the Julia profiler.