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

Issue 1300993002: Use separate random number generator for each randomization pass (Closed)

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

Use separate random number generator for each randomization pass This removes random number generator from GlobalContext class and decouples different randomization passes 1. Add a new constructor for random number generator which merge three arguments to into one seed for the underlying implementation of random number generator. RandomNumberGenerator(uint64_t Seed, RandomizationPassesEnum RandomizationPassID, uint64_t Salt=0) param Seed: Should be the global random number seed passed through command line. param RandomizationPassID: Should be the ID for different randomization passes. param Salt: Should be an additional integer salt, default to be 0. 2. Move the creation of random number generators to the call sites of randomization passes. Each randomization pass create its own random number generator with specific salt value. Function reordering: Salt = 0 (default) Basic Block reordering: Salt = Function Sequence Number Global Variable reordering: Salt = 0 (default) Pooled Constants reordering: Salt = Constants' Kind value (return of getKind()) *Jump Tables: Salt = 0 Nop Insertion: Salt = Function Sequence Number Register Alloc Randomization: Salt = (Function Sequence Number << 1) ^ (Kind == RAK_Phi ? 0u : 1u) Constants Blinding: Salt = Function Sequence Number *Jump tables are treated as pooled constants, but without Kind value as salt. BUG= R=stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=aee5fa8dd6aa948160a290c8237d7ae4875811fb

Patch Set 1 #

Patch Set 2 : Assign default value of ConstantBlindingCookie in its declaration #

Total comments: 24

Patch Set 3 : #

Total comments: 2

Patch Set 4 : add test for RNG #

Patch Set 5 : Minor change in GlobalContext::getJumpTables(), make jump tables in deterministic order even pooled… #

Total comments: 10

Patch Set 6 : #

Total comments: 3

Patch Set 7 : fix comments #

Patch Set 8 : rebase to master #

