[Accepted with Modifications] SE-0229: SIMD


(Ben Cohen) #1

Hello Swift Community,

The review for SE-0229: SIMD Vectors ran from September 27th through November 16th, 2018. You can find the review thread here.

During the review, the proposal changed in a number of ways, so you can find a changlog towards the end of the proposal.

The core team evaluated the new proposal and implementation of a generic-style spelling of the SIMD types, and believes that this fits best with the future direction of the language.

Some concern was expressed during the review and other discussions that the term Vector had additional meaning in non-SIMD domains (as a synonym for a contiguous array, or as a mathematical term), and that e.g. Vector4 was too general a name for a SIMD-specific type. Conversely, namespacing or prefixing these types would lead to overly verbose and noisy code. The core team felt that dropping the term Vector in all names was just as clear. The resulting names are generally shorter, which is an nice benefit, and they now have a uniform SIMD prefix. In particular, this leaves the basic vector types as SIMD4 (instead of Vector4 or SIMDVector4). As a future direction, matrix types could be spelled as SIMD4x4.

Additionally, the team recommends dropping the underscores from the "implementation detail" types. While they are not important to users, only type implementors, the underscore should be reserved for API that only the core Swift libraries should use/implement. A future proposal for annotations to hide such implementation detail from code completion in inappropriate contexts would be welcomed.

Finally, a number of enhancements that could be made additively, such as arbitrary swizzling or testing of masks with all or any, were deferred to later proposals.

Thank you to everyone who participated in the review!

Ben Cohen
Review Manager


SE-0229 — SIMD Vectors
SE-0229 SIMD, migration process plans?
SE-0229 — SIMD Vectors
(Xiaodi Wu) #2

Fantastic!

Point of clarification: according to the changelog, we’ll have the associated types SIMDMaskScalar but MaskStorage—is the latter intended to be SIMDMaskStorage?


(Steve Canon) #3

MaskStorage is defined on the SIMD protocol, so you would only ever see it in an "obviously SIMD" context, like SIMD2<Int>.MaskStorage. By contrast, SIMDMaskScalar is an associatedtype of the SIMDScalar protocol, so you'll see it as, e.g. Float.SIMDMaskScalar. We want the explicit SIMD to avoid confusion.