[RF] RooFFTConvPdf: cache norm. val to avoid bookkeeping during scan#21615
Merged
guitargeek merged 1 commit intoroot-project:masterfrom Mar 16, 2026
Merged
[RF] RooFFTConvPdf: cache norm. val to avoid bookkeeping during scan#21615guitargeek merged 1 commit intoroot-project:masterfrom
guitargeek merged 1 commit intoroot-project:masterfrom
Conversation
`RooFFTConvPdf::scanPdf()` repeatedly evaluates the component pdfs with `pdf.getVal(normSet)` while filling the FFT input buffers. For large scans this incurs unnecessary overhead from `RooAbsPdf::getValV()`'s normalization-set tracking and cache management, even though the normalization set is fixed for a given FFTCacheElem. This change caches the normalization integrals for both component pdf clones (normVal1, normVal2) when the FFTCacheElem is constructed. During scanning, the pdfs are then evaluated without passing a normalization set and are normalized manually using the cached integral values. To exactly reproduce `RooAbsPdf::getValV()` behaviour (including NaN-packing semantics), the `RooAbsPdf::normalizeWithNaNPacking(rawVal, normVal)` helper function was moved to an internal helper namespace. This reduces evaluation overhead in FFT convolutions while preserving bitwise-equivalent normalization behaviour.
Test Results 22 files 22 suites 3d 4h 45m 56s ⏱️ Results for commit af10789. |
lmoneta
approved these changes
Mar 16, 2026
Member
lmoneta
left a comment
There was a problem hiding this comment.
LGTM!
Thanks Jonas for this improvement!
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.
RooFFTConvPdf::scanPdf()repeatedly evaluates the component pdfs withpdf.getVal(normSet)while filling the FFT input buffers. For large scans this incurs unnecessary overhead fromRooAbsPdf::getValV()'s normalization-set tracking and cache management, even though the normalization set is fixed for a given FFTCacheElem.This change caches the normalization integrals for both component pdf clones (normVal1, normVal2) when the FFTCacheElem is constructed. During scanning, the pdfs are then evaluated without passing a normalization set and are normalized manually using the cached integral values.
To exactly reproduce
RooAbsPdf::getValV()behaviour (including NaN-packing semantics), theRooAbsPdf::normalizeWithNaNPacking(rawVal, normVal)helper function was moved to an internal helper namespace.This reduces evaluation overhead in FFT convolutions while preserving bitwise-equivalent normalization behaviour.
Spinoff from #21343 to reduce the size of the "internal" computation graphs a bit that are not visible to the
RooFit::Evaluator.