haskell / haskell/mwc-random

Vectorized version ?

Open
#67 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
61
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Using a state vector containing the information of 4 seeds, we could provide a new API where we get 4 random numbers at a time (using SIMD instructions for example).

The state vector would have to be "interleaved" to optimize cache usage, so that when reading or writing 4 elements, we read or write contiguous memory.

(I use the number 4 but it could be a different number depending on the Variate type (to build a double we need 2 Word32), and on the vectorization primitives available.)

I'm not familiar with haskell vector primitives but looking at GHC.Exts I saw some there, so I guess it is possible to go this way... What do you think?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the library's existing random-number API and state representation, then investigate the GHC.Exts vector primitives mentioned in the issue. Define the vector width, interleaved state layout, and supported Variate types before determining what tests and benchmarks would demonstrate a complete implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.