-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 array_zip #112096
Merged
Merged
Remove array_zip #112096
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`[T; N]::zip` is "eager" but most zips are mapped. This causes poor optimization in generated code. This is a fundamental design issue and "zip" is "prime real estate" in terms of function names, so let's free it up again.
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 30, 2023
workingjubilee
added
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
and removed
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
labels
May 30, 2023
scottmcm
reviewed
May 30, 2023
tests/codegen/autovectorize-f32x4.rs
Outdated
Comment on lines
34
to
43
|
||
// CHECK-LABEL: @auto_vectorize_array_zip_map | ||
#[no_mangle] | ||
pub fn auto_vectorize_array_zip_map(a: [f32; 4], b: [f32; 4]) -> [f32; 4] { | ||
// CHECK: load <4 x float> | ||
// CHECK: load <4 x float> | ||
// CHECK: fadd <4 x float> | ||
// CHECK: store <4 x float> | ||
a.zip(b).map(|(a, b)| a + b) | ||
} |
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.
I'd like to keep something with extra layers of abstraction here, so how about
Suggested change
// CHECK-LABEL: @auto_vectorize_array_zip_map | |
#[no_mangle] | |
pub fn auto_vectorize_array_zip_map(a: [f32; 4], b: [f32; 4]) -> [f32; 4] { | |
// CHECK: load <4 x float> | |
// CHECK: load <4 x float> | |
// CHECK: fadd <4 x float> | |
// CHECK: store <4 x float> | |
a.zip(b).map(|(a, b)| a + b) | |
} | |
// CHECK-LABEL: @auto_vectorize_array_from_fn | |
#[no_mangle] | |
pub fn auto_vectorize_array_from_fn(a: [f32; 4], b: [f32; 4]) -> [f32; 4] { | |
// CHECK: load <4 x float> | |
// CHECK: load <4 x float> | |
// CHECK: fadd <4 x float> | |
// CHECK: store <4 x float> | |
std::array::from_fn(|i| a[i] + b[i]) | |
} |
r=me with the codegen test suggested above |
@bors r=scottmcm rollup |
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 31, 2023
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 31, 2023
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#112031 (Migrate `item_proc_macro` to Askama) - rust-lang#112053 (Remove `-Zcgu-partitioning-strategy`.) - rust-lang#112069 (offset_of: don't require type to be `Sized`) - rust-lang#112084 (enhancements on build_helper utilization and rustdoc-gui-test) - rust-lang#112096 (Remove array_zip) - rust-lang#112108 (Fix re-export of doc hidden item inside private item not displayed) - rust-lang#112113 (rustdoc: simplify `clean` by removing `FnRetTy`) r? `@ghost` `@rustbot` modify labels: rollup
overvenus
added a commit
to overvenus/tikv
that referenced
this pull request
Dec 22, 2023
See rust-lang/rust/pull/112096 Signed-off-by: Neil Shen <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[T; N]::zip
is "eager" but most zips are mapped. This causes poor optimization in generated code. This is a fundamental design issue and "zip" is "prime real estate" in terms of function names, so let's free it up again.array_zip
#80094 (comment)array_zip
#80094array::zip
in combination witharray::map
optimises very poorly #103555Could use review to make sure we aren't losing any essential codegen tests.
r? @scottmcm