PrimeLister 3.2–3.4.1: Cache-, SIMD-, and Memory-Bandwidth Optimization of Modulo-6 Prime Enumeration with Full RAM Materialization and Matched Comparison Against primesieve 12.18
This technical report (Revision 2.1) documents four progressive C++17 microarchitectural revisions of the PrimeLister prime-enumeration kernel—versions 3.2, 3.3, 3.4, and 3.4.1—building directly on PrimeLister v2.9 (Zenodo 18428535) and PrimeLister v3.1.1 (Zenodo 22979590). All revisions strictly preserve the author's original modulo-6 candidate mapping c(i) = 3i + ((i & 1) ? 4 : 5) and both composite-marking progressions (start = floor(p^2 / 3) - 1 and start = floor(p * (p + delta(p)) / 3) - 1, stride 2p), while optimizing cache residency, vectorization, branch behavior, and DRAM write bandwidth for full 64-bit RAM materialization. Key Engineering Changes (v3.1.1 -> v3.4.1):- v3.2: 32 KiB L1-resident segments, 8-pattern fused presieving (primes 5..73), chunk-amortized offsets, fused 8-mark/branch small-prime loops, bucket sieving for large primes, hardware POPCNT, and pre-allocated uninitialized chunk blocks.- v3.3: 16-pattern 2 KiB-tiled AVX2 presieving (primes 5..163), switch-free 8-lane stride-p and flat 64-bit word marking, 64-byte aligned chunks, and L1 staging with AVX2 non-temporal stores (_mm256_stream_si256) to bypass DRAM write-allocate traffic.- v3.4: 24 KiB segments tuned for dual-SMT Zen 5 L1d residency (2 x 24 KiB = 48 KiB), AVX-512 VPTERNLOGQ presieving, branchless 4-way unrolled AVX-512 VPCOMPRESSQ extraction, and 64-byte full-cacheline non-temporal stores (_mm512_stream_si512).- v3.4.1: Combines v3.3's power-of-two 32 KiB shift-indexed sieve engine (BUCKET_LIMIT = 131,072) with v3.4's full AVX-512 VPTERNLOGQ / VPCOMPRESSQ / 64-byte NT store pipeline, eliminating non-power-of-two bucket division overhead for N >= 1.5e10. Summary of Matched Benchmark Results (AMD Ryzen 9 9955HX, 16 cores / 32 threads, 32 GB DDR5, Windows 11, MSVC 195136257, /arch:AVX512, full uint64_t RAM materialization):1) Internal Multi-Version Evolution (Benchmarker 2.0, N = 10^6 .. 1.5e10, 10 interleaved randomized rounds, 400 timed runs, 361,992 verified primes): - Peak mean throughput: PrimeLister 3.4 reached 3.510 +/- 0.462 billion primes/s at N = 1.8e9 (median 3.684 B/s, max 3.949 B/s; 2.22x mean / 2.39x median speedup vs. v3.1.1). - At N = 5.2e9 (1.951 GB payload): v3.4 reached 3.268 +/- 0.252 B/s (2.12x vs. v3.1.1). - At N = 1.5e10 (670,180,516 primes; 5.361 GB payload): v3.3 reached 2.967 +/- 0.331 B/s (median 3.082 B/s; 2.12x vs. v3.1.1) vs. v3.4 at 2.712 +/- 0.158 B/s (1.94x). All 520 summary statistics were independently audited from raw logs to within 5.2e-16 relative error. 2) Matched Head-to-Head Comparison Against Kim Walisch's primesieve 12.18 (v2.1 harness, isolated sessions at N = 1e9, 5e9, 1e10, 1.5e10, n = 5 interleaved rounds per N): - 32-Thread RAM Materialization: All three PrimeLister variants (v3.3, v3.4, v3.4.1) outperformed OpenMP-parallelized primesieve 12.18 (primesieve_OMP_MT) at every tested limit by +22% to +38% mean (+19% to +51% median), and out-of-the-box single-threaded primesieve::generate_primes() by 7.3x to 9.1x. - Regime crossover: v3.4 led up to N = 1e10 (3.712 B/s at 1e9, median 3.999 B/s; 3.523 B/s at 5e9; 3.557 B/s at 1e10), while v3.4.1 took first place at N = 1.5e10 with 3.332 +/- 0.156 B/s (0.2015 s, max 3.491 B/s; +12.7% over v3.4; +29.0% mean / +36.4% median over primesieve_OMP_MT at 2.582 B/s). - Single-Thread RAM & Counting-Only: In 1T RAM mode, v3.4.1 outperformed v3.4 across all limits (+1.4% to +9.1%) and matched primesieve 12.18 within 2.9% at 1e9 (0.396 vs. 0.408 B/s), whereas primesieve 12.18 retained the lead on larger 1T ranges (0.456 vs. 0.285 B/s at 1.5e10) and in 32T counting-only mode (7.083 vs. 5.174 B/s at 1.5e10) due to its modulo-210 wheel and AVX-512 VPOPCNTDQ. Verification & Reproducibility:Every benchmark executable verified all four/three kernels element-by-element at N = 10^6 (78,498 primes) against an independent reference sieve / primesieve 12.18, enforced cross-model prime-count identity on all runs, performed deterministic 64-bit Miller-Rabin verification on large materialized outputs, and logged cryptographic SHA-256 hashes of both executables and all unmodified C++ kernel source files. License & Authorship Disclosure:Tobias Jung originated the PrimeLister modulo-6 construction, directed all design and benchmarking campaigns, compiled all binaries, and executed all Windows benchmarks. Generative AI assisted with C++ SIMD/cache optimization, benchmark-harness engineering, raw-log auditing, and manuscript preparation.
Authors
- Tobias Jung
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-23
- DOI
- https://doi.org/10.5281/zenodo.24451602
- Primary Topic
- Parallel Computing and Optimization Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00