Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meiravg_feature_bfloat16 #455

Merged
merged 14 commits into from
May 12, 2024
Merged

Meiravg_feature_bfloat16 #455

merged 14 commits into from
May 12, 2024

Conversation

meiravgri
Copy link
Collaborator

Describe the changes in the pull request

A clear and concise description of what the PR is solving.

Which issues this PR fixes

  1. #...
  2. MOD...

Main objects this PR modified

  1. ...
  2. ...

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Copy link

codecov bot commented Apr 16, 2024

Codecov Report

Attention: Patch coverage is 99.09794% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 97.16%. Comparing base (b02a320) to head (704282b).
Report is 1 commits behind head on main.

Files Patch % Lines
src/VecSim/spaces/IP/IP.cpp 91.66% 2 Missing ⚠️
src/VecSim/spaces/L2/L2.cpp 90.90% 2 Missing ⚠️
src/VecSim/spaces/IP_space.cpp 98.27% 1 Missing ⚠️
src/VecSim/spaces/L2_space.cpp 98.27% 1 Missing ⚠️
src/VecSim/spaces/spaces.cpp 97.36% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #455      +/-   ##
==========================================
+ Coverage   95.59%   97.16%   +1.56%     
==========================================
  Files          69       85      +16     
  Lines        4017     4684     +667     
==========================================
+ Hits         3840     4551     +711     
+ Misses        177      133      -44     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

alonre24 and others added 9 commits April 24, 2024 18:09
* Introduce bfloat16 datatype

add Datatype to `VecSimIndexAbstract` template args.

add template to SetDistFunc and have specialized implemntation for each <dataType, distType> combintation
now the dist function pointer argument is not neseccesary, we can simple return the function.

move using dist_func_t to spaces_aux.h (should be in a file included by both L2_spaces.h/IP.spaces.h and spaces.h)

* move getdistance imp to spaces.cpp

* move normalize function from vec_utils to spaces:

spaces.h: get normalize function.
spaces.cpp: specialized templates according to the datatype for the normalization functions
spaces/normalize/normalize_naive.h: templated naive implementations of normalization functions

VecSimIndexAbstract must have both DataType and DistType

add VecSimType_BFLOAT16
update vec_utile accordingly

bfloat16.h: add bfloat16_to_float32 for little and big

TieredFactory::NewIndex calls TieredHNSWFactory::TieredFactory::NewIndex instead of implmentation duplication

add bfloat to index factory for NewIndex and EstimateInitialSize

* add no_opt functions tests for bfloat16

also add normalization function test for bf16

* fixed nohrmalized value

* add bf16 benchmarks:

add serialized hnsw bf16 files

hnswfactory: add ctor from file for bf16

add fitMemory and run it at the begining of each benchmark to tighten memory.

* update bm_files script

* add flow tests to bf16

bruteforce:
L2
batch iterator
range query
multivalue

hnsw:
serialization
L2
batch iterator
range
multi

tiered:
create
search and insert

* add bfloat16 module to toml

* upgrade scipy nupy

* also use python 3.10

* upgrade PR python to 3.10

* update serializer

* bm: fix casts

unit tests: add test_bf16

* more unit tests

* tiered tests

* add index_type assertion ti hnsw serialization test

add desgnated classes for bf and flat in bf16 unit test

* unit test final

* repalce cast to dynamic casts

* add get neighors test to tiered
add normalize test for bfloat16 in testcommon

* use bit_cast

* upgrade codecov machine

* Revert "upgrade codecov machine"

This reverts commit 7619b05.

* Revert "use bit_cast"

This reverts commit 59b8fab.

* fix alignment intialization by changing the order

* make bfloat16_to_float32 templated accroding to system's endianess

* eliminate default in GetDistFunc
add test for invalid metric

* add test fot fit memory

* split fit memory tests
* fix fit memory test

* remove xenial checks

* remove irrelevant comment

* free index in seralization test
* remove bw_vl arch (not needed, avx512 is enough)

* remove xenial from merge queue flow

* fix fit memory test (#461)

* fix fit memory test

* remove xenial checks

* remove irrelevant comment

* free index in seralization test

* install gcc10 bionic

* install newer vg ubuntu18

* exit valgrind directory
* remove bw_vl arch (not needed, avx512 is enough)

* remove xenial from merge queue flow

* introduce fp16 type!

change bfloat and fp16 to struct typedef to avoid ambiguty between them

* added flow tests

* fp16 benchmarks

* fix hnsw flow test

* add float616 to serializing script

add fp16 files to bm files

decrease testSizeEstimation dim size to make it run fasetr in debug

* set log call back to null in benchmarks

* remove struct typedef
add default ctor

* add comma seriaizer file

* disable temp flow

* disabe for real

* remove constexpr from bfloat default ctor

declaring a default ctor as constexpr is allowed as of c++20, and this feature in particular is supported as of gcc10

I don't see any benefit using this feature...

* test focal

* disable temp flow
Copy link
Collaborator

@alonre24 alonre24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do it! :)

@meiravgri meiravgri added this pull request to the merge queue May 12, 2024
Merged via the queue into main with commit e713299 May 12, 2024
47 checks passed
Copy link

Successfully created backport PR for 0.8:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants