-
Notifications
You must be signed in to change notification settings - Fork 0
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
black_box improvements #1
base: benchmarking
Are you sure you want to change the base?
Conversation
``` | ||
|
||
Prevents a value or the result of an expression from being optimized away by the | ||
compiler adding as little overhead as possible. It does not prevent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also mention that it prevents outer code from "seeing" the inside optimization-wise -- values produced by black_box are from the optimizer's perspective no different from being random.
text/0000-benchmarking.md
Outdated
|
||
[winsorized]: https://en.wikipedia.org/wiki/Winsorizing | ||
Is a read/write barriert: it flushes pending writes to variables "escaped" with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
barrier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed :)
Could you explain what's the difference between |
ea4543f
to
b37b88f
Compare
@kennytm sorry! for some reason I wasn't following this so I did not receive any notifications.
Maybe the implementation helps? https://gist.github.com/gnzlbg/92b00f4d5362b06e72b48f824604e64e First, What clobber says is a bit different: "at the clobber something will read all memory in the heap and do something depending on it". For the I don't know exactly how compiler_fence works internally or how it should be used, but it looks like it is intended to synchronize reads/writes across threads by preventing reorderings. Even if you prevent a reordering, if LLVM can prove that the value written by one thread is not read by any other thread, the write can be elided without reordering anything. So the use-case seems a bit different. Clobber is more like a single-threaded full-memory fence, while But as mentioned, I am not 100% sure about this. |
I think the above explanation is worth including in the reference-level explanation section. By the way, it's likely that rust-lang#2287 will be closed given that folks seem to prefer rust-lang#2318 (in the discussions with the team so far). In that case, we should make mem::black_box and clobber into its own RFC |
@Manishearth there is also rust-lang#1484 open where @SimonSapin suggests doing exactly that. Maybe we should move them already into its own RFC and ask the folks over there to get involved. |
works for me. Would you like to open the RFC? I can help if you need. |
I'll add it to my todo list, might get to it later today. |
rfc, const-repeat-expr: notes on is_rvalue_promotable(expr)
RFC 2582: Fix typo (must not -> need not)
I'd be willing to write up the RFC for this. Presumably not much has changed about the assumed API since this was filed? |
Yeah. |
No description provided.