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

Remove -Zfuel. #115293

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Remove -Zfuel. #115293

wants to merge 2 commits into from

Conversation

cjgillot
Copy link
Contributor

I'm not sure this feature is used. I only found 2 references in a google search, both referring to its introduction.

Meanwhile, it's a global mutable state, untracked by incremental compilation, so incompatible with it.

@rustbot
Copy link
Collaborator

rustbot commented Aug 27, 2023

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 27, 2023
@rustbot
Copy link
Collaborator

rustbot commented Aug 27, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@tmiasko
Copy link
Contributor

tmiasko commented Aug 27, 2023

I found it quite useful in the past for bisecting bugs (it could be declared incompatible with incremental compilation if that aspect is an issue).

@rust-log-analyzer

This comment has been minimized.

@JakobDegen
Copy link
Contributor

I agree we should remove it right now, primarily because it's usefulness is significantly diminished by inconsistent use. At some point in the future we should switch to more structured transformations (as opposed to writing to &muts) in which case this can be brought back and we can enforce consistent usage

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Aug 28, 2023
@bors
Copy link
Contributor

bors commented Aug 29, 2023

☔ The latest upstream changes (presumably #112775) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Sep 13, 2023

☔ The latest upstream changes (presumably #115803) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Sep 21, 2023

☔ The latest upstream changes (presumably #116027) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Sep 27, 2023

☔ The latest upstream changes (presumably #116144) made this pull request unmergeable. Please resolve the merge conflicts.

@wesleywiser
Copy link
Member

wesleywiser commented Oct 5, 2023

Similar to @tmiasko, I've also found this useful in the past. The point that this is inconsistently used is true, but wouldn't it be better to fix that than to remove it entirely?

@pnkfelix suggested that attempting to use -Zfuel with incremental compilation enabled could generate a warning so that devs know it could lead to other problems.

@cjgillot
Copy link
Contributor Author

cjgillot commented Oct 5, 2023

We now have a more reliable way to disable optimizations: -Zmir-enable-passes. I recommend using that one for debugging.

@bors
Copy link
Contributor

bors commented Oct 13, 2023

☔ The latest upstream changes (presumably #115964) made this pull request unmergeable. Please resolve the merge conflicts.

@workingjubilee
Copy link
Contributor

It is more important that the information in the rustc-dev-guide is actually up-to-date, and that "how to debug optimization" is easy and accurate, as people try to actually use it e.g. to analyze and debug their codegen problems. By holding on to this, we are advising much more inexperienced devs to try to make sense of a de facto useless option.

So, do we want random passerby to try to use -Zfuel because we still document it as the thing to do, or do we want them to be informed as to what actually works? If we want -Zfuel to actually work, where is the PR?

Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with a corresponding PR to adjust rustc-dev-guide

@Dylan-DPC Dylan-DPC 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 Nov 6, 2023
@tmiasko
Copy link
Contributor

tmiasko commented Nov 11, 2023

The -Zfuel can be used to bisect specific transformation that is incorrect. It makes it trivial to generate diff between working and broken MIR. To locate the source code that is being miscompiled and extract minimized test case. The -Zmir-enable-passes is no alternative for such use cases.

It works perfectly fine even if not every single MIR optimizations uses it - just run bisection, dump MIR at the boundary, and diff between those. If for some reason the current inconsistent use is a deal breaker for others, I can prepare a pull request that will incorporate it directly into a pass manager.

I don't think we should remove it without a proper replacement.

@bjorn3
Copy link
Member

bjorn3 commented Nov 26, 2023

-Zfuel is entirely unreliable with parallel rustc, right? The order in which functions get mir optimizations running is non-deterministic and thus which function sees the last fuel consumed.

@nnethercote
Copy link
Contributor

FWIW, I just wrote a patch to refactor the OptimizationFuel type (because it's a bit messy) and then I just discovered this PR...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet