Skip to content

Use UnsafeArg in Arguments::new_v1 #89155

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

Closed
wants to merge 1 commit into from

Conversation

camsteffen
Copy link
Contributor

@camsteffen camsteffen commented Sep 21, 2021

...instead of having a panic case.

Continues #89139

r? @Mark-Simulacrum

@rust-highfive
Copy link
Contributor

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 21, 2021
@camsteffen
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 21, 2021
@bors
Copy link
Collaborator

bors commented Sep 21, 2021

⌛ Trying commit 8999391ffd611c6603d17d7c6a864086c524eac4 with merge 2d0cbf47213faa5e914df67c6ecff357704e6c60...

@rust-log-analyzer

This comment has been minimized.

@camsteffen
Copy link
Contributor Author

@rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rust-log-analyzer

This comment has been minimized.

@camsteffen
Copy link
Contributor Author

@rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@camsteffen
Copy link
Contributor Author

@rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@camsteffen
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@bors
Copy link
Collaborator

bors commented Sep 21, 2021

⌛ Trying commit a54bc5873b02d0774f787ecc381965048efb8fca with merge 05b81d65ee137dd24915e693fee7bab00f70b0d1...

@bors
Copy link
Collaborator

bors commented Sep 21, 2021

☀️ Try build successful - checks-actions
Build commit: 05b81d65ee137dd24915e693fee7bab00f70b0d1 (05b81d65ee137dd24915e693fee7bab00f70b0d1)

@rust-timer
Copy link
Collaborator

Queued 05b81d65ee137dd24915e693fee7bab00f70b0d1 with parent 840acd3, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (05b81d65ee137dd24915e693fee7bab00f70b0d1): comparison url.

Summary: This change led to large relevant mixed results 🤷 in compiler performance.

  • Large improvement in instruction counts (up to -2.5% on full builds of keccak)
  • Moderate regression in instruction counts (up to 0.9% on incr-unchanged builds of html5ever)

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 led to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 22, 2021
@camsteffen
Copy link
Contributor Author

@bors try @rust-timer queue

(probably should have waited for #89139 to be merged in the first place)

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@Mark-Simulacrum
Copy link
Member

Looking at the regressions in the perf run above, they're mostly down to some slight codegen time regressions. Looking at the IR generated by format_args!, though, it seems like it's pretty much the same or maybe slightly better at most -- I think the primary difference is that the UnsafeArg unsafe constructor creates an extra basic block in the MIR and LLVM IR (since call is a terminator), even though it's not actually codegen'd into LLVM IR even without optimizations.

My suspicion is that these are related to UnsafeArg::new being const now -- I've adjusted to just apply that change for another evaluation.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 27, 2021
@bors
Copy link
Collaborator

bors commented Sep 27, 2021

⌛ Trying commit 69cdb0d38780c849ae2dc636a464e89b4a8aa690 with merge 8d71823382b5b3f1a45de0524158120e3a504461...

@Mark-Simulacrum
Copy link
Member

@bors try

@bors
Copy link
Collaborator

bors commented Sep 27, 2021

⌛ Trying commit d753e34e94a4c707e15a4cd006e02ea234ad2e5e with merge 4790386457cce89d275a3d6ec0c4cb81c71cd565...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Sep 27, 2021

☀️ Try build successful - checks-actions
Build commit: 4790386457cce89d275a3d6ec0c4cb81c71cd565 (4790386457cce89d275a3d6ec0c4cb81c71cd565)

@rust-timer
Copy link
Collaborator

Queued 4790386457cce89d275a3d6ec0c4cb81c71cd565 with parent 2b6ed3b, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4790386457cce89d275a3d6ec0c4cb81c71cd565): comparison url.

Summary: This benchmark run did not return any relevant changes.

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 led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Sep 27, 2021
@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

Let's try the original set again, just in case.

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 28, 2021
@bors
Copy link
Collaborator

bors commented Sep 28, 2021

⌛ Trying commit 86b42ab with merge b16fcaca1209afedd97a9dd4db06d5abdadac403...

@bors
Copy link
Collaborator

bors commented Sep 28, 2021

☀️ Try build successful - checks-actions
Build commit: b16fcaca1209afedd97a9dd4db06d5abdadac403 (b16fcaca1209afedd97a9dd4db06d5abdadac403)

@rust-timer
Copy link
Collaborator

Queued b16fcaca1209afedd97a9dd4db06d5abdadac403 with parent 8a12be7, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b16fcaca1209afedd97a9dd4db06d5abdadac403): comparison url.

Summary: This change led to large relevant mixed results 🤷 in compiler performance.

  • Moderate improvement in instruction counts (up to -3.4% on incr-full builds of ctfe-stress-4)
  • Large regression in instruction counts (up to 1.5% on full builds of cranelift-codegen)

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 led to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 28, 2021
@Mark-Simulacrum
Copy link
Member

I believe the regressions, both in incremental and non-incremental benchmarks, are largely due to added queries checking that the UnsafeArg arguments being added are well-formed and such. That seems like a cost of this change, for sure, but one that seems not too unexpected.

I don't really have an explanation for the improvements, though. It seems like they are due to a large amount of instructions in process_obligations no longer running -- but that doesn't seem like it should be tied into this patch. It might be shuffling of instructions or something into different basic blocks which causes changes to optimizers, but I have no real proof of this. They don't seem as important to investigate regardless.

I am a little hesitant to proceed with accepting the regressions, particularly when it seems like they don't actually really benefit us (and indeed the API is "needlessly" made unsafe...). I think as of now, I'd prefer that we close this PR, but I am open to being convinced otherwise. I don't think there's an approach to this that avoids paying the cost for the extra work getting expanded into a bunch of user code (even if the runtime cost is ~0).

@camsteffen camsteffen closed this Oct 4, 2021
@camsteffen camsteffen deleted the write-perf2 branch October 4, 2021 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants