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

assume the runtime range of align_offset #111113

Merged
merged 1 commit into from
May 5, 2023

Conversation

scottmcm
Copy link
Member

@scottmcm scottmcm commented May 3, 2023

Found when I saw code with align_to having extraneous checks.

Demo that LLVM can't do this today: https://rust.godbolt.org/z/6dnG749bq

(It's filed as llvm/llvm-project#62502.)

@rustbot
Copy link
Collaborator

rustbot commented May 3, 2023

r? @Mark-Simulacrum

(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-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 3, 2023
@rustbot
Copy link
Collaborator

rustbot commented May 3, 2023

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-log-analyzer

This comment has been minimized.

@thomcc
Copy link
Member

thomcc commented May 3, 2023

I've wanted this for a while. I still have a lot of criticisms with the align_to API, but this should make it usable a lot more of the time.

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented May 3, 2023

📌 Commit 3afe8cdfa8731abbcdde929ccee46ec367a4bc75 has been approved by thomcc

It is now in the queue for this repository.

@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 May 3, 2023
@thomcc
Copy link
Member

thomcc commented May 3, 2023

Ah, compile errors. r=me with those fixed.

@bors r-

(P.S. Sorry if there are some sporatic comments from me here, I'm on a plane and the internet is... very spotty)

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 3, 2023
@scottmcm scottmcm force-pushed the assume-align-offset branch from 3afe8cd to 2160e5d Compare May 3, 2023 07:42
@scottmcm
Copy link
Member Author

scottmcm commented May 3, 2023

Ah, the assume being conditional blocked the branchless-ness that the assembly test was checking. Luckily that didn't need to be conditional -- it's mathematically true -- so I just moved a bit of code earlier and the assembly test passes without needing any changes.

I also expanded the codegen test a bunch.

@scottmcm
Copy link
Member Author

scottmcm commented May 3, 2023

r? thomcc
@bors r=thomcc

@bors
Copy link
Contributor

bors commented May 3, 2023

📌 Commit 2160e5d75ddfa39c64f1a4326664a2a848debf11 has been approved by thomcc

It is now in the queue for this repository.

@rustbot rustbot assigned thomcc and unassigned Mark-Simulacrum May 3, 2023
@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 3, 2023
@bors
Copy link
Contributor

bors commented May 5, 2023

⌛ Testing commit 2160e5d75ddfa39c64f1a4326664a2a848debf11 with merge d27debbe02b250d988f49fe6dced11e6147126f4...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 5, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 5, 2023
@scottmcm scottmcm force-pushed the assume-align-offset branch from 2160e5d to 9c57cdb Compare May 5, 2023 02:50
@scottmcm
Copy link
Member Author

scottmcm commented May 5, 2023

Oh, when I added more to the tests it included something that adds extra checking in debug, and thus made the optimizations not work and the test fail. Fixed.

@bors r=thomcc

@bors
Copy link
Contributor

bors commented May 5, 2023

📌 Commit 9c57cdbd8e0d4b72016f5799acef89f1978e1b85 has been approved by thomcc

It is now in the queue for this repository.

@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 May 5, 2023
@bors
Copy link
Contributor

bors commented May 5, 2023

⌛ Testing commit 9c57cdbd8e0d4b72016f5799acef89f1978e1b85 with merge 5e8369d4e4c917e5d226b720b9b2ad5054f2398f...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 5, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 5, 2023
Found when I saw code with `align_to` having extraneous checks.
@scottmcm scottmcm force-pushed the assume-align-offset branch from 9c57cdb to a1e5c65 Compare May 5, 2023 11:23
@scottmcm
Copy link
Member Author

scottmcm commented May 5, 2023

Ah, of course, I got the 32-vs-64-bit differences right in 19 places, but there are 20 🤬

@bors r=thomcc

@bors
Copy link
Contributor

bors commented May 5, 2023

📌 Commit a1e5c65 has been approved by thomcc

It is now in the queue for this repository.

@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 May 5, 2023
@bors
Copy link
Contributor

bors commented May 5, 2023

⌛ Testing commit a1e5c65 with merge 4a18324...

@bors
Copy link
Contributor

bors commented May 5, 2023

☀️ Test successful - checks-actions
Approved by: thomcc
Pushing 4a18324 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 5, 2023
@bors bors merged commit 4a18324 into rust-lang:master May 5, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 5, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4a18324): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [2.4%, 2.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.0% [-3.6%, -2.5%] 2
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.5% [-1.5%, -1.5%] 1
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) -1.5% [-1.5%, -1.5%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 654.413s -> 653.437s (-0.15%)

@scottmcm scottmcm deleted the assume-align-offset branch May 5, 2023 17:40
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-14 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
normalized stderr:
warning: the feature `const_ptr_read` has been stable since 1.71.0-nightly and no longer requires an attribute to enable
  --> $DIR/issue-105821.rs:4:30
   |
LL | #![feature(adt_const_params, const_ptr_read, generic_const_exprs)]
   |
   = note: `#[warn(stable_features)]` on by default

warning: 1 warning emitted
---
To only update this specific test, also pass `--test-args const-generics/issues/issue-105821.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/const-generics/issues/issue-105821.rs" "-Zthreads=1" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--remap-path-prefix=/checkout/tests/ui=fake-test-src-base" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/const-generics/issues/issue-105821" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/const-generics/issues/issue-105821/auxiliary"
stdout: none
warning: the feature `const_ptr_read` has been stable since 1.71.0-nightly and no longer requires an attribute to enable
  --> fake-test-src-base/const-generics/issues/issue-105821.rs:4:30
   |
   |
LL | #![feature(adt_const_params, const_ptr_read, generic_const_exprs)]
   |
   = note: `#[warn(stable_features)]` on by default

warning: 1 warning emitted

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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants