Skip to content
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

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Conversation

RalfJung
Copy link
Member

This is possible as a follow-up to #129403

@rustbot
Copy link
Collaborator

rustbot commented Sep 11, 2024

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 11, 2024
@rustbot
Copy link
Collaborator

rustbot commented Sep 11, 2024

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(
Copy link
Member Author

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

Copy link
Contributor

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)?;
Copy link
Member Author

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.

@RalfJung
Copy link
Member Author

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))
Copy link
Member

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

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@compiler-errors compiler-errors left a 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

@@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non?

@RalfJung
Copy link
Member Author

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.
@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Sep 13, 2024

📌 Commit e2bc16c has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 13, 2024
@bors
Copy link
Contributor

bors commented Sep 13, 2024

⌛ Testing commit e2bc16c with merge 0307e40...

@bors
Copy link
Contributor

bors commented Sep 13, 2024

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 0307e40 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 13, 2024
@bors bors merged commit 0307e40 into rust-lang:master Sep 13, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 13, 2024
@RalfJung RalfJung deleted the interpret-simd branch September 13, 2024 17:35
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0307e40): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-1.1%, -0.2%] 2
All ❌✅ (primary) - - 0

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
15.0% [2.3%, 18.7%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 757.647s -> 756.444s (-0.16%)
Artifact size: 341.27 MiB -> 341.13 MiB (-0.04%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants