Adventures in SIMD-Thinking (part 1 of 2)
summary
Builds a small C++ API around AVX-512 intrinsics (unaligned and masked loads/stores, permute/rotate/shift, fused multiply-add) and implements a compare-and-exchange sorting network that sorts 16 32-bit lanes using six phases (~24 intrinsics). Uses that to deliver a register-level median-of-7 filter (two medians per 512-bit register). Tests on Cascade Lake Xeon with GCC/Clang show the AVX version is correct and much faster: about 4× faster vs libstdc++ for sorted data and ~18× faster for random data with GCC (smaller but similar gains with Clang).
AI-written summary · about
chapters (14)
- 0:00Introduction
- 2:50Fundamentals
- 5:45Register Operations
- 11:02Permutation
- 14:04Rotation and Shifting
- 17:26Register Shifting
- 20:04Math Functions
- 22:48Sorting Primitive
- 24:51Sorting Networks
- 28:41Median Filter
- 32:33Median Algorithm
- 39:20Median Sort
- 42:41Performance
- 49:21Q&A
related talks
04mLightning Talk: How to Leverage SIMD Intrinsics for Massive Slowdowns
01h 03mCompute More in Less Time Using C++ Simd Wrapper Libraries
01h 06m“Improving Performance Through Compiler Switches..."
01h 04mDesign for Performance
06mLightning Talk: Use SIMD Pairwise Reduction in C++!
01h 08mFrom Numerical Cosmology to Efficient Bit Abstractions for the Standard Library
35mAlgorithmic and microarchitecture optimizations of C++ applications
01h 21mCPU optimized data structures - more fun with assembler
