Skip to content

Conversation

iliailia
Copy link
Collaborator

@iliailia iliailia commented Oct 8, 2025

No description provided.

@iliailia iliailia requested review from mcalancea and naure October 8, 2025 15:34
@iliailia iliailia changed the title [POP-2962] Batch rotation-aware dot products in Iris-Worker [POP-2983] Batch rotation-aware dot products in Iris-Worker Oct 8, 2025
@iliailia iliailia changed the title [POP-2983] Batch rotation-aware dot products in Iris-Worker [POP-2983] Batch oblivious array minimum Oct 9, 2025
@iliailia iliailia self-assigned this Oct 9, 2025
@sdwoodbury
Copy link
Collaborator

not related to this PR: I think I found a way to remove a clone() in oblivious_min_distance()

image

Copy link
Collaborator

@sdwoodbury sdwoodbury left a comment

Choose a reason for hiding this comment

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

Nice!

I left a comment about a potential optimization. It isn't blocking though.

Comment on lines 222 to 231
let pairs = res
.chunks_exact(2)
.flat_map(|chunk| izip!(chunk[0].clone(), chunk[1].clone()).collect_vec())
.collect_vec();
// compute minimums of pairs
let flattened_res = min_of_pair_batch(&mut self.session, &pairs).await?;
res = flattened_res
.chunks_exact(len)
.map(|chunk| chunk.to_vec())
.collect_vec();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let pairs = res
.chunks_exact(2)
.flat_map(|chunk| izip!(chunk[0].clone(), chunk[1].clone()).collect_vec())
.collect_vec();
// compute minimums of pairs
let flattened_res = min_of_pair_batch(&mut self.session, &pairs).await?;
res = flattened_res
.chunks_exact(len)
.map(|chunk| chunk.to_vec())
.collect_vec();
let mut res1 = vec![];
std::mem::swap(&mut res1, &mut res);
let pairs: Vec<(_, _)> = res1
.into_iter()
.tuples()
.flat_map(|(a, b)| izip!(a, b).collect_vec())
.collect();
// compute minimums of pairs
let flattened_res = min_of_pair_batch(&mut self.session, &pairs).await?;
res = flattened_res
.into_iter()
.chunks(len)
.into_iter()
.map(|chunk| chunk.collect())
.collect_vec();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice! Thanks!

@iliailia iliailia merged commit d245e52 into dev Oct 10, 2025
15 checks passed
@iliailia iliailia deleted the ilia/batch-oblivious-min-tree branch October 10, 2025 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants