Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Issue 1834473002: Allow Subzero to parse function blocks in parallel. (Closed)

Created:
4 years, 9 months ago by Karl
Modified:
4 years, 8 months ago
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Allow Subzero to parse function blocks in parallel. This CL modifies the code so that we can do sequential and parallel parsing of function blocks in bitcode files, based on a command line argument. The command line argument was added because during testing, I had one compilation failure (transient), and do not know the cause. Hence, I was reluctant to install this CL without a command-line flag. To test the new parallel parser, the easiest solution is to edit IceClFlags.def and set the default value of ParseParallel to true. This code also fixes up unit parsing tests, as well as one parsing test. The cause of these problems was the implicit assumption that function blocks are parsed sequentially, which no longer applies when function blocks are parsed in parallel. To fix this, the "threads=0" command line argument was added. It also added the starting up of worker threads, since parsing of function blocks will happen in the translation thread if parallel parsing is turned on. The OptQ queue was modified to contain OptWorkerItem instances with a single virtual to get the parsed code. This allows the IceConverter to continue to work, by simply passing the generated Cfg as a work item. BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4363 R=jpp@chromium.org, stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=e8457a26638d4d3ea5420ff80ff4ad9fc1ea1fb0

Patch Set 1 #

Patch Set 2 : Clean up code. #

Total comments: 23

Patch Set 3 : Fix issues from last patch. #

Total comments: 19

Patch Set 4 : More fixes for parallelization. #

Patch Set 5 : Fix nits. #

Total comments: 8

Patch Set 6 : Fix issues raised in last CL. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+241 lines, -118 lines) Patch
M pydir/run-pnacl-sz.py View 1 3 chunks +8 lines, -1 line 0 comments Download
M src/IceClFlags.def View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M src/IceCompiler.cpp View 1 2 3 4 5 4 chunks +3 lines, -2 lines 0 comments Download
M src/IceGlobalContext.h View 1 2 3 4 5 5 chunks +24 lines, -31 lines 0 comments Download
M src/IceGlobalContext.cpp View 1 2 3 4 5 4 chunks +42 lines, -7 lines 0 comments Download
M src/IceTranslator.cpp View 1 2 3 4 5 2 chunks +15 lines, -1 line 0 comments Download
M src/PNaClTranslator.cpp View 1 2 3 4 5 24 chunks +136 lines, -65 lines 0 comments Download
M tests_lit/parse_errs/insertextract-err.ll View 1 chunk +6 lines, -10 lines 0 comments Download
M unittest/BitcodeMunge.cpp View 1 2 3 2 chunks +4 lines, -1 line 0 comments Download

Messages

