IP Library › Granted Patent US 11,442,727
Granted Patent B2
US 11,442,727 · App. 16/895,825 · Granted Sep 13, 2022

Controlling prediction functional blocks used by a branch predictor in a processor

Inventors: Varun Agrawal (Acton, MA); John Kalamatianos (Arlington, MA)
Assignee: ADVANCED MICRO DEVICES, INC.
G06F9/30032G06F9/30058G06F9/3806
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,442,727
App. No.
16/895,825
Granted
Sep 13, 2022
Kind
B2
Abstract

An electronic device includes a processor, a branch predictor in the processor, and a predictor controller in the processor. The branch predictor includes multiple prediction functional blocks, each prediction functional block configured for generating predictions for control transfer instructions (CTIs) in program code based on respective prediction information, the branch predictor configured to select, from among predictions generated by the prediction functional blocks for each CTI, a selected prediction to be used for that CTI. The predictor controller keeps a record of prediction functional blocks from which the branch predictor previously selected predictions for CTIs. The predictor controller uses information from the record for controlling which prediction functional blocks are used by the branch predictor for generating predictions for CTIs.

Claims (90)

1. An electronic device, comprising:

a processor;

a branch predictor in the processor, the branch predictor including multiple prediction functional blocks, each prediction functional block configured for generating predictions for control transfer instructions (CTIs) based on respective prediction information; and

a predictor controller in the processor that stores a record of prediction functional blocks from which the branch predictor previously selected predictions for CTIs, the predictor controller configured to use information from the record for controlling which prediction functional blocks are used by the branch predictor for generating predictions for CTIs, the controlling including using only prediction functional blocks from which the record indicates the branch predictor previously selected predictions for generating predictions for CTIs.

2. The electronic device of claim 1 , wherein the record includes a table having multiple entries, each entry configured for storing tags associated with CTIs and listings of prediction functional blocks from which the branch predictor previously selected predictions for CTIs associated with the tags.

3. The electronic device of claim 2 , wherein the predictor controller is configured to:

train the table by:

receiving, from the branch predictor, an indication of a given prediction functional block from which the branch predictor selected the prediction for a given CTI;

when no entry in the table includes information for the given CTI, adding, to an available entry in the table, a tag associated with the given CTI and a listing of the prediction functional blocks that includes an indication of the given prediction functional block; and

when an existing entry in the table includes information for the given CTI, updating, in the existing entry, the listing of the prediction functional blocks to include an indication of the given prediction functional block.

4. The electronic device of claim 3 , wherein:

each entry in the table is configured for storing a confidence counter; and

when training the table, the predictor controller is configured to:

when adding the tag and the listing of the prediction functional blocks to the available entry, setting a value of a confidence counter for the available entry to an initial value; and

when updating the listing of the prediction functional blocks for the existing entry, increasing the value of the confidence counter for that entry.

5. The electronic device of claim 4 , wherein, when training the table, the predictor controller is configured to:

receive a misprediction signal and an identifier associated with a mispredicted CTI, the misprediction signal indicating that a prediction for the mispredicted CTI that was previously provided by the branch predictor was incorrect; and

when an entry in the table includes information for the mispredicted CTI, reducing the value of the confidence counter for that entry in the table.

6. The electronic device of claim 2 , wherein, when using the information from the record, the predictor controller is configured to:

when a prediction is to be provided by the branch predictor for a given CTI, search the table for an existing entry in which is stored an existing tag that matches a tag associated with the given CTI;

when a useable existing entry is found for which the existing tag matches the tag associated with the given CTI, acquire, from the existing entry, the listing of the prediction functional blocks from which the branch predictor previously selected predictions for the given CTI; and

cause the branch predictor to generate predictions for the given CTI using only the prediction functional blocks identified in the listing, wherein the branch predictor selects the prediction to be used for the given CTI from among the generated predictions.

7. The electronic device of claim 6 , wherein the predictor controller is configured to:

when no useable existing entry is found, cause the branch predictor to generate predictions for the given CTI using all of the prediction functional blocks, wherein the branch predictor selects the prediction to be used for the given CTI from among the generated predictions.

8. The electronic device of claim 6 , wherein searching the table for the existing entry includes:

upon finding an existing entry in the table in which is stored the existing tag that matches the tag associated with the given CTI, determining that the existing entry is useable only when a value of a confidence counter for the existing entry exceeds a threshold value.

9. The electronic device of claim 2 , wherein the table is organized as set associative.

10. The electronic device of claim 2 , wherein some or all of the entries in the table include respective circular buffers with multiple buffer elements, each buffer element configured for storing a listing of a prediction functional block that generated a prediction that was previously used by the branch predictor for a CTI associated with the tag for that entry.

11. The electronic device of claim 1 , wherein the record includes multiple sub-tables, each sub-table being accessed by the predictor controller using a respective hash function, and each sub-table configured for storing frequency values and listings of prediction functional blocks from which the branch predictor previously selected predictions for CTIs.

12. The electronic device of claim 11 , wherein the predictor controller is configured to:

train the sub-tables by:

receiving, from the branch predictor, an indication of a given prediction functional block from which the branch predictor selected the selected prediction for a given CTI;

generating, using the hash function for each sub-table, an index into that sub-table based on an identifier for the given CTI;

increasing a frequency value for an entry in each sub-table indicated by the respective index; and

updating the listing of the prediction functional blocks for the entry in each sub-table indicated by the respective index to include an indication of the given prediction functional block.

13. The electronic device of claim 12 , wherein, when training the sub-tables, the predictor controller is configured to:

receive a misprediction signal and an identifier of a mispredicted CTI, the misprediction signal indicating that a prediction for the mispredicted CTI previously provided by the branch predictor was incorrect;

generate, using the hash function for each sub-table, an index into that sub-table based on the identifier for the mispredicted CTI; and

reduce a frequency value for an entry in each sub-table indicated by the respective index.

14. The electronic device of claim 11 , wherein, when using the information from the record, the predictor controller is configured to:

when a prediction is to be provided by the branch predictor for a given CTI, generate, using the hash function for each sub-table, an index into that sub-table based on the identifier for the given CTI;

determine, based on the frequency value for an entry in each sub-table indicated by the respective index, that the listings of prediction functional blocks in those entries are useable;

generate a combined listing from a combination of the listing of prediction functional blocks in the entry in each sub-table indicated by the respective index; and

cause the branch predictor to generate predictions for the given CTI using only the prediction functional blocks identified in the combined listing, wherein the branch predictor selects the selected prediction to be used for the given CTI from among the generated predictions.

15. The electronic device of claim 14 , wherein the predictor controller is configured to:

determine, based on the frequency value for an entry in each sub-table indicated by the respective index, that the listings of prediction functional blocks in those entries are not useable; and

cause the branch predictor to generate predictions for the given CTI using all of the prediction functional blocks, wherein the branch predictor selects the selected prediction to be used for the given CTI from among the generated predictions.

16. The electronic device of claim 1 , wherein the branch predictor is configured to select, from among predictions generated by the prediction functional blocks for each CTI, a selected prediction to be used for that CTI.

17. A method for making predictions for control transfer instructions (CTIs) in an electronic device that includes a processor; a branch predictor in the processor, the branch predictor including multiple prediction functional blocks, each prediction functional block configured for generating predictions for control transfer instructions (CTIs) based on respective prediction information; and a predictor controller in the processor, the method comprising:

using, by the predictor controller, information from a record of prediction functional blocks from which the branch predictor previously selected predictions for CTIs for controlling which prediction functional blocks are used by the branch predictor for generating predictions for CTIs, the controlling including using only prediction functional blocks from which the record indicates the branch predictor previously selected predictions for generating predictions for CTIs.

18. The method of claim 17 , wherein the record includes a table having multiple entries, each entry configured for storing tags associated with CTIs and listings of prediction functional blocks from which the branch predictor previously selected predictions for CTIs associated with the tags.

19. The method of claim 18 , further comprising:

training, by the predictor controller, the table by:

receiving, from the branch predictor, an indication of a given prediction functional block from which the branch predictor selected the prediction for a given CTI;

when no entry in the table includes information for the given CTI, adding, to an available entry in the table, a tag associated with the given CTI and a listing of the prediction functional blocks that includes an indication of the given prediction functional block; and

when an existing entry in the table includes information for the given CTI, updating, in the existing entry, the listing of the prediction functional blocks to include an indication of the given prediction functional block.

20. The method of claim 19 , wherein each entry in the table is configured for storing a confidence counter and training the table comprises:

when adding the tag and the listing of the prediction functional blocks to the available entry, setting, by the predictor controller, a value of a confidence counter for the available entry to an initial value; and

when updating the listing of the prediction functional blocks for the existing entry, increasing, by the predictor controller, the value of the confidence counter for that entry.

21. The method of claim 20 , wherein training the table comprises:

receiving, by the predictor controller, a misprediction signal and an identifier associated with a mispredicted CTI, the misprediction signal indicating that a prediction for the mispredicted CTI that was previously provided by the branch predictor was incorrect; and

when an entry in the table includes information for the mispredicted CTI, reducing, by the predictor controller, the value of the confidence counter for that entry in the table.

22. The method of claim 18 , wherein using the information from the record comprises:

when a prediction is to be provided by the branch predictor for a given CTI, searching, by the predictor controller, the table for an existing entry in which is stored an existing tag that matches a tag associated with the given CTI;

when a useable existing entry is found for which the existing tag matches the tag associated with the given CTI, acquiring, by the predictor controller, from the existing entry, the listing of the prediction functional blocks from which the branch predictor previously selected predictions for the given CTI; and

causing, by the predictor controller, the branch predictor to generate predictions for the given CTI using only the prediction functional blocks identified in the listing, wherein the branch predictor selects the prediction to be used for the given CTI from among the generated predictions.

23. The method of claim 22 , further comprising:

when no useable existing entry is found, causing, by the predictor controller, the branch predictor to generate predictions for the given CTI using all of the prediction functional blocks, wherein the branch predictor selects the prediction to be used for the given CTI from among the generated predictions.

24. The method of claim 22 , wherein searching the table for the existing entry comprises:

upon finding an existing entry in the table in which is stored the existing tag that matches the tag associated with the given CTI, determining, by the predictor controller, that the existing entry is useable only when a value of a confidence counter for the existing entry exceeds a threshold value.

25. The method of claim 17 , wherein the record includes multiple sub-tables, each sub-table being accessed by the predictor controller using a respective hash function, and each sub-table configured for storing frequency values and listings of prediction functional blocks from which the branch predictor previously selected predictions for CTIs.

26. The method of claim 25 , further comprising:

training, by the predictor controller, the sub-tables by:

receiving, from the branch predictor, an indication of a given prediction functional block from which the branch predictor selected the selected prediction for a given CTI;

generating, using the hash function for each sub-table, an index into that sub-table based on an identifier for the given CTI;

increasing a frequency value for an entry in each sub-table indicated by the respective index; and

updating the listing of the prediction functional blocks for the entry in each sub-table indicated by the respective index to include an indication of the given prediction functional block.

27. The method of claim 26 , wherein training the sub-tables comprises:

receiving, by the predictor controller, a misprediction signal and an identifier of a mispredicted CTI, the misprediction signal indicating that a prediction for the mispredicted CTI previously provided by the branch predictor was incorrect;

generating, by the predictor controller, using the hash function for each sub-table, an index into that sub-table based on the identifier for the mispredicted CTI; and

reducing, by the predictor controller, a frequency value for an entry in each sub-table indicated by the respective index.

28. The method of claim 25 , wherein using the information from the record comprises:

when a prediction is to be provided by the branch predictor for a given CTI, generating, by the predictor controller, using the hash function for each sub-table, an index into that sub-table based on the identifier for the given CTI;

determining, by the predictor controller, based on the frequency value for an entry in each sub-table indicated by the respective index, that the listings of prediction functional blocks in those entries are useable;

generating, by the predictor controller, a combined listing from a combination of the listing of prediction functional blocks in the entry in each sub-table indicated by the respective index; and

causing, by the predictor controller, the branch predictor to generate predictions for the given CTI using only the prediction functional blocks identified in the combined listing, wherein the branch predictor selects the selected prediction to be used for the given CTI from among the generated predictions.

29. The method of claim 28 , further comprising:

determining, by the predictor controller, based on the frequency value for an entry in each sub-table indicated by the respective index, that the listings of prediction functional blocks in those entries are not useable; and

causing, by the predictor controller, the branch predictor to generate predictions for the given CTI using all of the prediction functional blocks, wherein the branch predictor selects the selected prediction to be used for the given CTI from among the generated predictions.

30. The method of claim 17 , wherein the branch predictor is configured to select, from among predictions generated by the prediction functional blocks for each CTI, a selected prediction to be used for that CTI.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 3, 2021
From: KALAMATIANOS, JOHN; AGRAWAL, VARUN
To: ADVANCED MICRO DEVICES, INC.
Reel/Frame 056118/0951 →
Continuity (1)
Related Publication 20210382718A1 · Dec 9, 2021