From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.6 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 9563A1F885 for ; Fri, 10 Jan 2020 14:36:42 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A66BC120AC5; Fri, 10 Jan 2020 23:36:29 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 535FF120AC4 for ; Fri, 10 Jan 2020 23:36:26 +0900 (JST) Received: by filterdrecv-p3iad2-57f487d66-fs626 with SMTP id filterdrecv-p3iad2-57f487d66-fs626-20-5E188BF1-6 2020-01-10 14:36:33.047147848 +0000 UTC m=+661728.819244708 Received: from herokuapp.com (unknown [54.166.107.205]) by ismtpd0021p1iad2.sendgrid.net (SG) with ESMTP id dPcamIqlQSqtWnAkF6oW4A for ; Fri, 10 Jan 2020 14:36:32.794 +0000 (UTC) Date: Fri, 10 Jan 2020 14:36:33 +0000 (UTC) From: jean.boussier@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72429 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 16487 X-Redmine-Issue-Author: byroot X-Redmine-Sender: byroot X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?AchqQMoUBMcQgz7gop0XiYUiatGIY7E61JGsTL4FvjcZ7paUREq+Q+lLMpyOGu?= =?us-ascii?Q?I9fchSng3MbndEAN9wDqwmAtJ2x4WE1bqHN6GBU?= =?us-ascii?Q?FyH6kPhg1QOr6h0AcafLa7mWpWEb4Ugkq4IZH94?= =?us-ascii?Q?uDH8Cai+CthDZz6yZUZtvsckHEzQl3Sf9q6SkZQ?= =?us-ascii?Q?NdC3Qgyy7yv+tKqmz1qDdWxRPnkzYVkpHhZkVG7?= =?us-ascii?Q?GuD37nEe2bBKQkn2w=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96766 Subject: [ruby-core:96766] [Ruby master Misc#16487] Potential for SIMD usage in ruby-core X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" 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: