fix(riscv,x86_64): validate vector semantics and native replay - #296
Conversation
Co-authored-by: carlos <102978772+carlosqwqqwq@users.noreply.github.com>
Preserve architecturally accepted LLIG guest encodings while emitting L'L=00 for dynamic-rounding host replay; retain L'L for embedded rounding controls. Co-authored-by: carlos <102978772+carlosqwqqwq@users.noreply.github.com>
Preserve architecturally accepted VRANGE and VSCALEF LLIG guest images while emitting the deterministic L'L=00 form for hosted helper replay. Co-authored-by: carlos <102978772+carlosqwqqwq@users.noreply.github.com>
carlosqwqqwq
left a comment
There was a problem hiding this comment.
Reviewed the consolidated rollup against the reported issues. All accepted behaviors are implemented through the shared pre-execution validator (direct interpreter and SMIR/JIT helper paths), and the regression tests cover the reported encodings:
- RV32 C.FLW/C.FSW F-extension gate, reserved CBO funct7, obsolete SFENCE.VM and URET handling;
- operand-group alignment for vmul/vdiv/vrem, vsaddu/vsadd/vssubu/vssub, vssrl/vssra, vslide1down/vfslide1down, vsmul, vmseq family, vid.v, segment and non-segment vector memory ops;
- masked-destination v0 rule, vmadc/vmsbc mask-result overlap, viota.m overlap disposition, whole-register moves honoring vstart, segment fault-only-first execution semantics, SRET supervisor restore, and WFI local-wake semantics.
I also verified locally on the current head (75e7172): cargo test --lib evex_fma3_register_replay (8/8), evex_integer_unary_memory_source (12/12), evex_packed_extend_memory_source (13/13), and evex_packed_fp_unary_memory_source (21/21) all pass, including the native replay cases that previously raised SIGILL on the hosted linux-x64 lane. CI on the replacement hosted run is green across all platforms.
Thanks for the co-author credit and for consolidating these fixes.
@carlosqwqqwq, this is the next independently implemented consolidation after #203, #231, and #255. Thank you for continuing to identify RISC-V gaps. Please review the consolidated behavior and tests here.
Overview
This change independently reproduces the reported failures against the current ISA contracts and implements the accepted fixes without importing contributor commits or copying their patches:
vltrimming;vstartin SEW elements and preserve overlapping sources;Consolidated reports
This supersedes #261, #262, #263, #264, #265, #272, #273, #274, #275, #282, #283, #284, #285, #291, #292, #293, #294, and #295.
#271 is already covered by merged #255. #281 was withdrawn after its reduction-overlap report proved to be a false positive, so it is intentionally excluded.
For #294, SRET is incorporated, while URET is rejected because the current privileged architecture no longer defines the former N-extension instruction. For #295, the valid WFI wake condition is incorporated, while the proposed unconditional trap is not: wake eligibility and interrupt trap eligibility are separate architectural decisions.
Issues
Fixes #256
Fixes #257
Fixes #258
Fixes #259
Fixes #260
Fixes #267
Fixes #268
Fixes #269
Fixes #270
Fixes #277
Fixes #278
Fixes #279
Fixes #280
Fixes #286
Fixes #287
Fixes #288
Fixes #289
Fixes #290
#266 is a duplicate of behavior already fixed by #255. #276 was withdrawn with #281.
Validation
cargo fmt --all --checkcargo clippy --all-targets --features x86_64-suitecargo clippy --lib --no-default-features --features x86_64-suite,smir-jit -- -D warningscargo build --all-targets --no-default-features --features x86_64-suite,smir-jitThe first hosted run raised SIGILL in scalar EVEX FMA3 replay on a runner that exposed AVX-512. Commit
39561be9canonicalizes its dynamic-rounding LLIG host image. The next run advanced past that test and raised SIGILL in scalar VRANGE helper replay; commit75e71722canonicalizes scalar VRANGE and the equivalent later VSCALEF frontier. Run 31722118481 is the authoritative replacement verification for that AVX-512 CPU configuration.Change-surface audit
OpKindis required.Assumption Register
vltrimming.vl; first-element faults remain precise.vstart.Out-of-scope findings
None currently block this rollup.
Co-authored-by: carlos 102978772+carlosqwqqwq@users.noreply.github.com