Skip to content

Commit 6fa85c0

Browse files
committed
Minor fixes
1 parent 05702a5 commit 6fa85c0

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

include/svs/index/ivf/common.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,16 @@ void compute_matmul(
250250
m_int, // const int M
251251
n_int, // const int N
252252
k_int, // const int K
253-
1.0f, // float alpha (explicitly float)
253+
1.0f, // float alpha
254254
data, // const float* A
255255
k_int, // const int lda
256256
centroids, // const float* B
257257
k_int, // const int ldb
258-
0.0f, // const float beta (explicitly float)
258+
0.0f, // const float beta
259259
results, // float* c
260260
n_int // const int ldc
261261
);
262262
} else if constexpr (std::is_same_v<T, BFloat16>) {
263-
// Intel MKL BFloat16 GEMM requires careful parameter casting to avoid parameter
264-
// errors Ensure all integer parameters are properly cast to int (MKL expects int,
265-
// not size_t)
266263
int m_int = static_cast<int>(m);
267264
int n_int = static_cast<int>(n);
268265
int k_int = static_cast<int>(k);
@@ -274,19 +271,16 @@ void compute_matmul(
274271
m_int, // const int M
275272
n_int, // const int N
276273
k_int, // const int K
277-
1.0f, // float alpha (explicitly float)
274+
1.0f, // float alpha
278275
(const uint16_t*)data, // const *uint16_t A
279276
k_int, // const int lda
280277
(const uint16_t*)centroids, // const uint16_t* B
281278
k_int, // const int ldb
282-
0.0f, // const float beta (explicitly float)
279+
0.0f, // const float beta
283280
results, // float* c
284281
n_int // const int ldc
285282
);
286283
} else if constexpr (std::is_same_v<T, Float16>) {
287-
// Intel MKL Float16 GEMM requires careful parameter casting to avoid parameter
288-
// errors Ensure all integer parameters are properly cast to int (MKL expects int,
289-
// not size_t)
290284
int m_int = static_cast<int>(m);
291285
int n_int = static_cast<int>(n);
292286
int k_int = static_cast<int>(k);
@@ -298,12 +292,12 @@ void compute_matmul(
298292
m_int, // const int M
299293
n_int, // const int N
300294
k_int, // const int K
301-
1.0f, // float alpha (explicitly float)
295+
1.0f, // float alpha
302296
(const uint16_t*)data, // const *uint16_t A
303297
k_int, // const int lda
304298
(const uint16_t*)centroids, // const uint16_t* B
305299
k_int, // const int ldb
306-
0.0f, // const float beta (explicitly float)
300+
0.0f, // const float beta
307301
results, // float* c
308302
n_int // const int ldc
309303
);

include/svs/index/ivf/hierarchical_kmeans.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,12 @@ auto hierarchical_kmeans_clustering_impl(
160160

161161
std::vector<std::vector<I>> clusters_level1_all;
162162

163-
// Declare timer outside if block to avoid scope issues
163+
// Declare timer outside of block to avoid scope issues
164164
auto all_assignments_time = timer.push_back("level1 all assignments");
165165

166166
if (!train_only) {
167167
// Step 5: Assign all data to clusters
168-
auto all_assignments_alloc = timer.push_back("level1 all assignments alloc");
169168
auto assignments_level1_all = std::vector<size_t>(data.size());
170-
all_assignments_alloc.finish();
171169

172170
batchsize = parameters.minibatch_size_;
173171
num_batches = lib::div_round_up(data.size(), batchsize);
@@ -178,10 +176,7 @@ auto hierarchical_kmeans_clustering_impl(
178176
auto this_batch = threads::UnitRange{
179177
batch * batchsize, std::min((batch + 1) * batchsize, data.size())};
180178
auto data_batch_view = data::make_view(data, this_batch);
181-
auto all_assignments_convert =
182-
timer.push_back("level1 all assignments convert");
183179
convert_data(data_batch_view, data_batch, threadpool);
184-
all_assignments_convert.finish();
185180
centroid_assignment(
186181
data_batch,
187182
data_norm,
@@ -199,7 +194,6 @@ auto hierarchical_kmeans_clustering_impl(
199194
clusters_level1_all =
200195
group_assignments(assignments_level1_all, num_level1_clusters, data);
201196
all_assignments_cluster.finish();
202-
all_assignments_time.finish();
203197
} else {
204198
// For train_only, create empty clusters
205199
clusters_level1_all.resize(num_level1_clusters);

0 commit comments

Comments
 (0)