i#3544: Save vector registers with LMUL=1 for any VLEN <= 256 - #8074
Open
wangzhemaxa wants to merge 1 commit into
Open
i#3544: Save vector registers with LMUL=1 for any VLEN <= 256#8074wangzhemaxa wants to merge 1 commit into
wangzhemaxa wants to merge 1 commit into
Conversation
The vector register save/restore paths (append_save_simd_reg, append_restore_simd_reg, insert_push_all_registers, and insert_pop_all_registers) copied eight registers at a time with LMUL=8. An LMUL=8 group store packs the eight registers contiguously, so register N's bytes land at &simd[N] only when VLEN is exactly 256 bits and fills a whole dr_simd_t slot. On any other VLEN the mcontext layout contract VREG_OFFSET(reg) == &simd[reg - VR0] is broken. Copy one register at a time with LMUL=1 instead, so each register's vlenb bytes always land in the low bytes of its own dr_simd_t slot for any supported VLEN <= 256 bits. Issue: DynamoRIO#3544
edeiana
self-requested a review
August 26, 2026 05:21
edeiana
approved these changes
Aug 27, 2026
edeiana
left a comment
Contributor
There was a problem hiding this comment.
Thank you for contributing!
It would be great if you could add a test for this issue, but I realize it's not straightforward; you'd have to write an application using the vector registers and a client that would insert, for example, a clean call, which would then trigger the saving of the mcontext.
So, approving regardless, as this is an improvement compared to what we have now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The vector register save/restore paths (append_save_simd_reg, append_restore_simd_reg, insert_push_all_registers, and insert_pop_all_registers) copied eight registers at a time with LMUL=8. An LMUL=8 group store packs the eight registers contiguously, so register N's bytes land at &simd[N] only when VLEN is exactly 256 bits and fills a whole dr_simd_t slot. On any other VLEN the mcontext layout contract VREG_OFFSET(reg) == &simd[reg - VR0] is broken.
Copy one register at a time with LMUL=1 instead, so each register's vlenb bytes always land in the low bytes of its own dr_simd_t slot for any supported VLEN <= 256 bits.
Issue: #3544