fix: guard debug print in CudaTrackBuilding against small bounds vectors#5067
fix: guard debug print in CudaTrackBuilding against small bounds vectors#5067murnanedaniel wants to merge 2 commits intoacts-project:mainfrom
Conversation
|
A little extra context: This is killing GNN testing when running on single particles, since a correctly reconstructed event will give just one label, which crashes this debug line. |
Plugins/Gnn/src/CudaTrackBuilding.cu
Outdated
| std::ostringstream oss; | ||
| for (std::size_t i = 0; i < bounds.size(); ++i) { | ||
| if (i > 0) { | ||
| oss << ", "; | ||
| } | ||
| oss << bounds[i]; | ||
| } | ||
| ACTS_DEBUG("Bounds: " << oss.str()); |
There was a problem hiding this comment.
Why not just do this in all cases? You could use a range based for loop and an immediately executing lambda to put this inside the log macro even.
There was a problem hiding this comment.
Good point. Will make the fix
There was a problem hiding this comment.
Hmm not sure what you mean with all cases, but we should not print out 150k-300k labels in DEBUG mode...
There was a problem hiding this comment.
Take a look at the attempted fix:
- Iterates over the first min(3, bounds.size)
- Then iterates over the last min(3, bounds.size-3)
more or less
benjaminhuth
left a comment
There was a problem hiding this comment.
Thanks for catching this!
Plugins/Gnn/src/CudaTrackBuilding.cu
Outdated
| std::ostringstream oss; | ||
| for (std::size_t i = 0; i < bounds.size(); ++i) { | ||
| if (i > 0) { | ||
| oss << ", "; | ||
| } | ||
| oss << bounds[i]; | ||
| } | ||
| ACTS_DEBUG("Bounds: " << oss.str()); |
There was a problem hiding this comment.
Hmm not sure what you mean with all cases, but we should not print out 150k-300k labels in DEBUG mode...
When numberLabels < 3, bounds.size() < 4, so accessing bounds.at(2) and bounds.at(numberLabels - 2) in the ACTS_DEBUG print caused an std::out_of_range crash. Guard the detailed print behind a size check and fall back to printing all elements for small vectors. Co-authored-by: Cursor <cursoragent@cursor.com>
5b2ba05 to
ce6fbb1
Compare
|
|
Hi @murnanedaniel @paulgessinger @benjaminhuth what's the status on this PR? |
|



When numberLabels < 3, bounds.size() < 4, so accessing bounds.at(2) and bounds.at(numberLabels - 2) in the ACTS_DEBUG print caused an std::out_of_range crash.
Guard the detailed print behind a size check and fall back to printing all elements for small vectors.
PLEASE DESCRIBE YOUR CHANGES.
THIS MESSAGE ENDS UP AS THE COMMIT MESSAGE.
DO NOT USE @-MENTIONS HERE!
--- END COMMIT MESSAGE ---
Any further description goes here, @-mentions are ok here!
feat,fix,refactor,docs,choreandbuildtypes.