Skip to content

Commit

Permalink
adjust style
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan1wan committed May 20, 2024
1 parent 90185f3 commit 7da539e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _posts/2022-12-14-BTB.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ next3:
ret
```
We count branch misprediction rates for different B and N. For each test, we first execute our test gadget 10 times to warm up the BTB; secondly, we run the test gadget once and log the difference of the PMU event counter(C). Then the branch misprediction rate is C/B. The result is in the following diagram.
<img src="/images/posts/BTB/ARM-capacity.png" style="zoom:80%" />
<img src="/images/posts/BTB/ARM-capacity.png" style="zoom:100%" />

From the diagram, we could know:
+ BTB set index starts from bit 5. Because if B goes from 3K to 7k, the misprediction rate is almost the same if N goes from 16 to 32(32=2^5); but there is a leap from 32 to 64.
Expand All @@ -53,7 +53,7 @@ From the diagram, we could know:
*I am not sure with the following contents and welcome to provide me the truth.*
### Ways
We already knew that the set index starts from bit 5. Since the BTB capacity is 4K, the set index bits are at most 12 bits (2^12=4096). Therefore, if we let N >= 2^17, all branches will fit into the same set. By counting branch mispredictions, we could know the ways in each set. Here is our result.
<img src="/images/posts/BTB/ARM-setindex.png" style="zoom:80%" />
<img src="/images/posts/BTB/ARM-setindex.png" style="zoom:70%" />
From the picture, we may conclude that each set has 8 ways. Because when B=8, there is always a low miss rate when log(N)>17. However, if there a eviction buffer for BTB, the ways maybe smaller(like 4 or 6).
If way=8, then there are 512 sets(8*512=4096). The set index should be 5-13 bit.
However, we observe that when log(N) = 14 and B=16, the cache miss rate is 0, which implies that the 16 branches are held by different sets so bit 14 is also used for indexing sets. As the picture shows, each bit from 5 to 14 could influence the set distribution thus influencing results. There should be a hash function which maps 5-13 bit to 512 BTB sets.
Expand Down

0 comments on commit 7da539e

Please sign in to comment.