Fix IVF extend list resize bug#2297
Conversation
|
old_used_size is the old logical size. old real size is checked via extends. |
in ivf-flat extend, resize_list() receives |
|
here is poc after base extend after grow extend BUG: index-visible size is 120 but internal list::size stayed 100 |
|
Ok, sorry for closing this prematurely, this does seem legit. I'm not sure though if this internal get_size() is used where it could cause any problems. I'll look into this in the following days. |
|
Thank you very much! I forgot to mention how i even stumbled upon this - i got very strange Illegal memory access errors (i am using python wrapper for multiple extends + search + torch for calculating the vectors) and believe that this bug is related (IMA was in calc_chunk_indices_kernel) |
|
off-topic, figured out why i got IMA, NVIDIA/raft#3041, different issue. |
|
Everything that gets merged in the main branch before next burndown, gets automatically in the next release - the new release branch is forked from the main when burndown starts. Here's our schedule https://docs.rapids.ai/maintainers/ |
huuanhhuyn
left a comment
There was a problem hiding this comment.
Thank you for your contribution! I'd have 1 doubt.
|
Some suggestions to improve the tests. Otherwise LGTM! Thank you for the contribution! |
|
/ok to test f4cee4f |
|
fixed the tests |
|
@achirkin I can't trigger the full 85 CI checks. Can you trigger it or it is because of missing commit signing? |
achirkin
left a comment
There was a problem hiding this comment.
I see the issue is real, but I still have the doubts about the chosen approach to fix it. ivf-list shouldn't be aware of what is "logical" size. I think a more appropriate fix for ivf-flat and ivf-sq would be to pad the extents to account for the interleaved storage. Please have a look at my draft qwertyforce#1
Removing myself from the reviewers as I contributed to the PR
|
/ok to test a51ec2a |
tfeher
left a comment
There was a problem hiding this comment.
Thanks @qwertyforce for the fix LGTM.
huuanhhuyn
left a comment
There was a problem hiding this comment.
Thanks @qwertyforce and @achirkin!
Description
Fixes a bug in IVF-Flat and IVF-SQ
extend()where a list could receive new vectors but keep its old logicallist::size.The issue happens when extending a list that already has enough allocated capacity. Interleaved IVF list storage may be padded, so the old copy extent can be larger than the old logical size.
Example:
Previously,
resize_list()received only the padded value,128, and used it both for copying old storage and for deciding whetherlist::sizeneeded to be updated. It checked120 <= 128, skipped the update, and leftlist::size == 100even though new vectors were inserted up to120.This stale size can break the shared-list / copy-on-write logic in later extends and corrupt search results.
Fix
Pass separate old sizes to
ivf::resize_list():The existing overload is kept for call sites where both sizes are the same.
Tests
Added regression tests for: