Skip to content

Commit

Permalink
update to use more randomness to avoid global history predicting the …
Browse files Browse the repository at this point in the history
…next branches
  • Loading branch information
andrej committed Jan 27, 2025
1 parent ae204af commit 7ac0857
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion eval/branch_prediction/gen_bp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
inlined_iters_p2 = 3 # 2**3 = 8
assert it % (2**inlined_iters_p2) == 0
assert it < 2**64
n_randbits_p2=12 # 2**12 = 4096
# If we have less randomness below than total iterations, the branch predictor
# will learn form the global history: The first branch in the iteration of 8
# can then be used to predict the behavior of the next 7, because they will all
# use the same randomness as on an earlier iteration. It might be possible to
# estimate the size of the global history by adjusting the amount of randomness.
n_randbits_p2=15 # 2**12 = 4096

n_random=int(sys.argv[1]) # number out of 8 that will be made random
assert 0 <= n_random <= 8
Expand Down

0 comments on commit 7ac0857

Please sign in to comment.