Fix xarch instruction size estimates#129877
Conversation
Correct xarch size accounting for VEX/K encodings and add an opt-in debug check. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make the emit-size check exact by default and cover the remaining xarch estimator gaps. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR updates the xarch emitter’s instruction-size estimation logic to more accurately account for encoding details (prefixes/opcode forms) and adds a DEBUG-only sanity check to assert when the emitted size differs from the estimated size.
Changes:
- Add a new DEBUG-only JIT config switch to enable/disable an emit-size mismatch assertion.
- Refine xarch size estimation in multiple paths (VEX/EVEX prefix accounting, certain opcode forms, K-reg moves, etc.).
- Add a DEBUG-only emit-time verification in
emitOutputInstrto compare estimated vs. actual encoded byte count (with skips for known intentionally-variable cases).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/jit/jitconfigvalues.h | Adds JitAssertOnEmitSizeMismatch debug config switch. |
| src/coreclr/jit/emitxarch.cpp | Adjusts instruction size estimation for various xarch encodings and adds DEBUG-only emit-size mismatch checking. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run runtime-coreclr jitstress-isas-avx512, runtime-coreclr jitstress-isas-x86 |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run runtime-coreclr jitstress-isas-avx512, runtime-coreclr jitstress-isas-x86 |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Use the actual opcode prefix state when adjusting K-instruction size estimates so EVEX stress and VEX output stay consistent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run runtime-coreclr jitstress-isas-avx512, runtime-coreclr jitstress-isas-x86 |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Correct x86 K-instruction prefix accounting and memory-source IMUL estimates exposed by checked CI runs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run runtime-coreclr jitstress-isas-avx512, runtime-coreclr jitstress-isas-x86 |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run runtime-coreclr jitstress-isas-avx512, runtime-coreclr jitstress-isas-x86 |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Summary
Validation
build.cmd -subset clr.jit -c Checkedbuild.cmd -subset clr.jit -arch x86 -c CheckedNote
This PR description was generated by GitHub Copilot.