Apparatus and method for consolidating memory access prediction information to prefetch cache memory data
An apparatus is connected to a main memory, includes a cache memory holding data and a memory storing prediction information in plural areas thereof. The prediction information is referenced to determine whether to execute prefetch, which holds data from the main memory to the cache memory, in a case where a plurality of unrolled instructions produced by unrolling a target instruction included in a loop sentence are executed individually, and corresponds to individual memory accesses executed at certain address intervals in accordance with the respective unrolled instructions. The apparatus executes memory access to the main memory, and executes the prefetch. When the plurality of unrolled instructions are executed individually, the apparatus consolidates a plurality of pieces of prediction information respectively stored in the plural areas of the memory into one based on the number-of-unrolling information, and stores the consolidated prediction information into any one of the plural areas.
1. An operation processing device connected to a main memory, comprising:
a cache memory configured to hold data;
an operation processing unit configured to execute memory access to the main memory;
a control unit configured to execute prefetch, the prefetch holding data from the main memory to the cache memory;
a prediction information storage unit configured to store prediction information in a plurality of areas thereof, the prediction information being referenced by the control unit to determine whether to execute the prefetch in a case where a plurality of unrolled instructions produced by unrolling a target instruction included in a loop sentence are executed individually, the prediction information corresponding to individual memory accesses executed at certain address intervals in accordance with the respective unrolled instructions;
a number-of-unrolling storage unit configured to store a number-of-unrolling information corresponding to a number of unrolled instructions when the target instruction is unrolled into the plurality of unrolled instructions; and
a consolidation unit configured to, when the plurality of unrolled instructions are executed individually, generate consolidated prediction information by consolidating a plurality of pieces of prediction information respectively stored in the plurality of areas of the prediction information storage unit into one based on the number-of-unrolling information, and store the consolidated prediction information into any one of the plurality of areas.
2. The operation processing device of claim 1 , wherein
the plurality of areas of the prediction information storage unit further stores a stride value to be used when the prediction information is updated; and
the consolidation unit further includes a calculation unit configured:
to calculate the stride value to be used when the prediction information is updated, based on an address interval of memory access repeatedly executed in accordance with any one of the plurality of unrolled instructions, and the number-of-unrolling information, and
to store the calculated stride value into an area storing the consolidated prediction information out of the plurality of areas.
3. The operation processing device of claim 2 , wherein
when the operation processing unit executes memory access, the operation processing unit outputs a program counter value indicating a storage destination of a memory access instruction executing memory access, and an access address indicating a storage destination of data accessed by the memory access instruction, to the consolidation unit;
the prediction information respectively stored in the plurality of areas includes a reference address to be compared with the access address;
each of the plurality of areas further stores a reference program counter value to be compared with the program counter value, and entry information indicating whether or not each area is in a recorded state assigned correspondingly to any one of memory accesses; and
the consolidation unit includes a management unit configured to, when the consolidation unit detects, from the plurality of areas, a first area storing the reference address matching the access address and a second area storing the reference program counter value matching the program counter value and different from the first area, set the entry information stored in the second area to an unrecorded state indicating that the second area is not in the recorded state.
4. A method of controlling an operation processing device including a cache memory configured to hold data, a control unit configured to execute prefetch that holds data from a main memory to the cache memory, a prediction information storage unit configured to store prediction information into a plurality of areas thereof, the prediction information being referenced by the control unit to determine whether to execute the prefetch in a case where a plurality of unrolled instructions produced by unrolling a target instruction included in a loop sentence are executed individually, the prediction information corresponding to individual memory accesses executed at certain address intervals in accordance with the respective unrolled instructions, and a number-of-unrolling storage unit configured to store a number-of-unrolling information corresponding to a number of unrolled instructions when the target instruction is unrolled into the plurality of unrolled instructions, the method comprising:
causing an operation processing unit included in the operation processing device to execute memory access to the main memory; and
causing a consolidation unit included in the operation processing device to, when the plurality of unrolled instructions are executed individually, generate consolidated prediction information by consolidating a plurality of pieces of prediction information respectively stored in the plurality of areas of the prediction information storage unit into one based on the number-of-unrolling information, and store the consolidated prediction information into any one of the plurality of areas.
5. An apparatus connected to a main memory, the apparatus comprising:
a cache memory configured to hold data;
a memory configured to store prediction information in a plurality of areas thereof, and store a number-of-unrolling information corresponding to a number of unrolled instructions when the target instruction is unrolled into the plurality of unrolled instructions, the prediction information being referenced to determine whether to execute prefetch, which holds data from the main memory to the cache memory, in a case where a plurality of unrolled instructions produced by unrolling a target instruction included in a loop sentence are executed individually, the prediction information corresponding to individual memory accesses executed at certain address intervals in accordance with the respective unrolled instructions; and
a processor configured:
to execute memory access to the main memory,
to execute the prefetch, and
to, when the plurality of unrolled instructions are executed individually, generate consolidated prediction information by consolidating a plurality of pieces of prediction information respectively stored in the plurality of areas of the memory into one based on the number-of-unrolling information, and store the consolidated prediction information into any one of the plurality of areas.