| 35 | }; |
| 36 | |
| 37 | bool alloc_state(IndexState& s, int64_t max_cells) { |
| 38 | CHECK(cudaMalloc((void**) &s.tail, (BLOCK - 1) * IDX * sizeof(float))); |
| 39 | CHECK(cudaMalloc((void**) &s.dead, IDX * sizeof(float))); |
| 40 | CHECK(cudaMalloc((void**) &s.pooled, (size_t) (max_cells / BLOCK + 1) * IDX * sizeof(float))); |
| 41 | CHECK(cudaMalloc((void**) &s.block_pos, sizeof(int32_t))); |
| 42 | return true; |
| 43 | } |
| 44 | void free_state(IndexState& s) { |
| 45 | if (s.tail) cudaFree(s.tail); |
| 46 | if (s.dead) cudaFree(s.dead); |
no test coverage detected