-
Notifications
You must be signed in to change notification settings - Fork 23
Tage #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Tage #443
Changes from all commits
Commits
Show all changes
86 commits
Select commit
Hold shift + click to select a range
ff665cf
Rebasing to dev
ABenC377 e81673f
Rebasing to dev
ABenC377 40e7709
Rebasing to dev
ABenC377 6fa281d
Addressing superficial comments on PR
ABenC377 31c871e
Clang format
ABenC377 110c1c6
Adding more detail to virtual flush and update functions re order of …
ABenC377 4b3617c
Moving buffer branch flush functionality from core.cc to PipelineBuff…
ABenC377 a55e292
Rebasing to dev
ABenC377 17c9baf
Rebasing to dev
ABenC377 508a2f4
Rebasing to dev
ABenC377 e0f8121
Rebasing to dev
ABenC377 af8d1a0
Rebasing to dev
ABenC377 f9089e0
Rebasing to dev
ABenC377 3e5b507
Rebasing to dev
ABenC377 0445478
Rebasing to dev
ABenC377 f49e538
Rebasing to dev
ABenC377 e688a05
Rebasing to dev
ABenC377 1f925ea
Rebasing to dev
ABenC377 52f9688
clang format
ABenC377 6a286d3
Rebasing to dev
ABenC377 d0cc56a
undoing last push
ABenC377 1c1b6ce
Updating haeders and comments
ABenC377 1b800c1
Rebasing to dev
ABenC377 3aa7ca0
replacing = with ==
ABenC377 e525016
Rebasing to dev
ABenC377 673fe87
clang format
ABenC377 ace2d59
Rebasing to dev
ABenC377 416cc20
Rebasing to dev
ABenC377 92e67a8
Rebasing to dev
ABenC377 f051277
Rebasing to dev
ABenC377 2a957cb
Rebasing to dev
ABenC377 0980811
Rebasing to dev
ABenC377 e5f52eb
undoing last push
ABenC377 37a1c34
Updating haeders and comments
ABenC377 e297e68
Rebasing to dev
ABenC377 6dfa36c
clang format
ABenC377 4155ffc
Rebasing to dev
ABenC377 601178b
Rebasing to dev
ABenC377 5031d15
Rebasing to dev
ABenC377 4ad630c
Rebasing to dev
ABenC377 d2a651b
Rebasing to dev
ABenC377 111a48f
Rebasing
ABenC377 c661294
Adding Tage config file
ABenC377 e8683c1
Merging in dev
ABenC377 00d198a
Changes to config to allow parameterisation
ABenC377 9f144e1
Making TAGE paramterisable
ABenC377 6f73f4e
Specifying size of constant 1 throughout
ABenC377 03d807d
Updating default A64FX config branch predictor
ABenC377 9afa83c
Cleaning up BranchHistory.hh comments
ABenC377 79a5c7f
Adding to documentation
ABenC377 e11742d
Adding to documentation
ABenC377 729de42
Adding tests
ABenC377 922ba4b
Actually adding the test file
ABenC377 dd3053a
Adjusting comments
ABenC377 4e1717d
clang format
ABenC377 bff5fa8
Finessing
ABenC377 22756e6
Adding include to BranchHistory.hh
ABenC377 eba5447
Turning around Finn's comments
ABenC377 768db53
Capitalising a comment
ABenC377 14789a6
Turning vectors for indices and tags in the ftq into shared_ptrs of a…
ABenC377 7dcbb16
predTable from uint8_t to int8_t
ABenC377 c6dc5b5
updating how predTable is handled so that btb is -1, rather than 0 (i…
ABenC377 f9da602
Correcting tests after optimisation
ABenC377 0ecdd6b
TAGE->Tage in the documentation
ABenC377 57f3575
Adding Tage to TX2 config file
ABenC377 674672f
Correcting typos in comments
ABenC377 800ce6f
Merge branch 'dev' into TAGE
ABenC377 b23429f
Adding Tage to a64fx_SME.yaml
ABenC377 ac0d2cf
Adjusting comments
ABenC377 f9ecd29
Clang format
ABenC377 f11661d
Merge branch 'dev' into TAGE
ABenC377 e00ec65
Merge branch 'dev' into TAGE
ABenC377 d87cc5d
Updating comments and docs in response to PR comments
ABenC377 44182e0
Tage -> TAGE
ABenC377 fdfc963
Tage -> TAGE
ABenC377 c22b9d4
Merge branch 'dev' into TAGE
ABenC377 1714a5b
Cleaning up BranchHistory.hh logic in view of Finn's comments
ABenC377 b923ec1
Adding cmake minimum to build script for ubuntu
ABenC377 ed4c620
Udpating logic per Finn comment
ABenC377 26c8d2b
Increasing google test version
ABenC377 cdcb534
Changing google test version
ABenC377 4ec9694
Changing google test version
ABenC377 d6a032f
Changing google test version
ABenC377 63ff90c
Correcting indentation
ABenC377 a475884
Testing google test v1.17
ABenC377 5eab8d3
Reverting to google test v1.13 for fewest changes (1.17 did pass test…
ABenC377 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| #pragma once | ||
|
|
||
| #include <cstdint> | ||
| #include <memory> | ||
|
|
||
| namespace simeng { | ||
| /** A class for storing a branch history. Needed for cases where a branch | ||
| * history of more than 64 bits is required. This class makes it easier to | ||
| * access and manipulate large branch histories, as are needed in | ||
| * sophisticated branch predictors. | ||
| * | ||
| * The bits of the branch history are stored in an array of uint64_t values, | ||
| * and their access/manipulation is facilitated by the public functions. */ | ||
|
|
||
| class BranchHistory { | ||
| public: | ||
| BranchHistory(uint64_t size) : size_(size) { | ||
| history_ = std::make_unique<uint64_t[]>(size_); | ||
| } | ||
|
|
||
| ~BranchHistory() {}; | ||
|
FinnWilkinson marked this conversation as resolved.
|
||
|
|
||
| /** Returns the 'numBits' most recent bits of the branch history. Maximum | ||
| * number of bits returnable is 64 to allow it to be provided in a 64-bit | ||
| * integer. */ | ||
| uint64_t getHistory(uint8_t numBits) { | ||
| assert(numBits <= 64 && "Cannot get more than 64 bits without rolling"); | ||
| assert(numBits <= size_ && | ||
| "Cannot get more bits of branch history than " | ||
| "the size of the history"); | ||
| return (history_[0] & ((1ull << numBits) - 1)); | ||
| } | ||
|
|
||
| /** Returns 'numBits' of the global history folded over on itself to get a | ||
| * value of size 'length'. The global history is folded by taking an | ||
| * XOR hash with the overflowing bits to get an output of 'length' bits. */ | ||
| uint64_t getFolded(uint8_t numBits, uint8_t length) { | ||
| assert(numBits <= size_ && | ||
| "Cannot get more bits of branch history than " | ||
| "the size of the history"); | ||
| uint64_t output = 0; | ||
|
|
||
| uint64_t startIndex = 0; | ||
| uint64_t endIndex = numBits - 1; | ||
|
|
||
| while (startIndex <= numBits) { | ||
| output ^= ((history_[startIndex / 64] >> startIndex) & | ||
| ((1ull << (numBits - startIndex)) - 1)); | ||
|
|
||
| // Check to see if a second uint64_t value will need to be accessed | ||
| if ((startIndex / 64) == (endIndex / 64)) { | ||
| uint8_t leftOverBits = endIndex % 64; | ||
| output ^= (history_[endIndex / 64] << (numBits - leftOverBits)); | ||
| } | ||
| startIndex += length; | ||
| endIndex += length; | ||
| } | ||
|
|
||
| // Trim the output to the desired size | ||
| output &= (1 << length) - 1; | ||
| return output; | ||
| } | ||
|
|
||
| /** Adds a branch outcome ('isTaken') to the global history */ | ||
| void addHistory(bool isTaken) { | ||
| for (int8_t i = size_ / 64; i >= 0; i--) { | ||
| history_[i] <<= 1; | ||
| if (i == 0) { | ||
| history_[i] |= ((isTaken) ? 1 : 0); | ||
| } else { | ||
| history_[i] |= (history_[i - 1] & 0x80000000) >> 63; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** Updates the state of a branch that has already been added to the global | ||
| * history at 'position', where 'position' is 0-indexed and starts from the | ||
| * most recent history. I.e., to update the most recently added branch | ||
| * outcome, 'position' would be 0. | ||
| * */ | ||
| void updateHistory(bool isTaken, uint64_t position) { | ||
| if (position < size_) { | ||
|
dANW34V3R marked this conversation as resolved.
|
||
| uint8_t vectIndex = position / 64; | ||
| uint8_t bitIndex = position % 64; | ||
| bool currentlyTaken = ((history_[vectIndex] & (1ull << bitIndex)) != 0); | ||
| if (currentlyTaken != isTaken) { | ||
| history_[vectIndex] ^= (1ull << bitIndex); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** Removes the most recently added branch from the history */ | ||
| void rollBack() { | ||
| for (uint8_t i = 0; i <= (size_ / 64); i++) { | ||
| history_[i] >>= 1; | ||
| if (i < (size_ / 64)) { | ||
| history_[i] |= (history_[i + 1] & 1ull) << 63; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private: | ||
| /** The number of bits of branch history stored in this branch history */ | ||
| uint64_t size_; | ||
|
|
||
| /** An array containing the bits of the branch history. The bits are | ||
| * arranged such that the most recent branches are stored in uint64_t at | ||
| * index 0 of the vector, then the next most recent at index 1 and so forth. | ||
| * Within each uint64_t, the most recent branches are recorded in the | ||
| * least-significant bits. */ | ||
| std::unique_ptr<uint64_t[]> history_; | ||
| }; | ||
|
|
||
| } // namespace simeng | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.