Fix ZeroIfNegative for 16/32/64-bit signed ints on AVX2 #3510
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 115 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
Shallow Review Depth
shallow_review_depth
0.289
Diff Size
diff_size
0.284
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #3510"
general
weight: 0.35
Arthur031221
On AVX2,
ZeroIfNegativeon 256-bit vectors ofint16_t,int32_torint64_treturns wrong values for positive lanes.ZeroIfNegative(Set(d, 1000))gives 768, and 128 or 255 give 0. SSE4 and AVX3 return the input unchanged.The
Vec256overload inx86_256-inl.hdidIfThenElse(MaskFromVec(v), zero, v), which passes the data itself as the mask. For integer lanes AVX2IfThenElseis_mm256_blendv_epi8, and that tests the top bit of every byte. So any positive lane with a byte >= 0x80 below its top byte was partly zeroed. I removed the overload so the genericZeroIfNegative(viaIfNegativeThenZeroElse) gets used, same as for 128-bit and 512-bit vectors.TestZeroIfNegativeinif_test.ccnow also checks a positive lane with such bytes. Built as a standaloneif_test, it aborts on AVX2 without the change (i16x16 expect 0x03E8 ...) and passes on all targets with it.Assisted by Claude/Codex.