Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 42F1A200CAE for ; Wed, 7 Jun 2017 02:15:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 41ED3160BD3; Wed, 7 Jun 2017 00:15:44 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 62630160BC6 for ; Wed, 7 Jun 2017 02:15:43 +0200 (CEST) Received: (qmail 25139 invoked by uid 500); 7 Jun 2017 00:15:42 -0000 Mailing-List: contact dev-help@impala.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@impala.incubator.apache.org Delivered-To: mailing list dev@impala.incubator.apache.org Received: (qmail 25128 invoked by uid 99); 7 Jun 2017 00:15:42 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2017 00:15:42 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 26EE11A01EC for ; Wed, 7 Jun 2017 00:15:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.02 X-Spam-Level: X-Spam-Status: No, score=-3.02 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, WEIRD_PORT=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 2xtgNfd6evqd for ; Wed, 7 Jun 2017 00:15:39 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 1A47E5F642 for ; Wed, 7 Jun 2017 00:15:37 +0000 (UTC) Received: (qmail 25098 invoked by uid 99); 7 Jun 2017 00:15:37 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2017 00:15:37 +0000 Received: from mail-ua0-f170.google.com (mail-ua0-f170.google.com [209.85.217.170]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id EF52C1A003E for ; Wed, 7 Jun 2017 00:15:36 +0000 (UTC) Received: by mail-ua0-f170.google.com with SMTP id m31so7369044uam.1 for ; Tue, 06 Jun 2017 17:15:36 -0700 (PDT) X-Gm-Message-State: AODbwcBa2LkrXf96OMVDb266nLUUBgiTATLdy+DSjHcxqEX4qOveee8N gUT5ktpZor0yGRQV2Vv7lBMdmKw7fFTi X-Received: by 10.176.2.82 with SMTP id 76mr7060309uas.152.1496794536126; Tue, 06 Jun 2017 17:15:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.68.37 with HTTP; Tue, 6 Jun 2017 17:15:35 -0700 (PDT) Received: by 10.176.68.37 with HTTP; Tue, 6 Jun 2017 17:15:35 -0700 (PDT) In-Reply-To: References: From: Todd Lipcon Date: Tue, 6 Jun 2017 17:15:35 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Fwd: [kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade To: "dev@impala" Content-Type: multipart/alternative; boundary="001a113e4c24a0db38055153a23e" archived-at: Wed, 07 Jun 2017 00:15:44 -0000 --001a113e4c24a0db38055153a23e Content-Type: text/plain; charset="UTF-8" FYI Impala folks: you might hit this issue when you upgrade to llvm 4.0 as well. Something to be aware of ---------- Forwarded message ---------- From: "Todd Lipcon (Code Review)" Date: Jun 6, 2017 5:06 PM Subject: [kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade To: "Dan Burkert" , "David Ribeiro Alves" < davidralves@gmail.com>, "Binglin Chang" , < reviews@kudu.incubator.apache.org> Cc: "Todd Lipcon" Hello Dan Burkert, I'd like you to do a code review. Please visit http://gerrit.cloudera.org:8080/7099 to review the following change. Change subject: codegen: fix regression in inlining after LLVM 4.0 upgrade ...................................................................... codegen: fix regression in inlining after LLVM 4.0 upgrade With the upgrade to LLVM 4.0, the performance of our generated code regressed significantly. After looking at the generated assembly from codegen-test, I could see that there were many 'call' instructions that didn't appear in the earlier output, which led me to suspect the inliner. After adding a 'module->dump()' call and looking at the output, I could see that the calls were to utility functions like BitmapTest() which should be inlined due to be very small. However, the function was marked 'noinline' in precompiled.ll. After a bit of Googling I came across a thread[1] in which someone else noticed that all of their functions had unexpected 'noinline' attributes after upgrading to 4.0. After following the breadcrumbs, I found some advice to change the way in which we emit precompiled.ll to disable the built-in LLVM passes which were responsible for adding this attribute. During my investigation, I also found that we should have been passing the optimization and size levels into the inlining pass, so I threw that change in for good measure. This fixed the perf regression. I benchmarked using: memrowset-test --roundtrip_num_rows=10000000 \ --gtest_filter=\*InsertCount\* \ --gtest_repeat=10 Before this fix: I0606 16:55:51.448117 48991 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.502s user 0.502s sys 0.000s I0606 16:55:57.937391 48991 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.500s user 0.499s sys 0.000s I0606 16:56:04.330037 48991 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.498s user 0.499s sys 0.000s I0606 16:56:10.706786 48991 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.504s user 0.503s sys 0.001s I0606 16:56:17.094764 48991 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.510s user 0.510s sys 0.000s I0606 16:56:23.474200 48991 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.502s user 0.502s sys 0.000s I0606 16:56:29.845799 48991 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.503s user 0.503s sys 0.000s I0606 16:56:36.221843 48991 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.502s user 0.503s sys 0.000s I0606 16:56:42.599604 48991 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.502s user 0.503s sys 0.000s I0606 16:56:48.962482 48991 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.503s user 0.502s sys 0.000s After this fix: I0606 16:53:51.573541 48403 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.302s user 0.302s sys 0.000s I0606 16:53:57.922485 48403 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.301s user 0.301s sys 0.000s I0606 16:54:04.186511 48403 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.310s user 0.310s sys 0.000s I0606 16:54:10.425207 48403 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.313s user 0.313s sys 0.000s I0606 16:54:16.648202 48403 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.316s user 0.316s sys 0.000s I0606 16:54:22.868655 48403 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.311s user 0.312s sys 0.000s I0606 16:54:29.081784 48403 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.313s user 0.314s sys 0.000s I0606 16:54:35.317623 48403 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.314s user 0.312s sys 0.003s I0606 16:54:41.550542 48403 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.316s user 0.315s sys 0.000s I0606 16:54:47.761406 48403 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.314s user 0.314s sys 0.000s I also manually inspected the assembly from codegen-test and compared vs a version compiled with LLVM 3.9 and found that it now has fewer instructions than before. [1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/113175.html Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf --- M src/kudu/codegen/CMakeLists.txt M src/kudu/codegen/module_builder.cc 2 files changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/99/7099/1 -- To view, visit http://gerrit.cloudera.org:8080/7099 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf Gerrit-PatchSet: 1 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Todd Lipcon Gerrit-Reviewer: Dan Burkert --001a113e4c24a0db38055153a23e--