Skip to content

GPU-native AtomSpace Phase 0-1: hash table + pool layouts - #3

Open
plankatron wants to merge 1 commit into
opencog:masterfrom
plankatron:feat/gpu-hashtable-pools
Open

GPU-native AtomSpace Phase 0-1: hash table + pool layouts#3
plankatron wants to merge 1 commit into
opencog:masterfrom
plankatron:feat/gpu-hashtable-pools

Conversation

@plankatron

@plankatron plankatron commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

Summary

GPU-resident data structures for the AtomSpace pipeline — the foundation layer that all subsequent kernels build on.

  • gpu-hashtable.cl — Lock-free hash table using FNV-1a hashing with CAS-based insert. Provides O(1) atom identity lookups on GPU with linear probing for collision handling and support for concurrent writers.
  • gpu-atomspace.cl — SoA (Structure of Arrays) pool management for WordPool, PairPool, and SectionPool. Atomic allocation via gpu_pool_alloc(), capacity tracking, and efficient GPU-side memory layout.

Pipeline Position

This is Phase 0-1 of the GPU-native AtomSpace pipeline:

[Phase 0-1: Hash Table + Pools] ← THIS PR (foundation — merge first)
 Phase 2-3: Counting + MI      (#4, depends on this)
 Phase 4-5: Sections + Cosine  (#5, depends on this)
 Phase 6:   Substitution       (#6, depends on this)

Note: PRs #4, #5, and #6 reference the pool structs (WordPool, PairPool, SectionPool) and hash table defined here. This PR should be merged first. Each subsequent PR adds only new kernel files — no merge conflicts between them.

Files

File Lines Description
gpu-hashtable.cl 303 Lock-free FNV-1a hash table kernel
gpu-atomspace.cl 407 Word/Pair/Section pool management
test-hashtable.c 532 Hash table unit tests
test-atomspace.c 739 Pool management unit tests
.gitignore 8 Ignore compiled test binaries

Building & Testing

cd opencog/opencl/atomspace

# Hash table tests
gcc -o test-hashtable test-hashtable.c -lOpenCL -lm
./test-hashtable

# Pool management tests
gcc -o test-atomspace test-atomspace.c -lOpenCL -lm
./test-atomspace

Relationship to Prior Work

Builds on PR #2 (binary caching + dispatch thread build), which was merged as 2a9c544. These kernels benefit from the binary caching infrastructure for faster program load times.

🤖 Generated with Claude Code

Phase 0: Lock-free FNV-1a hash table with CAS-based insert for
O(1) atom identity lookups on GPU. Handles collisions with linear
probing and supports concurrent writers.

Phase 1: SoA (Structure of Arrays) pool management for WordPool,
PairPool, and SectionPool. Atomic allocation with gpu_pool_alloc(),
capacity tracking, and efficient GPU-side memory layout.

Includes comprehensive C test suites for both components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant