New issue
Advanced search Search tips

Issue 878954 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug
Build-Toolchain



Sign in to add a comment

toolchain bisection tool: add compiler pass level bisection.

Project Member Reported by llozano@chromium.org, Aug 29

Issue description

It would be very nice to have the capability to bisect compiler passes once we know the bad object file.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Sep 5

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils/+/d6c617782ab73c5552f4bfea9e0cede8431d1a65

commit d6c617782ab73c5552f4bfea9e0cede8431d1a65
Author: Zhizhou Yang <zhizhouy@google.com>
Date: Wed Sep 05 04:04:00 2018

Bisect tool: Add pass level bisection command option helper

This patch introduces a new option for bisection tool which is
`--pass_bisect`. When it is set to android/generate_cmd.sh, bisection
tool will create a new script which extracts command line options to
build the bad item (We now only support pass level bisecting for single
bad item, so prune need to be turned off with this option on).

Another python wrapper script will come soon and it will take the
generated script as one argument, indicating how the compiler will build
the bad item at certain limit.

BUG=chromium:878954
TEST=Ran test successfully with Android compiler wrapper. Will add
unittests once verified ChromeOS.

Change-Id: Iaa972e9e1a364143b59a89e6518bbb2bba6e3522
Reviewed-on: https://chromium-review.googlesource.com/1195595
Commit-Ready: Zhizhou Yang <zhizhouy@google.com>
Tested-by: Zhizhou Yang <zhizhouy@google.com>
Reviewed-by: Caroline Tice <cmtice@chromium.org>

[modify] https://crrev.com/d6c617782ab73c5552f4bfea9e0cede8431d1a65/binary_search_tool/common.py
[modify] https://crrev.com/d6c617782ab73c5552f4bfea9e0cede8431d1a65/binary_search_tool/binary_search_state.py
[add] https://crrev.com/d6c617782ab73c5552f4bfea9e0cede8431d1a65/binary_search_tool/android/generate_cmd.sh

Project Member

Comment 2 by bugdroid1@chromium.org, Sep 10

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils/+/11c19727288a216f827be48dc30bfbcc3db9748a

commit 11c19727288a216f827be48dc30bfbcc3db9748a
Author: Zhizhou Yang <zhizhouy@google.com>
Date: Mon Sep 10 20:33:45 2018

Bisect tool: Pass/Transformation level bisection for bad item

This patch provides pass and transformation level bisection support for
existing bisection tool.

Usage: When `--pass_bisect=script_path` is set, pass/transformation
level bisection will be turned on. It only works when prune is set to
False. Orignial bisection will end with the first bad item it find. This
patch then will rebuild and bisect the bad item using bad compiler with
pass/transformation level bisect limit. It will end up with the bad pass
name/index and bad transformation index for that pass.

Notice that this patch still need support from LLVM with this review:
https://reviews.llvm.org/D50031, which allows debugcounter to print info
we need.

The patch eventally add a new binary search process, and two build
function to saparately build with pass and transformation level limit.
A new BinarySearcherForPass is also introduced for pass level bisect.

The workflow is:
    1) get bad item and command to build it with existing bisection.
    2) rebuild bad item with pass level limit to -1 to get total pass
       count.
    3) binary search pass index until we got bad pass.
    4) rebuild bad item with pass limit we get and also set
       transformation level limit to -1 to get total number of
       transforamtion.
    5) binary search transformation index until we got bad
       transformation.

BUG=chromium:878954
TEST=Ran test successfully with Android compiler wrapper. Will add
unittests once new patch in LLVM applied.

Change-Id: I08f376f15d12eea232da5887981c44184ffb9568
Reviewed-on: https://chromium-review.googlesource.com/1208855
Commit-Ready: Zhizhou Yang <zhizhouy@google.com>
Tested-by: Zhizhou Yang <zhizhouy@google.com>
Reviewed-by: Caroline Tice <cmtice@chromium.org>

[add] https://crrev.com/11c19727288a216f827be48dc30bfbcc3db9748a/binary_search_tool/pass_mapping.py
[modify] https://crrev.com/11c19727288a216f827be48dc30bfbcc3db9748a/binary_search_tool/common.py
[modify] https://crrev.com/11c19727288a216f827be48dc30bfbcc3db9748a/binary_search_tool/test/binary_search_tool_tester.py
[modify] https://crrev.com/11c19727288a216f827be48dc30bfbcc3db9748a/binary_search_tool/binary_search_state.py
[modify] https://crrev.com/11c19727288a216f827be48dc30bfbcc3db9748a/binary_search_tool/android/generate_cmd.sh
[modify] https://crrev.com/11c19727288a216f827be48dc30bfbcc3db9748a/binary_search_tool/binary_search_perforce.py

Project Member

Comment 3 by bugdroid1@chromium.org, Sep 18

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils/+/6f7acfe655ed82355582cbd4f4130de9c25b22cb

commit 6f7acfe655ed82355582cbd4f4130de9c25b22cb
Author: Zhizhou Yang <zhizhouy@google.com>
Date: Tue Sep 18 04:34:53 2018

bisect tool: Symbolic link re-generated bad item to original one

This patch modifies the way to genearte bad item while pass level
bisection. Rather than directly overwrite the old object, we generate it
to a tmp file and symblic link it to original one to satisfy building
tool.

