google-deepmind / alphadev

Apache License 2.0
674 stars 67 forks source link

Can we apply the optimized VarSort5 to the LLVM C++ standard library #4

Closed laoshucike closed 11 months ago

laoshucike commented 1 year ago

Following the same idea of adding sort3, sort4, and sort5 to the LLVM C++ standard library, is it possible to reverse engineer the VarSort5 assembly code and use it in the LLVM C++ standard library?

Notice that in the current LLVM C++ sort implementation, a function similar to VarSort5 is used: https://github.com/llvm/llvm-project/blob/main/libcxx/include/__algorithm/sort.h#L711-L730.

I'm not sure how much performance gain it would get, and whether the maintainer likes the idea. Based on the paper, the VarSort5 reduces latency by around 6% compared to the human benchmark.

Looking for comments. Thanks!

andydude commented 12 months ago

You should also measure correctness.