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

Really remove static min and max on simd. One slipped through. #24283

Conversation

stephentyrone
Copy link
Contributor

No description provided.

@stephentyrone
Copy link
Contributor Author

@swift-ci please test

@stephentyrone stephentyrone merged commit ba0888d into swiftlang:master Apr 26, 2019
@stephentyrone stephentyrone deleted the simd-really-remove-static-min-max branch April 26, 2019 11:41
stephentyrone added a commit to stephentyrone/swift that referenced this pull request May 14, 2019
stephentyrone added a commit that referenced this pull request May 15, 2019
* Restore elementwise min/max on SIMD, with explicit naming. (#24136)

* Restore elementwise min/max on SIMD, but as statics instead of free functions.

Having these as free functions causes expression too complex issues due to overload vis-a-vis min<Collection>. There are (at least) three plausible solutions:

1. Fix the typechecker. This is infeasable in the short term; or more precisely, we do not know how much work is involved.

2. Give these operations different names. Candidates discussed with core team include "pointwiseMin", "elementwiseMin", "lanewiseMin"; these all suffer from the flaw that when someone writes "min" in a SIMD context, they are essentially always looking for either the horizontal minimum (reduction) on a single vector or--more often--the lanewise minimum of two vectors (this operation). It would be odd to give the operation that people actually want the unnecessarily verbose name.

3. Make these operations static; this is, in effect, a different name, but it's one which frequently allows eliding the qualifier:

  let x = v + .min(v, w)

This isn't perfect; you will still need to spell out SIMD4.min( ) fairly often, but that's more concise than any of the proposed alternatives, and at least allows elision some of the time. Also, if you squint, you can pretend that the "." prefix is like ".<" and ".&" and indicates lanewise operation.

* Really remove static min and max on simd. One slipped through. (#24283)
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.

1 participant