Conflict detection method and apparatus, electronic device, medium and chip
Patent Information
- Application Number
- CN202611005821.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-07
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2046-07-07
AI Technical Summary
[0005]本申请提供一种冲突检测方法、装置、电子设备、存储介质及芯片,以解决相关技术中高速缓存冲突检测存在虚假冲突导致性能损失、硬件资源消耗大以及依赖额外排序逻辑导致时序收敛困难的问题
[0015]本申请的第五方面实施例提出了一种芯片,包括一个或多个接口电路和一个或多个处理器;接口电路用于从电子设备的内存接收信号,并向处理器发送信号,信号包括内存中存储的计算机指令,当处理器执行计算机指令时,使得电子设备执行如本申请第一方面实施例中描述的方法的步骤。
Smart Images

Figure CN122507658B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a collision detection method, apparatus, electronic device, storage medium, and chip. Background Technology
[0002] In the field of AI chip architecture design, the cache, as a key layer connecting the processor core and main memory, directly determines the overall performance and energy efficiency of the chip through its address access conflict management and data read / write order preservation mechanism.
[0003] Currently, the relevant technologies mainly employ two conflict detection schemes: group address conflict protection and complete address broadcasting.
[0004] However, the group address conflict protection window only compares group addresses. When multiple commands access the same group, they must be executed serially even if they access different cache lines, resulting in a large number of false conflicts. When the cache is missing, subsequent commands are blocked for a long time, resulting in severe performance loss. Full address broadcasting broadcasts the full address of the command in the queue and compares it with each received command. It requires additional command sorting logic to determine the order. At the same time, it broadcasts two relatively wide address information, the target address and the replacement address, which consumes a lot of hardware resources, has a high area overhead, and is not conducive to timing convergence. Summary of the Invention
[0005] This application provides a conflict detection method, apparatus, electronic device, storage medium, and chip to solve the problems in related technologies where cache conflict detection suffers from performance loss due to false conflicts, high hardware resource consumption, and difficulty in timing convergence due to reliance on additional sorting logic.
[0006] The first aspect of this application proposes a conflict detection method applied to a caching scenario. The method includes: responding to a received access command, performing conflict detection on the access command based on the address information requested by the access command and the address information requested by the received pending access command, to determine at least one set of conflicting commands under at least one conflict type. The address information includes target address information and replacement address information. The conflict type includes at least one of target address-to-target address conflict, target address-to-replacement address conflict, and replacement address-to-target address conflict. Based on the tag field of the tail command in each set of conflicting commands, configuring the tag field of each conflict type corresponding to the access command, so that the access command is attached to the end of the conflict chain of each conflict type, obtaining the target conflict chain of each conflict type. The target conflict chain is used to establish an execution dependency relationship between the access command and the tail command in each set of conflicting commands. The tag field includes at least one of tail identifier, command identifier, conflict association identifier, and blocking identifier. Executing the access command based on the command identifier of the currently executed conflicting command in the target conflict chain of each conflict type and the conflict association identifier corresponding to the access command for each conflict type.
[0007] In some embodiments, performing conflict detection on the access command based on the address information requested by the access command and the address information requested by the received access command to be executed, to determine at least one set of conflicting commands under at least one conflict type includes: if the target address information of the access command matches the target address information of the access command to be executed, determining that there is a target address conflict between the access command to be executed and the access command, and determining the access command to be executed as a conflicting command under the target address conflict; and / or, if the target address information of the access command matches the alternative address information of the access command to be executed, determining that there is a target address conflict between the access command to be executed and the access command, and determining the access command to be executed as a conflicting command under the target address conflict; and / or, if the alternative address information of the access command matches the target address information of the access command to be executed, determining that there is a alternative address conflict between the access command to be executed and the access command, and determining the access command to be executed as a conflicting command under the alternative address conflict.
[0008] In some embodiments, configuring the tag field of each conflict type in at least one conflict type corresponding to the access command according to the tag field of the tail command in each group of conflict commands, so that the access command is attached to the end of the conflict chain of each conflict type, and obtaining the target conflict chain of each conflict type includes: filtering out the tail commands in each group of conflict commands whose tail tags are in a valid state according to the tail tags of each conflict command in each group of conflict commands; determining the conflict association tag of the conflict type of the tail command corresponding to the access command by using the command tag of the tail command; updating the tail tag of the tail command to an invalid state, and configuring the tail tag of the conflict type of the tail command corresponding to the access command to a valid state; configuring the blocking tag of the conflict type of the tail command corresponding to the access command to a valid state.
[0009] In some embodiments, executing an access command based on the command identifier of the currently executed and completed conflict command in the target conflict chain of each conflict type and the conflict association identifier of the access command corresponding to each conflict type includes: obtaining the command identifier of the broadcast of the currently executed and completed conflict command in the target conflict chain of each conflict type; matching the conflict association identifier of the access command corresponding to each conflict type with the command identifier of the broadcast of the currently executed and completed conflict command to obtain the matching result of each conflict type; updating the blocking identifier of the access command corresponding to each conflict type to an invalid state based on the matching result of each conflict type, so as to execute the access command based on the invalid state of the blocking identifier of the access command corresponding to each conflict type.
[0010] In some embodiments, executing an access command based on the invalid state of the blocking flags corresponding to each conflict type includes: executing the access command when all blocking flags corresponding to at least one conflict type are invalid; and prohibiting the execution of the access command when the blocking flags corresponding to at least one conflict type are valid.
[0011] In some embodiments, the access command is configured with a validity flag. After executing the access command according to the target conflict chain of each conflict type, the method includes: updating the validity flag of the access command to an invalid state after the access command has been executed and the corresponding command storage item has been released, so that the access command is removed from the conflict detection range.
[0012] A second aspect of this application provides a collision detection device, the device comprising: The detection unit is configured to respond to a received access command by performing conflict detection on the access command based on the address information requested by the access command and the address information requested by the received access command to be executed, so as to determine at least one set of conflicting commands under at least one conflict type. The address information includes target address information and replacement address information, and the conflict type includes at least one of target address conflict, target address conflict and replacement address conflict, and replacement address conflict and target address conflict. The analysis unit is used to configure the tag fields of each conflict type in at least one conflict type for the access command according to the tag fields of the tail command in each group of conflict commands, so that the access command is attached to the end of the conflict chain of each conflict type to obtain the target conflict chain of each conflict type. The target conflict chain is used to establish the execution dependency relationship between the access command and the tail of each group of conflict commands. The tag fields include at least one of the tail identifier, command identifier, conflict association identifier and blocking identifier. The execution unit is used to execute the access command based on the command identifier of the currently executed conflict command in the target conflict chain of each conflict type and the conflict association identifier of the access command corresponding to each conflict type.
[0013] A third aspect of this application provides an electronic device including a processor and a memory for storing a computer program, the processor for calling and running the computer program stored in the memory to perform the steps of the method described in the first aspect of this application.
[0014] A fourth aspect of this application provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the steps of the method described in the first aspect of this application.
[0015] A fifth aspect of this application provides a chip including one or more interface circuits and one or more processors; the interface circuits are configured to receive signals from the memory of an electronic device and send signals to the processors, the signals including computer instructions stored in the memory, which, when executed by the processors, cause the electronic device to perform the steps of the method described in the first aspect of this application.
[0016] In summary, the conflict detection method provided in this application eliminates unnecessary false conflicts and improves cache access efficiency by accurately detecting different conflict types compared to group address conflict protection windows. Furthermore, by replacing full address broadcasting with a chain-based mounting mechanism based on a tag field, global sorting logic is eliminated, reducing hardware overhead and facilitating timing convergence. Simultaneously, by independently maintaining execution dependencies for multiple conflict chains, strict ordering of data reads and writes is ensured in multi-core high-concurrency access scenarios, effectively improving the overall performance and energy efficiency of the cache.
[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application, and do not constitute an undue limitation of this application.
[0019] Figure 1 A flowchart illustrating a conflict detection method provided in an embodiment of this application; Figure 2 A schematic diagram illustrating the composition of address information for an access command provided in an embodiment of this application; Figure 3 A flowchart illustrating another conflict detection method provided as an application example of this application; Figure 4 A schematic diagram of a specific tag field table provided as an application example of this application; Figure 5 This is a schematic diagram illustrating the receiving order of multiple access commands and the address information of each command, provided as an application example of this application. Figure 6 A schematic diagram illustrating the changes in a T2T conflict chain, provided as an application example of this application; Figure 7 A schematic diagram illustrating the changes in an R2T conflict chain, provided as an application example of this application; Figure 8 A schematic diagram illustrating the change of a T2R conflict chain as an application example of this application; Figure 9 A schematic diagram of a collision detection device provided as an application example of this application; Figure 10 This is a schematic diagram illustrating the composition of an electronic device provided in an embodiment of this application. Detailed Implementation
[0020] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0021] In the field of AI chip architecture design, the cache, as a crucial layer connecting the processor core and main memory, directly determines the overall performance and energy efficiency of the chip. As AI models iterate towards large-scale, highly parallel processing, the number of chip cores continues to increase, making the cache's hierarchical structure, number of ports, replacement strategies, and inter-core sharing mechanisms increasingly complex, posing severe challenges to cache timing convergence and functional verification. The core requirements for cache functional correctness focus on address access conflict management and data read / write order preservation—address access conflicts easily lead to cache thrashing, data overwriting, and memory access blocking, while the data order preservation mechanism must ensure that the data read / write timing strictly follows the program logic in multi-core, multi-threaded concurrent access scenarios. Both are fundamental prerequisites for ensuring stable chip operation. Current chip design faces the dual demands of hardware resource constraints and performance improvement. How to achieve efficient conflict handling and order preservation while reducing hardware overhead, and simultaneously overcome timing bottlenecks and increase cache operating frequency, has become a core research hotspot and technical challenge in current cache design.
[0022] Currently, the relevant technologies mainly employ the following three cache conflict detection schemes: Option 1: Fully Associative Mapping. This allows any block of main memory to be mapped to any location in the cache, completely eliminating set conflicts. However, because it requires parallel comparison of the main memory address flag with the flags of all cache lines, the number of comparators increases exponentially with the cache capacity. The logic gate and wiring complexity is extremely high, leading to a significant increase in manufacturing cost, power consumption, and access latency. Replacing the algorithm with this option is difficult to implement in hardware and has extremely poor scalability. Therefore, it is only used in small-capacity caches (such as TLBs) and is almost never used in actual chip design.
[0023] Option 2: Group Address Conflict Protection Window. Applied to set-associative cache structures, this method detects conflicts by comparing the group addresses of commands. When multiple commands access the same group, a protection window is established for each command. During the window's validity period, subsequent commands mapped to the same group are prohibited from execution until the current command completes. This option only compares group addresses; even if multiple commands access different cache lines within the same group, they must be executed serially, resulting in a large number of false sharing. When a command experiences a cache miss and needs to read data from main memory, all subsequent commands in the same group are blocked for a long time. The higher the cache access group conflict rate, the lower the performance.
[0024] Option 3: Full Address Broadcast. The full address of the command is broadcast in the existing queue and compared with each received command to determine if a conflict exists. This method requires additional command sorting logic (such as an age matrix) to determine the command order. Address information is broadcast multiple times at various nodes, including new command reception, command issuance and execution, and command completion and release, to determine if a command is blocked. While this method provides more accurate conflict detection, it relies on additional sorting logic to determine the order and simultaneously broadcasts both the full target address and the replacement path address, resulting in significantly increased hardware resource consumption, large area overhead, and poor timing convergence.
[0025] In summary, in practical chip design, caches generally adopt set-associative mapping to balance performance, cost, and complexity. To reduce the impact of cache access conflicts on performance, related technologies often employ set address conflict protection and full address broadcasting. However, both have drawbacks: severe false conflicts leading to performance loss, and high hardware resource consumption and reliance on additional sorting logic causing timing convergence difficulties, respectively.
[0026] To address the problems of the aforementioned related technologies, the chain-passing cache address conflict detection method of this application determines the execution order of conflicting commands without relying on additional command sorting logic. At the same time, by replacing full address broadcasting with a chain-passing mechanism and comparison of conflict association identifiers, the number of comparators and the bit width used are reduced. Under the premise of ensuring accurate conflict detection and strict data ordering, the efficiency of command execution in access pattern scenarios is significantly improved, achieving the technical effect of less hardware resources, smaller chip area, and better timing convergence.
[0027] Figure 1 This is a schematic flowchart illustrating a conflict detection method provided in an embodiment of this application. Figure 1 As shown, the method includes the following steps: Step 101: In response to the received access command, perform conflict detection on the access command based on the address information requested by the access command and the address information requested by the received access command to be executed, so as to determine at least one set of conflicting commands under at least one conflict type.
[0028] In the embodiments of this application, the access command is a request issued by a master device such as a processor or DMA to perform read / write access to the cache. Each access command contains the address information requested for access.
[0029] In some embodiments, the address information includes target address information and replacement address information.
[0030] The target address information is the address corresponding to the target cache line that the access command actually reads or writes. In a set-associative cache, the target address consists of two parts: the set index and the tag address. The set index is used to locate a specific set in the cache, and the tag address is used to uniquely identify the target cache line within that set.
[0031] Replacement address information is used when an access command misses in the cache. A cache line from the target set is selected for replacement to make room for the new data. The address corresponding to the selected cache line is the replacement address. Replacement address information only exists in access commands that have experienced cache misses. That is, in a set-associative cache, a set contains multiple ways. When a new command accesses a target address, if that address is not in the cache (Miss), a way is selected from the set as the victim way, and the data within it is evicted. The address where the evicted data is located is the replacement address. This address may be accessed as the target address by subsequent commands, thus creating resource contention.
[0032] Access commands awaiting execution are those that have been received and cached in the command queue but have not yet been completed. These commands may be in states such as waiting to be issued, currently being executed, or waiting to be written back.
[0033] Conflict detection involves comparing the address information of a newly received access command with the address information of all pending access commands in the command queue to determine whether there is a resource contention or data dependency.
[0034] Conflict types are classified into different types based on the different address information matching methods. Conflict types include at least one of target address-target address conflict, target address-replacement address conflict, and replacement address-target address conflict. This application mainly includes three types: target-target conflict, target-replacement conflict, and replacement-target conflict.
[0035] A conflicting command is a command to be executed that has an address association (i.e., a match) with a newly received access command. There can be one or more conflicting commands of the same conflict type, forming a group.
[0036] Specifically, the three conflict types in this application include the first conflict type (T2T) corresponding to a conflict between two target addresses, the second conflict type (T2R) corresponding to a conflict between a target address and a replacement address, and the third conflict type (R2T) corresponding to a conflict between a replacement address and a target address.
[0037] For the first type of conflict, the target address of the newly received access command is the same as the target address of the existing command. For example, two commands need to access the same cache line, or there is a read / write competition for the same address among multiple cores sharing data.
[0038] For the second type of conflict, the target address of the newly received access command is the same as the replacement address of the existing command. For example, the data that the new command wants to read / write is selected and kicked out by the existing command. The new command needs to wait for the old command to write the dirty data back to main memory before it can access the data.
[0039] For the third type of conflict, the replacement address of the newly received access command is the same as the target address of the existing command. For example, if the old data that the new command wants to kick out is being accessed by an existing command, the new command cannot arbitrarily kick out data that is still being used by other commands.
[0040] The three conflict types mentioned above cover all scenarios where resource contention may occur during cache access. The first type is direct contention for the same data block; the second and third types are cross-dependencies between "replacement operations" and "target access"—the replacement command needs to write the old data back to main memory (especially when the data is dirty), and the target command needs to read the correct data. Both must be executed sequentially to ensure data consistency.
[0041] The three conflict types mentioned above can occur individually or simultaneously. For example, the target address of a new access command might match the target address of command A, while the replacement address of the same access command might match the target address of command B. In this case, the access command is associated with both type I and type III conflicts. Meeting any matching condition triggers conflict detection for the corresponding type. This application supports associating a single access command with multiple conflict types simultaneously by configuring a flag field independently for each conflict type. This covers the complex and diverse resource contention scenarios in actual chip design, demonstrating good completeness and versatility.
[0042] For example, such as Figure 2 The address information for the access command shown is based on an example of a 256-byte cache line, a 16-way set-associative cache, and a total capacity of 2MB. The address information consists of three parts: the set address, the tag address, and the replacement address (256 bytes). The set address is used to locate the target set in the cache, and the tag address is used to uniquely identify the target cache line within the target set.
[0043] Under the set-associative cache architecture described above, access conflicts include the following three types: Set Conflict: When multiple access commands have the same set address, due to the limited access port resources of the tag array, subsequent commands must wait for the tag access of the previous command to be completed before they can be transmitted.
[0044] Target Address Conflict (T2T Conflict): When two access commands have the same group address and label address, it means that they are accessing the same cache line, and the subsequent command must wait for the previous command to complete.
[0045] Replacement Address Conflict (R2T / T2R Conflict): When all cache lines in the target group are occupied, a cache line replacement (Evict) operation is required to accommodate new data. The replacement address refers to the address of the old cache line selected for replacement. A replacement address conflict occurs when the replacement address of a new access command is the same as the target address of an existing access command, or vice versa. In this case, the replacement operation must wait until it is completed before proceeding.
[0046] This application can accurately identify the true dependency relationship between a new command and a command to be executed by precisely detecting three types of conflicts, avoiding the false conflict problem of only looking at the group address and the group being completely blocked, thus improving the cache access efficiency from the source.
[0047] Step 102: Based on the tag field of the tail command in each group of conflict commands, configure the tag field of each conflict type in at least one conflict type for the access command, so that the access command is attached to the end of the conflict chain of each conflict type, and obtain the target conflict chain of each conflict type. The target conflict chain is used to establish the execution dependency relationship between the access command and the tail command in each group of conflict commands.
[0048] In the embodiments of this application, the flag field is a flag configured for conflict chain management and execution control for each access command, including at least a command identifier, a chain tail identifier, a conflict association identifier, and a blocking identifier. For a command associated with multiple conflict types, each conflict type corresponds to a separate set of flag fields.
[0049] A command identifier (command ID) is a unique identification code for each access command, used to identify the command in operations such as broadcasting, matching, and releasing. For example, it can be represented by a 4-bit encoding of one of the 16 state machines. This application can generate its corresponding command identifier after receiving an access command.
[0050] The Tail flag indicates whether the current command is the end node of a conflict chain. The default value is "1". When a newly received access command is attached, it becomes the new tail, and the tail flag of the old tail is cleared to 0, i.e., updated to invalid.
[0051] The STALL flag indicates whether the current command is blocked under the corresponding conflict type. A valid status means that the command has been paused due to this type of conflict and must wait for its dependent preceding commands to complete.
[0052] Mounting is the operation of linking / adding a newly received access command to the end of a conflict chain. After mounting, the newly received access command forms an execution dependency with the commands in the chain, meaning that the newly received access command must wait for the commands it depends on to complete before it can be executed.
[0053] The end of a conflict chain is the last node added to the chain. Newly received access commands only establish a direct dependency with the current tail of the chain (the command whose tail is marked as valid), rather than with all commands on the chain.
[0054] The target conflict chain is the updated conflict chain corresponding to each conflict type after the mounting operation. Each conflict type maintains an independent conflict chain, and the commands on the chain are arranged in order of receipt time.
[0055] Execution dependency is a constraint relationship between commands regarding the order of execution. In a conflict chain, a command that is mounted later must wait for its predecessor command to complete before it can be executed, ensuring the correct timing of data access.
[0056] This application assigns a separate set of flag fields to each conflict type because an access command may be blocked by multiple conflict types simultaneously. For example, the target address of the access command may conflict with the target address of command A (T2T), while the replacement address of the command may conflict with the target address of command B (R2T). These two blocking reasons are independent and need to be recorded and resolved separately. Therefore, this application configures a separate set of command identifiers, chain tail identifiers, and blocking identifiers for each conflict type.
[0057] This application utilizes a chain-passing mechanism to automatically maintain the sequential order of multiple commands at the same address / on the same replacement path without requiring additional sorting logic (such as an age matrix), ensuring strict order preservation for data read and write operations in multi-core concurrent scenarios. Simultaneously, the mechanism of only searching the tail of the queue and passing the chain tail narrows the address comparison range to comparison only with the tail of the queue, significantly reducing the number of comparators.
[0058] Furthermore, in this application, different conflict types correspond to different independent conflict chains. In actual cache access scenarios, the same access command can simultaneously have different types of conflicts with multiple existing commands. For example, its target address may conflict with the target address of command A (T2T), while its replacement address may conflict with the target address of command B (R2T). Such intertwined conflicts of multiple types often require complex global sorting logic or unified blocking mechanisms in related technologies, resulting in high design complexity and hardware overhead. However, this application establishes independent conflict chains for each conflict type, decomposing the complex and intertwined conflict relationships between commands according to the conflict type dimension. This decomposes the originally coupled multidimensional conflicts into multiple independent chain-like dependencies for separate management. Each conflict chain is maintained, blocked, and released independently without interfering with each other. This simplifies the complex multidimensional conflict resolution task into multiple independent one-dimensional chain-like transmission tasks, effectively reducing design complexity, reducing hardware resource overhead, and improving the parallelism of conflict processing and system performance.
[0059] Step 103: Execute the access command based on the command identifier of the currently executed conflict command in the target conflict chain of each conflict type and the conflict association identifier of the access command corresponding to each conflict type.
[0060] In the embodiments of this application, for each type of conflict chain, the command identifier broadcast by the currently completed command in the conflict chain is matched with the conflict association identifier of the access command to be executed corresponding to the conflict type, and the blocking is released in sequence according to the matching result, so that each command in the conflict chain is executed in the order of mounting.
[0061] Specifically, commands in the target conflict chain have explicit execution dependencies. For a blocked access command, it can only be executed after all conflicting commands it depends on have been executed and the blocking flag for the corresponding conflict type has been removed. Commands in different conflict chains do not affect each other and can be executed in parallel.
[0062] In summary, the conflict detection method provided in this application, through accurate detection of three conflict types, chain-based transfer and mounting, and independent blocking and releasing of multiple chains, solves the two major problems of performance loss caused by false conflicts and high hardware resource consumption and reliance on additional sorting logic in related technologies. It achieves the effects of accurate detection, strict order preservation, low hardware resource consumption, small area, and time convergence.
[0063] Figure 3 This is a flowchart illustrating another conflict detection method provided in an embodiment of this application. Figure 3 based on Figure 1 The illustrated embodiment further defines step 102. Figure 3In the illustrated embodiment, step 102 includes steps 202, 203, and 204, and step 103 includes steps 205, 206, and 207. Figure 3 As shown, the method includes the following steps.
[0064] Step 201: In response to the received access command, perform conflict detection on the access command based on the address information requested by the access command and the address information requested by the received access command to be executed, so as to determine at least one set of conflicting commands under at least one conflict type.
[0065] In embodiments of this application, corresponding tag fields can be configured for access commands, specifically as follows: Figure 4 The table of marked fields shown is used to enable subsequent conflict detection and access command execution.
[0066] The target address includes the group address and the tag address (TAG), which is used to locate the cache line to be accessed.
[0067] Replacement address: When an access command misses in the cache, the address information corresponding to the cache line selected for replacement is provided.
[0068] Operation Way Number: 4 bits, representing a specific way number among a set of 16 ways for the command operation.
[0069] Conflict ID: Used to record the ID code of the closest command that blocks the current command. There are three types of conflict IDs: T2T ID: A conflict identifier when the target address of a new command conflicts with the target address of an already received command; T2R ID: A conflict identifier when the target address of a new command conflicts with the replacement route address of a received command; R2T ID: A conflict identifier when the replacement path address of a new command conflicts with the target address of a received command. This type is also called a Way Number Conflict, and a conflict can be determined by comparing the operation path numbers. Since the path number width is smaller than the full address, this method is usually more efficient in terms of hardware resources.
[0070] Since a single command may conflict with a previous command in terms of target address and with another command in terms of replacement address, it is necessary to record the corresponding conflict identifier for each type of conflict.
[0071] STALL (blocking flag): 3 bits, indicating whether the command operation is blocked. Different bits correspond to different types of blocking states.
[0072] Allocate flag: Indicates whether the command has a substitute route address. For non-allocate commands, there is no substitute route address; therefore, in conflict detection based on substitute route addresses, this flag is used to mask the comparison of substitute route addresses.
[0073] Tail identifier: 3 bits, indicating whether the current command is the last node (tail) of the corresponding conflict chain under the three conflict relationships. The default value is "1", that is, a valid state.
[0074] Dirty flag: Indicates whether the data in the cache line corresponding to the replacement address has been modified. The replacement address will only conflict with the target address of a subsequent miss command if the data corresponding to the replacement address of the received command is dirty.
[0075] Validity flag: Indicates whether the command information is valid. When a command queue item is released, the validity flag of the corresponding command is cleared to "0". All the bit field information above is only meaningful when the validity flag is "1" (i.e., valid state), and participates in the construction of the collision chain and collision detection.
[0076] Step 202: Based on the chain tail identifier of each conflict command in each group of conflict commands, filter out the chain tail commands in each group of conflict commands whose chain tail identifier is in a valid state.
[0077] In the embodiments of this application, each access command is configured with multiple sets of flag fields that correspond one-to-one with each conflict type. Each set of flag fields includes a chain tail identifier, a blocking identifier, and a conflict association identifier.
[0078] The tail identifier is used to indicate whether the current command is the end node in the conflict chain of the corresponding conflict type. The default value of the tail identifier is a valid state (e.g., "1"), indicating that the command is currently the tail of the conflict chain of this conflict type; when a new command is attached to the chain, the tail identifier of the original tail is updated to an invalid state (e.g., "0").
[0079] During the conflict detection process, this application filters conflict commands based on the tail identifier of each group, identifying only conflict commands with a valid tail identifier as tail commands. Through this filtering mechanism, the scope of conflict command search is narrowed from all conflict commands to only the current tail of the conflict chain, effectively reducing the number of comparison operations.
[0080] Step 203: Determine the conflict association identifier of the conflict type of the tail command corresponding to the access command by using the command identifier of the tail command.
[0081] In embodiments of this application, each access command is configured with a unique command identifier, which is broadcast upon completion to release any blocked subsequent commands.
[0082] Once the tail command is determined, this application records the command identifier of the tail command (i.e., the conflict identifier of the tail command) as the conflict association identifier (i.e., the conflict identifier) corresponding to the current access command for the same conflict type.
[0083] The conflict association identifier is used to characterize the dependency relationship between the current access command and the tail command, that is, the current access command needs to wait for the tail command to complete before it can continue to execute.
[0084] By recording conflict association identifiers, this application achieves precise binding of dependencies between commands with minimal bit width overhead (rather than complete address information), avoiding the hardware overhead required for broadcasting complete addresses.
[0085] Step 204: Update the tail flag of the tail command to an invalid state, and configure the tail flag of the conflict type of the tail command corresponding to the access command to an valid state; and configure the blocking flag of the conflict type of the tail command corresponding to the access command to a valid state.
[0086] In the embodiments of this application, the mounting operation specifically includes three actions: establishing dependencies, passing the chain tail, and setting blocking.
[0087] Specifically, the tail of the queue is passed by updating the tail flag of the tail command to an invalid state and updating the tail flag of the current access command corresponding to the conflict type to a valid state. At the same time, the blocking flag of the current access command corresponding to the conflict type is updated to a valid state (e.g., "1"), indicating that the command is blocked under this conflict type and cannot be issued or executed temporarily.
[0088] Understandably, in this application, each new command only needs to establish a direct dependency with the current tail of the queue. That is, when the tail of the queue finishes execution, it broadcasts a release signal, and the new command can be unblocked upon receiving this signal. This application transforms the traditional global sorting problem into a local chained propagation problem, eliminating the need for a global sorting matrix and significantly saving comparator resources. Furthermore, due to the shorter path and simpler logic, it is more conducive to temporal convergence.
[0089] Step 205: Obtain the command identifier of the currently executed conflict command broadcast in the target conflict chain for each conflict type.
[0090] In the embodiments of this application, when the currently executing conflict command in the target conflict chain completes its execution, the command broadcasts its command identifier to all pending commands in its corresponding target conflict chain. The broadcast content is only the command identifier (e.g., 4 bits), not the complete address information. By using a small-width command identifier instead of a large-width complete address for broadcasting, this application significantly reduces the bit width of the broadcast bus and the comparator resource consumption at the receiving end.
[0091] Step 206: Match the conflict association identifiers of each conflict type corresponding to the access command with the command identifiers of the currently executed conflict command broadcast to obtain the matching results for each conflict type.
[0092] In the embodiments of this application, after a blocked access command receives the broadcast current command identifier, it matches it one by one with the conflict association identifiers stored under each conflict type. If a conflict association identifier under a certain conflict type is the same as the current command identifier, the match is successful, indicating that the preceding command on which the access command depends has been executed. This matching process only involves the comparison of small-width identifiers (e.g., the comparison of a 4-bit conflict association identifier and a 4-bit command identifier), rather than the comparison of the complete address, which significantly reduces the bit width and power consumption of the comparator.
[0093] Step 207: Based on the matching results of each conflict type, update the blocking flag of each conflict type corresponding to the access command to an invalid state, so as to execute the access command according to the invalid state of the blocking flag of each conflict type corresponding to the access command.
[0094] In embodiments of this application, executing an access command based on the invalid state of the blocking flags corresponding to each conflict type includes: executing the access command when all blocking flags corresponding to at least one conflict type are invalid; and prohibiting the execution of the access command when the blocking flags corresponding to at least one conflict type are valid.
[0095] The access command is configured with a validity flag. After executing the access command according to the target conflict chain of each conflict type, the method includes: after the access command is executed and the corresponding command storage item is released, updating the validity flag of the access command to an invalid state so that the access command is removed from the conflict detection range.
[0096] In embodiments of this application, when a match is successful, the application updates the blocking flag corresponding to the conflict type of the access command to an invalid state (e.g., 0). Since different conflict types correspond to different conflict chains in this application, and each conflict chain is independent of the others, the blocking flags under different conflict types are also independent of each other.
[0097] This application only allows the execution of an access command if the blocking flags under all conflict types are invalid; if the blocking flags under any conflict type are valid, the command is still prohibited from execution. This ensures strict data ordering, guaranteeing that resource dependencies of the command are satisfied across all dimensions before execution is permitted.
[0098] Furthermore, when the access command is executed and the corresponding command storage item is released, this application updates its validity flag to invalid, so that the command is removed from the conflict detection scope and no longer participates in the construction and comparison of subsequent conflict chains.
[0099] Understandably, in this application, conflict chains of different conflict types are independent of each other, and their blocking and release operations do not affect each other. For example, if an access command is blocked on the target-target conflict chain (T2T chain), it does not mean that it is also blocked on the replacement-target conflict chain (R2T chain); correspondingly, the completion of the preceding command on the T2T chain only unblocks the blocking on the T2T chain, and the blocking on the R2T chain is unaffected. Through the above-mentioned chained release mechanism of broadcasting, matching, unblocking, and releasing all, this application supports the parallel execution of commands on different conflict chains that do not interfere with each other while ensuring strict order preservation, further improving the throughput of the cache. Compared with the method of global sorting through an age matrix in related technologies, this application does not require a global sorting matrix, reducing hardware resource consumption, and is more conducive to timing convergence due to the short propagation path and small comparison bit width.
[0100] In summary, the conflict detection method in this application eliminates false conflicts caused by comparing only group addresses in related technologies by performing multi-type accurate conflict detection on access commands; it transforms the global sorting problem into local chained transmission through a chained mounting mechanism, establishing execution dependencies between commands without additional global sorting logic; and it uses a broadcast matching and blocking unblocking mechanism to broadcast commands with a small-bit-width command identifier instead of a large-bit-width complete address, and adopts execution logic that allows execution only after all blocking is unblocked. This ensures strict order preservation of data read and write in multi-core high-concurrency scenarios while supporting parallel execution of commands on different conflict chains, reducing the hardware requirements for the number and bit width of comparators, reducing chip area and power consumption, and facilitating timing convergence. Thus, it achieves a good balance between accurate conflict detection, data order preservation, and hardware resource overhead, significantly improving the overall performance and energy efficiency of the cache system.
[0101] Furthermore, for ease of understanding, this application explains the specific process of a conflict detection method.
[0102] In this embodiment, the conflict detection and blocking control process is as follows: 1) New request entry and blocking judgment When a new access command enters the conflict detection module, the following operations are performed: First, based on the request address of the new command, search the command queue for all commands with a valid status (Valid), and then compare the address information of the new command with the address information of these valid commands one by one.
[0103] Secondly, based on the comparison results, the following three situations should be handled: Scenario 1: Target address conflict (T2T) When the target address of a new command matches the target address of an already received command, from all valid commands that conflict with the new command's target address, the command with the T2T Tail identifier (T2T Tail) in the target-target conflict type is selected as valid (i.e., "1"). The command identifier of the new command is recorded as the T2T conflict identifier (T2T ID) of the new command, and the T2T Tail identifier of the new command is cleared to invalid (i.e., "0"). At the same time, the T2T blocking identifier (T2T STALL) of the new command is set to valid (i.e., "1"), so that the new command is blocked under this conflict type and waits for the conflict to be resolved.
[0104] Scenario 2: Target-Replacement Address Conflict (T2R) When the target address of a new command matches the replacement address of a received command, from all valid commands that have a target-replacement address conflict with the new command, the command with the T2R Tail identifier (T2R Tail) in the target-replacement conflict type is selected as valid (i.e., "1"). The command identifier of the new command is recorded as the T2R conflict identifier (T2R ID) of the new command, and the T2R Tail identifier of the new command is cleared to invalid (i.e., "0"). At the same time, the T2R blocking identifier (T2R STALL) of the new command is set to valid (i.e., "1"), so that the new command is blocked under this conflict type and waits for the conflict to be resolved.
[0105] Scenario 3: Replacement - Target Address Conflict (R2T) When the replacement address of a new command matches the target address of a received command, from all valid commands that have a replacement-target address conflict with the new command, the command with the R2T Tail flag set to a valid state (i.e., "1") under the replacement-target conflict type is selected. The command identifier of the new command is recorded as the R2T conflict identifier (R2T ID) of the new command, and the R2T Tail flag of the new command is cleared to an invalid state (i.e., "0"). At the same time, the R2T blocking flag (R2T STALL) of the new command is set to a valid state (i.e., "1"), so that the new command is blocked under this conflict type and waits for the conflict to be resolved.
[0106] By using the mechanism of finding only the tail of the chain, each new command only needs to establish a dependency relationship with the tail of the current conflict chain, transforming the global sorting problem into a local chain-like transmission, eliminating the need for a global sorting matrix, thus significantly saving hardware resources.
[0107] 2) Command execution completion and block release When a command in the conflict chain completes execution, it sends completion information to all other pending commands in the command queue by either releasing the flag or directly broadcasting its command identifier (i.e., state machine ID).
[0108] After receiving the broadcast release flag, the blocked command matches it one by one with the conflict flags of each conflict type stored in its own database: If the release flag matches the T2T conflict flag of the command, then the T2T blocking flag (T2TSTALL) of the command is pulled low to an invalid state; If the release flag matches the T2R conflict flag of the command, then the T2R blocking flag (T2RSTALL) of the command is pulled low to an invalid state; If the release flag matches the R2T conflict flag of the command, then the R2T blocking flag (R2TSTALL) of the command is pulled low to an invalid state.
[0109] When all blocking flags (T2T STALL, T2R STALL, R2T STALL) of the command are invalid (i.e., all are "0"), the command is unblocked and can enter the execution process. This ensures strict ordering of data read and write operations in multi-core high-concurrency access scenarios.
[0110] For example, such as Figure 5 The diagram shows the receiving order of multiple access commands in this application and the address information of each command. Based on the aforementioned conflict detection and chain mounting mechanism, the following can be obtained: Figure 6 The T2T conflict chain shown is as follows: Figure 7 The R2T conflict chain shown is as follows: Figure 8 The T2R collision chain shown in the diagram is illustrated using tag address B (TAG addr B) as an example.
[0111] See Figures 6-8For access commands related to label address B, commands 1, 2, 4, 5, 7, 9, and 11 are linked into a conflict dependency chain through independently maintained conflict chains for each conflict type in this application. The execution dependency order is: 1→2→4→5→7→9→11. That is, command 2 can only be executed after command 1 is executed; command 4 can only be executed after command 2 is executed, and so on. This order is automatically established through the chained transmission of conflict association identifiers and chain tail identifiers recorded in each command, without requiring additional global sorting logic.
[0112] Similarly, the conflict dependencies corresponding to other tag addresses can be derived in the same way. For example, state machine 8 depends on the completion of state machine 4 (TAG addr G) and state machine 6 (TAG addr E). That is, state machine 8 needs to wait for state machines 4 and 6 to complete their respective conflict chains before all its blocking flags can be released, thus allowing execution. This example only uses tag address B for illustration; the conflict dependencies of other tag addresses can be deduced similarly, and will not be elaborated on in this application.
[0113] In this application, the state machine corresponds to each access command, and each command has a unique command identifier (i.e., state machine ID). State machine 8 is the access command with command identifier 8. As a blocked command, its conflict association identifier records the command identifiers of command 4 and command 6 respectively. Therefore, it is necessary to wait for both of these commands to be executed before it can be unblocked and executed.
[0114] To implement the collision detection method provided in the embodiments of this application, the embodiments of this application also provide a collision detection device, such as... Figure 9 As shown, the collision detection device 300 includes: The detection unit 310 is configured to, in response to a received access command, perform conflict detection on the access command based on the address information requested by the access command and the address information requested by the received access command to be executed, in order to determine at least one set of conflicting commands under at least one conflict type. The address information includes target address information and replacement address information, and the conflict type includes at least one of target address conflict, target address conflict and replacement address conflict, and replacement address conflict and target address conflict. Analysis unit 320 is configured to configure the tag fields of each conflict type in at least one conflict type according to the tag fields of the tail command in each group of conflict commands, so that the access command is attached to the end of the conflict chain of each conflict type, and the target conflict chain of each conflict type is obtained. The target conflict chain is used to establish the execution dependency relationship between the access command and the tail command in each group of conflict commands. The tag fields include at least one of the tail identifier, command identifier, conflict association identifier and blocking identifier. The execution unit 330 is used to execute the access command based on the command identifier of the currently executed conflict command in the target conflict chain of each conflict type and the conflict association identifier of the access command corresponding to each conflict type.
[0115] In some embodiments, the detection unit 310 is configured to: If the target address information of the access command matches the target address information of the access command to be executed, it is determined that there is a target address conflict between the access command to be executed and the access command, and the access command to be executed is identified as a conflicting command under the target address conflict; and / or, If the target address information of the access command matches the replacement address information of the access command to be executed, it is determined that there is a target address and replacement address conflict between the access command to be executed and the access command, and the access command to be executed is identified as a conflicting command under the target address and replacement address conflict; and / or, If the replacement address information of the access command matches the target address information of the access command to be executed, it is determined that there is a conflict between the replacement address and the target address between the access command to be executed and the access command, and the access command to be executed is determined to be a conflicting command under the conflict between the replacement address and the target address.
[0116] In some embodiments, the analysis unit 320 is configured to: Based on the chain tail identifier of each conflict command in each group of conflict commands, filter out the chain tail commands in each group of conflict commands whose chain tail identifier is in a valid state. The command identifier of the tail command determines the conflict association identifier of the conflict type of the access command corresponding to the tail command; Update the tail flag of the tail command to invalid state, and configure the tail flag of the conflict type of the tail command corresponding to the access command to valid state; Configure the blocking flag for the conflict type of the tail command corresponding to the access command to a valid state.
[0117] In some embodiments, the execution unit 330 is configured to: Obtain the command identifier of the currently executed and completed conflict command broadcast in the target conflict chain for each conflict type; Match the conflict association identifiers of each conflict type corresponding to the access command with the command identifiers broadcast by the currently executed conflict command to obtain the matching results for each conflict type; Based on the matching results of each conflict type, the blocking flags corresponding to each conflict type of the access command are updated to invalid status, so that the access command can be executed according to the invalid status of the blocking flags corresponding to each conflict type of the access command.
[0118] In some embodiments, the execution unit 330 is configured to: The access command is executed if all blocking flags corresponding to at least one conflict type are invalid. If the blocking flag for at least one conflict type corresponding to the access command is in a valid state, the execution of the access command is prohibited.
[0119] In some embodiments, the execution unit 330 is configured to: after executing the access command according to the target conflict chain of each conflict type, when the access command is configured with a validity identifier, update the validity identifier of the access command to an invalid state, so that the access command is removed from the conflict detection range.
[0120] Those skilled in the art should understand that Figure 9 The functions of each unit in the collision detection device 300 shown can be understood by referring to the relevant description of the aforementioned collision detection method. Figure 9 The functions of each unit in the collision detection device 300 shown can be implemented through a program running on a processor or through specific logic circuits. It should be noted that the collision detection device 300 provided in the above embodiments is only illustrated by the division of the program units described above. In practical applications, the above processing can be assigned to different program units as needed, that is, the internal structure of the system can be divided into different program units to complete all or part of the processing described above. Furthermore, the collision detection device 300 and the collision detection method embodiments provided in the above embodiments belong to the same concept; the specific implementation process is detailed in the method embodiments and will not be repeated here.
[0121] Based on the hardware implementation of the program units in the collision detection device 300 of this application, and in order to implement the collision detection method provided in the embodiments of this application, this application also provides an electronic device 400. For example... Figure 10 As shown, Figure 10 The electronic device 400 provided in this application embodiment is a schematic diagram of its composition. The electronic device includes a processor 401 and a memory 402. The memory 402 is used to store computer programs, and the processor 401 is used to call and run the computer programs stored in the memory 402 to perform the steps of the conflict detection method provided in this application embodiment.
[0122] In practical applications, such as Figure 10 As shown, the various components in electronic device 400 are coupled together via bus module 403. It can be understood that bus module 403 is used to implement communication between these components. In addition to a data bus, bus module 403 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 10 The general labels all buses as bus module 403.
[0123] This application also provides a non-transitory computer-readable storage medium storing computer instructions, which, when executed by a computer, implement the steps of the conflict detection method provided in this application.
[0124] In some embodiments, the computer-readable storage medium may be magnetic random access memory (FRAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM), etc.; or it may be various devices that include one or any combination of the above-mentioned memory.
[0125] In some embodiments, computer instructions may take the form of programs, software, software modules, scripts, or code, written in any type of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as standalone programs or as modules, components, subroutines, or other units suitable for use in a computing environment. As an example, computer instructions may, but not necessarily, correspond to files in a file system, and may be stored as part of a file containing other programs or data, for example, in one or more scripts within a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files storing one or more modules, subroutines, or code portions). As an example, computer instructions may be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.
[0126] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0127] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0128] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.
[0129] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a system including a processing module or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).
[0130] It should be understood that various parts of the embodiments of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0131] Those skilled in the art will understand that all or part of the steps of the methods described in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0132] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The aforementioned storage medium can be read-only memory, a disk, or an optical disk, etc.
[0133] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A collision detection method, characterized in that, The method is applied to caching scenarios, including: In response to a received access command, based on the address information requested by the access command and the address information requested by the received access command to be executed, conflict detection is performed on the access command to determine at least one set of conflicting commands under at least one conflict type. The address information includes target address information and replacement address information. The conflict type includes at least one of target address conflict with target address, target address conflict with replacement address, and replacement address conflict with target address. Each of the at least one conflict type corresponds to an independent conflict chain, and the flag fields in the access command corresponding to different conflict types are configured independently of each other; Based on the tag field of the tail command in each group of conflict commands, the access command is configured to correspond to the tag field of each conflict type in the at least one conflict type, so that the access command is attached to the end of the conflict chain of each conflict type to obtain the target conflict chain of each conflict type. The target conflict chain is used to establish the execution dependency relationship between the access command and the tail command in each group of conflict commands. The tag field includes the tail identifier, command identifier, conflict association identifier and blocking identifier. The access command is executed based on the command identifier of the currently executed conflict command in the target conflict chain of each conflict type and the conflict association identifier of each conflict type corresponding to the access command. The step of executing the access command based on the command identifier of the currently executed conflict command in the target conflict chain of each conflict type and the conflict association identifier of each conflict type corresponding to the access command includes: Obtain the command identifier of the currently executed and completed conflict command broadcast in the target conflict chain of each conflict type; The conflict association identifiers corresponding to each conflict type of the access command are matched with the command identifiers broadcast by the currently executed conflict command to obtain the matching results for each conflict type. Based on the matching results of each conflict type, if any conflict type is successfully matched, the blocking flag of the conflict type corresponding to the access command is updated to an invalid state, so as to execute the access command according to the invalid state of the blocking flag of each conflict type corresponding to the access command. The step of executing the access command based on the invalid status of the blocking identifier corresponding to each conflict type includes: The access command is executed if all blocking flags corresponding to the conflict types of the access command are invalid. If the blocking flag for the at least one conflict type corresponding to the access command is in a valid state, the execution of the access command is prohibited.
2. The method according to claim 1, characterized in that, The step of performing conflict detection on the access command based on the address information requested by the access command and the address information requested by the received access command to be executed, to determine at least one set of conflicting commands under at least one conflict type, includes: If the target address information of the access command matches the target address information of the access command to be executed, it is determined that there is a target address conflict between the access command to be executed and the access command, and the access command to be executed is identified as a conflicting command under the target address conflict; and / or, If the target address information of the access command matches the replacement address information of the access command to be executed, it is determined that there is a target address and replacement address conflict between the access command to be executed and the access command, and the access command to be executed is identified as a conflicting command under the target address and replacement address conflict; and / or, If the replacement address information of the access command matches the target address information of the access command to be executed, it is determined that there is a conflict between the replacement address and the target address between the access command to be executed and the access command, and the access command to be executed is determined to be a conflict command under the conflict between the replacement address and the target address.
3. The method according to claim 1, characterized in that, The step of configuring the access command to correspond to the tag field of each conflict type in the at least one conflict type according to the tag field of the chain tail command in each group of conflict commands, so that the access command is attached to the end of the conflict chain of each conflict type, and obtaining the target conflict chain of each conflict type includes: Based on the chain tail identifier of each conflict command in each group of conflict commands, filter out the chain tail commands in each group of conflict commands whose chain tail identifier is in a valid state; The command identifier of the tail command is determined as the conflict association identifier of the conflict type of the tail command corresponding to the access command; Update the tail identifier of the tail command to an invalid state, and configure the tail identifier of the conflict type of the tail command corresponding to the access command to a valid state; Configure the blocking flag of the conflict type of the access command corresponding to the tail command to a valid state.
4. The method according to claim 1, characterized in that, The access command is configured with a validity identifier. After executing the access command according to the target conflict chain of each conflict type, the method includes: If the access command is executed and the corresponding command storage item is released, the validity flag of the access command is updated to invalid, so that the access command is removed from the conflict detection range.
5. A collision detection device, characterized in that, The device includes: A detection unit is configured to, in response to a received access command, perform conflict detection on the access command based on the address information requested by the access command and the address information requested by the received access command to be executed, in order to determine at least one set of conflicting commands under at least one conflict type. The address information includes target address information and replacement address information. The conflict type includes target address conflict with target address, target address conflict with replacement address, and replacement address conflict with target address. Each of the at least one conflict type corresponds to an independent conflict chain, and the flag fields in the access command corresponding to different conflict types are configured independently of each other; The analysis unit is configured to configure the access command to correspond to the tag field of each conflict type in the at least one conflict type according to the tag field of the tail command in each group of conflict commands, so that the access command is attached to the end of the conflict chain of each conflict type to obtain the target conflict chain of each conflict type. The target conflict chain is used to establish the execution dependency relationship between the access command and the tail command in each group of conflict commands. The tag field includes at least one of the tail identifier, command identifier, conflict association identifier and blocking identifier. An execution unit is configured to execute the access command based on the command identifier of the currently executed conflict command in the target conflict chain of each conflict type and the conflict association identifier of each conflict type corresponding to the access command; The step of executing the access command based on the command identifier of the currently executed conflict command in the target conflict chain of each conflict type and the conflict association identifier of each conflict type corresponding to the access command includes: Obtain the command identifier of the currently executed and completed conflict command broadcast in the target conflict chain of each conflict type; The conflict association identifiers corresponding to each conflict type of the access command are matched with the command identifiers broadcast by the currently executed conflict command to obtain the matching results for each conflict type. Based on the matching results of each conflict type, if any conflict type is successfully matched, the blocking flag of the conflict type corresponding to the access command is updated to an invalid state, so as to execute the access command according to the invalid state of the blocking flag of each conflict type corresponding to the access command. The step of executing the access command based on the invalid status of the blocking identifier corresponding to each conflict type includes: The access command is executed if all blocking flags corresponding to the conflict types of the access command are invalid. If the blocking flag for the at least one conflict type corresponding to the access command is in a valid state, the execution of the access command is prohibited.
6. An electronic device, characterized in that, include: A processor and memory, the memory being used to store a computer program, the processor being used to invoke and run the computer program stored in the memory, performing the steps of the method as claimed in any one of claims 1 to 4.
7. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the steps of the method as described in any one of claims 1 to 4.
8. A chip, characterized in that, The device includes one or more interface circuits and one or more processors; the interface circuits are configured to receive signals from the memory of the electronic device and send the signals to the processors, the signals including computer instructions stored in the memory, which, when executed by the processors, cause the electronic device to perform the method of any one of claims 1 to 4.
Citation Information
Patent Citations
Tracking load store ordering hazards
US20090157943A1
Cross dependency checking logic
US20140173218A1