Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebookresearch#3890

Differential Revision: D63406173
  • Loading branch information
mengdilin authored and facebook-github-bot committed Sep 25, 2024
1 parent b7c7bc3 commit a705a9c
Show file tree
Hide file tree
Showing 3 changed files with 272 additions and 191 deletions.
20 changes: 10 additions & 10 deletions faiss/impl/ScalarQuantizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ struct QuantizerBF16<8> : QuantizerBF16<1> {

FAISS_ALWAYS_INLINE simd8float32
reconstruct_8_components(const uint8_t* code, int i) const {
#ifdef __AVX2__
// #ifdef __AVX2__
// reference impl: decode_bf16(((uint16_t*)code)[i]);
// decode_bf16(v) -> (uint32_t(v) << 16)
// read 128-bits (16 uint8_t) -> (uint16_t*)code)[i]
Expand All @@ -683,18 +683,18 @@ struct QuantizerBF16<8> : QuantizerBF16<1> {
simd8uint32 shifted_16 = code_256i << 16;
return as_float32(shifted_16);

#endif
// #endif

#ifdef __aarch64__
// #ifdef __aarch64__

uint16x4x2_t codei = vld1_u16_x2((const uint16_t*)(code + 2 * i));
return simd8float32(
{vreinterpretq_f32_u32(
vshlq_n_u32(vmovl_u16(codei.val[0]), 16)),
vreinterpretq_f32_u32(
vshlq_n_u32(vmovl_u16(codei.val[1]), 16))});
// uint16x4x2_t codei = vld1_u16_x2((const uint16_t*)(code + 2 *
// i)); return simd8float32(
// {vreinterpretq_f32_u32(
// vshlq_n_u32(vmovl_u16(codei.val[0]), 16)),
// vreinterpretq_f32_u32(
// vshlq_n_u32(vmovl_u16(codei.val[1]), 16))});

#endif
// #endif
}
};

Expand Down
Loading

0 comments on commit a705a9c

Please sign in to comment.