perf(diskann): async I/O overlap and dynamic beam - #617
Open
richyreachy wants to merge 12 commits into
Open
Conversation
iaojnh
reviewed
Jul 27, 2026
|
|
||
| uint32_t num_ios = 0; | ||
|
|
||
| uint32_t effective_beam_width = |
Collaborator
There was a problem hiding this comment.
sector_buffer_ 可能会因为这个改动越界。比如这个值是32,要写入4096维的FP32,sector = ceil(16788 / 4096) = 5,32 * 5就会超过kMaxSectorReadNum = 128
|
|
||
| int ret = LibAioLoader::Instance().io_submit(ctx, (int64_t)n_ops, | ||
| batch.cb_ptrs.data()); | ||
| if (ret == (int)n_ops) { |
Collaborator
There was a problem hiding this comment.
如果还有正在异步处理的请求,这个条件不满足,不应该被视为失败降级pread
|
|
||
| for (int i = 0; i < ret; i++) { | ||
| uint32_t idx = (uint32_t)(uintptr_t)evts[i].data; | ||
| if ((int64_t)evts[i].res != (int64_t)batch.cbs[idx].u.c.nbytes) { |
Collaborator
There was a problem hiding this comment.
这里应该是要异常处理的,不能直接往completed_indices里丢。必要时可能要考虑降级。
| if (min_req < 1) min_req = 1; | ||
|
|
||
| std::vector<io_event_t> evts(n_remaining); | ||
| int ret = LibAioLoader::Instance().io_getevents( |
Collaborator
There was a problem hiding this comment.
Returning here leaves submitted AIO requests unquiesced. For example, -EINTR may occur while requests are still in flight; they can later overwrite the shared sector buffer or leave completion events that the next PendingBatch misattributes to its own requests. Retry EINTR; for permanent failures, drain or destroy/recreate the AIO context before returning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimizes DiskANN beam search to overlap CPU computation with disk I/O, reducing query latency on disk-bound workloads. By introducing the following improvement:
Add async I/O submit/get_completed pattern to allow CPU work to proceed while disk reads still in progress.
Add dynamic beam width to ensure sufficient I/O parallelism while preventing excessive concurrent I/Os.
Fix Visit-filter deduplication to avoid redundant candidate insertions for already-visited nodes.