[ruby-core:96766] [Ruby master Misc#16487] Potential for SIMD usage in ruby-core
[email protected] Fri, 10 Jan 2020 14:36:33 +0000 (UTC)
| Newsgroups | gmane.comp.lang.ruby.core |
|---|---|
| Message-ID | <redmine.journal-83760.20200110143632.776632baf508e499@ruby-lang.org> |
Issue #16487 has been updated by byroot (Jean Boussier).
Just to confirm, `__attribute__(target(""))` is how PHP does it: =
- https://github.com/php/php-src/blob/7ce531f2c28dcfe4aeed271b55b82de65c3=
bca8a/ext/standard/base64.c#L370-L371
- https://github.com/php/php-src/blob/7ce531f2c28dcfe4aeed271b55b82de65c3=
bca8a/Zend/zend_portability.h#L592
In the end there's indeed quite a bit of ceremonial code with a significati=
ve amount of extra `#ifdef`, but IMHO it's tolerable, and could probably be=
reduced with some macros.
> I'm more worried about code bloat, having many functions (c, sse2, avx2 v=
ersion etc...) to solve the same problem isn't DRY.
It would probably be limited to a few hotpaths though. I might be wrong, bu=
t I don't see it used beside a select few string functions.
----------------------------------------
Misc #16487: Potential for SIMD usage in ruby-core
https://bugs.ruby-lang.org/issues/16487#change-83760
* 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/pu=
ll/2, and Pavel Rosick=FD experimented on `String#strip` https://github.com=
/ruby/ruby/pull/2815.
### Problem
The downside of SIMD instructions is that they are not universally availabl=
e.
So it means maintaining several versions of the same code, and switching th=
em either statically or dynamically.
And since most Ruby users use precompiled binaries from repositories and su=
ch, 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 i=
nstructions ? And if so under which conditions.
cc @shyouhei
-- =
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>