Home

Awesome

SimpleComputeShaderHashTable

hash

About This Project

This project is a Unity Compute Shader implementation of a simple GPU hash table written by David Farell which in turn is based on Cliff Click's hash table. It uses the MurmurHash3 function by Austin Appleby. All of the above works are in the public domain, and free to use, as is this project.

This code implements a lock free hash table using linear probing, and achieves thread safety using an atomic function, InterlockedCompareExchange(), to insert key/values into the table. Because it uses linear probing, the table is cache-effecient, but performance quickly degrades as the load factor increases.

Important notes

To use this project

To use this project, simply add Hash.compute and Test.cs to an existing Unity project, attach Test.cs to a gameobject in the editor, and attach Hash.compute to Test.cs.

To Learn More

If you want learn more about this hash table and how it was designed I would highly encourage reading David Farell's blog post. If you want to learn more about GPU powered hash tables in general see this scholarly article WarpCore: A Library for fast Hash Tables on GPUs.