Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ ifneq (,$(findstring $(ARCH), x86_64 amd64))
POPCNT_CAPABILITY ?= 1
ifneq (0, $(SSE_AVX2))
ENABLE_V256 := 1
V256_FLAG := -march=x86-64-v3 -mtune=znver3 -faligned-new -DSSE_AVX2 -DPOPCNT_CAPABILITY
# -ffp-contract=off: no fused multiply-adds, so floating-point results (e.g.
# --score-min, MAPQ) are rounded as in the 128-bit build and outputs match it
V256_FLAG := -march=x86-64-v3 -mtune=znver3 -ffp-contract=off -faligned-new -DSSE_AVX2 -DPOPCNT_CAPABILITY
# tell 128-bit version to check for v256 capability and use it, if found
SSE_FLAG += -DENABLE_x86_64_v3
endif
Expand Down
33 changes: 30 additions & 3 deletions aligner_bt.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ class BtBranchTracer {
public:

explicit BtBranchTracer() :
prob_(), bs_(), seenPaths_(DP_CAT), sawcell_(DP_CAT), doTri_() { }
prob_(), bs_(), seenPaths_(DP_CAT), sawcell_(DP_CAT), doTri_(),
resetPending_(false), resetNdiag_(0), resetRflen_(0) { }

/**
* Add a branch to the queue.
Expand Down Expand Up @@ -642,7 +643,10 @@ class BtBranchTracer {

/**
* Initialize the tracer with respect to a new read. This involves
* resetting all the state relating to the set of cells already visited
* resetting all the state relating to the set of cells already visited.
* The reset itself is deferred to the next initBt(), since most
* reference windows are never backtraced with this tracer;
* seenPaths_ and sawcell_ are read only from initBt() on.
*/
void initRef(
const char* rd, // in: read sequence
Expand All @@ -660,7 +664,22 @@ class BtBranchTracer {
size_t nceil) // in: N ceiling
{
prob_.initRef(rd, qu, rdlen, rf, rflen, trflen, refid, refoff, fw, rect, cper, &sc, nceil);
const size_t ndiag = rflen + rdlen - 1;
resetNdiag_ = rflen + rdlen - 1;
// An eager reset clears every per-column set below the largest rflen
// seen since the last backtrace, so keep the largest.
if(!resetPending_ || rflen > resetRflen_) {
resetRflen_ = rflen;
}
resetPending_ = true;
}

/**
* Perform the reset of seenPaths_ and sawcell_ that the last initRef()
* (and any initRef() calls before it since the last initBt()) deferred.
*/
void resetSeen() {
const size_t ndiag = resetNdiag_;
const size_t rflen = resetRflen_;
seenPaths_.resize(ndiag);
for(size_t i = 0; i < ndiag; i++) {
seenPaths_[i].clear();
Expand All @@ -677,6 +696,7 @@ class BtBranchTracer {
sawcell_[i].setCat(DP_CAT);
sawcell_[i].clear(); // clear the set
}
resetPending_ = false;
}

/**
Expand All @@ -691,6 +711,9 @@ class BtBranchTracer {
bool doTri, // in: triangle-shaped mini-fills?
RandomSource& rnd) // in: random gen, to choose among equal paths
{
if(resetPending_) {
resetSeen();
}
prob_.initBt(row, col, fill, usecp, escore);
Edit e; e.reset();
unsorted_.clear();
Expand Down Expand Up @@ -939,6 +962,10 @@ class BtBranchTracer {
ELList<CpQuad> tri_; // triangle to fill when doing mini-fills
EList<size_t> ndep_; // # triangles mini-filled at various depths

bool resetPending_; // seenPaths_/sawcell_ reset owed by initRef
size_t resetNdiag_; // # diagonals of the last initRef's window
size_t resetRflen_; // largest rflen since the last reset

#ifndef NDEBUG
ESet<size_t> seen_; // seedn branch ids; should never see same twice
#endif
Expand Down
13 changes: 7 additions & 6 deletions aligner_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ bool AlignmentCache::addOnTheFlyImpl(
s->payload.len = botf - topf;
s->payload.topf = topf;
s->payload.topb = topb;
for(size_t j = 0; j < (botf-topf); j++) {
if(!salist_.add(pool(), OFF_MASK)) {
// Change the payload's len field
s->payload.len = (TIndexOffU)j;
return false; // Exhausted pool memory
}
// One OFF_MASK (offset not yet resolved) per element of the range
const size_t len = botf - topf;
const size_t j = salist_.addFillUpTo(pool(), len, OFF_MASK);
if(j < len) {
// Change the payload's len field
s->payload.len = (TIndexOffU)j;
return false; // Exhausted pool memory
}
assert(s->payload.repOk(*this));
}
Expand Down
Loading
Loading