BUG=chromium:878954
TEST=Ran test successfully with Android compiler wrapper.

Change-Id: If152742e0a2088e9d8c2456bf046cede938d88d3
Reviewed-on: https://chromium-review.googlesource.com/1220016
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Zhizhou Yang <zhizhouy@google.com>
Reviewed-by: Caroline Tice <cmtice@chromium.org>

[modify] https://crrev.com/6f7acfe655ed82355582cbd4f4130de9c25b22cb/binary_search_tool/android/cleanup.sh
[modify] https://crrev.com/6f7acfe655ed82355582cbd4f4130de9c25b22cb/binary_search_tool/android/generate_cmd.sh

Project Member

Comment 4 by bugdroid1@chromium.org, Sep 19

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils/+/8c95dfc94ad3b0e93a6d7e9637af2e0dcad3db13

commit 8c95dfc94ad3b0e93a6d7e9637af2e0dcad3db13
Author: Zhizhou Yang <zhizhouy@google.com>
Date: Wed Sep 19 22:40:42 2018

bisect tool: Add README file for pass level bisection

Added a readme file for the user to know how to use the bisection tool
for pass/transformation level debugging.

Also added some description of default script generate_cmd.sh under
android specific directory.

BUG=chromium:878954
TEST=None

Change-Id: I1d683704e0e4de9f7d1874632c2c241e3aea4fb9
Reviewed-on: https://chromium-review.googlesource.com/1229253
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Zhizhou Yang <zhizhouy@google.com>
Reviewed-by: Caroline Tice <cmtice@chromium.org>
Reviewed-by: George Burgess <gbiv@chromium.org>

[add] https://crrev.com/8c95dfc94ad3b0e93a6d7e9637af2e0dcad3db13/binary_search_tool/README.pass_bisect
[modify] https://crrev.com/8c95dfc94ad3b0e93a6d7e9637af2e0dcad3db13/binary_search_tool/android/README.android

Project Member

Comment 5 by bugdroid1@chromium.org, Sep 24

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils/+/3be25c3b37109ae46a534b6c56c72bfc6ab6340a

commit 3be25c3b37109ae46a534b6c56c72bfc6ab6340a
Author: Zhizhou Yang <zhizhouy@google.com>
Date: Mon Sep 24 22:31:04 2018

Bisect tool: Support print IR differences before and after bisection

This patch provides an option to print out IR differences before and
after pass/transformation level bisection.

This feature will help if user want to know what exactly does the bad
pass/transformation do to IR. It added two extra run with `-S` and
`-emit-llvm` to generate two IR files and use `diff` to compare them.

Note: `--ir_diff` option only works when pass_bisect is enabled.

BUG=chromium:878954
TEST=Ran test successfully with Android compiler wrapper.

Change-Id: Ia691dc6f23331a3e584eaf9e390edeeb990f3c87
Reviewed-on: https://chromium-review.googlesource.com/1220015
Commit-Ready: Zhizhou Yang <zhizhouy@google.com>
Tested-by: Zhizhou Yang <zhizhouy@google.com>
Reviewed-by: Caroline Tice <cmtice@chromium.org>
Reviewed-by: George Burgess <gbiv@chromium.org>

[modify] https://crrev.com/3be25c3b37109ae46a534b6c56c72bfc6ab6340a/binary_search_tool/common.py
[modify] https://crrev.com/3be25c3b37109ae46a534b6c56c72bfc6ab6340a/binary_search_tool/binary_search_state.py

Project Member

Comment 6 by bugdroid1@chromium.org, Oct 30

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils/+/9e47c31de6940a2b28d40d50ebb2e1fad6963c95

commit 9e47c31de6940a2b28d40d50ebb2e1fad6963c95
Author: Zhizhou Yang <zhizhouy@google.com>
Date: Tue Oct 30 08:04:56 2018

bisect tool: Adding unit tests for pass/transform level bisect

This patch added unit tests for pass and transformation level bisect to
the bisecting tool. Since no compiler is involved in unit test, it used
cmd_script.py to simulate the output of compiler (to stderr).

BUG=chromium:878954
TEST=Passed all unit tests.

Change-Id: I599c079497333ec24f08f37c3315a16f28c0f887
Reviewed-on: https://chromium-review.googlesource.com/1298384
Commit-Ready: Zhizhou Yang <zhizhouy@google.com>
Tested-by: Zhizhou Yang <zhizhouy@google.com>
Reviewed-by: Caroline Tice <cmtice@chromium.org>

[modify] https://crrev.com/9e47c31de6940a2b28d40d50ebb2e1fad6963c95/binary_search_tool/test/gen_obj.py
[add] https://crrev.com/9e47c31de6940a2b28d40d50ebb2e1fad6963c95/binary_search_tool/test/cmd_script.py
[add] https://crrev.com/9e47c31de6940a2b28d40d50ebb2e1fad6963c95/binary_search_tool/test/generate_cmd.py
[add] https://crrev.com/9e47c31de6940a2b28d40d50ebb2e1fad6963c95/binary_search_tool/test/cmd_script_no_support.py
[modify] https://crrev.com/9e47c31de6940a2b28d40d50ebb2e1fad6963c95/binary_search_tool/test/binary_search_tool_tester.py

Status: Started (was: Assigned)

Sign in to add a comment