Skip to content
Discussion options

You must be logged in to vote

The alignas(16) BPEIndex struct forces the compiler to pad the structure to exactly 16 bytes. Modern CPU caches load memory in fixed-size chunks (usually 64-byte cache lines). Because 16 divides perfectly into 64, exactly four BPEIndex nodes fit seamlessly into a single CPU cache line without straddling the boundary. This prevents cache-line bouncing and speeds up the rapid, sequential linked-list traversal during BPE merging.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by eamonsippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants