feat: optimize memory usage and add --auto-bf option - #939
Open
cyw-cc wants to merge 1 commit into
Open
Conversation
Apply three sets of optimizations:
1. Memory/threading optimizations (kalloc, kthread, Hash_Table, POA):
- Improve memory allocation in kalloc.cpp
- Optimize threading in kthread.cpp
- Refactor Hash_Table.cpp for better memory handling
- Minor POA.cpp adjustments
2. Levenshtein distance optimizations (Correct, Levenshtein_distance.h):
- Add SIMD-accelerated banded BPM functions (AVX2/SSE)
- Add Reserve_Banded_BPM_8_AVX2_only and Reserve_Banded_BPM_4_SSE_only
- Expand Levenshtein_distance.h with optimized edit distance implementation
3. Automatic bloom filter detection (--auto-bf, id=366):
- sys.cpp: yak_available_mem_gb() reads MemAvailable from /proc/meminfo
- Process_Read.cpp: ha_scan_read_stats() samples read lengths (avg/N50/min/max)
- htab.cpp: ha_auto_bf_shift() two-level decision logic
* Level 1: disable bloom filter if available memory insufficient
* Level 2: disable bloom filter for HiFi-like data (avg>8kb, N50>8kb)
- Assembly.cpp: call ha_auto_bf_shift() before ha_ft_gen()
Test results (SRR11606870, 4M HiFi reads, 16 threads):
- Peak RSS: 24.92 -> 16.92 GB (-32%)
- Real time: 1467 -> 1171 sec (-20.2%)
- Output: identical to baseline across all 5 GFA files
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.
Apply three sets of optimizations:
Memory/threading optimizations (kalloc, kthread, Hash_Table, POA):
Levenshtein distance optimizations (Correct, Levenshtein_distance.h):
Automatic bloom filter detection (--auto-bf, id=366):
Test results (SRR11606870, 4M HiFi reads, 16 threads):