From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.bugs Subject: bug#30020: floating point unboxing regression in 2.2.3 Date: Mon, 28 May 2018 02:21:37 -0400 Message-ID: <87lgc4xpu6.fsf@netris.org> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1527488465 27018 195.159.176.226 (28 May 2018 06:21:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 28 May 2018 06:21:05 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cc: 30020@debbugs.gnu.org To: "Thompson\, David" Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon May 28 08:21:01 2018 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fNBWe-0006uP-0e for guile-bugs@m.gmane.org; Mon, 28 May 2018 08:21:00 +0200 Original-Received: from localhost ([::1]:54374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNBYk-0001sF-T1 for guile-bugs@m.gmane.org; Mon, 28 May 2018 02:23:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNBYf-0001rx-8D for bug-guile@gnu.org; Mon, 28 May 2018 02:23:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNBYc-0004hF-25 for bug-guile@gnu.org; Mon, 28 May 2018 02:23:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNBYb-0004h7-VF for bug-guile@gnu.org; Mon, 28 May 2018 02:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fNBYb-0003fe-M9 for bug-guile@gnu.org; Mon, 28 May 2018 02:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 28 May 2018 06:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30020 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 30020-submit@debbugs.gnu.org id=B30020.152748857714088 (code B ref 30020); Mon, 28 May 2018 06:23:01 +0000 Original-Received: (at 30020) by debbugs.gnu.org; 28 May 2018 06:22:57 +0000 Original-Received: from localhost ([127.0.0.1]:51489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fNBYX-0003fA-DI for submit@debbugs.gnu.org; Mon, 28 May 2018 02:22:57 -0400 Original-Received: from world.peace.net ([64.112.178.59]:38042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fNBYW-0003ex-El for 30020@debbugs.gnu.org; Mon, 28 May 2018 02:22:56 -0400 Original-Received: from mhw by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fNBYQ-0001yJ-A8; Mon, 28 May 2018 02:22:50 -0400 In-Reply-To: (David Thompson's message of "Sun, 7 Jan 2018 22:16:17 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9049 Archived-At: Hi David, Sorry for the long delay. "Thompson, David" writes: > Guile 2.2.3 seems to have lost some of the abilities that Guile 2.2.2 > had wrt unboxing floats. Here's a simple procedure to show the > problem. It simply adds the first two elements of an f32vector: > > (define (add-two-floats bv) > (+ (f32vector-ref bv 0) (f32vector-ref bv 1))) Thanks for the tiny test case. This helps a lot! > Here's the disassembly from 2.2.2 (note that f64->scm appears only once): > > Disassembly of # at #x7efef4006230: > > 0 (assert-nargs-ee/locals 2 1) ;; 3 slots (1 arg) at > (unknown file):22:0 > 1 (load-u64 2 0 0) at > (unknown file):23:26 > 4 (bv-f32-ref 2 1 2) > 5 (load-u64 0 0 4) at > (unknown file):23:47 > 8 (bv-f32-ref 1 1 0) > 9 (fadd 2 2 1) at > (unknown file):23:23 > 10 (f64->scm 1 2) > 11 (handle-interrupts) > 12 (return-values 2) ;; 1 value > > And here is 2.2.3: > > Disassembly of # at #x2457140: > > 0 (assert-nargs-ee/locals 2 1) ;; 3 slots (1 arg) at > (unknown file):29:0 > 1 (load-u64 2 0 0) at > (unknown file):30:26 > 4 (bv-f32-ref 2 1 2) > 5 (f64->scm 2 2) > 6 (load-u64 0 0 4) at > (unknown file):30:47 > 9 (bv-f32-ref 1 1 0) > 10 (f64->scm 1 1) > 11 (scm->f64 2 2) at > (unknown file):30:23 > 12 (scm->f64 1 1) > 13 (fadd 2 2 1) > 14 (f64->scm 1 2) > 15 (handle-interrupts) > 16 (return-values 2) ;; 1 value > > 2.2.3 is reading unboxed floats from the bytevector, boxing them, > unboxing them, then calling fadd. The result is that some formerly > well optimized code of mine that generated little to no garbage is now > generating lots of garbage. I did the moral equivalent of a git bisect, and found the culprit: commit d4883307ca64a7028b9a6cd072974437306c19d3 Author: Andy Wingo Date: Thu Nov 30 10:41:45 2017 +0100 Minor CSE run-time optimization * module/language/cps/cse.scm (compute-equivalent-subexpressions): Minor optimization to reduce the size of equivalent expression keys, and to avoid some work if an expression has no key. Fortunately, this commit can be reverted in isolation without any difficulty, and apparently without any negative consequences. If a better solution isn't found soon, perhaps that's what we should do. Andy, do you have any idea what's going on here? Thanks, Mark