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

Issue 1234803007: Introduction of improved switch lowering. (Closed)

Created:
5 years, 5 months ago by ascull
Modified:
5 years, 5 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

Introduction of improved switch lowering. This includes the high level analysis of switches, the x86 lowering, the repointing of targets in jump tables and ASM emission of jump tables. The technique uses jump tables, range test and binary search with worst case O(lg n) which improves the previous worst case of O(n) from a sequential search. Use is hidden by the --adv-switch flag as the IAS emission still needs to be implemented. BUG=None R=jvoung@chromium.org, stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=87f80c128a9e2bc95829cd1aac2bbc3c44b44ac1

Patch Set 1 #

Total comments: 73

Patch Set 2 : CL feedback #

Total comments: 18

Patch Set 3 : Formatting tweaks. #

Total comments: 16

Patch Set 4 : Address Comment #9 #

Total comments: 1

Patch Set 5 : Safer check for 0 size type #

Unified diffs Side-by-side diffs Delta from patch set Stats (+841 lines, -111 lines) Patch
M Makefile.standalone View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/IceCfgNode.cpp View 1 3 chunks +16 lines, -23 lines 0 comments Download
M src/IceClFlags.h View 1 2 chunks +8 lines, -0 lines 0 comments Download
M src/IceClFlags.cpp View 1 2 3 4 3 chunks +6 lines, -0 lines 0 comments Download
M src/IceELFObjectWriter.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M src/IceInst.h View 1 6 chunks +43 lines, -5 lines 0 comments Download
M src/IceInst.cpp View 1 5 chunks +77 lines, -9 lines 0 comments Download
M src/IceInstARM32.h View 1 chunk +1 line, -1 line 0 comments Download
M src/IceInstARM32.cpp View 1 chunk +7 lines, -5 lines 0 comments Download
M src/IceInstX86Base.h View 1 chunk +1 line, -1 line 0 comments Download
M src/IceInstX86BaseImpl.h View 1 chunk +7 lines, -5 lines 0 comments Download
M src/IceRegistersX8632.h View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
A src/IceSwitchLowering.h View 1 2 3 1 chunk +78 lines, -0 lines 0 comments Download
A src/IceSwitchLowering.cpp View 1 2 3 1 chunk +96 lines, -0 lines 0 comments Download
M src/IceTargetLowering.h View 1 chunk +4 lines, -0 lines 0 comments Download
M src/IceTargetLoweringARM32.h View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
M src/IceTargetLoweringMIPS32.h View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M src/IceTargetLoweringX8632.cpp View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M src/IceTargetLoweringX86Base.h View 1 2 3 4 3 chunks +16 lines, -0 lines 0 comments Download
M src/IceTargetLoweringX86BaseImpl.h View 1 2 3 4 2 chunks +243 lines, -30 lines 0 comments Download
M src/IceTypes.h View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M src/IceTypes.cpp View 1 2 3 4 6 chunks +13 lines, -8 lines 0 comments Download
M src/IceTypes.def View 1 2 3 1 chunk +18 lines, -18 lines 0 comments Download
A tests_lit/llvm2ice_tests/adv-switch-opt.ll View 1 2 1 chunk +191 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
ascull
5 years, 5 months ago (2015-07-15 01:20:27 UTC) #1
jvoung (off chromium)
Could you add a .ll smoke test using the transitional flag and filetype=asm, for a ...
5 years, 5 months ago (2015-07-15 15:40:32 UTC) #2
jvoung (off chromium)
Thanks! https://codereview.chromium.org/1234803007/diff/1/src/IceCfgNode.cpp File src/IceCfgNode.cpp (right): https://codereview.chromium.org/1234803007/diff/1/src/IceCfgNode.cpp#newcode218 src/IceCfgNode.cpp:218: // not comtain duplicates. comtain -> contain https://codereview.chromium.org/1234803007/diff/1/src/IceInst.cpp ...
5 years, 5 months ago (2015-07-15 18:32:02 UTC) #3
Jim Stichnoth
https://codereview.chromium.org/1234803007/diff/1/src/IceCfgNode.cpp File src/IceCfgNode.cpp (right): https://codereview.chromium.org/1234803007/diff/1/src/IceCfgNode.cpp#newcode218 src/IceCfgNode.cpp:218: // not comtain duplicates. contain https://codereview.chromium.org/1234803007/diff/1/src/IceCfgNode.cpp#newcode249 src/IceCfgNode.cpp:249: // Repoint ...
5 years, 5 months ago (2015-07-15 19:17:43 UTC) #4
Jim Stichnoth
One higher-level comment. I wonder if this transformation could be done at a higher level, ...
5 years, 5 months ago (2015-07-15 20:05:12 UTC) #5
ascull
Looking into moving switch expansion to a higher level has identified some issues: - InstBr ...
5 years, 5 months ago (2015-07-16 19:38:46 UTC) #6
jvoung (off chromium)
https://codereview.chromium.org/1234803007/diff/20001/src/IceClFlags.cpp File src/IceClFlags.cpp (right): https://codereview.chromium.org/1234803007/diff/20001/src/IceClFlags.cpp#newcode411 src/IceClFlags.cpp:411: OutFlags.setUseAdvancedSwitchLowering(::UseAdvancedSwitchLowering); could swap with UseSandboxing here too for alphabetical ...
5 years, 5 months ago (2015-07-16 22:27:50 UTC) #7
ascull
https://codereview.chromium.org/1234803007/diff/20001/src/IceClFlags.cpp File src/IceClFlags.cpp (right): https://codereview.chromium.org/1234803007/diff/20001/src/IceClFlags.cpp#newcode411 src/IceClFlags.cpp:411: OutFlags.setUseAdvancedSwitchLowering(::UseAdvancedSwitchLowering); On 2015/07/16 22:27:49, jvoung wrote: > could swap ...
5 years, 5 months ago (2015-07-16 22:55:44 UTC) #8
Jim Stichnoth
https://codereview.chromium.org/1234803007/diff/1/src/IceInst.cpp File src/IceInst.cpp (right): https://codereview.chromium.org/1234803007/diff/1/src/IceInst.cpp#newcode951 src/IceInst.cpp:951: void InstJumpTable::emit(const Cfg *Func) const { On 2015/07/16 19:38:45, ...
5 years, 5 months ago (2015-07-17 15:33:48 UTC) #9
ascull
https://codereview.chromium.org/1234803007/diff/1/src/IceTargetLoweringX86BaseImpl.h File src/IceTargetLoweringX86BaseImpl.h (right): https://codereview.chromium.org/1234803007/diff/1/src/IceTargetLoweringX86BaseImpl.h#newcode4548 src/IceTargetLoweringX86BaseImpl.h:4548: Variable *Target = makeReg(getPointerType()); On 2015/07/17 15:33:47, stichnot wrote: ...
5 years, 5 months ago (2015-07-17 18:21:29 UTC) #10
jvoung (off chromium)
LGTM from my side
5 years, 5 months ago (2015-07-17 20:19:47 UTC) #11
Jim Stichnoth
otherwise lgtm https://codereview.chromium.org/1234803007/diff/60001/src/IceTypes.cpp File src/IceTypes.cpp (right): https://codereview.chromium.org/1234803007/diff/60001/src/IceTypes.cpp#newcode137 src/IceTypes.cpp:137: return (Shift == -1) ? 0 : ...
5 years, 5 months ago (2015-07-18 00:13:28 UTC) #12
Jim Stichnoth
BTW, were you able to see any performance improvements (or degradations) in spec2k?
5 years, 5 months ago (2015-07-18 00:14:32 UTC) #13
ascull
There were improvements on most of the spek2 benchmarks. I don't remember all the details ...
5 years, 5 months ago (2015-07-20 17:19:02 UTC) #14
ascull
Committed patchset #5 (id:80001) manually as 87f80c128a9e2bc95829cd1aac2bbc3c44b44ac1 (presubmit successful).
5 years, 5 months ago (2015-07-20 17:19:20 UTC) #15
Jim Stichnoth
On 2015/07/20 17:19:02, ascull wrote: > There were improvements on most of the spek2 benchmarks. ...
5 years, 5 months ago (2015-07-20 18:09:52 UTC) #16
native-client-reviews_googlegroups.com
5 years, 5 months ago (2015-07-20 21:13:11 UTC) #17
Message was sent while issue was closed.
 I ran the test myself and got very different results (shown below and in
updated spreadsheet). Did you pass `--filetype=asm --sz='--adv-switch'` to
szbuild_spec2k.py? Without that it falls back on the old way of doing
things and your results would just show variation in the runs of the tests.

 min avg  1.08% 2.06%  1.80% 2.73%  18.91% 18.26%  18.35% 17.97%  1.41%
