Device and data processing method for transaction memory
By introducing a transaction memory support mechanism in the data processing system, the performance loss problem of locking method in the case of fewer conflicts is solved, more efficient thread resource access is achieved, and the performance of the data processing system is improved.
Patent Information
- Application Number
- CN201980055680.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-11-28
- Filing Date
- 2019-10-17
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2039-10-17
AI Technical Summary
Existing lock-based methods may result in performance losses in case of fewer conflicts between threads, as threads may unnecessarily wait for the lock to be released and it is difficult to effectively control the exclusive access of multiple resources.
The transaction memory support mechanism is adopted to mark the start and end of a transaction through transaction start and end instructions, and abort the transaction when a conflict is detected, avoid unnecessary locking and waiting, and improve resource access efficiency between threads.
Through transaction memory support, conflicts between threads are reduced, performance is improved in the case of fewer conflicts, allowing more threads to process key segments simultaneously, and improving the overall performance of the data processing system.
Smart Images

Figure CN112639728B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing. More specifically, the present disclosure relates to transactional memory. Background Art
[0002] A data processing system may execute multiple threads of data processing. Sometimes, a thread may need to access a shared resource and the nature of the data processing operation may be such that once a thread begins interacting with the shared resource, it may be necessary to atomically utilize the resource in order for a set of operations to complete without another thread accessing the resource at the same time.
[0003] One technique for handling such conflicts between threads may be to utilize locks to control exclusive access to at least one target resource. For example, when a thread begins to access data in a particular address region, the thread may set a lock variable to claim ownership of the lock, and then while the thread that owns the lock has ownership of the lock, other threads that check the lock variable may determine that the lock has been claimed and therefore may not enter the code section that interacts with the address region. This lock-based approach can be viewed as pessimistic in that each thread assumes by default that it cannot enter the code section that accesses the shared resource because a conflict with another thread may occur unless its ownership of the lock ensures that no conflict will occur. However, often a lock identifier may control exclusive access to multiple resources (e.g., address ranges), and therefore if one thread is accessing a particular resource within a set of resources protected by the lock variable, there is no guarantee that another thread will necessarily access the same resource. Therefore, in the rare case of a conflict between threads, a lock-based approach may result in a loss of performance because a thread may unnecessarily wait for a lock to be released before entering a critical section of code that utilizes the shared resource. Summary of the invention
[0004] An ideal method for handling conflicts between threads accessing shared resources may be to utilize transactional memory support. A data processing system may have a circuit system to support the execution of transactions within a data processing thread by the processing circuit system. The transaction may be instructions executed by the thread between a transaction start instruction and a transaction end instruction, the transaction start instruction marking the beginning of the transaction and the transaction end instruction marking the end of the transaction. Between the transaction start and end instructions, the processing circuit system may speculatively execute intervening instructions and prevent the submission of the results of the speculatively executed instructions until the transaction end instruction is reached. The occurrence of an abort event following the execution of the transaction start instruction (but before the transaction end instruction is reached) may cause the transaction to be aborted and the speculative results to be discarded. There are multiple reasons for aborting a transaction, but one reason may be the detection of a conflict with a memory access performed by another thread. Therefore, using this method, each thread can ideally begin processing the code of a critical section assuming that no conflict with other threads will occur, and then if the end of the critical section is reached without detecting any conflict, the results of the transaction can be submitted. In situations where conflicts are rare, utilizing transactional memory support can improve performance by allowing more threads to process their critical sections of code simultaneously.
[0005] In example embodiments described herein, an apparatus comprises: an instruction decoder for decoding an instruction; processing circuitry for performing data processing in response to the instruction being decoded by the instruction decoder; transactional memory support circuitry for supporting execution of transactions within a data thread processed by the processing circuitry, the transactional memory support circuitry including address tracking circuitry to track addresses accessed by instructions within the transaction; for a first type of transaction initiated using a first type of transaction start instruction, the instruction decoder is configured to control the processing circuitry to prevent commit of results of instructions speculatively executed following the first type of transaction start instruction until a second type of transaction initiated with a second type of transaction start instruction, the instruction decoder being configured to control the processing circuitry to respond to the execution of a read operation within the transaction by marking the address of the read operation as traceable by the address tracking circuitry, and to respond to the execution of a write operation within the transaction by omitting marking the address of the write operation as traceable by the address tracking circuitry.
[0006] A data processing method is also described herein, comprising: decoding an instruction using an instruction decoder; performing data processing using a processing circuit system of a device in response to the decoded instruction, the device comprising a transactional memory support circuit system to support execution of transactions within a data thread processed by the processing circuit system, the transactional memory support circuit system comprising an address tracking circuit system to track addresses accessed by instructions within the transaction, wherein for a first type of transaction started using a first type of transaction start instruction, the instruction decoder is configured to control the processing circuit system to prevent the commit of results of instructions speculatively executed following the first type of transaction start instruction, until until a transaction end instruction is reached, wherein the transactional memory support circuitry is configured to trigger an abort of the transaction in response to detecting a conflict between an address of a memory access from another thread and an address tracked by the address tracking circuitry; and in response to a second type transaction started with a second type transaction start instruction, controlling the processing circuitry by the instruction decoder to respond to execution of a read operation within the transaction by marking the address of the read operation as trackable by the address tracking circuitry, and to respond to execution of a write operation within the transaction by omitting marking the address of the write operation as trackable by the address tracking circuitry.
[0007] Also described herein is a computer program for controlling a host data processing device to provide an instruction execution environment for execution of instructions, the computer program comprising: instruction decoding program logic for decoding instructions of a target code to control the host data processing device to perform data processing; transaction memory support program logic for supporting execution of transactions within a data processing thread, the transaction memory support program logic comprising address tracking program logic to track addresses accessed by instructions within the transaction, wherein for a first type transaction started with a first type transaction start instruction, results of speculatively executed instructions following the first type transaction start instruction are prevented from being executed the transactional memory support program logic being configured to trigger an abort of the transaction in response to detecting a conflict between an address of a memory access from another thread and an address tracked by the address tracking program logic; and corresponding to a second type transaction started with a second type transaction start instruction, the instruction decoding program logic being configured to respond to execution of a read operation within the transaction by marking the address of the read operation as trackable by the address tracking program logic, and respond to execution of a write operation within the transaction by omitting marking the address of the write operation as trackable by the address tracking program logic.
[0008] A storage medium storing the computer program is also described herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The invention will be further described, by way of example, with reference to embodiments of the invention shown in the accompanying drawings, in which:
[0010] Figure 1 schematically illustrates an example of a data processing device having transactional memory support circuitry;
[0011] Figure 2 illustrates an example of processing a first transaction in a system with transactional memory support;
[0012] Figure 3 An example of processing a second transaction in a system with transactional memory support is illustrated;
[0013] Figure 4 Another example of processing a second transaction in a system with transactional memory support is illustrated;
[0014] Figure 5 schematically illustrates an example system including two or more processor cores and a cache coherent interconnect;
[0015] Figure 6 is a flow chart illustrating an example of processing a transaction;
[0016] Figure 7 An example of a simulator that may be used is shown. DETAILED DESCRIPTION
[0017] Before discussing the embodiments with reference to the drawings, the following description of the embodiments is provided.
[0018] According to an example configuration, a device is provided that is capable of supporting a first type transaction initiated with a first type transaction start instruction and a second type transaction initiated with a second type transaction start instruction. Following the second type transaction start instruction, addresses of read operations are marked as traceable while omitting marking addresses of write operations as traceable.
[0019] It may be considered counterintuitive to envision not tracking writes for a transaction, as at first glance it would seem to completely defeat the very purpose of transactions (which is to provide a set of operations that cannot be atomically divided to ensure exclusive access to a shared resource). However, the inventors have realized that transactions can be used for other purposes that do not require ensuring exclusive access for the transaction.
[0020] For example, address watching is a technique for enabling software executing on a thread to detect when a particular memory address is updated by another thread or another processor core. One way to implement address watching is polling, where the software executing on the thread must repeatedly read the address to check if the address has changed, but this is slow and power-hungry. In another approach, the architecture can provide automatic (non-polling) monitoring of a single address by executing a load exclusive instruction to set an "exclusive" state for a particular address. Exclusive monitor hardware is provided to monitor accesses by other threads or cores, and remove the exclusive state when a write to the address is detected to be marked as exclusive. If the exclusive state has been removed from the target address, subsequent store exclusive instructions fail, and the original software can use this to find out if the address has been written to. However, this approach does not scale well to polling multiple addresses simultaneously, so most architectures limit the setting of the exclusive state to only one address at a time. An alternative approach is to utilize a mapping or virtual mailbox, where a single address watched in hardware is utilized as a mailbox that indicates whether a group (or range) of other addresses have been updated. With this approach, another software that updates one of the addresses must also update the virtual mailbox address to signal that an update has been performed. The thread that is to be notified about the update is then interrupted when the mailbox address is updated, but then each address in this number or range will still need to be individually polled by the interrupted thread in order to determine which other address the other software actually updated. Therefore, these methods of address watching do not scale well as the number of addresses to be watched increases.
[0021] The inventors have learned that in systems that support transactional memory, there is already logic for monitoring access to multiple addresses and interrupting software processing when one of these addresses is accessed, that is, conflict detection logic for detecting when to abort a transaction. Multiple address monitoring can therefore be achieved with relatively little additional hardware. It is further learned that entering a first type of transaction is not necessarily computationally intensive when used only for address monitoring, because the addresses of all read and write operations need to be tracked. Therefore, it is learned that it is more efficient to provide a device capable of supporting a second type of transaction, in which the addresses of read operations are marked as traceable but the marking of write addresses as traceable is omitted, which provides a device capable of monitoring multiple addresses without the full computational burden of the first type of transaction.
[0022] In some example configurations, for a first type of transaction, the transactional memory support circuitry is configured to trigger the capture of an architectural state that will be restored in the event that the transaction is aborted, and for a second type of transaction, the transactional memory support circuitry is configured to omit the capture of the architectural state. This allows the restore state to be captured and used in the event of an abort of the first type of transaction, but omits the capture of the restore state for the second type of transaction, thereby reducing the burden and processing delay in starting the second type of transaction.
[0023] In some example configurations, for a first type of transaction, following the transaction end instruction, the instruction decoder is configured to control the processing circuit system to discard the captured architectural state or allow it to be subsequently overwritten. By reaching the transaction end instruction, the first type of transaction will have been successfully executed, and therefore there will be no need to restore the architectural state. By discarding the captured architectural state, memory or register space can be freed up for other processing operations.
[0024] In some example configurations, for the second type of transaction, the transactional memory support circuit system is configured to trigger an abort of the transaction upon detecting a conflict between the address of a read operation performed within the transaction and the address of a write operation from another thread. Thus, this provides a means of stopping a transaction when a conflict is detected. In particular, in this case, the conflict is between the address of a read operation performed within the transaction and the address of a write operation from another thread; in other words, when another thread attempts to write to one of the addresses in the transaction, the address has been marked as traceable. Conversely, for the first type of transaction, the conflict may be between a read operation in the transaction and a write operation from another thread, or between a write operation in the transaction and a read operation from another thread.
[0025] In some example configurations, the transactional memory support circuitry is configured to trigger an abort of the second type of transaction in response to at least one other event. For example, another event that may trigger an abort may be a system reset, an interrupt, execution of an instruction that is not allowed to execute within a transaction, or insufficient storage. This provides a variety of different mechanisms for triggering an abort and a conflict.
[0026] In some example configurations, for a second type of transaction, the instruction decoder is configured to control the processing circuit system to omit restoration of the architectural state in response to the abort. For a second type of transaction, a write address is not marked as having been accessed by the transaction, but the architectural state may still change during the transaction (for example, any load or arithmetic instructions may update the architectural state in the registers of the core where the transaction is executed). However, the second type of transaction is not used to ensure atomic processing of a set of operations as in ordinary transactional memory, but is instead used for address monitoring, where there is no requirement that a set of operations be completed atomically. Therefore, if a second type of transaction is aborted, there is no need to restore the previous state because the results of any intervening instructions are still valid. Omitting the restoration step therefore reduces the computational burden (and processing delay) caused by the abort of the transaction and increases processing efficiency.
[0027] In some example configurations, for a second type of transaction, the processing circuit system is configured to perform at least one of the following operations: in response to an abort of the second type of transaction, commit the results of the intervening instructions of the transaction; or commit the results of the instructions within the second type of transaction without waiting for the transaction end instruction. Unlike the first type of transaction, for the second type, its intervening results can be valid even if an abort is assumed. Therefore, it is good to commit on abort, or just commit any intervening results during the entire transaction without waiting for the transaction end instruction. Committing the results of the instructions within the second type of transaction without waiting for the transaction end instruction means that the intervening results do not need to be buffered in a buffer, which is more energy-efficient. Committing the results of the intervening instructions of the transaction in response to an abort of the second type of transaction means that the processing of the second type of transaction is more similar to the processing of the first type of transaction, and therefore requires less control modification.
[0028] In some example configurations, for transactions of the second type, the instruction decoder controls the processing circuit system in response to an instruction of a predetermined type to suspend processing of the instruction until a notification is received that the abort has been triggered. This places the processing circuit system in a watch configuration mode, in which no further operations are processed within the transaction until the abort is triggered, thereby providing a low-burden (e.g., low-power) means of address tracking.
[0029] In some example arrangements, the predetermined type of instruction specifies a register storing an address indication representing the address of a memory access from another thread that triggered the abort. This provides a means of recording the address of the memory access that triggered the abort.
[0030] In some example configurations, in response to an abort of a second type of transaction being triggered, the processing circuit system is configured to store an abort cause indication indicating whether the abort was triggered by a conflict. This provides a means of recording the abort cause, which is useful for a thread to determine whether the abort is indeed due to an update to one of the tracked addresses, or for some other reason (e.g., an interrupt). This helps software determine how to continue processing after a transaction is aborted.
[0031] In some example configurations, the instruction of the predetermined type specifies a register storing an address indication representing an address of a memory access from another thread that triggered the abort. This allows software to determine which particular address among the plurality of addresses being tracked was updated, and respond accordingly. This avoids the need to poll each of the plurality of addresses being tracked (as in the alternative approach discussed above) in order to find out which address was updated.
[0032] In some example configurations, the cause of the suspension indication is stored in a register identical to the address indication. This allows the cause of the suspension to be recorded in the same location as the address of the memory access that triggers the suspension, allowing other processing operations to be easily accessed. It is expected that the memory address should be the same width as the register, so it is counterintuitive to have space for the cause of the suspension indication in the same register. However, due to the restrictions of address alignment (which may require the memory address to be adjusted to a number of bytes of a specific size), the low-order portion of the address must be all 0 and can therefore be reused to indicate the cause of the suspension indication. Alternatively, some architectures may not fully use the entire address space (e.g., only 48 bits in a potential 64-bit address space are used), so there may be idle bits at the high position that can be utilized to provide the cause of the suspension indication. The instruction has only one destination register to be updated, which may be easier to implement on the microarchitecture and generate less register pressure in the utilization of registers.
[0033] However, in other examples the abort cause indication may be stored in a general register different from the address indication. An advantage of this approach may be that the address indication provided in the register may be directly utilized to trigger another memory access without first having to mask the abort cause indication.
[0034] In some example configurations, the apparatus includes a control register to store at least one conditional status indication, the conditional status indication indicating an attribute of a previous processing result; wherein: in response to a conditional instruction, the instruction decoder is configured to control the processing circuit system to perform a conditional operation, the conditional operation depending on whether at least one conditional status indication stored in the control register satisfies a test condition; and the abort cause indication includes at least one of the at least one conditional status indication. Thus, the abort cause indication can be recorded directly to the (one or more) conditional status indications, which can be directly tested by the conditional instruction, thereby reducing the number of processing steps necessary to follow the abort, because the abort cause indication is utilized as an input into the conditional operation, without the need for an intervening comparison instruction to test the abort cause indication and establish the conditional status indication accordingly.
[0035] A corresponding computer program may control a host data processing device to provide an instruction execution environment for executing instructions, wherein the processing program logic marks the address of a read operation as traceable in response to a second type transaction start instruction, while omitting to mark the address of a write operation as traceable. Such a computer program may allow a general purpose host data processing device that does not itself have a transactional memory support circuit system or an instruction decoder that supports the first or second type transaction start instruction to be unable to benefit from the transactional memory function and the address monitoring function of the second type transaction, even though there may be no real hardware providing such features. Alternatively, the computer program provides program logic (e.g., an instruction set or data structure) that emulates this function, so that the general purpose host data processing device can execute code intended for execution on a device that does have such hardware features provided.
[0036] Specific embodiments will now be illustrated with reference to the accompanying drawings.
[0037] Figure 1An example of a data processing device 2 with hardware transactional memory (HTM) support is shown. The device has a processing circuit system (processing logic) 4 for executing instructions to perform data processing operations. For example, the processing circuit system 4 may include an execution unit for performing various types of processing operations, such as an arithmetic / logic unit (ALU) for performing arithmetic or logical operations such as addition, multiplication, AND, OR, etc.; a floating point unit for operating on floating point operands; or a vector processing unit for performing vector processing on vector operands containing multiple data elements. A set of architectural registers 6 are provided for storing operands for instructions executed by the processing circuit system 4 and for storing the results of the executed instructions. The instruction decoder 8 decodes the instructions extracted from the instruction cache 10 to generate control signals for controlling the processing circuit system 4 or other components of the data processing device 2 to perform related operations. A load / store unit 12 is also provided to perform a load operation (in response to a load instruction decoded by the instruction decoder 8) to load data values from the data cache 14 or the main memory 16 into the architectural register 6, and to perform a store operation (in response to a store instruction decoded by the instruction decoder 8) to store data values from the architectural register 6 to the data cache 14 or the memory 16.
[0038] The device 2 also has a transactional memory support circuitry 20 that provides various resources for supporting a hardware transactional memory (HTM). The HTM resources in the transactional memory support circuitry 20 may include, for example, a speculative result storage device 22 for storing speculative transaction results, an address tracking circuitry 24 for tracking addresses accessed by a transaction, a conflict detection circuitry 26 for detecting conflicts between data accesses made by a transaction and data accesses made by other threads (so that the transaction can be aborted when a conflict is detected), and a restore state storage circuitry 28 for storing a snapshot of architectural state data from the architectural registers 6 at the beginning of a transaction (so that the state can be restored to overwrite the speculative transaction results when the transaction is aborted). In addition, these resources may include a lock storage structure 30 for a strong lock identifier, and a nest depth register 32 for storing a nest depth value that tracks the nesting level of a transaction, as will be described in more detail below.
[0039] Figure 2 An example of performing a first type transaction within a given thread using transactional memory support circuitry 20 and processing circuitry 4 is shown. The first type transaction is a program code segment bounded by a first type transaction start instruction (tstart) and a transaction end instruction (tcommit). Figure 2As shown in FIG. 1 , the current architectural state in the architectural register 6 in response to a first type transaction start instruction is captured and stored in the recovery state storage circuitry 28. The processing circuitry 4 begins speculative execution of subsequent instructions following the tstart instruction, and as these instructions are executed, addresses accessed by these instructions are tracked by the address tracking circuitry 24, and the conflict detection circuitry 26 detects conflicts between the tracked addresses and addresses of accesses made by the load / store unit 12 in response to other threads. At least some of the speculative results of the instructions within the transaction are stored in the speculative result storage circuitry 22. For example, values stored to a cache or memory in response to a store instruction STR may be retained in the speculative result storage device 22 while the transaction remains pending. If a transaction end instruction (tcommit) is reached without an abort event occurring in the meantime, the speculative results are committed in response to the transaction end instruction. When the transaction commits, any results stored in speculative result store 22 for that thread may be written to data cache 14 or memory 16, and the captured architectural state restore state 28 can be discarded or allowed to be overwritten since it is no longer needed to rewind the architectural state to the point before the first type transaction begin instruction was encountered.
[0040] On the other hand, if an abort event occurs, such as conflict detection circuitry 26 detecting a conflict when another thread accesses an address already accessed by the transaction, then abort of the transaction is triggered and the captured architectural state from restore state storage 28 is restored to architectural registers 6. Other causes of an abort event may include, for example, the execution of an instruction that is not allowed to execute within a transaction, insufficient resources within speculative result storage 22 or address tracking circuitry 24 to process the speculative results or addresses necessary for a given transaction, or an interrupt received during the transaction.
[0041] Figure 3 An example of executing a second type of transaction within a given thread using transactional memory support circuitry 20 and processing circuitry 4 is shown. A second type of transaction is a program code segment that begins with a second type of transaction start instruction. Figure 3 In the example of , the second type transaction start instruction is a specific instruction (start1). Alternatively, a flag previously set in a control register can be used to send a signal as to whether the transaction start instruction is of the first type or the second type. Figure 3 As shown in FIG. 1 , in response to the second type transaction start instruction, the processing circuit system 26 responds to the execution of the read operation (e.g., load instructions LD x0, [A] to LD x4, [E]) within the transaction, and uses the address tracking circuit system 24 to track the address of the read operation (e.g., Figure 3In contrast to the first type of transaction, by omitting the address of the write operation being marked as traceable by the address tracking circuitry 24, the processing circuitry 26 responds to the execution of the write operation within the transaction. In other words, Figure 3 In the example shown in FIG. 1 , when a storage instruction such as STR[#add2] is encountered, the write flag for the memory address is not marked.
[0042] like Figure 3 As shown in FIG. 1 , the transactional memory support circuitry 20 may also be configured to omit the capture of the architectural state for the second type of transaction. In other words, for the second type of transaction, the instructions following the tstart1 instruction are performed without capturing the architectural state. Figure 2 The first type of transaction start instruction tstart shown in will capture the architectural state.
[0043] If the conflict detection circuit system 26 detects a conflict when another thread writes to an address that has been tracked as part of the read set of the second type of transaction, the transactional memory support circuit system 20 is configured to trigger an abort of the second type of transaction. The transactional memory support circuit system may also be configured to trigger an abort of the second type of transaction in response to at least one other event, such as the execution of an instruction that is not allowed to be executed within the transaction, a system reset, insufficient resources within the speculative result storage device 22 or the address tracking circuit system 24, or an interrupt received during the transaction. In response to the abort of the second type of transaction, the processing circuit system 4 may be configured to perform a variety of different actions. For example, the processing circuit system 4 may be configured to commit the results of the intervening instructions of the transaction in response to the abort of the second type of transaction. Alternatively or additionally, the processing circuit system 4 may be configured to commit the results of the instructions within the second type of transaction without waiting for the transaction end instruction. Alternatively or additionally, the processing circuit system 4 may be configured to store an abort reason indication, which indicates whether the abort was triggered by a conflict.
[0044] Figure 3 Also illustrated is an instruction of a predetermined type (wft) for use with a second type of transaction. In response to the wft instruction, the processing circuitry suspends processing the instruction until notification that an abort has been triggered is received. In other words, processing of instructions in the transaction is suspended until there is an abort (e.g., due to a conflict between an address that has been marked as traceable and a write operation from another thread). Figure 3As shown in , the wft instruction specifies register x5 to store an address indication representing an address from a memory accessed by another thread that triggered the abort. This indication may be an indication of the first address in the set that triggered the abort, rather than an indication of an individual address. When the processing circuit system 4 stores an abort cause indication in response to the abort, the abort cause indication may be stored in the same register as the address indication. Alternatively, the abort cause indication may be stored in a general register different from the address indication, such as in a status register.
[0045] The device 2 may also include a control register to store at least one conditional status indication, which indicates an attribute of a previous processing result. In response to the conditional instruction, the instruction decoder 8 is configured to control the processing circuit system 4 to perform a conditional operation, which conditional operation depends on whether the at least one conditional status indication stored in the control register satisfies the test condition. The abort cause indication then includes at least one of the at least one conditional status indication.
[0046] Figure 4 Another example of using transactional memory support circuitry 20 and processing circuitry 4 to perform a second type of transaction within a given thread is shown. Figure 3 In the example illustrated in , the second type transaction starts with a second type transaction start instruction (start1). In response to the second type transaction start instruction, the processing circuit system 26 marks the address of the read operation within the transaction as traceable through the address tracking circuit system 24 to respond to the execution of the read operation, and omits marking the address of the write operation as traceable through the address tracking circuit system 24. Additionally, the transactional memory support circuit system 20 can also be configured to omit the capture of the architectural state. Follow Figure 4 The second type of transaction start instruction in the example is followed by a load exclusive (LDX) instruction and a store exclusive (STX) instruction. The load and store exclusive instructions can be used to split the operation of atomically updating memory into two different steps, while also providing atomic updates in conjunction with an exclusive monitor that tracks exclusive memory accesses. Figure 5 Further explanation: The store exclusive instruction may be preceded by other operations (as indicated by ellipses), such as normal (non-exclusive) load and store instructions.
[0047] Figure 5 An example of a cache coherent interconnect system 100 is schematically illustrated. The illustrated system includes two processing elements 110, 120, each having its own local cache 115, 125. Although Figure 5Only two processing elements 110 , 120 are shown in FIG. 1 , it will be appreciated that more processing elements may be provided. Memory 140 is shared between processing elements 110 , 120 and coherent interconnect 130 maintains coherency between processing elements 110 , 120 and memory 130 . Figure 5 A snoop filter 135 is also shown in FIG. Figure 5 Snoop filter 135 is illustrated as being located on coherent interconnect 130, but this is not necessary and the snoop filter may be provided as a separate element connected to processing elements 110, 120 via coherent interconnect 130. Alternatively, the snoop filter may form part of one of processing elements 110, 120. Figure 5 In the system shown in , snoop filter 135 acts as an exclusive monitor to track exclusive access to memory regions marked as shareable. Alternatively, the exclusive monitor may be implemented as separate circuitry between processing elements 110, 120 and operate by allocating addresses supporting exclusive access to each processing element 110, 120.
[0048] A load exclusive (LDX) operation on the first processing element 110 specifies a destination register ( Figure 4 x0 in ), and in addition to the load reason, the target address of the load exclusive operation ( Figure 4 The exclusive state is removed if the second processing element 120 performs a store to address [A] that is marked as exclusive to the first processing element 120. It will be appreciated that there are other events that may also cause the exclusive state to be removed. The store exclusive (STX) instruction specifies that the target address ( Figure 4 [A] in ), from the source register whose data will be stored to the destination address ( Figure 4 x20 in), and the destination register ( Figure 4 In response to the store exclusive instruction executed by the first processing element 110, it is checked whether the exclusive monitor is set for the target address [A] mentioned by the store exclusive instruction. If the exclusive monitor is still set, the store is successful and the destination register w21 is set to a pass indication. If the exclusive monitor is still not set for the target address [A], the store is not implemented and the destination register w21 is set to a fail indication.
[0049] Figure 4The example may be useful when address [A] represents a pointer to a data structure at addresses [B], [C], [D]. Multiple updates can be made based on the values read from addresses [B], [C], [D], and non-exclusive store instructions can be used to store the updated values to a separate address range (different from addresses [B]-[D]). The transaction mechanism provided in the hardware (including address monitoring and conflict detection logic) can ensure that if another thread updates one of addresses [B]-[D] while the transaction has not yet completed, the transaction is aborted and no store exclusion is implemented. However, if the transaction reaches a store exclusive instruction without any such abort, the store exclusive instruction can update the pointer stored at address [A] to point to the new data structure, swinging the pointer so that the new data structure is atomically produced, but through the use of the tstartl instruction in conjunction with the LDX / STX instruction pair, it can be achieved without the delay associated with the store / reset recovery state as with the first type of transaction start instruction. Therefore, the pointer at [A] will only be changed if the set of addresses [B]-[D] in the original data structure has not been modified, and therefore the indication associated with the store exclusive instruction indicates that the store exclusive instruction was successful.
[0050] Figure 66 is a flow chart illustrating a method 600 of processing a transaction. At step 605, a transaction start instruction (e.g., tstart or start1 described above) is decoded and executed. At step 610, it is determined whether the transaction start instruction is of a first type (tstart) or a second type (tstart1). If the transaction start instruction is of the first type, the method continues to step 615, where an architectural state is captured. The method then continues to step 620, where speculative execution of instructions in the transaction is started, including tracking of a set of addresses read and written (step 625). The method then continues to step 645. If it is determined at step 610 that the transaction start instruction is of the second type, the method continues to step 630, where a set of addresses read is tracked during execution of instructions in the transaction. At step 635, it is determined whether the predetermined instruction type (wft) is encountered during execution of instructions in the transaction. If the predetermined instruction type is encountered, the method continues to step 640, where further instruction processing is suspended. The method then continues to step 645. If the predetermined instruction type is not encountered, instructions in the transaction continue to be executed and the method continues directly to step 645. At step 645, it is determined whether an abort event has occurred. If an abort event has not occurred, the method continues to step 650, where it is determined whether a transaction end (tend) instruction has been encountered (in other words, whether a tend instruction has been decoded and executed). If a transaction end instruction has not been encountered, the method returns to step 645. If a transaction end instruction has been encountered, the method continues to step 655, where speculative results from the transaction are committed and the captured architectural state is allowed to be overwritten because it is no longer necessary for this transaction. The method then returns to step 605 to prepare for the next transaction start instruction to be received. If it is determined at step 645 that an abort event has been encountered, the method continues to step 660, where the transaction is aborted. At step 665, it is again determined whether the transaction start instruction encountered is of the first type or the second type (in other words, whether the transaction is of the first type or the second type). If it is determined that the transaction start instruction encountered is not of the second type (in other words, of the first type) the method continues to step 670, where the captured architectural state is restored. The method then returns to step 605 to prepare for the next transaction start instruction to be received. If it is determined at step 665 that the transaction start instruction encountered is of the second type, the method continues to step 675 where the results of the intervening instructions are committed and / or the results of the instructions are committed without waiting for the transaction end instruction. The method then returns to step 605 to prepare for the next transaction start instruction to be received. It will be understood that although Figure 6 The method 600 illustrated in is shown as a closed loop, but the method may be implemented using a single transaction, where the method would end at one of steps 655 , 670 , or 675 .
[0051] Figure 7 The diagram shows a usable simulator implementation. Although the earlier described embodiments implement the present invention in terms of the apparatus and method for operating the specific processing hardware supporting the technology of interest, it is also possible to provide an instruction execution environment implemented by using a computer program according to the embodiments described herein. In the scope of software-based implementations of hardware architectures provided by such computer programs, such computer programs are generally referred to as simulators. Various simulator computer programs include simulators, virtual machines, models, and binary translators, including dynamic binary translators. Typically, simulator implementations can be run on a host processor 230, which optionally runs a host operating system 220, supporting simulator programs 210. In some arrangements, there may be multiple simulation layers between the hardware and the provided instruction execution environment, and / or multiple different instruction execution environments provided on the same host processor. Historically, powerful processors have been required to provide simulator implementations that execute at reasonable speeds, but this approach can be adjusted in certain environments, such as when it is necessary to run code that is native to another processor for compatibility or reuse reasons. For example, a simulator implementation can provide an instruction execution environment with additional functions that are not supported by the host processor hardware, or provide an instruction execution environment that is generally associated with different hardware architectures. An overview of simulation is given in "Some Efficient Architecture Simulation Techniques", Robert Bedichek, Winter 1990 USENIX Conference, pages 53–63.
[0052] To the extent that embodiments have been previously described with reference to particular hardware constructs or features, in simulated embodiments, equivalent functionality may be provided by appropriate software constructs or features. For example, particular circuitry may be implemented as computer program logic in simulated embodiments. Similarly, memory hardware (e.g., registers or caches) may be implemented as software data structures in simulated embodiments. In configurations where one or more of the hardware components referenced in previously described embodiments are present on host hardware (e.g., host processor 230), some simulated embodiments may utilize host hardware (where appropriate).
[0053] The simulator program 210 may be stored on a computer-readable storage medium (which may be a non-transitory medium), and provides a program interface (instruction execution environment) to the target code 200 (which may include an application program, an operating system, and a hypervisor), which is the same as the application programming interface of the hardware architecture modeled by the simulator program 210. Therefore, the program instructions of the target code 200 (including the first type and second type transaction start instructions described above) can be executed within the instruction execution environment using the simulator program 210, so that the host computer 230, which does not actually have the hardware features of the device 2 discussed above, can simulate these features.
[0054] In this application, the term "configured to ..." is used to mean that the elements of a device have a configuration that can implement the defined operation. In this context, "configuration" means the arrangement or manner of interconnection of hardware or software. For example, a 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 imply that the device elements need to be changed in any way in order to provide the defined operation.
[0055] Although illustrative embodiments of the present invention have been described in detail herein with reference to the accompanying drawings, it will be understood that the invention is not limited to these precise embodiments and that various changes and modifications may be effected therein by those skilled in the art without departing from the scope and spirit of the invention as defined by the appended claims.
Claims
1. A device for data processing, comprising: an instruction decoder for decoding instructions; processing circuitry for performing data processing in response to the instruction being decoded by the instruction decoder; transactional memory support circuitry for supporting execution of transactions within a data thread processed by the processing circuitry, the transactional memory support circuitry including address tracking circuitry to track addresses accessed by instructions within the transaction; for a first type transaction begun with a first type transaction start instruction, the instruction decoder is configured to control the processing circuitry to prevent commit of results of speculatively executed instructions following the first type transaction start instruction until a transaction end instruction is reached, wherein the transactional memory support circuitry is configured to trigger an abort of the transaction upon detecting a conflict between an address of a memory access from another thread and an address tracked by the address tracking circuitry; and for a second type transaction initiated using a second type transaction start instruction, the instruction decoder is configured to control the processing circuitry to respond to the execution of a read operation within the transaction by marking an address of the read operation as being traceable by the address tracking circuitry, and to respond to the execution of a write operation within the transaction by omitting marking an address of the write operation as being traceable by the address tracking circuitry, wherein, for the second type of transaction, the transactional memory support circuitry is configured to trigger an abort of the second type of transaction upon detecting a conflict between an address of a read operation performed within the second type of transaction and an address of a write operation from another thread, and For the second type of transaction, the instruction decoder is configured to control the processing circuitry to omit restoration of architectural state in response to abort of the second type of transaction, wherein restoring the omitted architectural state includes architectural state modified during the transaction.
2. The device according to claim 1, wherein: for the first type of transaction, the transactional memory support circuitry being configured to trigger a capture of an architectural state to be restored upon aborting the transaction; and Wherein, for the second type of transaction, the transactional memory support circuit system is configured to omit capturing of the architectural state.
3. The device according to claim 2, wherein: For the first type of transaction, following the transaction end instruction the instruction decoder is configured to control the processing circuitry to discard the captured architectural state or to allow the captured architectural state to be overwritten.
4. The device according to claim 1, wherein: The transactional memory support circuitry is configured to trigger abort of the second type of transaction in response to at least one other event.
5. The device according to claim 1, wherein: For the second type of transaction, the processing circuitry is configured to perform at least one of the following operations: Committing the results of the intervening instructions of the transaction in response to the abort of the second type of transaction; or Results of the instructions within the second-type transaction are committed without waiting for the transaction end instruction.
6. The device according to claim 1, wherein: For the second type of transaction, the instruction decoder controls the processing circuitry to suspend processing of instructions in response to an instruction of a predetermined type until a notification is received that the abort has been triggered.
7. The device according to claim 6, wherein: The instruction of the predetermined type specifies a register storing an address indication representing an address of the memory access from the other thread that triggered the abort.
8. The device according to claim 1, wherein: In response to an abort of the second type of transaction being triggered, the processing circuitry is configured to store an abort cause indication indicating whether the abort was triggered by a conflict.
9. The device according to claim 8, wherein: For the second type of transaction, the instruction decoder controls the processing circuitry to suspend processing of instructions in response to an instruction of a predetermined type until receiving a notification that the abort has been triggered; and The instruction of the predetermined type specifies a register storing an address indication representing an address of the memory access from another thread that triggered the abort.
10. The device according to claim 9, wherein: The abort cause indication is stored in the same register as the address indication.
11. The device according to claim 9, wherein: The abort cause indication is stored in a general register different from the address indication.
12. The device according to any one of claims 8 to 11, comprising a control register to store at least one condition status indication, the condition status indication representing an attribute of a previous processing result; wherein: In response to a conditional instruction, the instruction decoder is configured to control the processing circuitry to perform a conditional operation that depends on whether the at least one condition status indication stored in the control register satisfies a test condition; and The abort cause indication includes at least one of the at least one conditional status indication.
13. A data processing method, comprising: Decoding the instruction using an instruction decoder; performing data processing with processing circuitry of a device in response to decoded instructions, the device comprising transactional memory support circuitry to support execution of transactions within a data thread processed by the processing circuitry, the transactional memory support circuitry comprising address tracking circuitry to track addresses accessed by instructions within the transaction, wherein, for a first type of transaction begun with a first type of transaction begin instruction, the instruction decoder is configured to control the processing circuitry to prevent commit of results of speculatively executed instructions following the first type of transaction begin instruction until a transaction end instruction is reached, wherein the transactional memory support circuitry is configured to trigger an abort of the transaction in response to detecting a conflict between an address of a memory access from another thread and an address tracked by the address tracking circuitry; and In response to a second type transaction started using a second type transaction start instruction, controlling the processing circuitry by the instruction decoder to respond to the execution of a read operation within the transaction by marking the address of the read operation as being traceable by the address tracking circuitry, and to respond to the execution of a write operation within the transaction by omitting marking the address of the write operation as being traceable by the address tracking circuitry, wherein, for the second type of transaction, the transactional memory support circuitry is configured to trigger an abort of the second type of transaction upon detecting a conflict between an address of a read operation performed within the second type of transaction and an address of a write operation from another thread, and For the second type of transaction, the instruction decoder is configured to control the processing circuitry to omit restoration of architectural state in response to abort of the second type of transaction, wherein restoring the omitted architectural state includes architectural state modified during the transaction.
14. A computer program product comprising a computer program for controlling a host data processing device, the computer program for providing an instruction execution environment for the execution of instructions, the computer program comprising: Instruction decoding program logic for decoding instructions of the target code to control the host data processing device to perform data processing; transactional memory support program logic for supporting execution of transactions within a data processing thread, the transactional memory support program logic comprising address tracking program logic to track addresses accessed by instructions within the transaction, wherein, for a first type of transaction begun with a first type of transaction begin instruction, results of speculatively executed instructions following the first type of transaction begin instruction are prevented from committing until a transaction end instruction is reached, and the transactional memory support program logic is configured to trigger an abort of the transaction in response to detecting a conflict between an address of a memory access from another thread and an address tracked by the address tracking program logic; and In response to a second type transaction started using a second type transaction start instruction, the instruction decode program logic is configured to respond to execution of a read operation within the transaction by marking an address of the read operation as being trackable by the address tracking program logic, and to respond to execution of a write operation within the transaction by omitting marking an address of the write operation as being trackable by the address tracking program logic, wherein, for the second type of transaction, the transactional memory support program logic is configured to trigger an abort of the second type of transaction upon detecting a conflict between an address of a read operation performed within the second type of transaction and an address of a write operation from another thread, and For the second type of transaction, the instruction decode program logic is configured to control the processing circuitry to omit restoration of architectural state in response to abort of the second type of transaction, wherein restoring the omitted architectural state includes architectural state modified during the transaction.
15. A storage medium for data processing, the storage medium storing the computer program according to claim 14.
