Skip to main content

Crate flash_map

Crate flash_map 

Source
Expand description

FlashMap — GPU-native concurrent hash map.

Bulk-only API designed for maximum GPU throughput:

  • bulk_get / bulk_insert / bulk_remove — host-facing (H↔D transfers)
  • bulk_get_device / bulk_insert_device — device-resident (zero-copy)
  • bulk_get_values_device — values-only lookup (no found mask)
  • bulk_insert_device_uncounted — fire-and-forget insert (no readback)

SoA (Struct of Arrays) memory layout on GPU for coalesced access. Robin Hood hashing with probe distance early exit. Warp-cooperative probing (32 slots per iteration).

§Features

  • cuda — GPU backend via CUDA (requires NVIDIA GPU + CUDA toolkit)
  • rayon — multi-threaded CPU backend (default)

§Host API Example

use flash_map::{FlashMap, HashStrategy};

let mut map: FlashMap<[u8; 32], [u8; 128]> =
    FlashMap::with_capacity(1_000_000).unwrap();

let pairs: Vec<([u8; 32], [u8; 128])> = generate_pairs();
map.bulk_insert(&pairs).unwrap();

let keys: Vec<[u8; 32]> = pairs.iter().map(|(k, _)| *k).collect();
let results: Vec<Option<[u8; 128]>> = map.bulk_get(&keys).unwrap();

§Device-Resident Pipeline Example

use flash_map::FlashMap;

let mut map = FlashMap::<u64, [u8; 32]>::with_capacity(1_000_000).unwrap();

// Upload keys once (H→D), then all operations stay on GPU
let d_keys = map.upload_keys(&[42u64]).unwrap();
let d_vals = map.bulk_get_values_device(&d_keys, 1).unwrap();
// d_vals is on GPU — pass to your CUDA kernel, then insert results back:
// map.bulk_insert_device_uncounted(&d_new_keys, &d_new_vals, n).unwrap();

Structs§

FlashMap
GPU-native concurrent hash map with bulk-only operations.
FlashMapBuilder
Builder for configuring a FlashMap.

Enums§

FlashMapError
HashStrategy
Hash strategy for key distribution.

Traits§

Pod
Marker trait for “plain old data”.

Derive Macros§

Pod
Derive the Pod trait for a struct