Uh oh!
There was an error while loading. Please reload this page.
tighten sanity checks around Scalar and ScalarPair - #96220
Conversation
rust-highfive
commented
Apr 19, 2022
Some changes occured to the CTFE / Miri engine cc @rust-lang/miri |
There was a problem hiding this comment.
I removed all this since I think it is redundant with the scalar size check in to_bits that alloc.write_scalar does.
This comment has been minimized.
This comment has been minimized.
a9666f7 to
60c3d1aCompareThere was a problem hiding this comment.
This is the odd one -- a ScalarPair at Aggregate ABI just doesn't seem right.
I added sanity checking in operand_downcast, and my theory was confirmed: when downcasting std::option::Option<*mut std::ffi::c_void> to variant 1, the ABI changes from ScalarPair to Aggegreate.
Details
downcast to 1 turned ScalarPair layout into non-scalar layout: TyAndLayout {
ty: std::option::Option<*mut std::ffi::c_void>,
layout: Layout {
fields: Arbitrary {
offsets: [
Size {
raw: 0,
},
],
memory_index: [
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
I64,
false,
),
valid_range: 0..=1,
},
tag_encoding: Direct,
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align {
pow2: 0,
},
pref: Align {
pow2: 3,
},
},
size: Size {
raw: 8,
},
},
Layout {
fields: Arbitrary {
offsets: [
Size {
raw: 8,
},
],
memory_index: [
0,
],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align {
pow2: 3,
},
pref: Align {
pow2: 3,
},
},
size: Size {
raw: 16,
},
},
],
},
abi: ScalarPair(
Initialized {
value: Int(
I64,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Pointer,
valid_range: 0..=18446744073709551615,
},
),
largest_niche: Some(
Niche {
offset: Size {
raw: 0,
},
value: Int(
I64,
false,
),
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align {
pow2: 3,
},
pref: Align {
pow2: 3,
},
},
size: Size {
raw: 16,
},
},
} to TyAndLayout {
ty: std::option::Option<*mut std::ffi::c_void>,
layout: Layout {
fields: Arbitrary {
offsets: [
Size {
raw: 8,
},
],
memory_index: [
0,
],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align {
pow2: 3,
},
pref: Align {
pow2: 3,
},
},
size: Size {
raw: 16,
},
},
}
60c3d1a to
e7d1aceCompare
This comment has been minimized.
This comment has been minimized.
RalfJung
commented
Apr 19, 2022
Ah, I guess this is enough to anger const-eval on the runtime version of this example.^^ I guess this is blocked on fixing that enum layout then. |
d448749 to
64826e5Compare
This comment has been minimized.
This comment has been minimized.
oli-obk
commented
Apr 20, 2022
Const prop strikes again 🙈 |
RalfJung
commented
Apr 20, 2022
The curious part is that const prop managed to dodge the assertions we had in place before. I guess that goes to show some extra assertions are really needed. ;) |
bors
commented
May 5, 2022
☔ The latest upstream changes (presumably #96734) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
RalfJung
commented
May 10, 2022
I rebased and commented out the things that are broken by #96185. @oli-obk I think this is ready for review. Also let's ensure this does not cost too much perf. |
rust-timer
commented
May 10, 2022
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
bors
commented
May 10, 2022
⌛ Trying commit aef8a93 with merge e20aa27db438b844d57419af48c40860d88dbcda... |
rust-timer
commented
May 11, 2022
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
bors
commented
May 11, 2022
⌛ Trying commit 14f6daf with merge bae4e5b81419bd94533a9428d118973194da792b... |
bors
commented
May 11, 2022
☀️ Try build successful - checks-actions |
rust-timer
commented
May 11, 2022
Queued bae4e5b81419bd94533a9428d118973194da792b with parent f296b9a, future comparison URL. |
rust-timer
commented
May 11, 2022
Finished benchmarking commit (bae4e5b81419bd94533a9428d118973194da792b): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Footnotes |
RalfJung
commented
May 11, 2022
Hm, well, that did not help... Maybe the |
oli-obk
commented
May 11, 2022
mir interpret is always hitting LLVM inlining thresholds, I don't think it's worth looking into further in this PR @bors r+ |
bors
commented
May 11, 2022
📌 Commit 14f6daf has been approved by |
bors
commented
May 11, 2022
⌛ Testing commit 14f6daf with merge 3e2c8514996fffe0081afd8cd6dcf2fcf362d4ff... |
rust-log-analyzer
commented
May 11, 2022
bors
commented
May 11, 2022
💔 Test failed - checks-actions |
oli-obk
commented
May 11, 2022
@bors retry timeout, logs empty/stuck |
bors
commented
May 11, 2022
bors
commented
May 11, 2022
☀️ Test successful - checks-actions |
rust-timer
commented
May 11, 2022
Finished benchmarking commit (6dd6840): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
While investigating #96185 I noticed codegen has tighter sanity checks here than Miri does, so I added some more assertions. Strangely, some of them fail, so I also needed to add a HACK... that is probably worth looking into.
This does not fix that issue, but it changes the ICE messages, making it quite clear that we have a scalar whose size is not the same as that of the surrounding layout.
r? @oli-obk