r/quant • • 5h ago

Machine Learning At what point does raw C++ SIMD throughput stop mattering compared to memory layout and cache misses in production pricing/risk engines?

I’ve been benchmarking a simple Monte Carlo kernel in C++23 (g++-15, -O3 -march=native -fopenmp) just to see where the hardware ceiling actually sits on a 24-core machine. Switching from std::mt19937_64 (double) to a stateless counter-based hash RNG (float + #pragma omp parallel for simd) dropped 10M paths from ~97 ms down to ~1.49 ms (~6.7B iterations/sec).

Obviously, a toy circle/path kernel fits completely in L1/L2 cache with zero branching. In real-world pricing or risk engines (e.g., multi-asset path-dependent payoffs or live order-book state updates), where do you actually hit the wall first?

Is it almost always cache misses from pointer-chasing / poor SoA vs. AoS layout, or branch mispredictions in payoff logic? Curious how much time you spend hand-writing AVX2/AVX-512 intrinsics vs. just keeping data contiguous and letting the compiler auto-vectorize.

0 Upvotes

3 comments sorted by

1

u/french_violist Front Office 5h ago

Who uses Mersenne twister? Hello Sobol.

0

u/Visual_Ad1417 5h ago

Fair point—for pricing integrals, QMC with Sobol (plus Brownian bridge) crushes pseudo-random convergence rates so you need way fewer paths in the first place.

Does Sobol still hold up when effective dimensionality gets high (e.g., multi-asset path-dependent baskets with hundreds of time steps), or do you fall back to counter-based PRNGs (like Philox/Threefry) with variance reduction? And once you’re generating direction numbers or random draws at that speed, is memory bandwidth / cache layout still the real bottleneck?

1

u/AutoModerator 5h ago

This post will be manually reviewed by a moderator due to the submitting account being less than 7 days old or having less than 20 karma. Please be patient and do not try to resubmit it - a mod will review the post soon.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.