Total messages: 21 (4 generated)
Karl
4 years, 9 months ago (2016-03-24 16:06:35 UTC) #3
Karl
4 years, 9 months ago (2016-03-24 17:15:19 UTC) #5
John
https://codereview.chromium.org/1834473002/diff/20001/src/IceCompiler.cpp File src/IceCompiler.cpp (right): https://codereview.chromium.org/1834473002/diff/20001/src/IceCompiler.cpp#newcode117 src/IceCompiler.cpp:117: Ctx.waitForWorkerThreads(); I don't understand this change. https://codereview.chromium.org/1834473002/diff/20001/src/IceTranslator.cpp File src/IceTranslator.cpp ...
4 years, 9 months ago (2016-03-24 17:32:35 UTC) #6
Karl
https://codereview.chromium.org/1834473002/diff/20001/src/IceCompiler.cpp File src/IceCompiler.cpp (right): https://codereview.chromium.org/1834473002/diff/20001/src/IceCompiler.cpp#newcode117 src/IceCompiler.cpp:117: Ctx.waitForWorkerThreads(); On 2016/03/24 17:32:34, John wrote: > I don't ...
4 years, 9 months ago (2016-03-24 17:37:50 UTC) #7
John
https://codereview.chromium.org/1834473002/diff/20001/src/IceCompiler.cpp File src/IceCompiler.cpp (right): https://codereview.chromium.org/1834473002/diff/20001/src/IceCompiler.cpp#newcode117 src/IceCompiler.cpp:117: Ctx.waitForWorkerThreads(); On 2016/03/24 17:37:49, Karl wrote: > On 2016/03/24 ...
4 years, 9 months ago (2016-03-24 17:44:00 UTC) #8
Karl
https://codereview.chromium.org/1834473002/diff/20001/src/IceCompiler.cpp File src/IceCompiler.cpp (right): https://codereview.chromium.org/1834473002/diff/20001/src/IceCompiler.cpp#newcode117 src/IceCompiler.cpp:117: Ctx.waitForWorkerThreads(); On 2016/03/24 17:44:00, John wrote: > On 2016/03/24 ...
4 years, 9 months ago (2016-03-24 22:35:26 UTC) #9
Jim Stichnoth
https://codereview.chromium.org/1834473002/diff/40001/src/IceClFlags.def File src/IceClFlags.def (right): https://codereview.chromium.org/1834473002/diff/40001/src/IceClFlags.def#newcode195 src/IceClFlags.def:195: cl::desc("Parse function blocks in parallel"), cl::init(false)) \ I think ...
4 years, 9 months ago (2016-03-25 04:31:04 UTC) #10
John
https://codereview.chromium.org/1834473002/diff/20001/src/PNaClTranslator.cpp File src/PNaClTranslator.cpp (right): https://codereview.chromium.org/1834473002/diff/20001/src/PNaClTranslator.cpp#newcode1398 src/PNaClTranslator.cpp:1398: return std::move(Func); Ah, Func is a class member... That's ...
4 years, 9 months ago (2016-03-25 04:55:22 UTC) #11
Karl
There was still threading issues in the previous version of this CL. The cause was ...
4 years, 8 months ago (2016-03-29 17:35:02 UTC) #12
Karl
Ping?
4 years, 8 months ago (2016-03-31 14:50:26 UTC) #13
John
lgtm https://codereview.chromium.org/1834473002/diff/80001/src/IceGlobalContext.cpp File src/IceGlobalContext.cpp (right): https://codereview.chromium.org/1834473002/diff/80001/src/IceGlobalContext.cpp#newcode347 src/IceGlobalContext.cpp:347: std::unique_ptr<Cfg> Func = OptItem->getParsedCfg(); optional: auto https://codereview.chromium.org/1834473002/diff/80001/src/PNaClTranslator.cpp File ...
4 years, 8 months ago (2016-03-31 15:51:36 UTC) #14
Jim Stichnoth
Could you rebase to master so I can try it out? I'm getting conflicts when ...
4 years, 8 months ago (2016-03-31 15:56:57 UTC) #15
native-client-reviews_googlegroups.com
I can't check that in because I still can't build the pnacl-toolchain. It appears that ...
4 years, 8 months ago (2016-03-31 16:00:14 UTC) #16
Jim Stichnoth
https://codereview.chromium.org/1834473002/diff/80001/src/IceGlobalContext.cpp File src/IceGlobalContext.cpp (right): https://codereview.chromium.org/1834473002/diff/80001/src/IceGlobalContext.cpp#newcode244 src/IceGlobalContext.cpp:244: // Do a separate loop over AllThreadContexts to avoid ...
4 years, 8 months ago (2016-03-31 16:08:09 UTC) #17
Karl
https://codereview.chromium.org/1834473002/diff/80001/src/IceGlobalContext.cpp File src/IceGlobalContext.cpp (right): https://codereview.chromium.org/1834473002/diff/80001/src/IceGlobalContext.cpp#newcode244 src/IceGlobalContext.cpp:244: // Do a separate loop over AllThreadContexts to avoid ...
4 years, 8 months ago (2016-03-31 16:33:49 UTC) #18
Jim Stichnoth
LGTM. Some nice observable speedups in parallel translation time!
4 years, 8 months ago (2016-03-31 17:18:46 UTC) #19
Karl
4 years, 8 months ago (2016-03-31 17:20:27 UTC) #21
Message was sent while issue was closed.
Committed patchset #6 (id:100001) manually as
e8457a26638d4d3ea5420ff80ff4ad9fc1ea1fb0 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698