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

Add config.toml options for enabling overflow checks in rustc and std #87784

Merged

Conversation

hkratz
Copy link
Contributor

@hkratz hkratz commented Aug 5, 2021

The names are overflow-checks and overflow-checks-std and they work similar to debug-assertions and debug-assertions-std. Once added we can measure how big the performance impact actually is and maybe enable them for CI tests.

Enabling them already makes two ui tests fail:

failures:
    [ui] ui/parser/item-free-const-no-body-semantic-fail.rs
    [ui] ui/parser/item-free-static-no-body-semantic-fail.rs

(See #84219 and #87761.)

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(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 Aug 5, 2021
@hkratz hkratz changed the title Add options for enabling overflow checks in rustc and std in config.toml Add config.toml options for enabling overflow checks in rustc and std Aug 5, 2021
@hkratz
Copy link
Contributor Author

hkratz commented Aug 5, 2021

Performance impact for running the full stage 1 testsuite locally is less than I expected:

# With fix from #87761 for the failing tests.
./x.py clean; time ./x.py test --stage 1

# no checks:
real	23m19.492s
user	176m22.251s
sys	20m28.837s

# w/ overflow checks in everything but std:
real	23m26.973s
user	176m50.005s
sys	20m32.393s

# w/ overflow checks in everything:
real	23m57.156s
user	181m20.771s
sys	21m25.673s

@Mark-Simulacrum
Copy link
Member

Could you change them to default to true in this PR temporarily, so we can run perf on this PR? I think if we can get away with not exposing this as an option (and instead always enabling them) we should.

@hkratz
Copy link
Contributor Author

hkratz commented Aug 5, 2021

Could you change them to default to true in this PR temporarily, so we can run perf on this PR? I think if we can get away with not exposing this as an option (and instead always enabling them) we should.

@Mark-Simulacrum Done. This should be ready for a perf test.

@Mark-Simulacrum
Copy link
Member

@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 Aug 5, 2021
@bors
Copy link
Contributor

bors commented Aug 5, 2021

⌛ Trying commit 72ada176db4853c7fb922e4b3efbdcb2b7df655c with merge f9bbcb152f7bd5dba5923c3c42999ee3c78aae98...

@bors
Copy link
Contributor

bors commented Aug 5, 2021

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

@rust-timer
Copy link
Collaborator

Queued f9bbcb152f7bd5dba5923c3c42999ee3c78aae98 with parent e21e1d6, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (f9bbcb152f7bd5dba5923c3c42999ee3c78aae98): comparison url.

Summary: This change led to significant regressions 😿 in compiler performance.

  • Very large regression in instruction counts (up to 23.8% on incr-unchanged builds of ctfe-stress-4-check)

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 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 Aug 5, 2021
@hkratz hkratz closed this Aug 5, 2021
@hkratz hkratz reopened this Aug 5, 2021
@hkratz
Copy link
Contributor Author

hkratz commented Aug 5, 2021

Hmm, at least now we know.

(Sorry the Close and Reopen was an accident on my mobile)

@Mark-Simulacrum
Copy link
Member

Could you drop the enablement for std and we can rerun benchmarks? I'd be interested in just rustc enablement impact.

I expect it'd be interesting to work out if there's just a few adds or whatever we can replace with explicit wrapping adds (with comments about performance or so). But that's a larger project, I just want numbers for now on the rustc-only overflow checks and we can likely merge after that.

@hkratz
Copy link
Contributor Author

hkratz commented Aug 5, 2021

@Mark-Simulacrum Ready for perf testing.

@Mark-Simulacrum
Copy link
Member

@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 Aug 5, 2021
@bors
Copy link
Contributor

bors commented Aug 5, 2021

⌛ Trying commit 1ee9083f12cf38e66e4c7bf2fc18a2d1c062f5ee with merge d570e77cc2384b466568c2ebc072def445db0f1b...

@bors
Copy link
Contributor

bors commented Aug 6, 2021

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

@rust-timer
Copy link
Collaborator

Queued d570e77cc2384b466568c2ebc072def445db0f1b with parent 2f07ae4, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (d570e77cc2384b466568c2ebc072def445db0f1b): comparison url.

Summary: This change led to significant regressions 😿 in compiler performance.

  • Very large regression in instruction counts (up to 21.4% on incr-unchanged builds of ctfe-stress-4-check)

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 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 removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 6, 2021
@Mark-Simulacrum
Copy link
Member

Alright, thanks! Looks like neither is an option for now as default, so if you can drop the testing commits we can probably merge (I'll give another glance over the code but don't think there's likely to be more work before merging).

@hkratz hkratz force-pushed the bootstrap_config_overflow_checks branch from 1ee9083 to 7f34b96 Compare August 6, 2021 05:26
@Mark-Simulacrum Mark-Simulacrum removed the perf-regression Performance regression. label Aug 6, 2021
@Mark-Simulacrum
Copy link
Member

r=me after last nit is fixed

The options are `overflow-checks` and `overflow-checks-std`
defaulting to false.
@hkratz hkratz force-pushed the bootstrap_config_overflow_checks branch from 7f34b96 to 2f70953 Compare August 6, 2021 12:04
@Mark-Simulacrum
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Aug 6, 2021

📌 Commit 2f70953 has been approved by Mark-Simulacrum

@bors bors 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 Aug 6, 2021
@bors
Copy link
Contributor

bors commented Aug 6, 2021

⌛ Testing commit 2f70953 with merge 24380a6...

@bors
Copy link
Contributor

bors commented Aug 6, 2021

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 24380a6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 6, 2021
@bors bors merged commit 24380a6 into rust-lang:master Aug 6, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 6, 2021
@hkratz hkratz deleted the bootstrap_config_overflow_checks branch August 6, 2021 18:24
@@ -968,6 +976,8 @@ impl Config {
config.rust_debug_assertions = debug_assertions.unwrap_or(default);
config.rust_debug_assertions_std =
debug_assertions_std.unwrap_or(config.rust_debug_assertions);
config.rust_overflow_checks = overflow_checks.unwrap_or(default);
config.rust_overflow_checks_std = overflow_checks_std.unwrap_or(default);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be .unwrap_or(rust_overflow_checks)? Otherwise overflow_checks = true won't actually enable it for the standard library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just noticed that too while working on #89776. It would be more in line with how rust_debug_assertions and rust_debug_assertions_std behave.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will put that and the stuff missing from config.toml.example and configure.py into a followup PR.

JohnTitor added a commit to JohnTitor/rust that referenced this pull request Oct 13, 2021
…take-two, r=Mark-Simulacrum

Fix config.toml overflow-checks options

This a follow-up PR to rust-lang#87784.

Improvements:
* Add missing entries for overflow-checks to config.toml.example.
* Add --enable-overflow-checks-std option to configure script.
* Make rust.overflow-checks-stdoption default to rust.overflow-checks.

Also adds the missing  `--enable-debug-assertions-std `option to configure script.

r? `@Mark-Simulacrum`
cc `@jyn514`
the8472 added a commit to the8472/rust that referenced this pull request Oct 13, 2021
…take-two, r=Mark-Simulacrum

Fix config.toml overflow-checks options

This a follow-up PR to rust-lang#87784.

Improvements:
* Add missing entries for overflow-checks to config.toml.example.
* Add --enable-overflow-checks-std option to configure script.
* Make rust.overflow-checks-stdoption default to rust.overflow-checks.

Also adds the missing  `--enable-debug-assertions-std `option to configure script.

r? ``@Mark-Simulacrum``
cc ``@jyn514``
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Oct 13, 2021
…take-two, r=Mark-Simulacrum

Fix config.toml overflow-checks options

This a follow-up PR to rust-lang#87784.

Improvements:
* Add missing entries for overflow-checks to config.toml.example.
* Add --enable-overflow-checks-std option to configure script.
* Make rust.overflow-checks-stdoption default to rust.overflow-checks.

Also adds the missing  `--enable-debug-assertions-std `option to configure script.

r? ```@Mark-Simulacrum```
cc ```@jyn514```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants