You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[RF] Disable redundant dirty-flag propagation during minimization
When a likelihood is evaluated with the new `"cpu"` backend, the
`RooFit::Evaluator` fully manages dependency tracking and re-evaluation
of the computation graph. In this case, RooFit’s built-in dirty flag
propagation in RooAbsArg becomes redundant and introduces significant
overhead for large models.
This patch disables regular dirty state propagation for all
non-fundamental nodes in the Evaluator's computation graph by setting
their OperMode to `RooAbsArg::ADirty`. Fundamental nodes (e.g.
RooRealVar, RooCategory) are excluded because they are often shared with
other computation graphs outside the Evaluator (usually the original pdf
in the RooWorkspace).
To set the OperMode of *all* RooAbsArgs to `ADirty` during minimization,
while avoiding side effects outside the minimization scope, the dirty
flag propagation for the fundamental nodes is only disabled temporarily
in the RooMinimizer.
This commit drastically speeds up fits with AD in particular (up to 2 x
for large models), because with fast gradients, the dirty flag
propagation that determines which part of the compute graph needs to be
recomputed becomes the bottleneck. It was also redundant with a faster
"dirty state" bookkeeping mechanism in the `RooFit::Evaluator` class
itself.
At this point, there is no performance regression anymore when disabling
recursive dirty flag propagation for all evaluated nodes, so the old
comment in the code about test 14 in stressRooFit being slow doesn't
apply anymore.
(cherry picked from commit fa97774)
0 commit comments