@@ -1100,24 +1100,24 @@ static __global__ void manyway_leaf_gram_knn_kernel(float const* gram,
11001100
11011101 int u = threadIdx .x ;
11021102 if (u >= leaf_n) { return ; }
1103- double top_d[MAX_LEAF_DEGREE ];
1103+ float top_d[MAX_LEAF_DEGREE ];
11041104 uint16_t top_v[MAX_LEAF_DEGREE ];
11051105 for (int t = 0 ; t < leaf_degree; ++t) {
1106- top_d[t] = std::numeric_limits<double >::max ();
1106+ top_d[t] = std::numeric_limits<float >::max ();
11071107 top_v[t] = std::numeric_limits<uint16_t >::max ();
11081108 }
11091109
11101110 // Scan this point's Gram row, keeping the `leaf_degree` nearest cross-origin neighbors.
11111111 int64_t gram_base = local_leaf * leaf_size * leaf_size;
1112- double norm_u = static_cast < double >( gram[gram_base + u * leaf_size + u]) ;
1112+ float norm_u = gram[gram_base + u * leaf_size + u];
11131113 for (int v = 0 ; v < leaf_n; ++v) {
11141114 if (u == v || leaf_origins[u] == leaf_origins[v] || records[u].id == records[v].id ) {
11151115 continue ;
11161116 }
1117- double norm_v = static_cast < double >( gram[gram_base + v * leaf_size + v]) ;
1118- double dot = static_cast < double >( gram[gram_base + v * leaf_size + u]) ;
1119- double distance = norm_u + norm_v - 2.0 * dot;
1120- if (isfinite (distance)) { distance = fmax (0.0 , distance); }
1117+ float norm_v = gram[gram_base + v * leaf_size + v];
1118+ float dot = gram[gram_base + v * leaf_size + u];
1119+ float distance = norm_u + norm_v - 2 .0f * dot;
1120+ if (isfinite (distance)) { distance = fmaxf (0 .0f , distance); }
11211121 int worst = 0 ;
11221122 for (int t = 1 ; t < leaf_degree; ++t) {
11231123 if (top_d[t] > top_d[worst] || (top_d[t] == top_d[worst] && top_v[t] > top_v[worst])) {
0 commit comments