12.04%  19.91% 19.35%  22.45% 22.42%  19.29% 18.45%  18.60% 18.90%  18.02%
16.61%  8.88% 16.76%  1.87% 1.99%  0.85% 1.02%  1.15% 0.30%  1.63% 1.46%
17.98% 17.54%

 10.42% 11.44%

On 20 July 2015 at 11:09, <stichnot@chromium.org> wrote:

> On 2015/07/20 17:19:02, ascull wrote:
>
>> There were improvements on most of the spek2 benchmarks. I don't remember
>> all
>> the details but perl and art benefited well. Art went from around 1.9 to
>> 1.6
>> (~15% improvement). Any degradation was on the order of 0.01s
>>
> (insignificant?).
>
>  N.B. I didn't run many trials so the numbers might not be accurate but the
>>
> trend
>
>> of being faster should be.
>>
>
> Here's the methodology I like to use for comparing results.
>
> 1. Run on your workstation, and close as many applications as practical,
> especially Chrome.
>
> 2. Run each spec2k component 5 times, e.g.:
>   SPEC_RUN_REPETITIONS=5 ./run_all.sh RunTimedBenchmarks SetupGccX8632Opt
> train
> | tee /tmp/spec.switch.old.txt
>   SPEC_RUN_REPETITIONS=5 ./run_all.sh RunTimedBenchmarks SetupGccX8632Opt
> train
> | tee /tmp/spec.switch.new.txt
> (rebuilding the spec2k binaries between runs)
>
> 3. Grab the data from the "RESULT" output lines and put it into a
> spreadsheet.
>
> 4. Look at both MIN() and AVERAGE() across the 5 runs.
>
> 5. Use GEOMEAN() to condense to a single number.
>
> I tried that, and found a geomean improvement of about 0.5%.  Perlbmk did
> show
> 3.6% improvement, but art was mostly unchanged.  Gap also showed a 2-3%
> improvement.  Eon actually showed a 1.5-3.5% degradation.
>
> https://codereview.chromium.org/1234803007/
>

-- 
You received this message because you are subscribed to the Google Groups
"Native-Client-Reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to native-client-reviews+unsubscribe@googlegroups.com.
To post to this group, send email to native-client-reviews@googlegroups.com.
Visit this group at http://groups.google.com/group/native-client-reviews.
For more options, visit https://groups.google.com/d/optout.

Powered by Google App Engine
This is Rietveld 408576698