Skip to content

Commit 0b6ded2

Browse files
Rob Patroclaude
andcommitted
Guard AVX2 ksw2 declaration and calls behind #ifndef KSW_USE_ARM
The AVX2 object file is not compiled on ARM, so the declaration and call sites must be guarded to avoid undefined symbol errors on aarch64. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c846e90 commit 0b6ded2

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

include/ksw2pp/ksw2.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ void ksw_extz(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t
5858

5959
void ksw_extz2_sse(/*unsigned int simd, */void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
6060
int8_t q, int8_t e, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez, int cutoff);
61+
#ifndef KSW_USE_ARM
6162
void ksw_extz2_avx2(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
6263
int8_t q, int8_t e, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez, int cutoff);
64+
#endif
6365
void ksw_extz2_sse41(/*unsigned int simd, */void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
6466
int8_t q, int8_t e, int w, int zdrop, int end_bonus, int flag, ksw_extz_t *ez, int cutoff);
6567
void ksw_extz2_sse2(/*unsigned int simd, */void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,

src/ksw2pp/KSW2Aligner.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,14 @@ int KSW2Aligner::operator()(const char* const queryOriginal,
249249
int max_qt_len = (queryLength > targetLength) ? queryLength : targetLength;
250250
int w = (config_.bandwidth > max_qt_len) ? max_qt_len : config_.bandwidth;
251251
int z = config_.dropoff;
252+
#ifndef KSW_USE_ARM
252253
if (haveAVX2) {
253254
ksw_extz2_avx2(kalloc_allocator_.get(), qlen, query_.data(), tlen,
254255
target_.data(), config_.alphabetSize, mat_.data(), q, e, w, z,
255256
config_.end_bonus, config_.flag, ez, cutoff);
256-
} else if (haveSSE41) {
257+
} else
258+
#endif
259+
if (haveSSE41) {
257260
ksw_extz2_sse41(kalloc_allocator_.get(), qlen, query_.data(), tlen,
258261
target_.data(), config_.alphabetSize, mat_.data(), q, e, w, z,
259262
config_.end_bonus, config_.flag, ez, cutoff);
@@ -398,11 +401,14 @@ int KSW2Aligner::operator()(const uint8_t* const query_, const int queryLength,
398401
int max_qt_len = (queryLength > targetLength) ? queryLength : targetLength;
399402
int w = (config_.bandwidth > max_qt_len) ? max_qt_len : config_.bandwidth;
400403
int z = config_.dropoff;
404+
#ifndef KSW_USE_ARM
401405
if (haveAVX2) {
402406
ksw_extz2_avx2(kalloc_allocator_.get(), qlen, query_, tlen, target_,
403407
config_.alphabetSize, mat_.data(), q, e, w, z, config_.end_bonus, config_.flag,
404408
ez, cutoff);
405-
} else if (haveSSE41) {
409+
} else
410+
#endif
411+
if (haveSSE41) {
406412
ksw_extz2_sse41(kalloc_allocator_.get(), qlen, query_, tlen, target_,
407413
config_.alphabetSize, mat_.data(), q, e, w, z, config_.end_bonus, config_.flag,
408414
ez, cutoff);

0 commit comments

Comments
 (0)