You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Todd Lipcon (Code Review)" <ge...@cloudera.org> on 2017/06/07 00:06:15 UTC

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

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 <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>

Re: [kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by Tim Wood <tw...@cloudera.com>.
Super interesting!  Nice sleuthing!
TW
Impala QE

On Tue, Jun 6, 2017 at 5:15 PM, Todd Lipcon <to...@apache.org> wrote:

> 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)" <ge...@cloudera.org>
> Date: Jun 6, 2017 5:06 PM
> Subject: [kudu-CR] codegen: fix regression in inlining after LLVM 4.0
> upgrade
> To: "Dan Burkert" <da...@apache.org>, "David Ribeiro Alves" <
> davidralves@gmail.com>, "Binglin Chang" <de...@gmail.com>, <
> reviews@kudu.incubator.apache.org>
> Cc: "Todd Lipcon" <to...@apache.org>
>
> 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 <to...@apache.org>
> Gerrit-Reviewer: Dan Burkert <da...@apache.org>
>

Fwd: [kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by Todd Lipcon <to...@apache.org>.
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)" <ge...@cloudera.org>
Date: Jun 6, 2017 5:06 PM
Subject: [kudu-CR] codegen: fix regression in inlining after LLVM 4.0
upgrade
To: "Dan Burkert" <da...@apache.org>, "David Ribeiro Alves" <
davidralves@gmail.com>, "Binglin Chang" <de...@gmail.com>, <
reviews@kudu.incubator.apache.org>
Cc: "Todd Lipcon" <to...@apache.org>

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 <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: codegen: fix regression in inlining after LLVM 4.0 upgrade
......................................................................


Patch Set 6: Code-Review+2 Verified+1

-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 6
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/7099

