44#include " VecSim/spaces/L2_space.h"
55#include " VecSim/spaces/IP_space.h"
66#include " VecSim/spaces/space_interface.h"
7- #include " VecSim/spaces/space_includes.h"
87#include " VecSim/utils/arr_cpp.h"
98#include " VecSim/memory/vecsim_malloc.h"
109#include " VecSim/utils/vecsim_stl.h"
@@ -362,21 +361,18 @@ dist_t HierarchicalNSW<dist_t>::processCandidate(tableint curNodeId, const void
362361 linklistsizeint *node_ll = get_linklist_at_level (curNodeId, layer);
363362 size_t links_num = getListCount (node_ll);
364363 auto *node_links = (tableint *)(node_ll + 1 );
365- #ifdef USE_SSE
366- _mm_prefetch ((char *)(visited_nodes_handler->getElementsTags () + *(node_ll + 1 )), _MM_HINT_T0);
367- _mm_prefetch ((char *)(visited_nodes_handler->getElementsTags () + *(node_ll + 1 ) + 64 ),
368- _MM_HINT_T0);
369- _mm_prefetch (getDataByInternalId (*node_links), _MM_HINT_T0);
370- _mm_prefetch (getDataByInternalId (*(node_links + 1 )), _MM_HINT_T0);
371- #endif
364+
365+ __builtin_prefetch (visited_nodes_handler->getElementsTags () + *(node_ll + 1 ));
366+ __builtin_prefetch (visited_nodes_handler->getElementsTags () + *(node_ll + 1 ) + 64 );
367+ __builtin_prefetch (getDataByInternalId (*node_links));
368+ __builtin_prefetch (getDataByInternalId (*(node_links + 1 )));
372369
373370 for (size_t j = 0 ; j < links_num; j++) {
374371 tableint candidate_id = *(node_links + j);
375- #ifdef USE_SSE
376- _mm_prefetch ((char *)(visited_nodes_handler->getElementsTags () + *(node_links + j + 1 )),
377- _MM_HINT_T0);
378- _mm_prefetch (getDataByInternalId (*(node_links + j + 1 )), _MM_HINT_T0);
379- #endif
372+
373+ __builtin_prefetch (visited_nodes_handler->getElementsTags () + *(node_links + j + 1 ));
374+ __builtin_prefetch (getDataByInternalId (*(node_links + j + 1 )));
375+
380376 if (this ->visited_nodes_handler ->getNodeTag (candidate_id) == visited_tag)
381377 continue ;
382378 this ->visited_nodes_handler ->tagNode (candidate_id, visited_tag);
@@ -385,9 +381,9 @@ dist_t HierarchicalNSW<dist_t>::processCandidate(tableint curNodeId, const void
385381 dist_t dist1 = fstdistfunc_ (data_point, currObj1, dist_func_param_);
386382 if (top_candidates.size () < ef || lowerBound > dist1) {
387383 candidate_set.emplace (-dist1, candidate_id);
388- # ifdef USE_SSE
389- _mm_prefetch (getDataByInternalId (candidate_set.top ().second ), _MM_HINT_T0 );
390- # endif
384+
385+ __builtin_prefetch (getDataByInternalId (candidate_set.top ().second ));
386+
391387 top_candidates.emplace (dist1, candidate_id);
392388
393389 if (top_candidates.size () > ef)
0 commit comments