Make `const_eval_select` a real intrinsic by fee1-dead · Pull Request #100759 ·...
source link: https://github.com/rust-lang/rust/pull/100759
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Conversation
This fixes issues where track_caller
functions do not have nice panic
messages anymore when there is a call to the function, and uses the
MIR system to replace the call instead of dispatching via lang items.
Fixes #100696.
added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
labels
Collaborator
rust-highfive commented 20 days ago
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
Collaborator
rustbot commented 20 days ago
Some changes occurred to the CTFE / Miri engine Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
force-pushed the const_eval_select_real_intrinsic
branch
2 times, most recently
from
79eca84
to
7aa26a1
Compare
Member
RalfJung commented 18 days ago
Another possible implementation plan would be to exploit that we have separate MIR for CTFE and runtime, and implement the intrinsic via lowering to a regular function call some place in the MIR pipeline. That would make supporting |
Member
Author
fee1-dead commented 18 days ago
Yes, but AFAIK there is no separate query for runtime-only MIR, right? Implementing it that way would require adding such a query and rewiring runtime MIR usage to that. |
The optimized_mir query is only used for runtime MIR, I think. But maybe that changed again. The hierarchy of MIR queries is historically an underdocumented mess, not sure if it improved over the last year. But I am pretty sure that there is a fork in the road somewhere for MIR (where it becomes CTFE/runtime only), and we should be able to use that here. |
Member
RalfJung commented 18 days ago
Yeah looks like |
Member
RalfJung commented 18 days ago
It is kind of a crude hack to have 'implementation' passes in optimized_mir, but it might be the best solution for this particular intrinsic. |
Collaborator
rustbot commented 17 days ago
Some changes occurred to MIR optimizations |
compiler/rustc_mir_transform/src/lib.rs
Outdated Show resolved
Contributor
oli-obk commented 17 days ago
@bors r+ |
Contributor
bors commented 17 days ago
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
Member
Author
fee1-dead commented 17 days ago
@bors r- There was a test that changed to a no-op when I was debugging. I need to fix that |
added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
Outdated
@@ -1034,6 +1034,7 @@ impl f32 { | ||
} |
||
} |
||
#[inline(always)] |
I don't think this is the right fix. I think the monomorphization collector needs to handle these functions even without #[inline(always)]
.
Member
Author
fee1-dead 7 days ago
The collector runs on instance_mir
which runs on the shim mir or optimized_mir
, which should already have the const_eval_select calls rewired.
I've tested with the arm target compiler and this is indeed a fix, so I guess this could just be some ghost bug that people who add const_eval_select
to library functions worry about in the future.
I don't think that's a sufficiently satisfying answer; the bug is at minimum exposed by these changes. We should understand why (even if we don't necessarily fix it here) and track fixing it.
Contributor
tmiasko 7 days ago
The undefined reference is from compiler-builtins, which shouldn't have any link time dependencies on the core. We have been using inline to avoid this issue so far, so that seems fine to me, although personally I would prefer approach proposed in rust-lang/compiler-builtins#472.
So looks like we do know what the problem is. Is there an issue open in https://github.com/rust-lang/compiler-builtins for that? If not, could you create one? Then the inline
attribute here should reference that issue.
Member
Author
fee1-dead 5 days ago
I created an issue and linked to it from this attribute.
Contributor
bors commented 5 days ago
The latest upstream changes (presumably #101396) made this pull request unmergeable. Please resolve the merge conflicts. |
Member
RalfJung commented 4 days ago
@bors delegate+
|
Contributor
bors commented 4 days ago
@fee1-dead can now approve this pull request |
Member
Author
fee1-dead commented 4 days ago
@bors r=oli-obk,RalfJung |
Contributor
bors commented 4 days ago
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
Contributor
bors commented 4 days ago
Contributor
bors commented 4 days ago
Test successful - checks-actions |
Collaborator
rust-timer commented 3 days ago
Finished benchmarking commit (9358d09): comparison URL. Overall result: regressions and improvements - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @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)Results CyclesResults Footnotes
|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Successfully merging this pull request may close these issues.
Recommend
-
6
Future::join and const-eval— 2021-01-16 Happy new year everyone! Today we're trying something new: less of a blog post, more of research notes. This is less of a "here's something I've concluded",...
-
5
Collaborator rust-timer ...
-
6
Copy link Contributor Smittyvb comment...
-
8
New issue Implement black_box using intrinsic #87916 Conversation...
-
9
New issue implement const_allocate intrinsic #1973
-
8
Const Eval (Un)Safety Rules Sept. 15, 2022 · Felix Klock on behalf of The Compiler Team ...
-
4
Conversation Contributor
-
4
const-eval: make misalignment a hard error #115524 Merged ...
-
5
Conversation Member Copied over f...
-
8
const_eval: allow function pointer signatures containing &mut T in const contexts #116015
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK