From: XrXr@... Date: 2020-01-16T05:25:09+00:00 Subject: [ruby-core:96883] [Ruby master Misc#16487] Potential for SIMD usage in ruby-core Issue #16487 has been updated by alanwu (Alan Wu). I think we can sidestep some maintainability problems by being liberal about ripping out SIMD code if we need to make changes. Some methods basically never change and I think we might be able to write once and forget for those. Having multiple implementations leaves room for bugs, though. We also need people with enough SIMD chop to review and merge the initial implementation. It seems like there are some footguns when it comes to SIMD. For examples, a long time ago Linus Torvolds said using SIMD for `memcpy` might make multi thread programs slower due to FPU use [1] and using AVX-512 can cause the CPU to throttle[2]. [1]: https://yarchive.net/comp/linux/page_zeroing_strategy.html [2]: https://blog.cloudflare.com/on-the-dangers-of-intels-frequency-scaling/ ---------------------------------------- Misc #16487: Potential for SIMD usage in ruby-core https://bugs.ruby-lang.org/issues/16487#change-83895 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal * Assignee: ---------------------------------------- ### Context There are several ruby core methods that could be optimized with the use of SIMD instructions. I experimented a bit on `coderange_scan` https://github.com/Shopify/ruby/pull/2, and Pavel Rosick� experimented on `String#strip` https://github.com/ruby/ruby/pull/2815. ### Problem The downside of SIMD instructions is that they are not universally available. So it means maintaining several versions of the same code, and switching them either statically or dynamically. And since most Ruby users use precompiled binaries from repositories and such, it would need to be dynamic if we want most users to benefit from it. So it's not exactly "free speed", as it means a complexified codebase. ### Question So the question is to know wether ruby-core is open to patches using SIMD instructions ? And if so under which conditions. cc @shyouhei -- https://bugs.ruby-lang.org/ Unsubscribe: