Circuit and method

By detecting and responding to data access conflicts in the processor's memory location selection circuit and adjusting the attribute mapping relationships of data items, the problem of waste and delay in memory locations in branch prediction is solved, and more efficient data access and storage optimization are achieved.

CN111124946BActive Publication Date: 2024-10-22ARM LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911005362.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2018-10-30
Filing Date
2019-10-22
Publication Date
2024-10-22
Estimated Expiration
2039-10-22

AI Technical Summary

Technical Problem

Existing branch prediction technology has data access conflict problems in the processor, resulting in waste and delay of memory locations, especially in the branch target buffer, due to frequent eviction and replacement of similar branch addresses, resulting in storage space competition and efficiency low.

Method used

By introducing a mapping relationship changing mechanism into the memory location selection circuit, data access conflicts are detected and responded to, and the attribute mapping relationships of data items are adjusted to avoid aliasing and achieve efficient replacement of data items and storage optimization.

Benefits of technology

It effectively reduces data access conflicts, improves memory location utilization, reduces processor latency and energy consumption, and improves the accuracy and efficiency of branch prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111124946B_ABST
    Figure CN111124946B_ABST
Patent Text Reader

Abstract

The present disclosure relates to circuits and methods. The circuits include: a memory circuit that provides a plurality of memory locations; a location selection circuit that is used to select a set of one or more memory locations through which a data item is accessed based on a mapping relationship between an attribute of the data item and a set of one or more memory locations; the location selection circuit is configured to initiate an allocation operation for the data item when the data item is recently stored by the memory circuit and the selected set of one or more memory locations is already occupied by one or more other data items, the allocation operation comprising an operation of replacing at least a subset of one or more other data items in the set of one or more memory locations with the recently stored data item; and a detector circuit that is used to detect a data access conflict, wherein a group of two or more data items with different corresponding attributes are mapped to the same set of one or more memory locations through a mapping relationship.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to circuits and methods. Background Art

[0002] In some data processing applications, so-called branch prediction is used to predict instances of non-linear program flow, for example, the outcome (branch taken or branch not taken) from a conditional program flow branch instruction.

[0003] In some examples, a branch prediction process is run before instructions are executed to speculatively provide instructions in a timely manner to avoid so-called starvation, which can occur if enough instructions (to be executed next) are not fetched in time to execute.

[0004] In order to predict the presence of branches in a given program code portion, a historical data store such as a so-called branch target buffer (BTB) can provide an indication of previously taken branches at a particular program counter (PC) value. For example, an attribute of a data item representing a previously taken branch, such as a PC value or a portion thereof, can be used as the basis for a mapping between the data item and a storage location in the BTB. Summary of the invention

[0005] In an example arrangement, a circuit is provided, the circuit comprising:

[0006] a memory circuit providing a plurality of memory locations;

[0007] a location selection circuit for selecting a set of one or more memory locations through which to access the data item based on a mapping relationship between an attribute of the data item and the set of one or more memory locations;

[0008] the location selection circuit being configured to, when a data item is recently stored by the memory circuit and the selected set of one or more memory locations is already occupied by one or more other data items, initiate an allocation operation for the data item, the allocation operation comprising an operation of replacing at least a subset of the one or more other data items in the set of one or more memory locations with the recently stored data item; and

[0009] a detector circuit for detecting a data access conflict in which a group of two or more data items having different corresponding attributes are mapped to the same set of one or more memory locations through a mapping relationship;

[0010] The location selection circuit is configured to change a mapping relationship applicable to an attribute of at least one data item in the group of two or more data items in response to the detector circuit detecting a data access conflict.

[0011] In another example arrangement, there is provided a cache memory comprising a circuit as defined above; wherein:

[0012] The data item represents a version of the contents of the higher level memory at the corresponding memory address; and

[0013] The properties of a data item depend, at least in part, on the address at which the data item is stored.

[0014] In another example arrangement, there is provided a data processor comprising:

[0015] a processing element for executing data processing instructions; and

[0016] fetch circuitry for fetching instructions defined by entries in the fetch queue for execution; and

[0017] prediction circuitry for generating an entry for the fetch queue defining one or more next data processing instructions to be fetched;

[0018] The prediction circuitry comprises circuitry as defined above, providing branch target storage means for storing one or more data items, each data item comprising at least a portion of a program counter value and information defining a corresponding branch target address of a previously taken branch instruction, wherein an attribute of the data item depends on at least the program counter value.

[0019] In another example arrangement, a circuit is provided, the circuit comprising:

[0020] a memory device providing a plurality of memory locations;

[0021] Selection means for selecting a set of one or more memory locations through which to access the data item based on a mapping relationship between an attribute of the data item and the set of one or more memory locations;

[0022] The selection means is operable to, when a data item is recently stored by the memory circuit and the selected set of one or more memory locations is already occupied by one or more other data items, initiate an allocation operation for the data item, the allocation operation comprising an operation to replace at least a subset of the one or more other data items in the set of one or more memory locations with the recently stored data item; and

[0023] a detection device for detecting a data access conflict in which a group of two or more data items having different corresponding attributes are mapped to the same set of one or more memory locations through a mapping relationship;

[0024] The selecting means may be operable to: in response to the detecting means detecting a data access conflict, change a mapping relationship applicable to the attributes of at least one data item in the group of two or more data items.

[0025] In another example arrangement, a method is provided, comprising:

[0026] selecting, from a plurality of memory locations, a set of one or more memory locations through which to access the data item based on a mapping relationship between an attribute of the data item and the set of one or more memory locations;

[0027] When a data item is recently stored by the memory circuit and the selected set of one or more memory locations is already occupied by one or more other data items, initiating an allocation operation for the data item, the allocation operation comprising an operation to replace at least a subset of the one or more other data items in the set of one or more memory locations with the recently stored data item; and

[0028] detecting a data access conflict in which a group of two or more data items having different corresponding attributes are mapped to the same set of one or more memory locations via a mapping relationship;

[0029] In response to detecting a data access conflict, a mapping relationship applicable to an attribute of at least one data item in the group of two or more data items is changed.

[0030] Various other aspects and features of the present technology are defined by the accompanying claims. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The present technology will be further described, by way of example only, with reference to embodiments of the present technology as illustrated in the accompanying drawings, in which:

[0032] Figure 1 An example of a data processing circuit is schematically shown;

[0033] Figure 2 A series of data processing instructions are schematically shown;

[0034] Figure 3 The prediction circuit is schematically shown;

[0035] Figure 4 schematically illustrates the generation of addressing information;

[0036] Figure 5 and Figure 6 A branch target buffer is schematically shown;

[0037] Figure 7 Aliasing monitoring is schematically shown;

[0038] Figure 8 , Fig.9A and Fig. 9BThe change of the mapping function is schematically shown;

[0039] Fig.10 The label generation is schematically shown;

[0040] Fig.11 A data processor is schematically shown; and

[0041] Fig.12 is a schematic flow chart illustrating the method. DETAILED DESCRIPTION

[0042] Figure 1 is an illustrative example of a data processing circuit 100 comprising a processing element (PE) 110 for executing program code instructions, a fetch circuit 120 for fetching blocks containing instructions for execution from a memory and / or a cache 130 (e.g., an instruction cache). The blocks to be fetched are defined by a fetch queue 140. The data processing circuit further comprises a prediction circuit 150 for predicting one or more next blocks to be fetched and adding the predicted next blocks to the fetch queue 140 as fetch queue entries.

[0043] The prediction circuit 150 references a branch target storage device (including at least a branch target buffer (BTB) 160) and a branch prediction buffer (BPB) 170. They are drawn separately for clarity of the drawing, but they can be considered as part of the prediction circuit 150. In the case where the instruction is a branch instruction, the BTB 160 provides information that associates the program counter (PC) value of the instruction to be executed with the associated branch target. The BPB 170 stores historical data about the results of previous instances of branch instructions (taken branches or not taken branches), which allows the prediction circuit 150 to derive a prediction of whether a particular branch instruction indicated by the BTB 160 is taken or not taken.

[0044] Prediction circuitry 150 may use various mechanisms to predict the "taken" or "not taken" status of an expected branch instruction. Examples of such techniques are provided in US 15 / 806,605 and https: / / en.wikipedia.org / wiki / Branch_predictor, the contents of each of which are incorporated herein by reference. Prediction circuitry 150 uses such techniques to predict blocks (or portions, granules, or even individual instructions in extreme examples) of program code to be extracted, and adds data identifying such blocks to extraction queue 140 on a first-in, first-out basis. Extraction circuitry 120 retrieves such data from extraction queue 140 on the same basis (that is, extraction circuitry 120 retrieves one or more entries most recently added in extraction queue 140) and initiates extraction of the blocks indicated by these entries. The desired block may be in cache 130, or may need to be retrieved from main memory or a higher level cache ( Figure 1 retrieval in (not shown).

[0045] In due course, processing element 110 executes the extracted program code block. Generally speaking, the system is intended to extract program code before it is executed, so that the processing itself will not be unable to maintain due to lack of code to be executed. Therefore, in this respect, extraction is speculative and purely based on the prediction circuit. When the relevant branch instruction is finally executed or resolved, the branch prediction result will be proved to be correct or incorrect. If the prediction is incorrect, it may be that the wrong branch target code has been extracted (or the code at the branch target has been extracted, but the branch is not actually adopted when solving), and the extraction and execution pipeline must be cleared, which produces a delay when extracting the correct program code block to execute.

[0046] The processing element may provide information 180 about branch instructions actually encountered during execution and their actual results back to the BTB 160 and BPB 170. In the event that a branch instruction is encountered during execution (at least for branch instructions that actually take the branch, but potentially for all branch instructions), information about the target of the branch instruction may be stored in the BTB 160. Information about the result (taken / not taken) of the branch instruction may also be stored in the BPB 170.

[0047] Figure 1Thus, an example of a data processor 100 is provided having: a processing element 110 for executing data processing instructions; a fetch circuit 120 for fetching instructions defined by entries in a fetch queue 140 for execution (e.g., individual instructions or blocks, blocks, etc. of instructions); and prediction circuits 150, 160, 170 for generating entries for the fetch queue defining the next one or more data processing instructions to be fetched; the prediction circuitry comprising circuitry as defined below, wherein, in at least some examples, the circuitry provides a branch target storage device to store one or more data items, each data item comprising at least a portion of a program counter value and information defining a corresponding branch target address of a previously taken branch instruction, wherein attributes of the data items depend on at least the program counter value.

[0048] Figure 2 A series of data processing instructions forming an example of a program code block, portion or section 200 is schematically shown. Figure 2 In the schematic representation of , six instructions are shown, but in the example embodiment of the present disclosure, the instruction block can have a consistent base length (in bytes), for example, a power of 2 or at least a multiple of 2, and be address-aligned in memory to a location representing a multiple of the base length. For example, each portion can have a base length of 16 bytes, and the portions can be aligned to 16-byte boundaries in memory.

[0049] exist Figure 2 , consecutive instructions are represented as either "X" or "BR". "X" instructions are non-branch instructions and are represented in this schematic manner to indicate that it is irrelevant what type of instruction they are for the purposes of this discussion. "BR" instructions are conditional branch instructions that may cause non-linear changes in program flow based on which branch decision is taken depending on one or more parameters.

[0050] Referring to the first example branch instruction 210, if the branch represented by the instruction is taken, program flow transfers to another program counter value A. If not, program flow continues to the next sequential instruction 220. Similarly, if the branch at branch instruction 230 is taken, program flow transfers to program counter value B, but if not, program flow continues to the next sequential instruction 240. Thus, as a result of executing portion 200, program flow may:

[0051] Redirect to program counter value A;

[0052] Redirect to program counter value B; or

[0053] • Continue to next program counter value C (in next block, not shown).

[0054] Note that the branch target or destination does not have to be aligned with the beginning of a portion (e.g., portion 200). In fact, a branch from elsewhere can enter portion 200 at any instruction location (e.g., instruction 220 of incoming branch 250).

[0055] Figure 3 An example of the operation of the prediction circuit 150 including the functions of the BTB 160 and the BPB 170 is schematically illustrated.

[0056] Regarding BTB 160, it receives a branch address 300 or a program counter (PC) value, for example, referring to Figure 2 The region table 310 maps branch addresses (and in some examples, processor contexts 320) to identification (ID) values ​​330, for example, by providing a mapping between a memory page identifier or a set of most significant bits (MSBs) of the branch address and the ID value. Thus, to retrieve the ID value, the region table utilizes a subset of the branch address 300.

[0057] Note that in the present technique, the use of a zone table is optional. If a zone table or similar functionality is used, then the attributes of the data item (from which the storage location is mapped, see below) can be, for example, an ID value derived from the zone table and / or one or more LSBs of the data item address (e.g., a branch address). However, if a zone table is not used, then the LSBs can again be used as attributes and (for example) the MSBs stored in the BTB, for example, as part of the tag, or alternatively, the MSBs can be ignored in the case of partial tagging. The following examples should therefore be considered in light of the optional nature of the zone table and the generation of its ID values. Whichever information is used as the basis for the mapping to the storage location is considered an attribute of the data item in question.

[0058] The BTB 160 also utilizes a subset of the branch address, in this example a least significant bit (LSB) set, and contains multiple entries, each of which maps a permutation of (ID, LSB set) to a predicted branch target address 340 .

[0059] In any case where an appropriate entry exists within BTB 160, BTB 160 will output predicted branch target address 340, that is, at least in this example, BTB 160's output of predicted branch target address 340 is independent of the prediction of whether the associated branch will actually be taken (discussed below).

[0060] Regarding the prediction of whether a branch is actually taken, various techniques can be used, such as Figure 3 The technique illustrated by way of example in , involves the use of a so-called Pattern History Table (PHT) 350, which forms at least a part of the BPB 170 described above.

[0061] The PHT 350 provides so-called adaptive branch prediction, where the recent history of whether branches were taken or not is used to select a corresponding version of the prediction information stored by the PHT 350 for the current branch instruction.

[0062] For example, to provide a lookahead, a two-bit saturating counter could be used, representing a state machine with four states:

[0063] 00 Strongly do not adopt 01 Not adopted 10 use 11 Strong adoption

[0064] In this context, the term "strongly" simply means utilizing a saturating counter scheme which will take two consecutive instances of the prediction being incorrect in order to change the prediction represented by the saturating counter, thus moving from 00 (strongly not taken) to 10 (taken), requiring two consecutive increments of the saturating counter before the actual prediction represented by the state of the saturating counter changes from a "not taken" prediction to a "taken" prediction.

[0065] The saturation counter is updated in response to the actual resolution of the branch instruction. If the resolution of the associated branch instruction is "taken", the saturation counter is incremented, saturating at a value of 11. If the resolution of the associated branch instruction is "not taken", the saturation counter is decremented, saturating at a value of 00.

[0066] In terms of its adaptive operation, the PHT 350 stores (and selects from for a given branch instruction) a plurality of entries, each of which represents, for example, a two-bit saturating counter of the type described above. The PHT 350 accesses the relevant entry based on addressing information 360, discussed below, and provides the counter value to a mapping circuit 355, which applies the mapping given in the table above to output a prediction 370 of "taken" (for counter values ​​of 10 or 11) or "not taken" (for counter values ​​of 00 or 01) based on the contents of the addressed PHT entry.

[0067] When the resolution of the branch instruction is determined, the resolution is transmitted 380 to PHT 350 (eg, Figure 1 180 in the information 180 schematically shown), and the associated saturation counter is again addressed and updated by increment or decrement depending on whether the branch is taken. In this way, the prediction circuit is configured to modify the stored prediction data depending on the resolution of whether the branch represented by a given branch instruction (associated with the stored entry) is taken.

[0068] As described above, the PHT 350 provides a plurality of entries, and a single entry is selected according to the addressing information 360 .

[0069] Various possibilities are available for generating the addressing information 360. Figure 4In the example schematically shown in FIG. 4 , history register 400 maintains a history of recent results of branch instruction executions, from most recent result 402 to the next most recent (in terms of the size of history register 400) result 404. When a branch instruction is resolved, its result is inserted at most recent result position 402, and the rest of the history register is moved to the next most recent result position 404. In practice, this can be implemented using a circular buffer and moving pointers, but the effect is as described above. Figure 4 In , historical results are shown as T (taken) or NT (not taken), but they can be stored as corresponding bit values, such as 1, 0.

[0070] The history register 400 may be a global history register, such that the result stored in the history register 400 is relevant to all executed branch instructions, or may be a local history register, such that the stored branch result is relevant to the result of the branch instruction at a specific branch address (PC value). In the current example, the history register 400 is a global history register. A subset 410 of the bits of the history register 400, for example, at a predetermined position relative to the most recent 402 position and the next most recent 404 position in the history register, may be used as an input to generate the addressing information 360.

[0071] Thus, in these examples of the local history register, each prediction register entry includes multiple prediction data values, and the prediction circuitry is configured to select one of the prediction data values ​​to use as prediction data for a given branch instruction based on the most recently resolved permutation of whether the branch represented by the given branch instruction was taken.

[0072] Another possible contribution to addressing information 360 is branch address 300, or at least a subset of its bits. One or both of these inputs may be combined by combiner 420 to generate addressing information 360. For example, combiner 420 may include a logical exclusive OR (XOR) function. In other examples, combiner 420 may include a hashing function.

[0073] In this context, a hash function is a general function that maps data input to data output.In the context of accessing entries in a PHT, a desired characteristic of a suitable hash function is that relatively similar branch addresses are mapped to relatively different entries or locations within the PHT.

[0074] Figure 5 Schematically illustrating various aspects of the operation of the BTB 160. The BTB 160 is an n-way associative structure, in this example a 4-way associative structure, wherein there are n different entries 162 (eg, Figure 5 ).

[0075] According to the location selection circuit 500 applying a hash function, the LSB of the branch address 300 is used to determine the location within the BTB 160, which provides an example in which the location selection circuit is configured to select a set of one or more memory locations for a data item by applying a hash function to the attributes of the data item. In this case, a hash function is a general function that maps a data input to a data output. In the context of accessing entries in the PHT, a desired characteristic of a suitable hash function is that relatively similar branch addresses are mapped to relatively different entries or locations within the BTB.

[0076] Thus, a row is selected according to the set of LSBs of branch address 300 (as shown), and a BTB entry is written to one of the four (in this example) entries 162 in that row.

[0077] Actual entry 510 includes a tag 512 (generated by tag generator 520) that includes at least a page identifier (IDE) 330 provided by region table 310 and a target address 514 associated with the branch in question. This information is stored when a branch instruction (or at least a taken branch instruction) is encountered while processing element 110 is executing program code.

[0078] Thus, BTB 160 provides an example of a memory circuit that provides multiple memory locations, and Figure 5 The arrangement provides a memory circuit (BTB) 160, a location selection circuit (e.g., location selection circuit 500, for selecting a set of one or more memory locations through which to access a data item (e.g., such as a hash function implemented by the location selection circuit 500) based on a mapping relationship between an attribute of the data item (e.g., the LSB or another group of bits of a branch address) and a set of one or more memory locations. Figure 5 An example of a circuit of row )) is shown.

[0079] The location selection circuit 500 is further configured to initiate an allocation operation for the data item when the data item is to be newly stored by the memory circuit and the selected set of one or more memory locations is already occupied by one or more data items. In other words, if the row pointed to by the hash of the current branch address LSB is already full, then an allocation operation is performed. The allocation operation includes the operation of replacing at least a subset of one or more other (already stored) data items in the set of one or more memory locations with the newly stored data item.

[0080] The fact that the hash function incremented by the position selection circuit 500 maps the set of LSBs to a (possibly small) range of positions or rows in the BTB 160 means that so-called aliasing may occur, such that two or more different branch addresses happen to be mapped to the same position in the BTB 160. Since the BTB is n-way associative, it can store multiple entries at the same hash position (such that the attribute maps to two or more memory entries), but in general, the occurrence of aliasing may mean that there is a large amount of information turnover at a particular hash position, because there are frequent evictions and replacements of existing stored information by two or more branch addresses competing for the same hash position. This situation is hereinafter referred to as a data access conflict, in which a group of two or more data items with different corresponding attributes are mapped to the same set of one or more memory locations (e.g., in the BTB 160) through a mapping relationship (e.g., a hash function). Note that such data access conflicts may mean that many branch addresses are mapped or assigned to the same location or index in BTB 160 , but it may also be that some indexes or locations in BTB 160 remain unused (rows as shown), which may waste storage space in BTB 160 .

[0081] At a read operation from BTB 160, location selection circuit 500 applies the same hash function and tags are regenerated by tag generator 520. The BTB entry in the location (row as shown) of BTB 160 corresponding to the hash address is read out, and the entry for which the storage tag 512 matches the tag newly regenerated by tag generator 520 is selected for output 530 by comparator and selector 540.

[0082] Figure 6 An arrangement is schematically shown which may at least partially alleviate the contention problem for BTB locations due to aliasing.

[0083] exist Figure 6 In the example embodiment, the detector / controller circuit 600 is configured to detect a data access conflict of the type described above, and in an example embodiment, is configured to control the operation of the position selection circuit so as to change the mapping relationship of the attributes of at least one data item in the group of two or more data items involved in the data access conflict in response to detecting the data access conflict.

[0084] Reference Figure 7 Further discussing the operation of the detector / controller circuit 600, Figure 7 A detector / controller circuit 600 is shown including a detector 700 and a controller 710, which is configured to communicate with the Figure 7 The aliasing monitoring data table 705 (eg, stored by the detector 700 ) shown on the right side of FIG.

[0085] The aliasing monitoring data table stores a tag field 720, a validity flag 724, a value "Nb_alloc" 726 (indicating the number of allocations detected in this BTB index), a value "Entries" 730 (indicating the number of branches attempting allocations in the current program code block), a remap valid (remap_valid) flag (R) 732, and a remap lock (remap_lock) value 734. The remap lock value is used by the detector circuit as described below to inhibit further changes to the indicator data associated with the data item for which a conflict was detected until the location selection circuit has performed at least a predetermined number of subsequent allocation operations.

