Skip to content

Move most of the simd operators into an optional module #20914

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

Merged
merged 4 commits into from
Nov 30, 2018

Conversation

stephentyrone
Copy link
Contributor

Adding simd to the stdlib caused some typechecker regressions. We can resolve them in the near-term by making the types universally available, but moving the arithmetic operators into a separate module that must be explicitly imported.

The working name for this module is SIMDOperators. We can tweak that going forward if we want to, but it seems generally plausible. I deliberately avoided SIMD to avoid collision with the existing SDK module named simd.

rdar://problem/46364455

Adding simd to the stdlib caused some typechecker regressions. We can resolve them in the near-term by making the types universally available, but moving the arithmetic operators into a separate module that must be explicitly imported.
@stephentyrone
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - dc8e287

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - dc8e287

@stephentyrone
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - dc8e287

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - dc8e287

infix operator .&= : AssignmentPrecedence
infix operator .^= : AssignmentPrecedence
infix operator .|= : AssignmentPrecedence
prefix operator .!
Copy link
Contributor

Choose a reason for hiding this comment

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

These should probably still be declared in the stdlib even if there are no functions that implement them.

@compnerd
Copy link
Member

@stephentyrone - why not make this an overlay? It could overlap the SIMD module in the SDK and re-export it with the additional overloads.

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

LGTM! (Concur with Jordan's note)

It's concerning to me that besides performance newly added operators re-introduced crashers, something has to be really fragile in the type-checker, going to take a closer look shortly.

@stephentyrone
Copy link
Contributor Author

@compnerd the simd SDK module depends on having the operators available. I'm not sure why you want to reverse that dependency?

@stephentyrone
Copy link
Contributor Author

@xedin Yeah, something is fishy about those two crashers. Clearly they weren't so much "fixed" as "happened to stop crashing" =)

@stephentyrone
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f9a6853

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - f9a6853

@xedin
Copy link
Contributor

xedin commented Nov 30, 2018

@swift-ci please test source compatibility

@xedin
Copy link
Contributor

xedin commented Nov 30, 2018

@stephentyrone One more thing I noticed might be good to do before merging - can you uncomment this expression https://github.com/apple/swift/blob/master/test/Sema/complex_expressions.swift#L7 and see if that works again?

@stephentyrone
Copy link
Contributor Author

@xedin I'll put that in a separate PR, so we can get this moving (but yes, it does work again).

@stephentyrone stephentyrone merged commit 28962b5 into swiftlang:master Nov 30, 2018
stephentyrone added a commit to stephentyrone/swift that referenced this pull request Nov 30, 2018
)

* Move most of the simd operators into an optional module

Adding simd to the stdlib caused some typechecker regressions. We can resolve them in the near-term by making the types universally available, but moving the arithmetic operators into a separate module that must be explicitly imported.

* Move two fuzzing tests back to fixed.

* Add SIMDOperators as a dependency for MediaPlayer.

* Move the .-prefixed operator declarations back into the stdlib.

(cherry picked from commit 28962b5)
@xedin
Copy link
Contributor

xedin commented Nov 30, 2018

Okay, sounds good!

@stephentyrone stephentyrone deleted the hide-simd-operators branch November 30, 2018 21:36
airspeedswift pushed a commit that referenced this pull request Dec 3, 2018
* SIMD into stdlib

Implements SE-0229.

Also updates simd module types in the Apple SDKs to use the new types, and updates a couple tests to work with the new types and protocols.

(cherry picked from commit fb8b9e1)

* Move most of the simd operators into an optional module (#20914)

* Move most of the simd operators into an optional module

Adding simd to the stdlib caused some typechecker regressions. We can resolve them in the near-term by making the types universally available, but moving the arithmetic operators into a separate module that must be explicitly imported.

* Move two fuzzing tests back to fixed.

* Add SIMDOperators as a dependency for MediaPlayer.

* Move the .-prefixed operator declarations back into the stdlib.

(cherry picked from commit 28962b5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants