Cached instruction recording for prediction embedding
A processor may include a bias prediction circuit and an instruction prediction circuit to provide respective predictions for a conditional instruction. The bias prediction circuit may provide a bias prediction whether a condition of the conditional instruction is biased true or biased false. The instruction prediction circuit may provide an instruction prediction whether the condition of the conditional instruction is true of false. Responsive to a bias prediction that the condition of the conditional instruction is biased true or biased false, the processor may use the bias prediction from the bias prediction circuit to speculatively process the conditional instruction. Otherwise, the processor may use the instruction prediction from the instruction prediction circuit to speculatively process the conditional instruction.
1 . A processor, comprising:
a bias prediction circuit configured to predict respective conditions for individual conditional instructions according to one or more previous executions of the individual conditional instructions, wherein the predicted conditions individually comprise a biased condition or an unbiased condition, and wherein the biased condition indicates that a respective condition is always true or always false; and
a fetch and decode circuit configured to encode, in a cache, information identifying a first conditional instruction as biased responsive to a prediction of a biased condition by the bias prediction circuit for the first conditional instruction.
2 . The processor of claim 1 , wherein to encode information identifying the first conditional instruction as biased, the fetch and decode circuit is configured to recode the first conditional instruction in the cache as a non-conditional instruction.
3 . The processor of claim 1 , wherein to encode information identifying the first conditional instruction as biased, the fetch and decode circuit is configured to:
encode the first conditional instruction in an entry of the cache; and
append information identifying the prediction of the biased condition to the entry of the cache.
4 . The processor of claim 1 , wherein to predict a condition for a given conditional instruction of the individual conditional instructions, the bias prediction circuit is configured to:
identify a value for the given conditional instruction in a bias table based on an address of the given conditional instruction; and
provide the predicted condition based on the identified value for the given conditional instruction in the bias table.
5 . The processor of claim 4 , wherein the value for the given conditional instruction in the bias table is one of a plurality of values including:
a first value indicating that no conditional instruction corresponding to an entry of the value in the bias table has been encountered by the bias prediction circuit;
a second value indicating that the condition of the given conditional instruction is biased false;
a third value indicating that the condition of the given conditional instruction is biased true; and
a fourth value indicating that the condition of the given conditional instruction is not biased.
6 . The processor of claim 5 , wherein the value for the given conditional instruction in the bias table is set from the first value to the second or third value when execution of the given conditional instruction indicates that the condition of the given conditional instruction is respectively false or true, or from the second or third value to the fourth value when the execution of the given conditional instruction indicates that the value for the given conditional instruction in the bias table mis-matches an outcome of the execution of the given conditional instruction.
7 . The processor of claim 1 , wherein the bias prediction circuit is configured to predict the respective conditions for the individual conditional instructions at a first stage of the processor corresponding to loading the respective individual conditional instructions to the cache of the processor, and wherein the processor further comprises an instruction prediction circuit configured to provide respective instruction predictions at a second stage of the processor corresponding to fetching, from the cache, of respective conditional instructions having respective predictions of unbiased conditions by the bias prediction circuit.
8 . A method, comprising:
predicting, using a bias prediction circuit of a processor, respective conditions for individual conditional instructions according to one or more previous executions of the individual conditional instructions, wherein the predicted conditions individually comprise a biased condition or an unbiased condition, and wherein the biased condition indicates that a respective condition of the respective conditions is always true or always false;
generating, by the bias prediction circuit, a prediction of the biased condition for a first conditional instruction; and
encoding, in a cache of the processor using a fetch and decode circuit of the processor, information identifying the first conditional instruction as biased responsive to a prediction of a biased condition by the bias prediction circuit for the first conditional instruction.
9 . The method of claim 8 , comprising: wherein encoding information identifying the first conditional instruction as biased comprises recoding the first conditional instruction in the cache as a non-conditional instruction.
10 . The method of claim 8 , wherein encoding information identifying the first conditional instruction as biased comprises:
encoding the first conditional instruction in an entry of the cache; and
appending information identifying the prediction of the biased condition to the entry of the cache.
11 . The method of claim 8 , wherein predicting a condition for a given conditional instruction of the individual conditional instructions comprises:
identifying a value for the given conditional instruction in a bias table based on an address of the given conditional instruction; and
providing the predicted condition based on the identified value for the given conditional instruction in the bias table.
12 . The method of claim 11 , wherein the value for the given conditional instruction in the bias table is one of a plurality of values including:
a first value indicating that no conditional instruction corresponding to an entry of the value in the bias table has been encountered by the bias prediction circuit;
a second value indicating that the condition of the given conditional instruction is biased false;
a third value indicating that the condition of the given conditional instruction is biased true; and
a fourth value indicating that the condition of the given conditional instruction is not biased.
13 . The method of claim 12 , wherein the value for the given conditional instruction in the bias table is set from the first value to the second or third value when execution of the given conditional instruction indicates that the condition of the given conditional instruction is respectively false or true, or from the second or third value to the fourth value when the execution of the given conditional instruction indicates that the value for the given conditional instruction in the bias table mis-matches an outcome of the execution of the given conditional instruction.
14 . The method of claim 8 , wherein predicting the respective conditions for the individual conditional instructions is performed at a first stage of the processor corresponding to loading the respective individual conditional instructions to the cache of the processor, and wherein the method further comprises providing, using an instruction prediction circuit of the processor, respective instruction predictions at a second stage of the processor corresponding to fetching, from the cache, of respective conditional instructions having respective predictions of unbiased conditions by the bias prediction circuit.
15 . A system, comprising:
one or more processors individually comprising:
a bias prediction circuit configured to predict respective conditions for individual conditional instructions according to one or more previous executions of the individual conditional instructions, wherein the predicted conditions individually comprise a biased condition or an unbiased condition, and wherein the biased condition indicates that a respective condition is always true or always false; and
a fetch and decode circuit configured to encode, in a cache, information identifying a first conditional instruction as biased responsive to a prediction of a biased condition by the bias prediction circuit for the first conditional instruction.
16 . The system of claim 15 , wherein to encode information identifying the first conditional instruction as biased, the fetch and decode circuit is configured to recode the first conditional instruction in the cache as a non-conditional instruction.
17 . The system of claim 15 , wherein to encode information identifying the first conditional instruction as biased, the fetch and decode circuit is configured to recode the first conditional instruction in the cache as a non-conditional instruction.
18 . The system of claim 15 , wherein to predict a condition for a given conditional instruction of the individual conditional instructions, the bias prediction circuit is configured to:
identify a value for the given conditional instruction in a bias table based on an address of the given conditional instruction; and
provide the predicted condition based on the identified value for the given conditional instruction in the bias table.
19 . The system of claim 18 , wherein the value for the given conditional instruction in the bias table is one of a plurality of values including:
a first value indicating that no conditional instruction corresponding to an entry of the value in the bias table has been encountered by the bias prediction circuit;
a second value indicating that the condition of the given conditional instruction is biased false;
a third value indicating that the condition of the given conditional instruction is biased true; and
a fourth value indicating that the condition of the given conditional instruction is not biased.
20 . The system of claim 19 , wherein the value for the given conditional instruction in the bias table is set from the first value to the second or third value when execution of the given conditional instruction indicates that the condition of the given conditional instruction is respectively false or true, or from the second or third value to the fourth value when the execution of the given conditional instruction indicates that the value for the given conditional instruction in the bias table mis-matches an outcome of the execution of the given conditional instruction.