to look at the new patch set (#5).

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 their very small size. 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.

This had one unintended side-effect which initially broke codegen in
TSAN builds (which use libc++ instead of libstdcxx). Fixing this required
changing the debug builds to still run the most basic ('-O0')
optimization passes at JIT time instead of skipping the optimization
pass manager entirely. Additionally I needed to explicitly run Global
Dead Code Elimination (GlobalDCE). See the new comments in
module_builder.cc for details.

That also caused the size of generated code in UBSAN builds to increase,
so I had to increase the limit on the number of dumped instructions per
function to avoid breaking one of the tests.

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

LLVM 3.9 (before the regression) (asm at [2]):

  I0607 12:00:17.540612 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s    user 0.294s     sys 0.000s
  I0607 12:00:23.842226 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:29.710149 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:35.587321 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:41.451495 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:47.309710 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:53.183537 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:59.051522 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:01:04.935763 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.298s     sys 0.000s
  I0607 12:01:10.821828 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.299s     sys 0.000s

LLVM 4.0 (before this fix) (asm at [3]):

  I0607 12:14:07.771476 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.524s    user 0.525s     sys 0.000s
  I0607 12:14:14.283260 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.525s    user 0.525s     sys 0.000s
  I0607 12:14:20.376360 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.543s    user 0.543s     sys 0.000s
  I0607 12:14:26.457681 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.530s    user 0.530s     sys 0.000s
  I0607 12:14:32.535305 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:38.615105 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.532s     sys 0.000s
  I0607 12:14:44.697655 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.531s     sys 0.000s
  I0607 12:14:50.779160 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:56.852665 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.530s     sys 0.000s
  I0607 12:15:02.954947 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.538s    user 0.540s     sys 0.000s

LLVM 4.0 (after this fix) (asm at [4]):

  I0607 12:17:37.953876 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:17:44.214912 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s      user 0.295s     sys 0.000s
  I0607 12:17:50.057200 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.299s      user 0.299s     sys 0.000s
  I0607 12:17:55.882935 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:18:01.725445 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:07.562417 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:13.421221 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:19.268613 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:25.113490 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:30.950954 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s

Looking at the assembly for the three tests above, it's clear that the
inlining is broken in 4.0 without this fix, and with it, the generated
assembly is a little better (shorter) than 3.9.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/113175.html
[2] https://gist.github.com/b4b0365ea1570f33d55c6c3dffd4a8af
[3] https://gist.github.com/128ecb292fddd069d5397a76dc53fc11
[4] https://gist.github.com/0cb01f454737d6c2dc457f0cdb6bb52d

Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
---
M src/kudu/codegen/CMakeLists.txt
M src/kudu/codegen/code_generator.cc
M src/kudu/codegen/codegen-test.cc
M src/kudu/codegen/module_builder.cc
4 files changed, 53 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/99/7099/5
-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 5
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Dan Burkert, David Ribeiro Alves, Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/7099

to look at the new patch set (#6).

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 their very small size. 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.

This had one unintended side-effect which initially broke codegen in
TSAN builds (which use libc++ instead of libstdcxx). Fixing this required
changing the debug builds to still run the most basic ('-O0')
optimization passes at JIT time instead of skipping the optimization
pass manager entirely. Additionally I needed to explicitly run Global
Dead Code Elimination (GlobalDCE). See the new comments in
module_builder.cc for details.

That also caused the size of generated code in UBSAN builds to increase,
so I had to increase the limit on the number of dumped instructions per
function to avoid breaking one of the tests.

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

LLVM 3.9 (before the regression) (asm at [2]):

  I0607 12:00:17.540612 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s    user 0.294s     sys 0.000s
  I0607 12:00:23.842226 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:29.710149 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:35.587321 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:41.451495 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:47.309710 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:53.183537 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:59.051522 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:01:04.935763 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.298s     sys 0.000s
  I0607 12:01:10.821828 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.299s     sys 0.000s

LLVM 4.0 (before this fix) (asm at [3]):

  I0607 12:14:07.771476 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.524s    user 0.525s     sys 0.000s
  I0607 12:14:14.283260 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.525s    user 0.525s     sys 0.000s
  I0607 12:14:20.376360 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.543s    user 0.543s     sys 0.000s
  I0607 12:14:26.457681 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.530s    user 0.530s     sys 0.000s
  I0607 12:14:32.535305 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:38.615105 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.532s     sys 0.000s
  I0607 12:14:44.697655 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.531s     sys 0.000s
  I0607 12:14:50.779160 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:56.852665 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.530s     sys 0.000s
  I0607 12:15:02.954947 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.538s    user 0.540s     sys 0.000s

LLVM 4.0 (after this fix) (asm at [4]):

  I0607 12:17:37.953876 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:17:44.214912 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s      user 0.295s     sys 0.000s
  I0607 12:17:50.057200 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.299s      user 0.299s     sys 0.000s
  I0607 12:17:55.882935 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:18:01.725445 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:07.562417 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:13.421221 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:19.268613 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:25.113490 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:30.950954 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s

Looking at the assembly for the three tests above, it's clear that the
inlining is broken in 4.0 without this fix, and with it, the generated
assembly is a little better (shorter) than 3.9.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/113175.html
[2] https://gist.github.com/b4b0365ea1570f33d55c6c3dffd4a8af
[3] https://gist.github.com/128ecb292fddd069d5397a76dc53fc11
[4] https://gist.github.com/0cb01f454737d6c2dc457f0cdb6bb52d

Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
---
M src/kudu/codegen/CMakeLists.txt
M src/kudu/codegen/code_generator.cc
M src/kudu/codegen/codegen-test.cc
M src/kudu/codegen/module_builder.cc
4 files changed, 53 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/99/7099/6
-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 6
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.

Change subject: codegen: fix regression in inlining after LLVM 4.0 upgrade
......................................................................


Patch Set 1:

(3 comments)

http://gerrit.cloudera.org:8080/#/c/7099/1//COMMIT_MSG
Commit Message:

PS1, Line 17: due to be very small
> wording
Done


PS1, Line 50: 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
> curious, how do these compare to the numbers before the regression?
will do


http://gerrit.cloudera.org:8080/#/c/7099/1/src/kudu/codegen/CMakeLists.txt
File src/kudu/codegen/CMakeLists.txt:

PS1, Line 120:  Disable built-in LLVM passes which would add 'noinline' attributes to all
             : # standalone functions.
> is there a way to disable that specific no-inlining pass? are we leaving pr
The thing is that we end up doing the optimization at the later stage (during codegen). What we didn't realize is that even without any "-O" options, Clang was running some optimization passes during the 'precompilation' stage. Now we're doing what we expect and not running any at all, and deferring all optimization until JIT time.


-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has submitted this change and it was merged.

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 their very small size. 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.

This had one unintended side-effect which initially broke codegen in
TSAN builds (which use libc++ instead of libstdcxx). Fixing this required
changing the debug builds to still run the most basic ('-O0')
optimization passes at JIT time instead of skipping the optimization
pass manager entirely. Additionally I needed to explicitly run Global
Dead Code Elimination (GlobalDCE). See the new comments in
module_builder.cc for details.

That also caused the size of generated code in UBSAN builds to increase,
so I had to increase the limit on the number of dumped instructions per
function to avoid breaking one of the tests.

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

LLVM 3.9 (before the regression) (asm at [2]):

  I0607 12:00:17.540612 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s    user 0.294s     sys 0.000s
  I0607 12:00:23.842226 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:29.710149 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:35.587321 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:41.451495 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:47.309710 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:53.183537 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:59.051522 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:01:04.935763 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.298s     sys 0.000s
  I0607 12:01:10.821828 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.299s     sys 0.000s

LLVM 4.0 (before this fix) (asm at [3]):

  I0607 12:14:07.771476 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.524s    user 0.525s     sys 0.000s
  I0607 12:14:14.283260 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.525s    user 0.525s     sys 0.000s
  I0607 12:14:20.376360 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.543s    user 0.543s     sys 0.000s
  I0607 12:14:26.457681 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.530s    user 0.530s     sys 0.000s
  I0607 12:14:32.535305 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:38.615105 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.532s     sys 0.000s
  I0607 12:14:44.697655 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.531s     sys 0.000s
  I0607 12:14:50.779160 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:56.852665 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.530s     sys 0.000s
  I0607 12:15:02.954947 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.538s    user 0.540s     sys 0.000s

LLVM 4.0 (after this fix) (asm at [4]):

  I0607 12:17:37.953876 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:17:44.214912 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s      user 0.295s     sys 0.000s
  I0607 12:17:50.057200 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.299s      user 0.299s     sys 0.000s
  I0607 12:17:55.882935 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:18:01.725445 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:07.562417 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:13.421221 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:19.268613 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:25.113490 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:30.950954 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s

Looking at the assembly for the three tests above, it's clear that the
inlining is broken in 4.0 without this fix, and with it, the generated
assembly is a little better (shorter) than 3.9.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/113175.html
[2] https://gist.github.com/b4b0365ea1570f33d55c6c3dffd4a8af
[3] https://gist.github.com/128ecb292fddd069d5397a76dc53fc11
[4] https://gist.github.com/0cb01f454737d6c2dc457f0cdb6bb52d

Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Reviewed-on: http://gerrit.cloudera.org:8080/7099
Reviewed-by: Todd Lipcon <to...@apache.org>
Tested-by: Todd Lipcon <to...@apache.org>
---
M src/kudu/codegen/CMakeLists.txt
M src/kudu/codegen/code_generator.cc
M src/kudu/codegen/codegen-test.cc
M src/kudu/codegen/module_builder.cc
4 files changed, 53 insertions(+), 12 deletions(-)

Approvals:
  Todd Lipcon: Looks good to me, approved; Verified



-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 7
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/7099

to look at the new patch set (#4).

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 their very small size. 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.

This had one unintended side-effect which initially broke codegen in
TSAN builds (which use libc++ instead of libstdcxx). Fixing this required
changing the debug builds to still run the most basic ('-O0')
optimization passes at JIT time instead of skipping the optimization
pass manager entirely. See the new comment in module_builder.cc for
details.

That also caused the size of generated code in UBSAN builds to increase,
so I had to increase the limit on the number of dumped instructions per
function to avoid breaking one of the tests.

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

LLVM 3.9 (before the regression) (asm at [2]):

  I0607 12:00:17.540612 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s    user 0.294s     sys 0.000s
  I0607 12:00:23.842226 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:29.710149 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:35.587321 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:41.451495 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:47.309710 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:53.183537 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:59.051522 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:01:04.935763 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.298s     sys 0.000s
  I0607 12:01:10.821828 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.299s     sys 0.000s

LLVM 4.0 (before this fix) (asm at [3]):

  I0607 12:14:07.771476 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.524s    user 0.525s     sys 0.000s
  I0607 12:14:14.283260 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.525s    user 0.525s     sys 0.000s
  I0607 12:14:20.376360 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.543s    user 0.543s     sys 0.000s
  I0607 12:14:26.457681 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.530s    user 0.530s     sys 0.000s
  I0607 12:14:32.535305 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:38.615105 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.532s     sys 0.000s
  I0607 12:14:44.697655 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.531s     sys 0.000s
  I0607 12:14:50.779160 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:56.852665 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.530s     sys 0.000s
  I0607 12:15:02.954947 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.538s    user 0.540s     sys 0.000s

LLVM 4.0 (after this fix) (asm at [4]):

  I0607 12:17:37.953876 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:17:44.214912 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s      user 0.295s     sys 0.000s
  I0607 12:17:50.057200 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.299s      user 0.299s     sys 0.000s
  I0607 12:17:55.882935 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:18:01.725445 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:07.562417 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:13.421221 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:19.268613 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:25.113490 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:30.950954 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s

Looking at the assembly for the three tests above, it's clear that the
inlining is broken in 4.0 without this fix, and with it, the generated
assembly is a little better (shorter) than 3.9.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/113175.html
[2] https://gist.github.com/b4b0365ea1570f33d55c6c3dffd4a8af
[3] https://gist.github.com/128ecb292fddd069d5397a76dc53fc11
[4] https://gist.github.com/0cb01f454737d6c2dc457f0cdb6bb52d

Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
---
M src/kudu/codegen/CMakeLists.txt
M src/kudu/codegen/code_generator.cc
M src/kudu/codegen/module_builder.cc
3 files changed, 35 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/99/7099/4
-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 4
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/7099

to look at the new patch set (#3).

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 their very small size. 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.

This had one unintended side-effect which initially broke codegen in
TSAN builds (which use libc++ instead of libstdcxx). Fixing this required
changing the debug builds to still run the most basic ('-O0')
optimization passes at JIT time instead of skipping the optimization
pass manager entirely. See the new comment in module_builder.cc for
details.

That also caused the size of generated code in UBSAN builds to increase,
so I had to increase the limit on the number of dumped instructions per
function to avoid breaking one of the tests.

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

LLVM 3.9 (before the regression) (asm at [2]):

  I0607 12:00:17.540612 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s    user 0.294s     sys 0.000s
  I0607 12:00:23.842226 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:29.710149 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:35.587321 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:41.451495 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:47.309710 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:53.183537 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:59.051522 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:01:04.935763 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.298s     sys 0.000s
  I0607 12:01:10.821828 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.299s     sys 0.000s

LLVM 4.0 (before this fix) (asm at [3]):

  I0607 12:14:07.771476 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.524s    user 0.525s     sys 0.000s
  I0607 12:14:14.283260 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.525s    user 0.525s     sys 0.000s
  I0607 12:14:20.376360 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.543s    user 0.543s     sys 0.000s
  I0607 12:14:26.457681 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.530s    user 0.530s     sys 0.000s
  I0607 12:14:32.535305 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:38.615105 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.532s     sys 0.000s
  I0607 12:14:44.697655 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.531s     sys 0.000s
  I0607 12:14:50.779160 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:56.852665 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.530s     sys 0.000s
  I0607 12:15:02.954947 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.538s    user 0.540s     sys 0.000s

LLVM 4.0 (after this fix) (asm at [4]):

  I0607 12:17:37.953876 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:17:44.214912 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s      user 0.295s     sys 0.000s
  I0607 12:17:50.057200 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.299s      user 0.299s     sys 0.000s
  I0607 12:17:55.882935 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:18:01.725445 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:07.562417 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:13.421221 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:19.268613 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:25.113490 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:30.950954 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s

Looking at the assembly for the three tests above, it's clear that the
inlining is broken in 4.0 without this fix, and with it, the generated
assembly is a little better (shorter) than 3.9.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/113175.html
[2] https://gist.github.com/b4b0365ea1570f33d55c6c3dffd4a8af
[3] https://gist.github.com/128ecb292fddd069d5397a76dc53fc11
[4] https://gist.github.com/0cb01f454737d6c2dc457f0cdb6bb52d

Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
---
M src/kudu/codegen/CMakeLists.txt
M src/kudu/codegen/code_generator.cc
M src/kudu/codegen/module_builder.cc
3 files changed, 33 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/99/7099/3
-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/7099

to look at the new patch set (#2).

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 their very small size. 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.

This had one unintended side-effect which initially broke codegen in
TSAN builds (which use libc++ instead of libstdcxx). Fixing this required
changing the debug builds to still run the most basic ('-O0')
optimization passes at JIT time instead of skipping the optimization
pass manager entirely. See the new comment in module_builder.cc for
details.

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

LLVM 3.9 (before the regression) (asm at [2]):

  I0607 12:00:17.540612 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s    user 0.294s     sys 0.000s
  I0607 12:00:23.842226 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:29.710149 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:35.587321 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:41.451495 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.296s    user 0.296s     sys 0.000s
  I0607 12:00:47.309710 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:53.183537 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:00:59.051522 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.297s     sys 0.000s
  I0607 12:01:04.935763 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.298s     sys 0.000s
  I0607 12:01:10.821828 23532 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.297s    user 0.299s     sys 0.000s

LLVM 4.0 (before this fix) (asm at [3]):

  I0607 12:14:07.771476 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.524s    user 0.525s     sys 0.000s
  I0607 12:14:14.283260 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.525s    user 0.525s     sys 0.000s
  I0607 12:14:20.376360 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.543s    user 0.543s     sys 0.000s
  I0607 12:14:26.457681 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.530s    user 0.530s     sys 0.000s
  I0607 12:14:32.535305 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:38.615105 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.532s     sys 0.000s
  I0607 12:14:44.697655 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.531s     sys 0.000s
  I0607 12:14:50.779160 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.532s    user 0.532s     sys 0.000s
  I0607 12:14:56.852665 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.531s    user 0.530s     sys 0.000s
  I0607 12:15:02.954947 12117 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.538s    user 0.540s     sys 0.000s

LLVM 4.0 (after this fix) (asm at [4]):

  I0607 12:17:37.953876 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:17:44.214912 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.295s      user 0.295s     sys 0.000s
  I0607 12:17:50.057200 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.299s      user 0.299s     sys 0.000s
  I0607 12:17:55.882935 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.292s      user 0.292s     sys 0.000s
  I0607 12:18:01.725445 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:07.562417 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:13.421221 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:19.268613 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.293s     sys 0.000s
  I0607 12:18:25.113490 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s
  I0607 12:18:30.950954 17916 memrowset-test.cc:446] Time spent Scanning rows where all are committed: real 0.293s      user 0.294s     sys 0.000s

Looking at the assembly for the three tests above, it's clear that the
inlining is broken in 4.0 without this fix, and with it, the generated
assembly is a little better (shorter) than 3.9.

[1] http://lists.llvm.org/pipermail/llvm-dev/2017-May/113175.html
[2] https://gist.github.com/b4b0365ea1570f33d55c6c3dffd4a8af
[3] https://gist.github.com/128ecb292fddd069d5397a76dc53fc11
[4] https://gist.github.com/0cb01f454737d6c2dc457f0cdb6bb52d

Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
---
M src/kudu/codegen/CMakeLists.txt
M src/kudu/codegen/module_builder.cc
2 files changed, 32 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/99/7099/2
-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "David Ribeiro Alves (Code Review)" <ge...@cloudera.org>.
David Ribeiro Alves has posted comments on this change.

Change subject: codegen: fix regression in inlining after LLVM 4.0 upgrade
......................................................................


Patch Set 5: Code-Review+2

(1 comment)

http://gerrit.cloudera.org:8080/#/c/7099/5//COMMIT_MSG
Commit Message:

PS5, Line 21: unexpected 'noinline' attributes after upgrading to 4.0.
xs nit: wrapping


-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 5
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "Dan Burkert (Code Review)" <ge...@cloudera.org>.
Dan Burkert has posted comments on this change.

Change subject: codegen: fix regression in inlining after LLVM 4.0 upgrade
......................................................................


Patch Set 5: Code-Review+1

-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 5
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No

[kudu-CR] codegen: fix regression in inlining after LLVM 4.0 upgrade

Posted by "David Ribeiro Alves (Code Review)" <ge...@cloudera.org>.
David Ribeiro Alves has posted comments on this change.

Change subject: codegen: fix regression in inlining after LLVM 4.0 upgrade
......................................................................


Patch Set 1:

(3 comments)

http://gerrit.cloudera.org:8080/#/c/7099/1//COMMIT_MSG
Commit Message:

PS1, Line 17: due to be very small
wording


PS1, Line 50: 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
curious, how do these compare to the numbers before the regression?


http://gerrit.cloudera.org:8080/#/c/7099/1/src/kudu/codegen/CMakeLists.txt
File src/kudu/codegen/CMakeLists.txt:

PS1, Line 120:  Disable built-in LLVM passes which would add 'noinline' attributes to all
             : # standalone functions.
is there a way to disable that specific no-inlining pass? are we leaving present or future perf on the table by not allowing this in general because of one faulty optimization pass?


-- 
To view, visit http://gerrit.cloudera.org:8080/7099
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I7e449df80e5cd02b9ce2dbf4daa5cf8151007dcf
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Dan Burkert <da...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@gmail.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-HasComments: Yes