fix(rocrand): fix race condition in poisson distribution #14419
All Vouch review confidence checks passed
Residual risk 0.13 = Change Risk (0.33) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.33 · 147 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.299
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #14419"
general
weight: 0.35
spolifroni-amd
Motivation
QA reported a races condition in
poissondistribution. This PR aims to fix this.JIRA ID: ROCM-32132
Technical Details
Using
TSANQA reported that inside thepoissondistribution when callingstd::lgammainsidecalculate_poisson_probabilitiesthere was a race condition. This is happening becausestd::lgammastores the sign of the output inside a global variable. To fix this we can uselgamma_rwhich allows us to store the sign locally without storing it in a global variable.Since
lgamma_ris not part of thestdliband is only implemented inglibc, it is not available for windows (msvc). This is the reason why we need to check if we are currently on windows or not.Test Plan
Standard CI test suite. Also local testing on both linux and windows.
Also re-run with
TSANto see if race condition is still reported.Test Result
Local unit test ran on linux and windows shows no failures.
TSANrun shows no race condition originated from rocrand.Submission Checklist