-
Notifications
You must be signed in to change notification settings - Fork 81
assume_aligned vs. std::assume_aligned #134
Description
Vectorscan uses a macro assume_aligned(x, y) in a few places (see files "src/util/simd_utils.h", "src/util/supervector/supervector.hpp") which maps to __builtin_assume_aligned() on systems which support that.
We (ClickHouse) use vectorscan as a third-party library. I currently try to upgrade our (LLVM) libcxx (= the C++ standard library) from 14 to 15. Libcxx 15 provides an implementation of std::assume_aligned which is part of the C++20 standard. I noticed that the standard library implementation and the macro definition in vectorscan clash and break compilation.
My initial attempt to fix this was to prefix vectorscan's macro as vectorscan_assume_aligned(x, y) and to rename all vectorscan-interal usages of the macro accordingly. That made the compiler happy and I think it is a viable interim solution.
Unfortunately, it looks like I somehow don't have rights to open a pull request in this repository so I could not upstream the patch. I also could not create a fork of vectorscan in our (ClickHouse's) organization because vectorscan is a fork of hyperscan, we already have an (archived) fork of hyperscan in our organization and GitHub doesn't allow forking a fork if the parent already exists in an organization 😞 So to make things work on our end and resolve the clash, I ended up commenting out std::assume_aligned in libcxx 15.
It would be great if you could prefix assume_aligned() in vectorscan or convert the code to use std::assume_aligned directly (if you are not afraid of the C++20 dependency).