Skip to content

*: use SimSIMD for vectors#9372

Merged
ti-chi-bot[bot] merged 9 commits intopingcap:feature/vector-indexfrom
Lloyd-Pottiger:cherry-pick-5
Aug 27, 2024
Merged

*: use SimSIMD for vectors#9372
ti-chi-bot[bot] merged 9 commits intopingcap:feature/vector-indexfrom
Lloyd-Pottiger:cherry-pick-5

Conversation

@Lloyd-Pottiger
Copy link
Contributor

@Lloyd-Pottiger Lloyd-Pottiger commented Aug 26, 2024

What problem does this PR solve?

Issue Number: ref #9032

Problem Summary:

What is changed and how it works?

Pick https://github.com/tidbcloud/tiflash-cse/pull/221, https://github.com/tidbcloud/tiflash-cse/pull/224, https://github.com/tidbcloud/tiflash-cse/pull/262 and https://github.com/tidbcloud/tiflash-cse/pull/245

*: use SimSIMD for vectors

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

breezewish and others added 3 commits August 26, 2024 17:59
Signed-off-by: Wish <breezewish@outlook.com>
Signed-off-by: Wish <breezewish@outlook.com>
Co-authored-by: JaySon <tshent@qq.com>
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 26, 2024
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
@JaySon-Huang
Copy link
Contributor

JaySon-Huang commented Aug 27, 2024

In order to resolve the compile error on gtests_libdaemon below, you need to pick these changes: https://github.com/tidbcloud/tiflash-cse/pull/262 @Lloyd-Pottiger

ld.lld: error: undefined symbol: DB::DM::VectorIndexHNSWSIMDFeatures::get()
>>> referenced by TiFlashBuildInfo.cpp
>>>               TiFlashBuildInfo.cpp.o:(TiFlashBuildInfo::getEnabledFeatures()) in archive dbms/libtiflash_common_iod.a
ld.lld: error: undefined symbol: DB::VectorDistanceSIMDFeatures::get()
>>> referenced by TiFlashBuildInfo.cpp
>>>               TiFlashBuildInfo.cpp.o:(TiFlashBuildInfo::getEnabledFeatures()) in archive dbms/libtiflash_common_iod.a

Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
Copy link
Contributor

@JaySon-Huang JaySon-Huang left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Aug 27, 2024
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
simsimd_capability_t cap_l2 = simsimd_details::actual_capability(simsimd_datatype_f32_k, simsimd_metric_l2sq_k);
simsimd_capability_t cap_cos = simsimd_details::actual_capability(simsimd_datatype_f32_k, simsimd_metric_cos_k);

auto cap_to_string = [](simsimd_capability_t cap) -> std::string {
Copy link
Member

Choose a reason for hiding this comment

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

Could there be cap == simsimd_cap_sve_k & simsimd_cap_sve2_k?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@CalvinNeo CalvinNeo Aug 27, 2024

Choose a reason for hiding this comment

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

Then just use == rather than &?
If it could be possible in further versions, then move sve2 in the front of sve? Because sve2 is extension of sve, we should return the "newest"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed

Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>

std::string line;
while (std::getline(ss, line, '\n'))
LOG_INFO(log, "{}", line);
Copy link
Member

Choose a reason for hiding this comment

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

What is the difference?

Copy link
Contributor Author

@Lloyd-Pottiger Lloyd-Pottiger Aug 27, 2024

Choose a reason for hiding this comment

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

print multiple logs

Copy link
Contributor Author

@Lloyd-Pottiger Lloyd-Pottiger Aug 27, 2024

Choose a reason for hiding this comment

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

reverted

Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
Copy link
Member

@CalvinNeo CalvinNeo left a comment

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot ti-chi-bot bot added the lgtm label Aug 27, 2024
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CalvinNeo, JaySon-Huang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [CalvinNeo,JaySon-Huang]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 27, 2024
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 27, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-27 06:15:50.554564015 +0000 UTC m=+850945.689014134: ☑️ agreed by JaySon-Huang.
  • 2024-08-27 08:52:00.222849934 +0000 UTC m=+860315.357300057: ☑️ agreed by CalvinNeo.

@Lloyd-Pottiger
Copy link
Contributor Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 5f08ae6 into pingcap:feature/vector-index Aug 27, 2024
@Lloyd-Pottiger Lloyd-Pottiger deleted the cherry-pick-5 branch August 28, 2024 02:34
@JaySon-Huang JaySon-Huang mentioned this pull request Sep 30, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants