block size, number of dimensions of each vector
| 400 | |
| 401 | template<int B, int NBytes, class dist_t> // block size, number of dimensions of each vector |
| 402 | inline void lut_dists_8b_vertical(const uint8_t* codes, const dist_t* luts, |
| 403 | dist_t* dists_out, int64_t N) |
| 404 | { |
| 405 | static constexpr int lut_sz = 256; |
| 406 | static constexpr int nstripes = B; // # of rows of per block |
| 407 | static_assert(B > 0, "Block size B must be > 0"); |
| 408 | const int64_t nblocks = N / B; |
| 409 | assert(N % B == 0); |
| 410 | |
| 411 | dist_t accumulators[nstripes]; |
| 412 | |
| 413 | for (int64_t b = 0; b < nblocks; b++) { // for each block |
| 414 | for (int i = 0; i < nstripes; i++) { |
| 415 | accumulators[i] = 0; // zero dists |
| 416 | } |
| 417 | for (int j = 0; j < NBytes; j++) { // for each pair of dimensions |
| 418 | auto lut_ptr = luts + lut_sz * j; |
| 419 | for (int i = 0; i < nstripes; i++) { // for each stripe |
| 420 | auto idx = *codes; |
| 421 | codes++; |
| 422 | accumulators[i] += lut_ptr[idx]; |
| 423 | } |
| 424 | } |
| 425 | for (int i = 0; i < nstripes; i++) { // for each stripe |
| 426 | dists_out[i] = accumulators[i]; |
| 427 | } |
| 428 | dists_out += nstripes; |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | template<int NBytes, class dist_t> |
| 433 | inline void lut_dists_12b(const uint8_t* codes, const dist_t* luts, |
nothing calls this directly
no outgoing calls
no test coverage detected