-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
interpret: simplify SIMD type handling #130215
Conversation
The Miri subtree was changed cc @rust-lang/miri Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
self.ptr_with_meta_to_mplace(ptr, MemPlaceMeta::None, layout, /*unaligned*/ false) | ||
} | ||
|
||
pub fn ptr_to_mplace_unaligned( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tiif this method should also come handy in rust-lang/miri#3852 to deal with the alignment problem in eventfd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, thanks!
this.mem_copy(value.ptr(), ptr, value.layout.size, /*nonoverlapping*/ true)?; | ||
// Deref the pointer *unaligned*, and do the copy. | ||
let dest = this.ptr_to_mplace_unaligned(ptr, value.layout); | ||
this.copy_op(&value, &dest)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to adjust the logic a bit here because operand_to_simd
used to return an MPlace
but project_to_simd
preserves the original type.
32143a6
to
d1e93ca
Compare
r? @saethlin |
@@ -103,5 +103,5 @@ pub(crate) fn create_static_alloc<'tcx>( | |||
assert_eq!(ecx.machine.static_root_ids, None); | |||
ecx.machine.static_root_ids = Some((alloc_id, static_def_id)); | |||
assert!(ecx.memory.alloc_map.insert(alloc_id, (MemoryKind::Stack, alloc)).is_none()); | |||
Ok(ecx.ptr_with_meta_to_mplace(Pointer::from(alloc_id).into(), MemPlaceMeta::None, layout)) | |||
Ok(ecx.ptr_to_mplace(Pointer::from(alloc_id).into(), layout)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this change have anything to do w the pr? it seems unrelated lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, i see you changed the privacy of that fn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I had to add ptr_to_mplace_unaligned
for this PR and so I had to make the lower-level ptr_with_meta_to_mplace
more flexible and didn't want to expose this somewhat "dangerous" operation too far so I checked if I could make it private, and turns out yes I could.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me unless you want specifically a review from saethlin
src/tools/miri/src/shims/x86/mod.rs
Outdated
@@ -1014,9 +1014,11 @@ fn mask_store<'tcx>( | |||
let value = this.project_index(&value, i)?; | |||
|
|||
if this.read_scalar(&mask)?.to_uint(mask_item_size)? >> high_bit_offset != 0 { | |||
// *Bon-inbounds* pointer arithmetic to compute the destination. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non?
d1e93ca
to
d4a9657
Compare
d4a9657
to
e2bc16c
Compare
I had to rebase as there was a conflict (a semantic conflict -- things merged fine but then they would fail to build). Seems fine to take this off saethlin's plate. |
☀️ Test successful - checks-actions |
Finished benchmarking commit (0307e40): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResults (secondary 15.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 757.647s -> 756.444s (-0.16%) |
This is possible as a follow-up to #129403