Fix full-width VPCOMPRESS byte and word masks #850
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 344 lines diff across 4 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.350
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #850"
general
weight: 0.35
stlintel
Problem
VPCOMPRESSBandVPCOMPRESSWconstruct a dense write mask afterpacking the selected source elements:
For an EVEX.512 instruction with every mask bit set,
kreaches 64for byte elements and 32 for word elements. The resulting C++ shifts
use a shift count equal to the width of the operand, which is undefined
behavior.
On the tested build, both expressions produced a zero write mask. The
shared instruction handlers consequently suppressed the complete
register write or memory store instead of writing all selected
elements.
Fix
Use an all-ones write mask when
kreaches the full element count:0xfffffffffffffffffor 64 byte elements0xfffffffffor 32 word elementsRetain the existing shift expression for smaller element counts. The
same handlers implement register and memory destinations, so this
corrects both forms.
Architectural reference
The Intel® 64 and IA-32 Architectures Software Developer’s Manual,
Volume 2, sections “VPCOMPRESSB/VPCOMPRESSW—Store Sparse Packed
Byte/Word Integer Values Into Dense Memory/Register,” specify that
source elements selected by the writemask are copied consecutively
into the low elements of the destination.
For an EVEX.512 operation with every writemask bit set, all 64 byte
elements or all 32 word elements are selected. The instruction must
therefore write the complete 512-bit result.
Validation
A standalone 64-bit CPL3 guest exercised the instructions on the Bochs
tigerlakeCPU model with AVX-512 state enabled (XCR0=0xe7).Each test initialized its destination with a distinguishable sentinel.
The full-width cases compared all 64 result bytes with the source. The
boundary controls selected 63 bytes or 31 words and additionally
verified that the unselected final destination element retained its
sentinel value.
| Instruction | Destination | Selected elements | Before | After |
|---|---|---:|---:|---:|
|
VPCOMPRESSB| register | 64 | FAIL | PASS ||
VPCOMPRESSB| register | 63 | PASS | PASS ||
VPCOMPRESSB| memory | 64 | FAIL | PASS ||
VPCOMPRESSB| memory | 63 | PASS | PASS ||
VPCOMPRESSW| register | 32 | FAIL | PASS ||
VPCOMPRESSW| register | 31 | PASS | PASS ||
VPCOMPRESSW| memory | 32 | FAIL | PASS ||
VPCOMPRESSW| memory | 31 | PASS | PASS |UBSan also identified the two affected expressions as shifts with
exponents 64 and 32, respectively.
The patched tree was rebuilt successfully with
make -j2.