Skip to content

Commit

Permalink
add bf16 patch (#525)
Browse files Browse the repository at this point in the history
Signed-off-by: xianliang.li <[email protected]>
  • Loading branch information
foxspy authored Apr 24, 2024
1 parent e3928b7 commit a65b733
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/knowhere/comp/knowhere_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ class KnowhereConfig {
static std::string
SetSimdType(const SimdType simd_type);

/**
*The purpose of this interface is: part of the sealed indexes default to using bf16 as the base data to achieve
*higher capacity; to ensure consistency in computation between growing and sealed, it is necessary to maintain the
*same precision in growing calculations as in sealed.
*/
static void
EnablePatchForComputeFP32AsBF16();

static void
DisablePatchForComputeFP32AsBF16();

/**
* Set openblas threshold
* if nq < use_blas_threshold, calculated by omp
Expand Down
10 changes: 10 additions & 0 deletions src/common/comp/knowhere_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ KnowhereConfig::SetSimdType(const SimdType simd_type) {
return simd_str;
}

void
KnowhereConfig::EnablePatchForComputeFP32AsBF16() {
LOG_KNOWHERE_INFO_ << "Just interface adaptation. Enable patch for compute fp32 as bf16";
}

void
KnowhereConfig::DisablePatchForComputeFP32AsBF16() {
LOG_KNOWHERE_INFO_ << "Just interface adaptation. Disable patch for compute fp32 as bf16";
}

void
KnowhereConfig::SetBlasThreshold(const int64_t use_blas_threshold) {
LOG_KNOWHERE_INFO_ << "Set faiss::distance_compute_blas_threshold to " << use_blas_threshold;
Expand Down

0 comments on commit a65b733

Please sign in to comment.