Method and apparatus for software-directed inhibiting of branch prediction in computing devices
AssigneeHuawei Technologies Co., Ltd.
InventorsMaziar GOUDARZI, Reza AZIMI, Viatcheslav STEPANOV
Life of this patent
Estimating the term…
Abstract
Methods and apparatus for inhibiting branch prediction unit operations of a computer are provided. Program code is generated having instructions which inhibit branch prediction prior to a stable path being executed, the stable path being stable (e.g. with all instructions executed sequentially as they occur in memory) with high likelihood. The instructions when executed trigger such branch prediction unit inhibition. The instructions can be generated so as to have a high prevalence, length, or both, of stable paths.
Claims18
A computer apparatus comprising a processor operatively coupled to memory, the apparatus configured to:
- generate executable computer program code having a stable path which consists essentially of a plurality of instructions to be most probably executed in a sequence, the plurality of instructions occurring in the stable path contiguously according to the sequence;
- the generating of the executable computer program code comprising arranging the computer program code to maximize a length of the stable path while respecting one or more conditions or constraints,
- the generating of the executable computer program code comprising including an indicator therein to inhibit operation of a branch prediction unit during execution of the stable path;
- and
- store the generated executable computer program code for subsequent use.
A computer apparatus comprising a processor operatively coupled to memory and a branch prediction unit, the apparatus configured to:
- execute computer program code stored in memory and having a stable path which consists essentially of a plurality of instructions to be most probably executed in a sequence, the plurality of instructions occurring in the stable path contiguously according to the sequence;
- read, in the computer program code, an indicator corresponding to the stable path approaching execution, the indicator included in the computer program code during generation thereof;
- and
- in response to reading the indicator, inhibit operation of the branch prediction unit during at least one subsequent execution of the stable path.
A non-transitory computer readable medium having stored thereon computer program code comprising:
- a stable path which consists essentially of a plurality of instructions to be most probably executed in a sequence, the plurality of instructions occurring in the stable path contiguously according to the sequence;
- an indicator in the computer program code and corresponding to the stable path approaching execution, the indicator included in the computer program code during generation thereof;
- wherein in response to the indicator being read by a computer apparatus executing the computer program code, the apparatus inhibits operation of the branch prediction unit during at least one subsequent execution of the stable path.
A method comprising, by a computer:
- generating executable computer program code having a stable path which consists essentially of a plurality of instructions to be most probably executed in a sequence, the plurality of instructions occurring in the stable path contiguously according to the sequence;
- the generating of the executable computer program code comprising arranging the computer program code to maximize a length of the stable path while respecting one or more conditions or constraints,
- the generating of the executable computer program code comprising including an indicator therein to inhibit operation of a branch prediction unit during execution of the stable path;
- and
- storing the generated executable computer program code for subsequent use.
A method comprising, by a computer having a branch prediction unit:
- executing computer program code stored in memory and having a stable path which consists essentially of a plurality of instructions to be most probably executed in a sequence, the plurality of instructions occurring in the stable path contiguously according to the sequence;
- reading, in the computer program code, an indicator corresponding to the stable path approaching execution, the indicator included in the computer program code during generation thereof;
- and
- in response to reading the indicator, inhibiting operation of the branch prediction unit during at least one subsequent execution of the stable path.
Dependencies are inferred from the claim text.