[Common] Avoid zero-initialising the NN TPC PID prediction buffer - #17831
Open
ktf wants to merge 1 commit into
Open
[Common] Avoid zero-initialising the NN TPC PID prediction buffer#17831ktf wants to merge 1 commit into
ktf wants to merge 1 commit into
Conversation
The per-DataFrame prediction buffer (masked tracks x output dims x 9 mass hypotheses, ~72 MB for a 1M-track PbPb DataFrame) is a value-initialised std::vector: a full memset touching every page, immediately overwritten in full by the per-hypothesis evaluation loop. Carry it as an uninitialised unique_ptr<float[]> instead, so each page is touched once, by the write that fills it. All consumers only read it under useNetworkCorrection, so the null buffer with the network disabled is never dereferenced. No change to any computed value. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DgKXVM9Q9Hcgexfyj7Eqpp
ktf
requested review from
a team,
alibuild,
ddobrigk,
dsekihat,
iarsene and
jgrosseo
as code owners
September 8, 2026 12:32
|
O2 linter results: ❌ 22 errors, |
Collaborator
|
Error while checking build/O2Physics/code-check for 6a54a0e at 2026-09-08 14:52: Full log here. |
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.
The per-DataFrame NN prediction buffer (masked tracks × output dims × 9 mass hypotheses, ~72 MB for a 1M-track PbPb DataFrame) is a value-initialised
std::vector<float>: a full memset touching every page of the allocation, immediately overwritten in full by the per-hypothesis evaluation loop, so every page is paid for twice.Carry it as an uninitialised
unique_ptr<float[]>instead, so each page is touched exactly once, by the write that fills it.makePidTablestakesconst float*accordingly.