This project is a small example comparison of 4-wide ray-bounding-box intersection implemented using two different scalar approaches, using SSE, and using Neon. The specific ray-bounding-box intersection algorithm implemented is adapted from "An Efficient and Robust Ray-Box Intersection Algorithm" by Amy Williams, Steve Barrus, Keith Morley, and Peter Shirley, 2005.
This project is an accompaniment to my blog post, "Comparing SIMD on x86-64 and arm64". For a thorough walkthrough of the code and explanation for what the code does, please see the blog post.
The arm64 build depends on sse2neon for the SSE implementation. sse2neon is included as a submodule; please clone using the following:
git clone --recursive
You will need a modern C++ compiler with support for C++17, and you will need a version of ispc with Neon support (v1.16.1 or newer).
To build, you will need CMake 3.19 or newer.
cmake . && make && ./sseneoncompare
The x86_64 build includes both scalar implementations and the SSE implementation. The arm64 build includes both scalar implementations, the SSE implementation (using sse2neon), and the Neon implementation.
When run, the program will run each ray-bounding-box intersection implementation 1000 times and report the total time taken.
Unfortunately, on macOS 11 and up, automatically building a Universal Binary with x86_64 and arm64 support does not work due to CMake's ispc support not working with Universal Binary support yet.
Copyright (c) Yining Karl Li 2021. Licensed under Apache 2.0 (see LICENSE.txt for details).