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

proc_macro/bridge: remove Closure. #97045

Closed
wants to merge 4 commits into from

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented May 14, 2022

(Note: the first commit is from #97041, only based on it so I can build at all locally, will undraft as soon as that lands and is rebased over)

This is mostly a potential step towards bridge internals friendlier wrt process-level or wasm-based isolation.
(Follow-ups would likely involve never passing buffers and instead having more of an io::{Read,Write} combo)

The main change here is the client->server FFI call (the dispatch field of Bridge), which no longer passes any data other than the Buffer itself - it's now effectively "global" (technically thread-local).

While this direction is arguably less Rust-y, the client having a pointer to server data could only work in the same address space anyway (and in practice was always pointing higher up the stack on the same thread), and it's additional representational complexity (if one were, say, trying to construct one of these C ABI Closures from outside a wasm VM, to pass to code inside the wasm VM).

There's still a chance we can't do this, but it's down to performance (IMO at least) now.

cc @petrochenkov @mystor

@rust-highfive

This comment was marked as off-topic.

@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 14, 2022
@eddyb
Copy link
Member Author

eddyb commented May 14, 2022

@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 May 14, 2022
@bors
Copy link
Contributor

bors commented May 14, 2022

⌛ Trying commit 9242c12 with merge 27e0a1ccff81e0c702800c4e46627bd584cded41...

@Urgau
Copy link
Member

Urgau commented May 14, 2022

Perf bot is currently broken until #97044 is merged. See https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/perfrlo.20broken for additional information.

@bors
Copy link
Contributor

bors commented May 14, 2022

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

@rust-timer
Copy link
Collaborator

Queued 27e0a1ccff81e0c702800c4e46627bd584cded41 with parent 8019fa0, future comparison URL.

@lqd
Copy link
Member

lqd commented May 14, 2022

Perf bot is currently broken

note: only the bootstrap rustc benchmark is currently broken.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (27e0a1ccff81e0c702800c4e46627bd584cded41): comparison url.

Summary:

  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 7 10 7 7 14
mean2 0.4% 2.1% -0.9% -0.5% -0.3%
max 0.7% 4.4% -4.6% -0.6% -4.6%

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.

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

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels May 14, 2022
@eddyb
Copy link
Member Author

eddyb commented May 14, 2022

So maybe the extra TLS isn't feasible after all :/

I might still want to keep some of the refactors (that streamline ExecutionStrategy to being only about Buffer-oriented request dispatch), but using Closure (like before this PR) instead of TLS.

@petrochenkov
Copy link
Contributor

I don't have enough time or interest to figure out how the bridge works and what this PR does.
r? rust-lang/compiler

@eddyb eddyb mentioned this pull request May 27, 2022
@wesleywiser
Copy link
Member

I see this is marked as a draft PR. @eddyb I'm going to mark this as S-waiting-on-author under the assumption this isn't yet ready for review. Please let me know if that is incorrect!

@wesleywiser wesleywiser 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-review Status: Awaiting review from the assignee but also interested parties. labels Jun 3, 2022
@eddyb
Copy link
Member Author

eddyb commented Jun 3, 2022

It's a slowdown so I'll just close it.

@eddyb eddyb closed this Jun 3, 2022
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-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants