US7469332B2

Systems and methods for adaptively mapping an instruction cache

Summary by NHIP

Adaptive Instruction Cache Mapping

The system observes collisions during program execution to determine an optimal mapping of address bits into a tag and an index. It then dynamically remaps the instruction cache using the selected function to minimize collisions without relinking the program.

Claim Score by NHIP

Read claim 1, the broadest

Abstract

Systems and methods for adaptively mapping system memory address bits into an instruction tag and an index into the cache are disclosed. More particularly, hardware and software are disclosed for observing collisions that occur for a given mapping of system memory bits into a tag and an index. Based on the observations, an optimal mapping may be determined that minimizes collisions.

US7469332B2, drawing sheet 1
Sheet 1 of 5

Term

Term ended

Expired 10 October 2025, 1 year ago.

  1. Priority and filed
  2. Granted
  3. Expired
  4. Today

14 claims: 3 independent, 11 dependent

  1. 1
    Broadest claimClaim Score 24, narrow(NHIP)A method for adaptively mapping an instruction cache, comprising:receiving addresses from a program counter, each address corresponding to a location in a system memory where an instruction is stored;defining a plurality of mapping functions, wherein each mapping function which maps different bits of an address received from the program counter into a tag to identify an instruction stored in the system memory at the address provided by the program counter and an index to identify a location in an instruction cache for storing the instruction and the tag;each mapping function mapping a different number of address bits into the tag and into the index so that a different number of collisions will occur under each different mapping functions;observing, for each of the plurality of mapping functions, during execution of multiple programs, a mapping of a sequence of addresses from the program counter to determine, for each mapping function, a number of collisions;wherein a collision is an occurrence of an address from the program counter mapping to an index where the location in an instruction cache corresponding to the index is full of valid instructions;determining from the observations a first mapping function of the plurality of mapping functions that reduces collisions, the first mapping function determining which bits of the instruction address are deemed to be the tag, and which bits are deemed to be the cache address;and dynamically remapping according to the first mapping function determined to reduce collisions, by determining which bits of the instruction address are deemed to be the tag, and which bits are deemed to be the cache address in order to minimize collisions as determined by the observations;writing instructions to the cache according to the first mapping function that is observed to reduce collisions without relinking a program;determining from the observations of the mapping of instructions into the cache a mapping of the system memory address bits to a tag and an index that reduce collisions with steady state code;and changing the mapping function implemented by an address mapper and flushing the instruction cache when the mapping function is changed.
  2. 6
    A digital system for processing data, comprising:an instruction cache configured to receive instructions from a system memory;a program counter configured to provide instruction addresses;a plurality of mapping functions, which maps bits of an address received from the program counter into a tag to identify an instruction stored in the system memory at the address provided by the program counter and an index to identify a location in an instruction cache for storing the instruction and the tag;each mapping function mapping a different number of address bits into the tag and into the index so that a different number of collisions will occur under each different mapping functions;an address mapper configured to map and dynamically remap, during execution of multiple programs, bits of each instruction address, according to a first mapping function of the plurality of mapping functions which is observed to reduce collisions when compared to the others of the plurality of mapping functions, into a tag to identify the instruction and an index to point to a location in the cache for storing the instruction;a collision observer configured to observe, during execution of the multiple programs, instruction cache collisions for each of the plurality of mapping functions;wherein a collision is an occurrence of an address from the program counter mapping to an index where the location in an instruction cache corresponding to the index is full of valid instructions;a collision analyzer configured to determine from the observations, the first mapping function that reduces collisions when compared to the others of the plurality of mapping functions, the first mapping function determining which bits of the instruction address are deemed to be the tag, and which bits are deemed to be the cache address in order to minimize collisions;wherein the collision analyzer determines collisions for the plurality of mapping functions and determines which of the plurality of mapping functions produces the least collisions with steady state code;a controller for writing instructions to the cache according to the first mapping function that is observed to reduce collisions without relinking a program;and a mechanism configured to change the mapping function that maps the program counter into an index and a tag and another mechanism to flush the instruction cache when the mapping function is changed.
  3. 12
    A machine-accessible medium containing instructions effective, when executing in a data processing system, to cause said data processing system to perform operations comprising:defining a plurality of mapping functions, which maps bits of an address received from a program counter into a tag to identify an instruction stored in the system memory at the address provided by the program counter and an index to identify a location in an instruction cache for storing the instruction and the tag;each mapping function mapping a different number of address bits into the tag and into the index so that a different number of collisions will occur under each different mapping functions;observing instruction cache collisions over a time interval, during the execution of multiple programs, for each of the plurality of mapping functions that determine which bits of the system address are the tag and which bits are the index;wherein an instruction cache collision is an occurrence of an address from the program counter mapping to an index where the location in the instruction cache corresponding to the index is full of valid instructions;based on the observations, determining a first mapping function of the plurality of mapping functions which maps bits of a system memory address into a tag and an index to reduce instruction cache collisions, the first mapping function determining which bits of the instruction address are deemed to be the tag, and which bits are deemed to be the cache address;dynamically remapping bits of the system address according to the first mapping function determined to reduce collisions, by determining which bits of the instruction address are deemed to be the tag, and which bits are deemed to be the cache address in order to minimize collisions as determined by the observations;writing instructions to the cache according to the first mapping function that is observed to reduce collisions without relinking a program;determining from the observations of the mapping of instructions into the cache a mapping of the system memory address bits to a tag and an index that reduce collisions with steady state code;and changing the mapping function implemented by the system and causing the instruction cache contents to be flushed when the mapping function is changed.