Revert label propagation: restore DisjointSetsAsm for correctness#137
Merged
Revert label propagation: restore DisjointSetsAsm for correctness#137
Conversation
The Shiloach-Vishkin label propagation had a race condition where parent[max(la,lb)] = min(la,lb) could link unrelated positions when la/lb were stale. This caused base mismatches in write_graph_chunk on larger inputs (e.g., USP14 region with 527 sequences, 212kb). Revert to DisjointSetsAsm (lock-free CAS-based union-find) which is proven correct. Keep all other optimizations: spanning tree BFS, orphan recovery, per-sequence iitree queries, adjacency list. MHC (466 seqs): 4m12s, correct (2727 nodes, 52047bp) USP14 (527 seqs): 19m60s, correct (10199 nodes, 236011bp) — was crashing
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.
Summary
The Shiloach-Vishkin label propagation introduced in PR #135 has a race condition that causes incorrect equivalence classes on larger inputs. Specifically,
parent[max(la,lb)] = min(la,lb)with Relaxed ordering can link unrelated positions whenla/lbare stale, causing base mismatches inwrite_graph_chunk.This reverts to
DisjointSetsAsm(lock-free CAS-based union-find) for correctness while keeping all other optimizations from #135:The bug
Reproduced on USP14 region (chr18:68526-280967, 527 sequences, 212kb).
Test results