IP Library › Granted Patent US 10,275,249
Granted Patent B1
US 10,275,249 · App. 15/272,248 · Granted Apr 30, 2019

Method and apparatus for predicting end of loop

Inventors: Daniel J. Richins (Austin, TX); Joseph Delgross (Chandler, AZ)
Assignee: Marvell International Ltd.
G06F9/30065G06F9/3802
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 10,275,249
App. No.
15/272,248
Filed
Sep 21, 2016
Granted
Apr 30, 2019
Kind
B1
Art Unit
2182
USPC
712/241
Abstract

Embodiments include a method comprising: executing a loop during a first encounter of the loop; tracking a first number of times the loop is iterated while the loop is executed during the first encounter; executing the loop during a second encounter of the loop; tracking a second number of times the loop is iterated while the loop is executed during the second encounter; and in response to the first number being equal to the second number, predicting a behavior of the loop during a third encounter of the loop.

Claims (60)

1. A method performed by a computing device to predict loop behavior, the method comprising:

executing a loop during a first encounter of the loop;

tracking a first number of times the loop is iterated while the loop is executed during the first encounter;

executing the loop during a second encounter of the loop;

tracking a second number of times the loop is iterated while the loop is executed during the second encounter;

comparing the first number of times the loop is iterated to the second number of times the loop is iterated;

generating, based on the comparison of the first number to the second number, an output having one of two values, the two values of the output including (i) a first value generated in response to the first number being equal to the second number and (ii) a second value generated in response to the first number not being equal to the second number and being effective to prevent prediction of loop behavior during a subsequent encounter with the loop; and

in response to the value of the output being the first value indicating that the first number is equal to the second number, predicting a behavior of the loop during a third encounter of the loop; or

in response to the value of the output being the second value indicating that the first number is not equal to the second number, not predicting the behavior of the loop during the third encounter of the loop.

2. The method of claim 1 , wherein the behavior of the loop predicted during the third encounter of the loop comprise

a number of predicted iterations of the loop during the third encounter of the loop that is equal to the first and second numbers.

3. The method of claim 1 , further comprising:

in response to the first number being equal to the second number, updating a counter.

4. The method of claim 3 , wherein the counter comprises a repeated counter; and

wherein updating the counter comprises

updating the repeated counter to have a value of at least two.

5. The method of claim 1 , wherein the first and second encounters of the loop are part of a larger group of consecutive encounters of the loop that have a same number of iterations as the first and second encounters of the loop; and

wherein the prediction is further based on a number of the consecutive encounters of the loop that had the same number of iterations as the first and second encounters passing a threshold number.

6. The method of claim 5 ,

wherein the threshold number is inversely proportional to the first number.

7. The method of claim 1 , wherein the prediction is performed by a first predictor circuit, and wherein the method further comprises:

predicting the behavior of the loop using a second predictor circuit;

comparing a prediction provided by the first predictor circuit with a prediction provided by the second predictor circuit;

based on the comparing, updating a reliability counter, wherein the reliability counter provides a reliability of prediction provided by the first predictor circuit; and

wherein the prediction is further based on the reliability counter.

8. The method of claim 1 , further comprising:

in response to the first number being equal to the second number, speculatively pre-fetching and pre-processing at least a section of the loop.

9. The method of claim 8 , wherein the tracking of the first and second encounters of the loop and the prediction are performed by a circuit of the computing device; and

wherein the method further comprises, sending the prediction to a pipeline of the computing device that causes a processor of the computing device to perform the pre-fetching and pre-processing.

10. The method of claim 1 , wherein the first and second numbers are stored within a register structure of the computing device.

11. A device comprising:

memory storing instructions that includes a loop;

a processor configured to execute the loop during (i) a first encounter of the loop and (ii) a second encounter of the loop; and

a circuit configured to

track (i) a first number of times the loop is iterated while the loop is executed during the first encounter and (ii) a second number of times the loop is iterated while the loop is executed during the second encounter

compare the first number of times the loop is iterated to the second number of times the loop is iterated;

generate, based on the comparison of the first number to the second number, an output having one of two values, the two values of the output including (i) a first value generated in response to the first number being equal to the second number and (ii) a second value generated in response to the first number not being equal to the second number and being effective to prevent prediction of loop behavior during a subsequent encounter with the loop; and

in response to the value of the output being the first value indicating that the first number is equal to the second number, predict a behavior of the loop during a third encounter of the loop; or

in response to the value of the output being the second value indicating that the first number is not equal to the second number, not predict the behavior of the loop during the third encounter of the loop.

12. The device of claim 11 , wherein the behavior of the loop predicted during the third encounter of the loop

comprises a number of predicted iterations of the loop during the third encounter of the loop that is equal to the first and second numbers.

13. The device of claim 11 , wherein the circuit is further configured to:

in response to the first number being equal to the second number, updating a counter.

14. The device of claim 13 , wherein the counter comprises a repeated counter; and

wherein updating the counter comprises updating the repeated counter have a value of at least two.

15. The device of claim 11 , wherein the first and second encounters of the loop are part of a larger group of consecutive encounters of the loop that have a same number of iterations as the first and second encounters of the loop; and

wherein the prediction is further based on a number of the consecutive encounters of the loop that had the same number of iterations as the first and second encounters passing a threshold number.

16. The device of claim 15 , wherein the

threshold number is inversely proportional to the first number.

17. The device of claim 11 , wherein the circuit is a first predictor circuit, and wherein the device further comprises:

a second predictor circuit configured to predict the behavior of the loop,

wherein the device is configured to:

compare a prediction provided by the first predictor circuit with a prediction provided by the second predictor circuit,

based on the comparing, updating a reliability counter, wherein the reliability counter provides a reliability of prediction provided by the first predictor circuit, and

wherein the prediction is further based on the reliability counter.

18. The device of claim 11 , further comprising:

an instruction pipeline, wherein in response to the behavior of the loop being predicted the instruction pipeline is configured to, responsive to the behavior of the loop during the third encounter of the loop being predicted, cause the processor to speculatively pre-fetch and pre-process at least a section of the loop prior to the processor executing the third encounter of the loop completely.

19. The device of claim 11 , further comprising a register structure; and

wherein the circuit is further configured to store the first and second numbers within the register structure.

20. The device of claim 19 , wherein the prediction is provided at least partially as an output of a multiplexer operably coupled to the register structure.

Assignments (4)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 16, 2020
From: CAVIUM INTERNATIONAL
To: MARVELL ASIA PTE, LTD.
Reel/Frame 053475/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 20, 2020
From: MARVELL INTERNATIONAL LTD.
To: CAVIUM INTERNATIONAL
Reel/Frame 052918/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 29, 2018
From: RICHINS, DANIEL J.; DELGROSS, JOSEPH
To: MARVELL SEMICONDUCTOR, INC.
Reel/Frame 046244/0889 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 29, 2018
From: MARVELL SEMICONDUCTOR, INC.
To: MARVELL INTERNATIONAL LTD.
Reel/Frame 046244/0912 →
Continuity (1)
Provisional Application 62242209 · Oct 15, 2015
Cited By (2)
US 12,379,929 US 12,417,104