Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rok committed Dec 8, 2023
1 parent bb3865d commit ce5dcb7
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions rust/lance-linalg/src/simd/bf16.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ float dot_bf16(const __bf16 *a, const __bf16 *b, size_t n) {

while (n > 0) {
if (n < 32) {
// __mmask32 mask = d - i >= 32 ? 0xFFFFFFFF : (1u << n) - 1u;
__mmask32 mask = (1u << n) - 1u;
a_vec = _mm512_maskz_loadu_epi16(mask, a);
b_vec = _mm512_maskz_loadu_epi16(mask, b);
Expand Down Expand Up @@ -91,7 +90,6 @@ float cosine_bf16(const __bf16 *a, const __bf16 *b, size_t n) {

while (n > 0) {
if (n < 32) {
// __mmask32 mask = d - i >= 32 ? 0xFFFFFFFF : (1u << n) - 1u;
__mmask32 mask = (1u << n) - 1u;
a_vec = _mm512_maskz_loadu_epi16(mask, a);
b_vec = _mm512_maskz_loadu_epi16(mask, b);
Expand All @@ -110,11 +108,4 @@ float cosine_bf16(const __bf16 *a, const __bf16 *b, size_t n) {
__bf16 a2 = _mm512_reduce_add_ph(a2_vec);
__bf16 b2 = _mm512_reduce_add_ph(b2_vec);
return 1 - ab / (a2 * b2);

// Compute the reciprocal square roots of a2 and b2
// __m128 rsqrts = __m128(_mm_set_ps(0.f, 0.f, a2 + 1.e-9f, b2 + 1.e-9f));
// __m128 rsqrt_a2 = _mm_cvtss_f32(rsqrts);
// f32_t rsqrt_b2 = _mm_cvtss_f32(_mm_shuffle_ps(rsqrts, rsqrts, _MM_SHUFFLE(0, 0, 0, 1)));
// return 1 - ab * rsqrt_a2 * rsqrt_b2;
// return 1;
}

0 comments on commit ce5dcb7

Please sign in to comment.