[0086] distribute

[0087] At allocation time, for each BTB allocation that misses (i.e., the entry is not already in the BTB), the predicted block address (in this case, branch address 300) is assigned to the aliasing monitoring table 705. A victim entry is selected in the BTB 160 for replacement. If the victim entry is locked by remapping (value 734 is greater than zero), value 734 is decremented. This allows the remapped entry to be released at some point in the future and avoids rapid changes in mapping and remapping.

[0088] renew

[0089] For updating, each time an allocation to the BTB hits this index, value 726 is incremented. Value 730 is updated to indicate how many branches (with a common portion of the branch address) in the current program code block are attempting to allocate. This information is used to detect the situation of a program code block whose several active branches all compete for sellers and exceed the relevance of the BTB.

[0090] When the value 726 exceeds a threshold value (e.g., 16), the remap valid flag 732 is set and the remap lock value 734 is set to a predetermined constant (e.g., 64 or 128). The remap operation discussed below is then established, providing an example of a detector circuit configured to detect data access conflicts in response to the location selection circuit performing at least a predetermined number of consecutive allocation operations for a given data item. The remap valid flag remains set until the remap lock value reaches zero.

[0091] In some examples, the detector circuit is configured to change the state of indicator data associated with a data item selected from a list consisting of: (i) a data item for which the location selection circuit has changed the mapping relationship; and (ii) a data item detected as part of a group of one or more data items for which a data access conflict has been detected. In other words, the remap valid flag can be changed for a remapped data item or a non-remapped data item.

[0092] Find