Unified diffs Side-by-side diffs Delta from patch set Stats (+555 lines, -231 lines) Patch
M src/IceCfg.h View 1 2 2 chunks +3 lines, -1 line 0 comments Download
M src/IceCfg.cpp View 1 2 3 4 5 6 7 3 chunks +17 lines, -3 lines 0 comments Download
M src/IceCfgNode.h View 1 chunk +1 line, -1 line 0 comments Download
M src/IceCfgNode.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M src/IceDefs.h View 1 2 3 4 5 6 7 1 chunk +12 lines, -0 lines 0 comments Download
M src/IceELFObjectWriter.cpp View 1 2 1 chunk +9 lines, -5 lines 0 comments Download
M src/IceGlobalContext.h View 4 chunks +0 lines, -14 lines 0 comments Download
M src/IceGlobalContext.cpp View 1 2 3 4 6 chunks +26 lines, -25 lines 0 comments Download
M src/IceRNG.h View 1 2 2 chunks +18 lines, -0 lines 0 comments Download
M src/IceRNG.cpp View 1 2 1 chunk +10 lines, -0 lines 0 comments Download
M src/IceRegAlloc.cpp View 1 2 3 4 5 6 2 chunks +13 lines, -6 lines 0 comments Download
M src/IceTargetLowering.h View 1 2 3 4 5 6 7 3 chunks +7 lines, -5 lines 0 comments Download
M src/IceTargetLowering.cpp View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M src/IceTargetLoweringARM32.h View 1 2 2 chunks +6 lines, -4 lines 0 comments Download
M src/IceTargetLoweringARM32.cpp View 1 2 2 chunks +6 lines, -4 lines 0 comments Download
M src/IceTargetLoweringMIPS32.h View 1 2 1 chunk +6 lines, -4 lines 0 comments Download
M src/IceTargetLoweringMIPS32.cpp View 1 2 2 chunks +6 lines, -4 lines 0 comments Download
M src/IceTargetLoweringX8632.cpp View 1 2 1 chunk +10 lines, -4 lines 0 comments Download
M src/IceTargetLoweringX8632Traits.h View 1 2 3 4 5 6 7 2 chunks +7 lines, -3 lines 0 comments Download
M src/IceTargetLoweringX8664.cpp View 1 2 1 chunk +9 lines, -4 lines 0 comments Download
M src/IceTargetLoweringX8664Traits.h View 1 2 3 4 5 6 7 2 chunks +7 lines, -3 lines 0 comments Download
M src/IceTargetLoweringX86Base.h View 1 2 3 4 5 6 7 2 chunks +6 lines, -4 lines 0 comments Download
M src/IceTargetLoweringX86BaseImpl.h View 1 2 3 4 5 6 7 4 chunks +9 lines, -8 lines 0 comments Download
M tests_lit/llvm2ice_tests/nop-insertion.ll View 1 2 3 1 chunk +43 lines, -37 lines 0 comments Download
M tests_lit/llvm2ice_tests/randomize-pool-immediate-basic.ll View 1 2 3 4 5 6 7 6 chunks +22 lines, -22 lines 0 comments Download
M tests_lit/llvm2ice_tests/randomize-regalloc.ll View 1 2 3 4 chunks +20 lines, -20 lines 0 comments Download
M tests_lit/llvm2ice_tests/reorder-basic-blocks.ll View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/reorder-functions.ll View 1 2 3 2 chunks +6 lines, -6 lines 0 comments Download
M tests_lit/llvm2ice_tests/reorder-global-variables.ll View 1 2 3 4 5 1 chunk +2 lines, -7 lines 0 comments Download
M tests_lit/llvm2ice_tests/reorder-pooled-constants.ll View 1 2 3 2 chunks +11 lines, -32 lines 0 comments Download
A tests_lit/llvm2ice_tests/rng.ll View 1 2 3 4 5 6 7 1 chunk +258 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (1 generated)
qining
5 years, 4 months ago (2015-08-18 23:48:23 UTC) #2
Jim Stichnoth
https://codereview.chromium.org/1300993002/diff/20001/src/IceCfg.h File src/IceCfg.h (right): https://codereview.chromium.org/1300993002/diff/20001/src/IceCfg.h#newcode252 src/IceCfg.h:252: uint32_t ConstantBlindingCookie = 0; /// Cookie for Constant Blinding ...
5 years, 4 months ago (2015-08-19 19:03:05 UTC) #3
qining
The tests still need to be fixed, will upload them later. https://codereview.chromium.org/1300993002/diff/20001/src/IceCfg.h File src/IceCfg.h (right): ...
5 years, 4 months ago (2015-08-19 23:25:49 UTC) #4
Jim Stichnoth
https://codereview.chromium.org/1300993002/diff/40001/src/IceRegAlloc.cpp File src/IceRegAlloc.cpp (right): https://codereview.chromium.org/1300993002/diff/40001/src/IceRegAlloc.cpp#newcode780 src/IceRegAlloc.cpp:780: // Use function's sequence and Kind value as the ...
5 years, 4 months ago (2015-08-20 04:04:41 UTC) #5
jvoung (off chromium)
https://codereview.chromium.org/1300993002/diff/80001/src/IceGlobalContext.cpp File src/IceGlobalContext.cpp (left): https://codereview.chromium.org/1300993002/diff/80001/src/IceGlobalContext.cpp#oldcode226 src/IceGlobalContext.cpp:226: RNG(Flags.getRandomSeed()), ObjectWriter(), On 2015/08/20 04:04:41, stichnot wrote: > A ...
5 years, 4 months ago (2015-08-20 12:41:04 UTC) #6
jvoung (off chromium)
random nits =) https://codereview.chromium.org/1300993002/diff/80001/tests_lit/llvm2ice_tests/reorder-global-variables.ll File tests_lit/llvm2ice_tests/reorder-global-variables.ll (right): https://codereview.chromium.org/1300993002/diff/80001/tests_lit/llvm2ice_tests/reorder-global-variables.ll#newcode57 tests_lit/llvm2ice_tests/reorder-global-variables.ll:57: ;@__init_array_start = internal constant [0 x ...
5 years, 4 months ago (2015-08-20 13:43:30 UTC) #7
Jim Stichnoth
Two other comments: 1. Please edit the Subject to be 80 characters or fewer. 2. ...
5 years, 4 months ago (2015-08-20 15:14:26 UTC) #8
qining
Updated with Patch set 6. https://codereview.chromium.org/1300993002/diff/40001/src/IceRegAlloc.cpp File src/IceRegAlloc.cpp (right): https://codereview.chromium.org/1300993002/diff/40001/src/IceRegAlloc.cpp#newcode780 src/IceRegAlloc.cpp:780: // Use function's sequence ...
5 years, 4 months ago (2015-08-20 16:19:34 UTC) #9
Jim Stichnoth
Sorry to nitpick, but may I suggest, "Use a separate random number generator for each ...
5 years, 4 months ago (2015-08-20 16:23:43 UTC) #10
native-client-reviews_googlegroups.com
Got it. On Thu, Aug 20, 2015 at 9:23 AM, <stichnot@chromium.org> wrote: > Sorry to ...
5 years, 4 months ago (2015-08-20 16:25:22 UTC) #11
native-client-reviews_googlegroups.com
About testing of SPEC2K with all randomization passes turned on, I've tested O2 with and ...
5 years, 4 months ago (2015-08-20 17:20:27 UTC) #12
Jim Stichnoth
lgtm https://codereview.chromium.org/1300993002/diff/100001/src/IceRegAlloc.cpp File src/IceRegAlloc.cpp (right): https://codereview.chromium.org/1300993002/diff/100001/src/IceRegAlloc.cpp#newcode780 src/IceRegAlloc.cpp:780: // function's sequence and Kind value as the ...
5 years, 4 months ago (2015-08-20 20:01:33 UTC) #13
qining
5 years, 4 months ago (2015-08-20 21:59:07 UTC) #14
Message was sent while issue was closed.
Committed patchset #8 (id:140001) manually as
aee5fa8dd6aa948160a290c8237d7ae4875811fb (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698