[ruby-core:96844] [Ruby master Misc#16487] Potential for SIMD usage in ruby-core

From: jean.boussier@...
Date: 2020-01-14 09:43:17 UTC
List: ruby-core #96844
Issue #16487 has been updated by byroot (Jean Boussier).


> It should be decided based on not micro benchmark

That's understandable. I'll try to produce a proper macro benchmark against https://github.com/Shopify/ruby/pull/2. I also agree that Rails apps are probably the best thing to benchmark, as they're quite string heavy.

> How to coordinate configure and ifdefs. What is the default behavior? How to specify to use SIMD?

I started working on that a bit: https://github.com/ruby/ruby/commit/2e9198a3af6eb8df8c9ebe40c4bb23b7e30a953d

The idea is to have different functions, and to select which implementation to use based on CPUID.

----------------------------------------
Misc #16487: Potential for SIMD usage in ruby-core
https://bugs.ruby-lang.org/issues/16487#change-83849

* 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 Rosickexperimented 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next