[0093] At lookup time, the aliasing monitoring data table is consulted, and if the remap valid flag 732 is set, a different mapping may be used to access the BTB for that entry.

[0094] Figure 8 An arrangement using multiple different hash functions 800 , 810 is schematically shown so that an attribute of a data item (e.g., a portion of a branch address) is processed by two hash functions and a remap valid flag 732 for selecting one of the hash values ​​to access the data item in the BTB 160 at a specified location 822 .

[0095] exist Fig.9A In another example shown, the remap valid flag 732 is combined with the attribute to be hashed by combination logic 900 (eg, logic providing an XOR operation) or by cascading logic, and the resulting combination is provided to a hash function 910 to generate a position 920 .

[0096] exist Fig. 9B In another example, the attribute to be hashed is provided to the hash function 930 and the hash output is combined by combining the logic 940 with the remap valid flag 732 to generate the desired location 950.

[0097] therefore, Figure 8 , Fig.9A and Fig. 9B Examples are provided in which the position selection circuit is configured to change a mapping relationship applicable to an attribute of at least a given data item.

[0098] In such Fig.10 In some examples such as the example shown in , tag generator 520 may be modified by providing concatenation logic 1002 that concatenates the remap valid flag with a tag generated by tag generator 524 to be stored as storage tag 1010 in field 512 .

