Skip to content

Commit

Permalink
fix potential phantom match (#871)
Browse files Browse the repository at this point in the history
* allow disabling of stream timers

* bump stage image

* fix potential phantom match

* dbg: just for e2e

* clear some more buffers

* revert dbg

* trigger image push

* test image in stage

* use rebased image

* bump image

---------

Co-authored-by: Ertugrul Aypek <ertugrul.aypek@toolsforhumanity.com>
  • Loading branch information
philsippl and eaypek-tfh authored Jan 3, 2025
1 parent 491fa3a commit ffad4fa
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/temp-branch-build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Branch - Build and push docker image
on:
push:
branches:
- "ps/reuse-events"
- "ps/potential-phantom-match"

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
Expand Down
2 changes: 1 addition & 1 deletion deploy/stage/common-values-iris-mpc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: "ghcr.io/worldcoin/iris-mpc:v0.13.8"
image: "ghcr.io/worldcoin/iris-mpc:v0.13.9"

environment: stage
replicaCount: 1
Expand Down
5 changes: 4 additions & 1 deletion iris-mpc-gpu/src/dot/share_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,10 @@ impl ShareDB {
let device = self.device_manager.device(idx);
device.bind_to_thread().unwrap();

if offset[idx] >= db_sizes[idx] || offset[idx] + chunk_sizes[idx] > db_sizes[idx] {
if offset[idx] >= db_sizes[idx]
|| offset[idx] + chunk_sizes[idx] > db_sizes[idx]
|| chunk_sizes[idx] == 0
{
continue;
}

Expand Down
38 changes: 14 additions & 24 deletions iris-mpc-gpu/src/server/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ impl ServerActor {
);

self.device_manager.await_streams(&self.streams[0]);
self.device_manager.await_streams(&self.streams[1]);

// Iterate over a list of tracing payloads, and create logs with mappings to
// payloads Log at least a "start" event using a log with trace.id
Expand Down Expand Up @@ -967,12 +968,8 @@ impl ServerActor {
})
.unwrap();

// Wait for all streams before get timings
self.device_manager.await_streams(&self.streams[0]);
self.device_manager.await_streams(&self.streams[1]);

// Reset the results buffers for reuse
for dst in &[
for dst in [
&self.db_match_list_left,
&self.db_match_list_right,
&self.batch_match_list_left,
Expand All @@ -981,26 +978,19 @@ impl ServerActor {
reset_slice(self.device_manager.devices(), dst, 0, &self.streams[0]);
}

reset_slice(
self.device_manager.devices(),
for dst in [
&self.distance_comparator.all_matches,
&self.distance_comparator.match_counters,
0,
&self.streams[0],
);

reset_slice(
self.device_manager.devices(),
&self.distance_comparator.match_counters_left,
0,
&self.streams[0],
);

reset_slice(
self.device_manager.devices(),
&self.distance_comparator.match_counters_right,
0,
&self.streams[0],
);
&self.distance_comparator.partial_results_left,
&self.distance_comparator.partial_results_right,
] {
reset_slice(self.device_manager.devices(), dst, 0, &self.streams[0]);
}

self.device_manager.await_streams(&self.streams[0]);
self.device_manager.await_streams(&self.streams[1]);

// ---- END RESULT PROCESSING ----
if self.enable_debug_timing {
Expand Down Expand Up @@ -1167,7 +1157,7 @@ impl ServerActor {
let chunk_sizes = |chunk_idx: usize| {
self.current_db_sizes
.iter()
.map(|s| (s - DB_CHUNK_SIZE * chunk_idx).clamp(1, DB_CHUNK_SIZE))
.map(|s| (s - DB_CHUNK_SIZE * chunk_idx).clamp(0, DB_CHUNK_SIZE))
.collect::<Vec<_>>()
};

Expand Down Expand Up @@ -1220,7 +1210,7 @@ impl ServerActor {
// later.
let dot_chunk_size = chunk_size
.iter()
.map(|s| s.div_ceil(64) * 64)
.map(|&s| (s.max(1).div_ceil(64) * 64))
.collect::<Vec<_>>();

// First stream doesn't need to wait
Expand Down

0 comments on commit ffad4fa

Please sign in to comment.