Jump to ratings and reviews
Rate this book

C++ Branchless Coding: CPU and GPU Efficiency

Rate this book
C++ Branchless CPU and GPU Efficiency. Let's make your code run straight and lean on a fast CPU and GPU. Remove branches from conditionals, short-circuited operators, multiway branches, loops, and function calls. Build up to larger algorithms with efficient branchless minikernels.


- CPU Branch Prediction -- avoid instruction cache misses
- GPU Warp Convergence -- avoid thread divergence
- Low latency programming -- branchless, loop unrolling.
- Minikernel optimizations -- vector dot product, GEMM.

Table of Contents

Part Foundations
1. Branchless Introduction
2. Branchless Coding Techniques
3. CPU Branch Prediction
4. GPU Warp Divergence
5. Branchless Pitfalls
Part Branchless Compute Sequences
6. Integer Bitwise Operations
7. Floating-Point Formats
8. Floating-Point Bit Tricks
9. Arithmetic Optimizations
10. Integer Overflow, Saturation and Clamping
11. Fixed-Point and Block-Floating Point
Part Conditional Branch Elimination
12. Branchless Conditional Tests
13. Short-Circuiting Operators
14. Multiway Branch Removal
Part Loop Branch Reduction
15. Loop Transformations
16. Loop Unrolling
Part Branchless Minikernels
18. AVX SIMD Vectorization
19. AVX Intrinsics
20. SWAR Techniques
Part Call Hierarchy Flattening
21. Inline Functions
22. Recursion Removal
Part Linear Algebra
23. Vector Dot Product
24. MatMul/GEMM Kernels
Part Metaprogramming
25. Compile-Time Optimizations
26. Zero Runtime Cost Operations
27. Lookup Tables & Precomputation
28. Perfect Hashing
Part Compute Parallelism
29. Instruction-Level Parallelism
30. Compute-Unit Parallelism
31. Software Emulation
Appendices
Appendix Long List of Low Latency Techniques
Appendix C++ Slug Catalog

527 pages, Kindle Edition

Published June 5, 2026

Loading...
Loading...

About the author

David Spuler

27 books8 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
0 (0%)
4 stars
0 (0%)
3 stars
0 (0%)
2 stars
0 (0%)
1 star
0 (0%)
No one has reviewed this book yet.