| 423 | |
| 424 | template<Architecture A> |
| 425 | void SimdAlignmentEngine<A>::Realloc( |
| 426 | std::uint64_t matrix_width, |
| 427 | std::uint64_t matrix_height, |
| 428 | std::uint8_t num_codes) { |
| 429 | #if defined(__AVX2__) || defined(__SSE4_1__) || defined(SPOA_USE_SIMDE) |
| 430 | if (pimpl_->node_id_to_rank.size() < matrix_height - 1) { |
| 431 | pimpl_->node_id_to_rank.resize(matrix_height - 1, 0); |
| 432 | } |
| 433 | if (pimpl_->sequence_profile_size < num_codes * matrix_width) { |
| 434 | __mxxxi* storage = nullptr; |
| 435 | pimpl_->sequence_profile_size = num_codes * matrix_width; |
| 436 | pimpl_->sequence_profile = AllocateAlignedMemory<A>( |
| 437 | &storage, |
| 438 | pimpl_->sequence_profile_size, |
| 439 | kRegisterSize / 8); |
| 440 | pimpl_->sequence_profile_storage.reset(); |
| 441 | pimpl_->sequence_profile_storage = std::unique_ptr<__mxxxi[]>(storage); |
| 442 | } |
| 443 | if (subtype_ == AlignmentSubtype::kLinear) { |
| 444 | if (pimpl_->first_column.size() < matrix_height) { |
| 445 | pimpl_->first_column.resize(matrix_height, 0); |
| 446 | } |
| 447 | if (pimpl_->M_size < matrix_height * matrix_width) { |
| 448 | __mxxxi* storage = nullptr; |
| 449 | pimpl_->M_size = matrix_height * matrix_width; |
| 450 | pimpl_->H = AllocateAlignedMemory<A>( |
| 451 | &storage, |
| 452 | pimpl_->M_size, |
| 453 | kRegisterSize / 8); |
| 454 | pimpl_->M_storage.reset(); |
| 455 | pimpl_->M_storage = std::unique_ptr<__mxxxi[]>(storage); |
| 456 | } |
| 457 | } else if (subtype_ == AlignmentSubtype::kAffine) { |
| 458 | if (pimpl_->first_column.size() < 2 * matrix_height) { |
| 459 | pimpl_->first_column.resize(2 * matrix_height, 0); |
| 460 | } |
| 461 | if (pimpl_->M_size < 3 * matrix_height * matrix_width) { |
| 462 | __mxxxi* storage = nullptr; |
| 463 | pimpl_->M_size = 3 * matrix_height * matrix_width; |
| 464 | pimpl_->H = AllocateAlignedMemory<A>( |
| 465 | &storage, |
| 466 | pimpl_->M_size, |
| 467 | kRegisterSize / 8); |
| 468 | pimpl_->F = pimpl_->H + matrix_height * matrix_width; |
| 469 | pimpl_->E = pimpl_->F + matrix_height * matrix_width; |
| 470 | pimpl_->M_storage.reset(); |
| 471 | pimpl_->M_storage = std::unique_ptr<__mxxxi[]>(storage); |
| 472 | } |
| 473 | } else if (subtype_ == AlignmentSubtype::kConvex) { |
| 474 | if (pimpl_->first_column.size() < 3 * matrix_height) { |
| 475 | pimpl_->first_column.resize(3 * matrix_height, 0); |
| 476 | } |
| 477 | if (pimpl_->M_size < 5 * matrix_height * matrix_width) { |
| 478 | __mxxxi* storage = nullptr; |
| 479 | pimpl_->M_size = 5 * matrix_height * matrix_width; |
| 480 | pimpl_->H = AllocateAlignedMemory<A>( |
| 481 | &storage, |
| 482 | pimpl_->M_size, |