# \#simd

**URL:** https://forums.swift.org/tag/simd/226.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [Array.map lacks auto-vectorisation](https://forums.swift.org/t/array-map-lacks-auto-vectorisation/90500)

<div class="topic-metadata">

**Author:** [@k.benua](https://forums.swift.org/u/k.benua)\
**Replies:** 7\
**Last updated:** [November 6, 2026, 12:21pm UTC](https://forums.swift.org/t/array-map-lacks-auto-vectorisation/90500 "2026-11-06T12:21:52Z")

</div>

Introduction Recently I was profiling my app and was amazed, that this code @inline(never) func xorMap(\_ bytes: \[UInt8\], salt: UInt8) -\> \[UInt8\] { bytes.map { $0 ^ salt } } is not vectorised by compiler: in compile…

---

## [Using SIMD types for vector addition](https://forums.swift.org/t/using-simd-types-for-vector-addition/75138)

<div class="topic-metadata">

**Author:** [@wigging](https://forums.swift.org/u/wigging)\
**Replies:** 32\
**Last updated:** [May 27, 2025, 4:18pm UTC](https://forums.swift.org/t/using-simd-types-for-vector-addition/75138 "2025-05-27T16:18:06Z")

</div>

In the example below I use SIMD and Accelerate to add two large vectors. The elapsed time for the SIMD4 and SIMD64 examples is much slower than the Accelerate example. Maybe Accelerate is doing something under-the-hood t…

---

## [SIMD code won't produce \`zip2.8h\`, but \`zip1.8h\` works fine](https://forums.swift.org/t/simd-code-wont-produce-zip2-8h-but-zip1-8h-works-fine/75825)

<div class="topic-metadata">

**Author:** [@AlexanderM](https://forums.swift.org/u/AlexanderM)\
**Replies:** 5\
**Last updated:** [November 20, 2024, 7:26pm UTC](https://forums.swift.org/t/simd-code-wont-produce-zip2-8h-but-zip1-8h-works-fine/75825 "2024-11-20T19:26:02Z")

</div>

Hey there, I'm not sure if this is a compiler bug, or I'm holding it wrong. I can open a GitHub issue if needed. This simple function: /// A function which uses the \`zip1.8h\` ARM instruction to interleave the first ha…

---

## [Missing concrete builtin's vector operations for \`SIMDN\<Float\>\`?](https://forums.swift.org/t/missing-concrete-builtins-vector-operations-for-simdn-float/72837)

<div class="topic-metadata">

**Author:** [@kntkymt](https://forums.swift.org/u/kntkymt)\
**Replies:** 2\
**Last updated:** [July 1, 2024, 5:09am UTC](https://forums.swift.org/t/missing-concrete-builtins-vector-operations-for-simdn-float/72837 "2024-07-01T05:09:52Z")

</div>

Hi, I found SIMDN\<Float\> doesn't have concrete builtin's vector operations (+, -, \*, /) that integers have Is there any reason for this? I think we can easily add these operations since builtin functions for these oper…

---

## [Determinants seem to be wrong with simd\_double4x4.determinant](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366)

<div class="topic-metadata">

**Author:** [@kunitsyn](https://forums.swift.org/u/kunitsyn)\
**Replies:** 19\
**Last updated:** [September 29, 2023, 2:48pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366 "2023-09-29T14:48:09Z")

</div>

I've been trying to do some 3D geometry things from this paper in Swift. Long story short, this requires calculating signs of determinants of 4x4 double-precision matrices. I've tried using simd\_double4x4.determinant for…

---

## [SIMD: Am I holding it wrong?](https://forums.swift.org/t/simd-am-i-holding-it-wrong/67251)

<div class="topic-metadata">

**Author:** [@jim](https://forums.swift.org/u/jim)\
**Replies:** 14\
**Last updated:** [September 15, 2023, 4:41pm UTC](https://forums.swift.org/t/simd-am-i-holding-it-wrong/67251 "2023-09-15T16:41:28Z")

</div>

I'm new to this, so any information is much appreciated. I've created a class like so: class ABunchOfVectors\<Vector: SIMD\> where Vector.Scalar: FloatingPoint { var myVectors: \[Vector\] } I'd like to be able to pas…

---

## [Specialize protocol witness for SIMDStorage](https://forums.swift.org/t/specialize-protocol-witness-for-simdstorage/62954)

<div class="topic-metadata">

**Author:** [@jeudesprits](https://forums.swift.org/u/jeudesprits)\
**Replies:** 11\
**Last updated:** [February 6, 2023, 11:44pm UTC](https://forums.swift.org/t/specialize-protocol-witness-for-simdstorage/62954 "2023-02-06T23:44:43Z")

</div>

There is a hierarchy of protocols as follows public protocol ColorSpaceBase\<Components\> { associatedtype Components: SIMD\<Double\> } public protocol ColorSpace: ColorSpaceBase { // ... } public struct Oklab: ColorS…

---

## [Can SIMD types compute the high part of a product?](https://forums.swift.org/t/can-simd-types-compute-the-high-part-of-a-product/55740)

<div class="topic-metadata">

**Author:** [@Nevin](https://forums.swift.org/u/Nevin)\
**Replies:** 17\
**Last updated:** [March 14, 2022, 2:16am UTC](https://forums.swift.org/t/can-simd-types-compute-the-high-part-of-a-product/55740 "2022-03-14T02:16:33Z")

</div>

Say I have two SIMD16\<UInt16\> vectors x and y. I can multiply their elements by writing x &\* y, which computes the low part of each product. However, suppose I actually want the high part of each product instead. Is the…

---

## [Generic SIMD 4x4 Matrices](https://forums.swift.org/t/generic-simd-4x4-matrices/52415)

<div class="topic-metadata">

**Author:** [@jacubit](https://forums.swift.org/u/jacubit)\
**Replies:** 7\
**Last updated:** [October 1, 2021, 10:20pm UTC](https://forums.swift.org/t/generic-simd-4x4-matrices/52415 "2021-10-01T22:20:25Z")

</div>

Hi, I apologise if my question is too basic, but I cannot find whether there is a way to have a generic 4x4 SIMD matrix? This is straightforward with vectors with SIMD4\<T\> where T is the type e.g. Double, Int. But I cann…

---

## [Math library using Swift Numerics](https://forums.swift.org/t/math-library-using-swift-numerics/42849)

<div class="topic-metadata">

**Author:** [@rfbigelow](https://forums.swift.org/u/rfbigelow)\
**Replies:** 0\
**Last updated:** [December 15, 2020, 8:10pm UTC](https://forums.swift.org/t/math-library-using-swift-numerics/42849 "2020-12-15T20:10:35Z")

</div>

I'm working through Foundations of Game Engine Development vol. 1: Mathematics by Eric Lengyel and decided to try my hand at writing a Swift package based on the material therein. I've been following the exploits of @sca…

---

## [Translate matrix 3x3 vs 4x4](https://forums.swift.org/t/translate-matrix-3x3-vs-4x4/40724)

<div class="topic-metadata">

**Author:** [@AlexSedykh](https://forums.swift.org/u/AlexSedykh)\
**Replies:** 3\
**Last updated:** [September 28, 2020, 4:14pm UTC](https://forums.swift.org/t/translate-matrix-3x3-vs-4x4/40724 "2020-09-28T16:14:13Z")

</div>

Why, if the dimension of matrices is 3x3 for using a translate matrix, the correct result is obtained when we multiply a vector by a matrix, and when using 4x4 matrices, the correct result is obtained when we multiply a …

---

## [Add SIMD random that supports supports different ranges on each SIMD index](https://forums.swift.org/t/add-simd-random-that-supports-supports-different-ranges-on-each-simd-index/38536)

<div class="topic-metadata">

**Author:** [@hishnash](https://forums.swift.org/u/hishnash)\
**Replies:** 0\
**Last updated:** [July 18, 2020, 1:41am UTC](https://forums.swift.org/t/add-simd-random-that-supports-supports-different-ranges-on-each-simd-index/38536 "2020-07-18T01:41:24Z")

</div>

Introduction The SIMD type currently support a .random static method that takes a Rang of the same type as the underlying scalar that is packed within the SIMD vector. However I would like to propose that we add an addi…

---

## [Vector extensions with Swift](https://forums.swift.org/t/vector-extensions-with-swift/37777)

<div class="topic-metadata">

**Author:** [@dehesa](https://forums.swift.org/u/dehesa)\
**Replies:** 5\
**Last updated:** [June 22, 2020, 3:04pm UTC](https://forums.swift.org/t/vector-extensions-with-swift/37777 "2020-06-22T15:04:51Z")

</div>

I have been happily using the Accelerate framework to speed up some financial operations involving thousands of data points. Sadly, there is no vDSP.sum(\_:) for signed integer numbers (only floating-point numbers). The …

---

## [Swift's SIMD from std appears to broken (?)](https://forums.swift.org/t/swifts-simd-from-std-appears-to-broken/34498)

<div class="topic-metadata">

**Author:** [@kozlowsqi](https://forums.swift.org/u/kozlowsqi)\
**Replies:** 8\
**Last updated:** [March 14, 2020, 8:35pm UTC](https://forums.swift.org/t/swifts-simd-from-std-appears-to-broken/34498 "2020-03-14T20:35:06Z")

</div>

I've been playing with SIMD decoding of base32 for the past month. I initially implemented base32 decoding using SIMD up to x64 in pure swift. As I realized that my CPU doesn't support x64 (512 bits) ..I downgraded it to…

---

## [Will using SIMD2\<Float\> always be more efficient than (Float, Float)?](https://forums.swift.org/t/will-using-simd2-float-always-be-more-efficient-than-float-float/32987)

<div class="topic-metadata">

**Author:** [@Jens](https://forums.swift.org/u/Jens)\
**Replies:** 8\
**Last updated:** [February 19, 2020, 10:19am UTC](https://forums.swift.org/t/will-using-simd2-float-always-be-more-efficient-than-float-float/32987 "2020-02-19T10:19:52Z")

</div>

Now that we have the SIMD types, it might be tempting to rewrite eg: struct Disk { var currentPosition: (x: Float, y: Float) var previousPosition: (x: Float, y: Float) var acceleration: (x: Float, y: Float) …

---

## [\[ANN\] CeedNumerics released (SN's ShapedArray API discussion)](https://forums.swift.org/t/ann-ceednumerics-released-sns-shapedarray-api-discussion/31285)

<div class="topic-metadata">

**Author:** [@rsebbe](https://forums.swift.org/u/rsebbe)\
**Replies:** 42\
**Last updated:** [December 6, 2019, 3:14pm UTC](https://forums.swift.org/t/ann-ceednumerics-released-sns-shapedarray-api-discussion/31285 "2019-12-06T15:14:04Z")

</div>

I'm posting this in response to @scanon's initiative on Swift Numerics, in the hope that this can help shape it. Over the last year, we had a need for numerical computation for one of our apps, and we decided to impleme…

---

## [SIMD Swizzles](https://forums.swift.org/t/simd-swizzles/30690)

<div class="topic-metadata">

**Author:** [@Syre](https://forums.swift.org/u/Syre)\
**Replies:** 4\
**Last updated:** [November 11, 2019, 9:02pm UTC](https://forums.swift.org/t/simd-swizzles/30690 "2019-11-11T21:02:52Z")

</div>

I'd like to propose a specific element swizzle for SIMD4, which I find myself adding to every project where I use SIMD types: extension SIMD4 { var xyz: SIMD3\<Scalar\> { return self\[SIMD3(0, 1, 2)\] }…

---

## [SIMD - Scope of Implementation?](https://forums.swift.org/t/simd-scope-of-implementation/29896)

<div class="topic-metadata">

**Author:** [@mattrips](https://forums.swift.org/u/mattrips)\
**Replies:** 3\
**Last updated:** [October 18, 2019, 1:01pm UTC](https://forums.swift.org/t/simd-scope-of-implementation/29896 "2019-10-18T13:01:45Z")

</div>

In the SIMD implementation, is there an equivalent to \_mm256\_movemask\_epi8()?

---

## [SIMD evolution plan (n-Dimensional vectors)](https://forums.swift.org/t/simd-evolution-plan-n-dimensional-vectors/27702)

<div class="topic-metadata">

**Author:** [@Troy\_Harvey](https://forums.swift.org/u/Troy_Harvey)\
**Replies:** 4\
**Last updated:** [August 9, 2019, 4:12pm UTC](https://forums.swift.org/t/simd-evolution-plan-n-dimensional-vectors/27702 "2019-08-09T16:12:51Z")

</div>

First of all, thanks for all your work on SIMD types. This is probably a question for @scanon. I'd like to understand the course-level evolution timeline — as you see it — for vector types. Particularly of interest is l…

---

## [No longer able to type check expressions with Xcode 10.2 (caused by new SIMD API?)](https://forums.swift.org/t/no-longer-able-to-type-check-expressions-with-xcode-10-2-caused-by-new-simd-api/22873)

<div class="topic-metadata">

**Author:** [@Jens](https://forums.swift.org/u/Jens)\
**Replies:** 8\
**Last updated:** [April 30, 2019, 4:21pm UTC](https://forums.swift.org/t/no-longer-able-to-type-check-expressions-with-xcode-10-2-caused-by-new-simd-api/22873 "2019-04-30T16:21:01Z")

</div>

I know for certain that the three lines with i, j and k in test.swift did type check (quickly) prior to upgrading to Xcode 10.2 and macOS 10.14.4. But the compiler is now unable to type check them in reasonable time (i t…

---

## [Has type checking operators on generic types always been this slow?](https://forums.swift.org/t/has-type-checking-operators-on-generic-types-always-been-this-slow/23413)

<div class="topic-metadata">

**Author:** [@Jens](https://forums.swift.org/u/Jens)\
**Replies:** 5\
**Last updated:** [April 22, 2019, 5:25am UTC](https://forums.swift.org/t/has-type-checking-operators-on-generic-types-always-been-this-slow/23413 "2019-04-22T05:25:03Z")

</div>

The following is too complex for Xcode 10.2.1: let u = SIMD2\<Float\>(0, 1) let v = SIMD2\<Float\>(1, 2) let r = \[ // ERROR: The compiler is unable to type-check this expression in reasonable time; try breaking up the expre…

---

## [Multithreading concurrent SIMD tasks](https://forums.swift.org/t/multithreading-concurrent-simd-tasks/21674)

<div class="topic-metadata">

**Author:** [@Dev1an](https://forums.swift.org/u/Dev1an)\
**Replies:** 5\
**Last updated:** [March 16, 2019, 3:06pm UTC](https://forums.swift.org/t/multithreading-concurrent-simd-tasks/21674 "2019-03-16T15:06:13Z")

</div>

I am stumbling upon an issue with concurrency and SIMD. To reproduce the issue I have simplified my code to the following fragment: import Dispatch let queue = DispatchQueue(label: "Concurrent threads", qos: .userIniti…
