Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

Using SYCL to create hash table

cmlee
Novice
1,166 Views

hi,

 

I am working to use SYCL to create hash table, similar to the code in following page.

https://developer.nvidia.com/blog/maximizing-performance-with-massively-parallel-hash-maps-on-gpus/

 

auto [old_k, old_v] = buckets[i].load(memory_order_relaxed);
// if the bucket is empty we can attempt to insert the pair
if (old_k == empty_sentinel) { // try to atomically replace the current content of the bucket with the input pair
bool success = buckets[i].compare_exchange_strong(
        {old_k, old_v}, {k,v}, memory_order_relaxed);
if (success) { // store was successful
   return true;
}

To create hash table parallel, will need to compare and exchange key and value pair in one atomic operation.   

SYCL supports atomic compare_exchange_strong but only limited to scalar data type.  It doesn't support some pair of key and value.

 

May I know any way to enable parallel hash table if atomic operation only support scalar data type? 

 

0 Kudos
1 Solution
cmlee
Novice
1,004 Views

sycl support atomic operation using a memory pointer.  So, manage to create hash table by storing all key/value into some memory buffer.   When insert the hash to the hash table, will use compare_exchange_strong with the pointer of the memory location that contains the key/value. 

View solution in original post

0 Kudos
1 Reply
cmlee
Novice
1,005 Views

sycl support atomic operation using a memory pointer.  So, manage to create hash table by storing all key/value into some memory buffer.   When insert the hash to the hash table, will use compare_exchange_strong with the pointer of the memory location that contains the key/value. 

0 Kudos
Reply