[0099] The above techniques are related to branch target buffers, but are also fully applicable to cache memory (e.g. Fig.11The cache memory 1100 is an example of a memory circuit that provides multiple memory locations, and is particularly an n-way set associative cache memory, so as to map an attribute (e.g., an address or a portion of an address of a data item to be cached) to n memory locations. For example, the cache memory 1100 may provide Figure 1 130 to provide a low latency storage device for access by processing element 110, possibly utilizing address translation by translation lookaside buffer / page table traversal translation circuit 1110. Cache memory 1100 may communicate with higher level memory 1120, which may include higher level cache memory 1130 and / or main memory 1140. Thus, Fig.11 An example is provided of a cache memory 1100 comprising circuitry as defined above, wherein: a data item represents a version of the contents of a higher level memory at a corresponding memory address; and an attribute of a data item depends at least in part on the memory address of the data item.

[0100] Fig.12 is a schematic flow chart illustrating a method, the method comprising:

[0101] selecting (step 1200) from a plurality of memory locations a set of one or more memory locations through which to access the data item based on a mapping relationship between an attribute of the data item and the set of one or more memory locations;

[0102] When the data item is to be newly stored by the memory circuit and the selected set of one or more memory locations is already occupied by one or more other data items, initiating (step 1210) an allocation operation for the data item, the allocation operation comprising an operation to replace at least a subset of the one or more other data items in the set of one or more memory locations with the newly stored data item;

[0103] detecting (step 1220) a data access conflict in which a group of two or more data items having different corresponding attributes are mapped to the same set of one or more memory locations through a mapping relationship; and

[0104] In response to detecting a data access conflict, a mapping relationship applicable to the attributes of at least one data item in the group of two or more data items is changed (step 1230).

[0105] In this application, the phrase "configured to..." is used to indicate that elements of a device have a configuration that enables the performance of a defined operation. In this context, "configuration" refers to the arrangement or manner of interconnection of hardware or software. For example, the device may have dedicated hardware that provides the defined operation, or a processor or other processing device that can be programmed to perform the function. "Configured to" does not mean that the device elements need to be changed in any way to provide the defined operation.

[0106] Although illustrative embodiments of the present invention have been described in detail herein with reference to the accompanying drawings, it should be understood that the present invention is not limited to these precise embodiments and that various changes, additions and modifications may be made therein by those skilled in the art without departing from the scope and spirit of the present invention as defined by the appended claims. For example, the features of the dependent claims may be combined in various ways with the features of the independent claims without departing from the scope of the present invention.

Claims

1. A circuit comprising: a memory circuit providing a plurality of memory locations; a location selection circuit for selecting a set of one or more memory locations through which to access the data item based on a mapping relationship between an attribute of the data item and the set of one or more memory locations; the location selection circuit being configured to, when a data item is recently stored by the memory circuit and the selected set of one or more memory locations is already occupied by one or more other data items, initiate an allocation operation for the data item, the allocation operation comprising an operation to replace at least a subset of the one or more other data items in the set of one or more memory locations with the recently stored data item; as well as a detector circuit for detecting a data access conflict in which a group of two or more data items having different respective attributes are mapped to the same set of one or more memory locations by the mapping relationship; The position selection circuit is configured to change the mapping relationship of the attribute applicable to at least one data item in the group of the two or more data items in response to the detector circuit detecting a data access conflict.

2. The circuit according to claim 1, wherein The detector circuit is configured to detect a data access conflict in response to the location selection circuit performing at least a predetermined number of consecutive allocation operations for a given data item.

3. The circuit according to claim 2, wherein: The position selection circuit is configured to change the mapping relationship applicable to at least the attribute of the given data item.

4. The circuit according to claim 1, wherein: The detector circuit is configured to change a state of indicator data associated with a data item selected from a list consisting of: (i) the data item for which the location selection circuit has changed the mapping relationship; as well as (ii) A data item detected as part of a group of one or more data items for which a data access conflict has been detected.

5. The circuit according to claim 4, wherein: The location selection circuit is configured to select a set of one or more memory locations for the data item by applying a hash function to the attribute of the data item.

6. The circuit according to claim 5, wherein: The position selection circuit is configured to apply the hash function to a combination of the attribute and the indicator data.

7. The circuit according to claim 4, wherein: The detector circuit is configured to inhibit further changes to the indicator data associated with the data item for which a data access conflict has been detected until the location selection circuit has performed at least a predetermined number of subsequent allocation operations.

8. The circuit according to claim 1, wherein: The set of memory locations includes two or more memory locations.

9. A cache memory, comprising the circuit according to claim 1; wherein: The data item represents a version of the contents of a higher level memory at the corresponding memory address, the higher level memory being relative to the cache memory; and The attribute of the data item depends at least in part on the memory address of the data item.

10. A data processor comprising: a processing element for executing data processing instructions; fetch circuitry for fetching instructions defined by entries in the fetch queue for execution; as well as prediction circuitry for generating an entry for the fetch queue defining one or more next data processing instructions to be fetched; The prediction circuitry comprises circuitry according to claim 1, the circuitry providing branch target storage means for storing one or more data items, each data item comprising at least a portion of a program counter value and information defining a corresponding branch target address of a previously taken branch instruction, wherein the attributes of the data items depend on at least the program counter value.

11. A circuit comprising: a memory device providing a plurality of memory locations; Selection means for selecting, based on a mapping relationship between an attribute of a data item and a set of one or more memory locations, a set of one or more memory locations through which the data item is accessed; The selection means is operable to, when a data item is recently stored by the memory means and the selected set of one or more memory locations is already occupied by one or more other data items, initiate an allocation operation for the data item, the allocation operation comprising an operation to replace at least a subset of the one or more other data items in the set of one or more memory locations with the recently stored data item; as well as a detection device for detecting a data access conflict in which a group of two or more data items having different corresponding attributes are mapped to the same set of one or more memory locations by the mapping relationship; The selecting means may be operable to: in response to the detecting means detecting a data access conflict, change the mapping relationship of the attribute applicable to at least one data item in the group of the two or more data items.

12. A data processing method, comprising: selecting, from a plurality of memory locations, a set of one or more memory locations through which to access the data item according to a mapping relationship between an attribute of the data item and the set of one or more memory locations; When a data item is recently stored by the memory circuit and the selected set of one or more memory locations is already occupied by one or more other data items, initiating an allocation operation for the data item, the allocation operation comprising an operation to replace at least a subset of the one or more other data items in the set of one or more memory locations with the recently stored data item; detecting a data access conflict in which a group of two or more data items having different corresponding attributes are mapped to the same set of one or more memory locations by the mapping relationship; as well as In response to detecting a data access conflict, the mapping relationship applicable to the attribute of at least one data item in the group of the two or more data items is changed.