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.
Old Kernels, New Types:
u8
On Intel Sapphire Rapids, for
l2sq
the throughput grows from 21 GB/s to 66 GB/s in AVX2 solution for Haswell and 94 GB/s in AVX-512 for Ice Lake+ CPUs.On Apple M2 Pro:
L2 vs L2sq
How fast can we compute the Euclidean distance in$\mathbb{R}^3$ ?
Is it much slower than computing the squared Euclidean distance? The answer, easily, 30% slower.
The cost of square root computation can be prohibitively high on low-dimensional vectors, so it's recommended to use L2sq where exact distance isn't necessary. Below are the numbers for 3D vectors on Intel Sapphire Rapids. Even on such tiny vectors, for
bf16
, for example, the Genoa kernels are over 4x faster than serial code - 31 GB/s vs 7 GB/s.