Skip to content

Commit

Permalink
Fix smem index calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
enp1s0 committed Mar 25, 2024
1 parent 43f327c commit 8c52e25
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ struct cagra_q_dataset_descriptor_t : public dataset_descriptor_base_t<half, DIS

// Change the order of PQ code book array to reduce the
// frequency of bank conflicts.
constexpr auto num_elements_per_bank = 4 / utils::size_of<CODE_BOOK_T>();
const auto j = i / num_elements_per_bank;
constexpr auto num_elements_per_bank = 4 / utils::size_of<CODE_BOOK_T>();
constexpr auto num_banks_per_subspace = PQ_LEN / num_elements_per_bank;
const auto j = i / num_elements_per_bank;
const auto smem_index =
(j / num_elements_per_bank) + (j % num_elements_per_bank) * (1 << PQ_BITS);
(j / num_banks_per_subspace) + (j % num_banks_per_subspace) * (1 << PQ_BITS);
reinterpret_cast<half2*>(smem_pq_code_book_ptr)[smem_index] = buf2;
}
} else {
Expand Down

0 comments on commit 8c52e25

Please sign in to comment.