Atomic operation execution method and device, equipment, storage medium and program product
By supporting the execution method of vector atomic operations and reading the payload from the load memory unit with extended size, the problem of low hardware resource utilization in graphics processors is solved, and efficient processing of vector atomic operations and optimization of hardware resources are achieved.
Patent Information
- Application Number
- CN202511438229.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-10-09
AI Technical Summary
In existing technologies, the load memory unit in graphics processors only supports scalar atomic operations, which results in low hardware resource utilization, poor adaptability, and cumbersome operation.
By providing a method for executing atomic operations, supporting vector atomic operations, the payload is read from the register in the load memory unit using an extended size, and the extended size is determined according to the data type and quantity to realize vector atomic operations. The bit field of the request size of scalar atomic operations is reused to improve the utilization of hardware resources.
It improves the utilization of path bandwidth and hardware resources, optimizes the processing of vector atomic operations, and reduces the waste of path bandwidth for operations without return values.
Smart Images

Figure CN120909801A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to, but is not limited to, the technical field of computer, and particularly relates to an execution method and device of atomic operation, equipment, storage medium and program product. BACKGROUND
[0002] Generally, graphics tasks are processed by programmable pipelines in a graphics processing unit (GPU). A load store unit (LSU) is an access port of memory, and in addition to providing load and store functions, control information parsing operations of global atomic operations are also one of the important functions of this module to support memory order.
[0003] However, the related memory access method only supports scalar atomic operations, and there is a problem of low hardware resource utilization. SUMMARY
[0004] Therefore, the embodiments of the present disclosure provide at least an execution method, device, equipment, storage medium and program product of atomic operation.
[0005] The technical solutions of the embodiments of the present disclosure are implemented as follows: In one aspect, the embodiments of the present disclosure provide an execution method of atomic operation, which comprises: in response to a first execution request of a vector atomic operation, reading a first payload from one or more first registers in a load store unit based on an extension size in the first execution request; the extension size is determined based on the number of vectors and the data type; and performing the vector atomic operation according to the first payload.
[0006] In another aspect, the embodiments of the present disclosure provide an execution device of atomic operation, which comprises: a reading module, configured to read a first payload from one or more first registers in a load store unit based on an extension size in a first execution request of a vector atomic operation in response to the first execution request; the extension size is determined based on the number of vectors and the data type; and a processing module, configured to perform the vector atomic operation according to the first payload.
[0007] In still another aspect, the embodiments of the present disclosure provide a computer device, which comprises a memory and a processor, and the memory stores a computer program capable of running on the processor, and the processor implements part or all of the steps in the above method when executing the program.
[0008] In yet another aspect, the embodiments of the present disclosure provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement part or all of the steps in the above method.
[0009] In yet another aspect, an embodiment of the present disclosure provides a computer program, including computer readable code, when the computer readable code is executed in a computer device, a processor in the computer device performs part or all steps of the above method.
[0010] In yet another aspect, an embodiment of the present disclosure provides a computer program product, the computer program product includes a non-transitory computer readable storage medium storing a computer program, when the computer program is read and executed by a computer, part or all steps of the above method are implemented.
[0011] In an embodiment of the present disclosure, since the data is stored in the registers in the load store unit in sequence when stored, the number of vectors can reflect the size of the data, and therefore, according to the extension size determined by the number of vectors and the data type, the data (first payload) required when the vector atomic operation is executed can be read from one or more first registers in the load store unit, so that the vector atomic operation is executed according to the first payload, and the processing of the vector atomic operation is implemented. The execution request of the vector atomic operation can be adapted on the instruction set of the scalar atomic operation, and the extension size of the vector atomic operation can reuse the bit field of the request size of the scalar atomic operation, so that the processing of the vector atomic operation is implemented on the basis of the existing hardware resources, and the usage rate of the channel bandwidth and the hardware resources is improved.
[0012] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, but not limiting the technical solutions of the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0013] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the technical solutions of the present disclosure.
[0014] Figure 1 Implementation flowchart of the execution method of the atomic operation provided by an embodiment of the present disclosure Figure 1 ; Figure 2 Implementation flowchart of the execution method of the atomic operation provided by an embodiment of the present disclosure Figure 2 ; Figure 3 Implementation flowchart of the execution method of the atomic operation provided by an embodiment of the present disclosure Figure 3 ; Figure 4 Implementation flowchart of the execution method of the atomic operation provided by an embodiment of the present disclosure Figure 4 ; Figure 5An implementation flowchart of a no-return-value scalar atomic operation in an atomic operation execution method provided by an embodiment of the present disclosure is shown in FIG. 1. Figure 6 An implementation flowchart of a vector atomic operation in an atomic operation execution method provided by an embodiment of the present disclosure is shown in FIG. 2. Figure 7 An implementation diagram of aligning a virtual address in an atomic operation execution method provided by an embodiment of the present disclosure is shown in FIG. 3. Figure 8 A pipeline diagram of an atomic operation execution method provided by an embodiment of the present disclosure is shown in FIG. 4. Figure 9 A hardware structure diagram of an atomic operation execution method provided by an embodiment of the present disclosure is shown in FIG. 5. Figure 10 A component structure diagram of an atomic operation execution apparatus provided by an embodiment of the present disclosure is shown in FIG. 6. Figure 11 A hardware entity diagram of a computer device provided by an embodiment of the present disclosure is shown in FIG. 7. DETAILED DESCRIPTION
[0015] In order to make the objects, technical solutions and advantages of the present disclosure clearer, the technical solutions of the present disclosure are further described in detail below in combination with the drawings and embodiments, and the described embodiments should not be regarded as limiting the present disclosure, and all other embodiments obtained by those skilled in the art without making creative efforts belong to the protection scope of the present disclosure.
[0016] In the following description, "some embodiments" are described, which describe a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.
[0017] The terms "first / second / third" involved only distinguish similar objects, and do not represent a specific order of the objects, and it can be understood that "first / second / third" can interchange specific order or sequence as allowed, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present disclosure belongs. The terms used herein are only for the purpose of describing the present disclosure, and are not intended to limit the present disclosure.
[0019] In order to better understand the atomic operation execution method provided by the embodiments of the present disclosure, the schemes in the related art will be described first.
[0020] GPU has played an increasingly important role in graphics and general computing scenarios due to its high parallel processing characteristics. The special processing of graphics in the GPU is usually placed in the fixed pipeline, and the general part is placed in the programmable pipeline processing. LSU plays a crucial role in the programmable pipeline as an access to the memory, providing a load function or a store function. Among them, the load function refers to loading the data stored in the memory to the storage unit (such as a register) inside the programmable pipeline through the cache. The storage function refers to writing the data processed inside the programmable pipeline to the memory through the cache.
[0021] In addition, in order to support memory order, the control information parsing operation of global atomic is also one of the important functions of LSU. Generally, the atomic operation needs to carry the operand participating in the atomic operation (optional), the operation type and the return operand (optional).
[0022] Combined with application requirements, atomic operations are subdivided into return scalar atomic operations (scalar atomic operations with instruction configured return operand), non-return scalar atomic operations (scalar atomic operations with instruction default return operand), return vector atomic operations (contiguous address vector atomic operations with instruction configured return operand), and non-return vector atomic operations (contiguous address vector atomic operations with instruction default return operand).
[0023] Here, the main behaviors in the related art are arranged in Table 1 below: Table 1
[0024] In order to simplify the hardware logic overhead, it is necessary to ensure that the data type of the operand meets the alignment requirement. In the related art, the user perceives the alignment of the data type through the compiled software, and then issues an execution request for the aligned atomic operation.
[0025] At least the following technical problems exist in the related art: 1. Only scalar atomic operations are supported, which has the problem of poor adaptability; 2. The return path of the non-return scalar atomic operation has the problem of waste of hardware resources; 3. The user needs to ensure address alignment through compiled software, which has the problem of complicated operation.
[0026] Therefore, an embodiment of the present disclosure provides an atomic operation execution method, which can be executed by a processor of a computer device. The computer device can be a server, a notebook computer, a tablet computer, a desktop computer, a smart television, a set-top box, a mobile device (such as a mobile phone, a portable video player, a personal digital assistant, a dedicated messaging device, a portable game device), and the like. For example, Figure 1As shown, the method comprises at least one of the following steps 101 to step 102: Step 101, in response to a first execution request of a vector atomic operation, reading a first payload from one or more first registers in a load store unit based on an extension size in the first execution request; the extension size is determined based on a number of vectors and a data type.
[0027] The first execution request refers to an execution request / command of a vector atomic operation that is currently being processed. The extension size is used to represent the number of vectors (i.e. data size) and the data type corresponding to the vector atomic operation, and the main purpose is to read the payload required by the vector atomic operation during execution. In some embodiments, the extension size can be the product of the number of vectors and the size of the data type. The data type is used to represent whether there is a return value for the corresponding atomic operation.
[0028] The load store unit is used to read data in the memory and transmit it to the specified register for use by the processing module; it is also used to write the executed data in the register to the memory to achieve long-term storage of data. The first register refers to one or more registers that store the data required by the vector atomic operation during execution. The first payload refers to the data required by the vector atomic operation during execution. In some embodiments, the first payload can include but is not limited to: the operand corresponding to the vector atomic operation, and the control data and verification data required to execute the vector atomic operation, etc.
[0029] In some embodiments, if a single register cannot meet the data storage requirements of the vector atomic operation, the data needs to be stored continuously in multiple registers when storing the payload; in this way, the payload of the vector atomic operation can be read from the continuous multiple registers according to the extension size of the vector atomic operation.
[0030] In some embodiments, the first execution request can carry the starting address corresponding to the vector atomic operation, so that the first register storing the data corresponding to the vector atomic operation can be located according to the starting address, and then the payload (first payload) of the vector atomic operation can be read from the continuous multiple registers according to the extension size.
[0031] In some embodiments, the first execution request can carry the address identifier corresponding to the vector atomic operation, so that the first register storing the data corresponding to the vector atomic operation can be located according to the address identifier, and then the payload (first payload) of the vector atomic operation can be read from the continuous multiple registers according to the extension size.
[0032] Step 102, executing the vector atomic operation according to the first payload.
[0033] In some embodiments, the vector atomic operation can be executed on the memory according to the first payload.
[0034] In the embodiments of the present disclosure, since the data is stored in the registers in the load-store unit in sequence when stored, the number of vectors can represent the size of the data, and therefore, according to the extended size determined by the number of vectors and the data type, the data (the first payload) required by the vector atomic operation when executed can be read from one or more first registers in the load-store unit, so that the vector atomic operation is executed according to the first payload, and the processing of the vector atomic operation is realized. The execution request of the vector atomic operation can be adapted on the instruction set of the scalar atomic operation, and the extended size of the vector atomic operation can reuse the bit field of the request size of the scalar atomic operation, so that the processing of the vector atomic operation is realized on the basis of the existing hardware resources, and the usage rate of the channel bandwidth and the hardware resources is improved.
[0035] In some embodiments, before the step of “reading the first payload from one or more first registers in the load-store unit according to the extended size in the first execution request” in step 101 is executed, the atomic operation execution method provided by the embodiments of the present disclosure further includes the following steps 103 to 104: Step 103: determining the range of the memory address to be updated by the vector atomic operation based on the start address and the extended size in the first execution request.
[0036] In some embodiments, the specific implementation of step 103 can include: taking the range of addresses from the start address to the address obtained by adding the start address and the extended size as the range of the memory address to be updated by the atomic operation.
[0037] Step 104: in the case where the range of the memory address is a non-aligned virtual address, performing alignment processing on the range of the memory address.
[0038] In some embodiments, the specific implementation of “performing alignment processing on the range of the memory address” can include: determining whether the range of the memory address is a processable address according to the virtual address corresponding to the range of the memory address and the data type of the vector atomic operation; and in the case where the range of the memory address is a processable address, performing alignment processing on the range of the memory address according to the data type of the atomic operation.
[0039] In a feasible implementation, the calculation formula of the processable address can be: virtual address % data type of atomic operation == 0. If the range of the memory address corresponding to the atomic operation satisfies the above formula, the range of the memory address is left shifted according to the data type of the atomic operation to obtain an aligned virtual address.
[0040] Based on the above technical solution, before reading the payload, the range of the memory address to be updated by the vector atomic operation is determined based on the start address and the extension size in the first execution request, and in the case that the range of the memory address is a non-aligned virtual address, the range of the memory address is aligned, so that the effectiveness of subsequent data reading can be improved, and normal execution of the atomic operation is ensured.
[0041] In some embodiments, "reading a first payload from one or more first registers in a load store unit based on an extension size in the first execution request" in step 101 can be implemented by the following steps 1011 to step 1014: Step 1011, determining the register resource allocated to the vector atomic operation.
[0042] In some embodiments, the register resource allocated to the vector atomic operation can be determined based on the resource requirement or operation complexity of the vector atomic operation. The resource requirement can be pre-set, and can be set according to the historical execution of the vector atomic operation.
[0043] Step 1012, determining the boundary of the write-back register corresponding to the vector atomic operation based on the operand corresponding to the vector atomic operation and the extension size; the boundary of the write-back register at least includes an upper boundary and a lower boundary.
[0044] In a feasible implementation, the specific implementation of "determining the upper boundary of the write-back register corresponding to the vector atomic operation based on the operand corresponding to the vector atomic operation and the extension size" can include: determining the upper boundary of the write-back register according to the operand corresponding to the vector atomic operation; adding the operand corresponding to the vector atomic operation and the extension size to obtain the lower boundary of the write-back register.
[0045] Step 1013, in the case that it is determined that there is no write-back out-of-bound of the vector atomic operation based on the boundary of the write-back register and the register resource, reading the first payload from one or more first registers in the load store unit based on the extension size.
[0046] In a feasible implementation, the specific implementation of "determining whether there is write-back out-of-bound of the vector atomic operation based on the boundary of the write-back register and the register resource" can include: in the case that the register resource does not match the boundary of the write-back register, determining that there is write-back out-of-bound of the atomic operation; in the case that the register resource matches the boundary of the write-back register, determining that there is no write-back out-of-bound of the atomic operation.
[0047] The register resource and the write-back register are not matched in boundary, which means that at least one of the upper and lower boundaries of the register resource and the write-back register is not matched. The register resource and the write-back register are matched in boundary, which means that both the upper and lower boundaries of the register resource and the write-back register are matched.
[0048] For example, if the current program has 32 accessible registers, the starting address of the write-back register is 30, and the extension size is 4 registers, the required write-back register range is 30, 31, 32, and 33 in turn. At this time, the accessible range is exceeded, so it is considered that there is a write-back out-of-bound situation. If the extension size is 2 registers, the required write-back register range is 30 and 31, and at this time, there is no write-back out-of-bound situation.
[0049] In some embodiments, when the range of the memory address is not a processable address, and / or the vector atomic operation has a write-back out-of-bound situation, it is determined that the first execution request has an exception, and / or a prompt information representing the exception of the first execution request is sent.
[0050] In some embodiments, the first execution request has an exception at least includes one of the following: the range of the memory address is not within the processable address range, the vector atomic operation has a write-back out-of-bound, the range of the memory address is not within the processable address range and the vector atomic operation has a write-back out-of-bound.
[0051] When implementing, if the atomic operation has a write-back out-of-bound situation, it is determined that the execution request of the atomic operation is an exception request, at this time, the execution request of the atomic operation is directly discarded, the configuration corresponding to the execution request is released, and an exception is reported for the user to query through software.
[0052] Based on the above technical solution, in the case that the vector atomic operation is determined not to have a write-back out-of-bound based on the boundary of the write-back register and the register resource, the first payload is read, which can further improve the effectiveness of data reading.
[0053] In some embodiments, the execution method of the atomic operation provided by the embodiments of the present disclosure further includes steps 105 to 106: Step 105, determining first return control information based on a first bit field in the first execution request, the first bit field being used to represent whether the destination operand corresponding to the vector atomic operation is empty.
[0054] The first bit field is empty, indicating that the destination operand corresponding to the vector atomic operation is empty, which means that no return value is needed. The first bit field is not empty, indicating that the destination operand corresponding to the vector atomic operation is not empty, which means that a return value is needed. The first return control information is used to represent whether to write the operand corresponding to the vector atomic operation back to the programmable pipeline in the load storage unit.
[0055] The destination operand is where the result of the atomic operation is to be stored. In most cases, the destination operand is a memory address or a register where the result of the operation is to be written. The source operand is the input data that the atomic operation needs to read. The source operand can be a fixed value, or a value in a memory address or a register.
[0056] In some embodiments, the first return control information can be added on the link between the load store unit and the atomic operation execution unit based on the first bit field in the first execution request; in this way, the atomic operation execution unit can determine whether the vector atomic operation needs to return a value according to the first return control information.
[0057] In some embodiments, the target bit in the bypass information passed by the load store unit to the atomic operation execution unit can be used as the first return control information. The target bit can be a bit that is not currently used, or a bit that is currently used but has a value that is not used. For example, if the cache control bit is included in the bypass information, the cache control bit contains two bits, and 00, 01, and 10 have been used, then 11 can be used as the first return control information. When the cache control bit is 11, it indicates that the operand corresponding to the vector atomic operation is written back to the programmable pipeline in the load store unit, and when the cache control bit is other bit values, it indicates that the operand corresponding to the vector atomic operation is not written back to the programmable pipeline in the load store unit.
[0058] In some embodiments, the first return control information can be passed to the atomic operation execution unit independently of the bypass information, or as part of the bypass information.
[0059] Step 106: When the first return control information indicates that the operand corresponding to the vector atomic operation is to be written back to the programmable pipeline in the load store unit, the operand corresponding to the vector atomic operation is written back to the programmable pipeline after the vector atomic operation is executed.
[0060] In some embodiments, when the first return control information indicates that the operand corresponding to the vector atomic operation is to be written back to the programmable pipeline in the load store unit, the operand is transmitted to the specified position of the programmable pipeline in the load store unit through the cache.
[0061] In some embodiments, when the first return control information indicates that the operand corresponding to the vector atomic operation is not to be written back to the programmable pipeline in the load store unit, the register resource in the programmable pipeline is released when the request is transmitted to the downstream module.
[0062] According to the first bit field indicating whether the destination operand corresponding to the vector atomic operation is empty, the first return control information that can be transmitted to the atomic operation execution unit is determined, so that the atomic operation execution unit can learn whether to write back the operand corresponding to the vector atomic operation to the programmable pipeline after execution according to the first return control information, the operand is returned on demand, and the waste of return path bandwidth of the atomic operation without return value is reduced.
[0063] In some embodiments, the step 105 can be implemented by the following steps 1051 to 1052: In the case that the bypass information in the control signal transmitted by the load storage unit to each level of cache has a bit in the first state value, the bit in the first state value is defined as the first return control information; the first state value indicates that the corresponding bit is not defined.
[0064] The bit in the first state value refers to an undefined bit. In some embodiments, the state value of the bit is 0 (first state value), indicating that the bit is not defined; the state value of the bit is 1, indicating that the bit is defined.
[0065] The bypass information is used to indicate whether to bypass the normal cache operation process and directly access data to the memory or other storage levels. In some embodiments, the bypass information can include but is not limited to an identifier indicating that the current operation needs to bypass the cache, an address mapping relationship, a request type, a cache hit situation, etc.
[0066] In the case that the bypass information in the control signal transmitted by the load storage unit to each level of cache has a bit in the first state value, the bit in the first state value is defined as the first return control information; the first state value indicates that the corresponding bit is not defined.
[0067] In some embodiments, the specific implementation of the step 1052 can include: in the case that the first bit field is a first identifier value, the first return control information is configured as a third identifier value; the first identifier value indicates that the destination operand corresponding to the vector atomic operation is empty, and the third identifier value indicates that the operand corresponding to the vector atomic operation is not written back to the programmable pipeline; in the case that the first bit field is a second identifier value, the first return control information is configured as a fourth identifier value; the second identifier value indicates that the destination operand corresponding to the vector atomic operation is not empty, and the fourth identifier value indicates that the operand corresponding to the vector atomic operation is written back to the programmable pipeline.
[0068] For example, the first identifier value can be null, and the second identifier value can be 1; the third identifier value can be 0, and the fourth identifier value can be 1. In this case, in the case that the first bit field is null, the first return control information is configured as 0; in the case that the first bit field is 1, the first return control information is configured as 1.
[0069] According to the technical solution, the undefined bit in the bypass information transmitted by the load store unit to the cache at each level is used as the first return control information, so that the utilization of the bandwidth of the path between the load store unit and the cache at each level can be improved.
[0070] The embodiment of the present disclosure provides an execution method of an atomic operation, which can be executed by a processor of a computer device. As shown in the method comprises at least one of the following steps 201 to step 202: Figure 2 Step 201, in response to a second execution request of an atomic operation, determining the type of the atomic operation and second return control information based on a bit field in the second execution request.
[0071] The type of the atomic operation at least includes a vector atomic operation and a scalar atomic operation; and the second return control information represents whether to write back an operand corresponding to the atomic operation to a programmable pipeline in the load store unit.
[0072] The atomic operation is divided into a vector atomic operation and a scalar atomic operation according to whether the operand has a direction; the vector atomic operation includes a returnless vector atomic operation and a return vector atomic operation, and the scalar atomic operation includes a returnless scalar atomic operation and a return scalar atomic operation. The atomic operation is divided into a return atomic operation and a returnless atomic operation according to whether a return value is needed; the return atomic operation includes a return scalar atomic operation and a return vector atomic operation, and the returnless atomic operation includes a returnless scalar atomic operation and a returnless vector atomic operation.
[0073] The second execution request refers to an execution request / command of the atomic operation currently being processed. Characters in the execution request can be defined as different bit fields according to business needs. For example, the execution request can include but is not limited to a bit field representing a memory size to be accessed, a bit field for storing an operand, a bit field representing the type of the atomic operation, and the like.
[0074] For partitioned return atomic operations and returnless atomic operations, the embodiment of the present disclosure adds return control information in the entire link from the LSU to the execution of the atomic operation, so as to return the source operand on demand after the execution of the atomic operation is completed, and reduce the waste of the path bandwidth.
[0075] In some embodiments, the type of the atomic operation can be determined according to a bit field representing the type of the atomic operation in the first execution request, or according to a bit field representing a memory size to be accessed in the first execution request.
[0076] In some embodiments, the determination of the return control information can be: according to the bit field in the first execution request indicating whether a return value is needed, adding the return control information.
[0077] Specifically, when the bit field indicating whether a return value is needed is empty, the return control information that the operand corresponding to the atomic operation does not need to be written back to the programmable pipeline is added; when the bit field indicating whether a return value is needed is not empty, the return control information that the operand corresponding to the atomic operation needs to be written back to the programmable pipeline is added.
[0078] It should be noted that, in order to be compatible with scalar atomic operations and vector atomic operations, the embodiments of the present disclosure multiplex the bit field of Load and Store indicating the size of the memory to be accessed (request size). Specifically, when sending an execution request of a scalar atomic operation, the specific value of the bit field of the request size is an unexpanded size determined based on the number of bits of the scalar; when sending an execution request of a vector atomic operation, the specific value of the bit field of the request size is an expanded size determined based on the number of vectors and the data type. In this way, adaptation is made from the instruction set to be compatible with the execution requests of different atomic operations, and the type of atomic operation and the request size corresponding to different types of atomic operations are embodied through the bit field of the request size.
[0079] Step 202, executing the atomic operation based on the type of the atomic operation and the second return control information.
[0080] In some embodiments, the specific implementation of step 202 can include: in the case where the second return control information represents that the operand corresponding to the atomic operation does not need to be written back to the programmable pipeline, executing the atomic operation on the memory based on the type of the atomic operation; in the case where the return control information represents that the operand corresponding to the atomic operation needs to be written back to the programmable pipeline, executing the atomic operation on the memory based on the type of the atomic operation and writing the operand corresponding to the atomic operation back to the programmable pipeline.
[0081] In the embodiments of the present disclosure, in order to enable the execution request of the atomic operation to be compatible with different types of atomic operations, adaptation is made from the instruction set, and the bit field of the request size is multiplexed so that the bit field of the request size has different values under different types of atomic operations; in this way, not only the type of the atomic operation can be embodied, but also the request size corresponding to different types of atomic operations can be embodied. In order to partition atomic operations with returns and atomic operations without returns, return control information is added in the entire link from the LSU to the execution of the atomic operation, so that the source operand is returned on demand after the execution of the atomic operation, so as to optimize the return path of the atomic operation without return value and reduce the waste of path bandwidth. In this way, not only scalar atomic operations can be supported, but also vector atomic operations can be supported, and the adaptability is high; and by optimizing the return path of the atomic operation without return value, the waste of path bandwidth and hardware bandwidth can be reduced.
[0082] The embodiment of the present disclosure provides an execution method of an atomic operation, which can be executed by a processor of a computer device. As shown in the figure, the method comprises at least one of the following steps 301 to step 303: Figure 3 Step 301, in response to a second execution request of an atomic operation, determining a type of the atomic operation based on a second bit field in the second execution request. Step 301, in response to a second execution request of an atomic operation, determining a type of the atomic operation based on a second bit field in the second execution request.
[0083] The second bit field represents a bit number of an operand corresponding to the atomic operation. The type of the atomic operation comprises a vector atomic operation and a scalar atomic operation. The second return control information represents whether to write back the operand corresponding to the atomic operation to a programmable pipeline in a load storage unit.
[0084] The second bit field refers to a bit field of a request size. The second bit field stores an unexpanded size under a scalar atomic operation, and the unexpanded size is a bit number of a scalar. The second bit field stores an expanded size under a vector atomic operation, and the expanded size is determined based on a number of vectors and a data type. Specifically, the expanded size is a product of the number of vectors and a size of the data type.
[0085] The expanded size is greater than the unexpanded size, and the number of bits required for storage of the expanded size is also greater than the number of bits required for storage of the unexpanded size. Therefore, the type of the atomic operation can be distinguished by a specific value in the bit field of the request size and / or the number of bits used.
[0086] In some embodiments, the specific implementation of "determining the type of the atomic operation based on the second bit field in the second execution request" in step 301 can comprise: determining whether the second bit field is an expanded size based on a first sub-bit field and a second sub-bit field in the second bit field; the first sub-bit field represents a data type size, and the second sub-bit field represents a data bit width to be updated by the atomic operation; in the case that the second bit field is the expanded size, determining that the type of the atomic operation is a vector atomic operation; the expanded size is determined based on a number of vectors and a data type; in the case that the second bit field is an unexpanded size, determining that the type of the atomic operation is a scalar atomic operation; the unexpanded size is determined based on a bit number of a scalar.
[0087] In some embodiments, the specific implementation of "determining whether the second bit field is an expanded size based on the first sub-bit field and the second sub-bit field in the second bit field" can comprise: determining a multiple relationship between the first sub-bit field and the second sub-bit field; in the case that the multiple relationship is 2 0 , determining that the second bit field is an unexpanded size; in the case that the multiple relationship is 2 nIn the case that the third bit field is null, it is determined that the second bit field is of an extended size; n is a positive integer.
[0088] In step 302, the second return control information is determined based on a third bit field in the second execution request.
[0089] The third bit field indicates whether the destination operand corresponding to the atomic operation is empty.
[0090] The third bit field is empty, indicating that no return value is needed; the third bit field is not empty, indicating that a return value is needed.
[0091] In some embodiments, the implementation of step 302 can include: in the case that there are undefined bits in the bypass information in the control signal transmitted by the load-store unit to the cache, the undefined bits are defined as the second return control information; and the identification value of the second return control information is configured based on the third bit field in the second execution request.
[0092] The bypass information in the control signal transmitted by the load-store unit to the cache can indicate the type of the atomic operation.
[0093] In some embodiments, the implementation of "configuring the identification value of the second return control information based on the third bit field in the second execution request" can include: in the case that the third bit field is a first identification value, the second return control information is configured to be a third identification value; the first identification value indicates that the destination operand corresponding to the atomic operation is empty, and the third identification value indicates that the operand corresponding to the atomic operation is not written back to the programmable pipeline; in the case that the third bit field is a second identification value, the second return control information is configured to be a fourth identification value; the second identification value indicates that the destination operand corresponding to the atomic operation is not empty, and the fourth identification value indicates that the operand corresponding to the atomic operation is written back to the programmable pipeline.
[0094] For example, the first identification value can be null, and the second identification value can be 1; the third identification value can be 0, and the fourth identification value can be 1. In this case, in the case that the third bit field is null, the second return control information is configured to be 0; and in the case that the third bit field is 1, the second return control information is configured to be 1.
[0095] In some embodiments, the return control information is configured together with the type of the atomic operation, which can improve the utilization of resources and reduce the waste of the bandwidth of the path between the LSU and the atomic operation execution module; if resource waste is not considered, the return control information can be configured separately.
[0096] In step 303, the atomic operation is executed based on the type of the atomic operation and the second return control information.
[0097] In some embodiments, when the type of the atomic operation is a scalar atomic operation, step 303 can be implemented by steps 3031 to 3032 as follows: Step 3031, in the case where the type of the atomic operation is the scalar atomic operation, reading a second payload from one or more second registers in the load store unit based on an unexpanded size in the second execution request; the unexpanded size is determined based on the number of bits of the scalar.
[0098] Here, the second payload refers to the payload of the scalar atomic operation. The second register refers to a register storing data required by the scalar atomic operation when executed.
[0099] Step 3032, executing the scalar atomic operation on the memory according to the second payload and the second return control information.
[0100] Here, the second payload includes the operand corresponding to the scalar atomic operation, and other information required to execute the scalar atomic operation, etc.
[0101] In some embodiments, the specific implementation of step 3032 can include: in the case where the second return control information is a third identification value, executing the scalar atomic operation on the memory according to the second payload, and releasing resources in the programmable pipeline; in the case where the second return control information is a fourth identification value, executing the scalar atomic operation on the memory according to the second payload, and writing back the operand corresponding to the scalar atomic operation to the programmable pipeline.
[0102] For example, if an execution request of a scalar atomic operation is received, first, the LSU configures the return control information according to the bit field (third bit field) in the execution request indicating whether a return value is required; then, the LSU reads the payload from the load store unit according to the unexpanded size in the execution request, and transmits the scalar atomic operation, the return control information and the payload to the memory through the caches; next, the scalar atomic operation is performed on the memory according to the payload, and if the return control information is 0, the register resources in the programmable pipeline are released when the request is transmitted to the downstream module; if the return control information is 1, the operand is transmitted to the specified position of the programmable pipeline in the load store unit through the caches after the scalar atomic operation is executed.
[0103] It should be noted that the scalar atomic operation, the main improvement of the embodiments of the present disclosure is that the return on demand is realized according to the return control information, the power consumption of the return path of the scalar atomic operation without return is avoided, and the bandwidth of the return path is released.
[0104] In some embodiments, when the atomic operation is a vector atomic operation, step 303 can be implemented by the following steps 3033 to 3034: Step 3033: When the atomic operation is a vector atomic operation, read the third payload from the load storage unit based on the extended size in the second execution request; the extended size is determined based on the number and data type of the vector.
[0105] Here, step 3033 corresponds to the aforementioned step 101, and the specific implementation of the aforementioned step 101 can be referred to during implementation.
[0106] The third payload refers to the payload of the vector atomic operation. The difference between the third payload and the first payload is that the third payload is the payload of the vector atomic operation corresponding to the second execution request, while the first payload is the payload of the vector atomic operation corresponding to the first execution request.
[0107] To ensure compatibility with vector atomic operations, in addition to adapting the instruction set, in vector scenarios, the payload also needs to be read from the register of the loading memory unit according to the extended size.
[0108] Step 3034: Perform the atomic operation in memory based on the third payload and the second return control information.
[0109] Here, step 3034 corresponds to the aforementioned step 102, and the specific implementation of the aforementioned step 102 can be referred to during implementation.
[0110] For example, if an execution request for a vector atomic operation is received, firstly, the LSU configures return control information based on the bit field (third bit field) in the execution request indicating whether a return value is required; then, the LSU reads the payload from the load storage unit according to the extended size in the execution request, and transfers the scalar atomic operation, return control information, and payload to memory (video memory) through various levels of cache; next, the vector atomic operation is performed in memory based on the payload. If the return control information is 0, the register resources in the programmable pipeline are released when the request is passed to the downstream module; if the return control information is 1, after the vector atomic operation is completed, the operands are transferred through the various levels of cache to the specified location in the programmable pipeline of the load transfer unit.
[0111] It should be noted that vector atomic operations have a higher risk of going out of bounds because they operate on multiple data units; while scalar atomic operations have an extremely low probability of going out of bounds because they operate on a single object and have a clearly defined address range. Therefore, the embodiments of this disclosure describe in detail the out-of-bounds situation of vector atomic operations. In implementation, the out-of-bounds situation of scalar atomic operations can also be analyzed and handled by referring to the out-of-bounds operation of vector atomic operations.
[0112] The embodiment of the present disclosure provides an execution method of an atomic operation, as shown in the following formula (1): Figure 4 The method comprises at least one of the following steps 401 to step 403: Step 401, in the case that there are a plurality of first execution requests of the vector atomic operation with continuous addresses, splicing a plurality of the first execution requests based on the starting addresses and the extension sizes of the plurality of the first execution requests to obtain a third execution request.
[0113] The second execution request refers to an execution request of the vector atomic operation with continuous addresses.
[0114] Step 402, determining the extension size of the third execution request based on the number and the data type of the vector corresponding to the third execution request.
[0115] Step 403, executing the corresponding vector atomic operation based on the extension size of the third execution request.
[0116] It should be noted that the LSU in the related art does not contain a request merging function, and the embodiment of the present disclosure multiplexes the external interface of the LSU, adds an adjacent address merging unit between the LSU and the cache at each level, and takes the product of the number of elements in the vector and the size of the data type of the vector as a new request size, so that the growth of the external interface resources is not caused.
[0117] In the embodiment of the present disclosure, by adding return control information, on-demand return can be realized; when there is no return, the register resources corresponding to the atomic operation are directly released, which can reduce the power consumption of the return path, and reduce the waste of register resources and the bandwidth of the return path. In order to be compatible with the vector atomic operation, the instruction set and the hardware logic are adapted, the reading path of the effective load of the storage request is multiplexed, the adjacent address merging unit is configured, the same downstream as the scalar atomic operation is used to process the vector atomic operation, and the utilization rate of the hardware resources such as the interface and the path can be improved. When a non-aligned virtual address is received, the non-aligned virtual address is aligned downward, which can reduce the situation that the module executing the atomic operation downstream is deadlocked due to receiving non-conventional input.
[0118] The following describes the application of the execution method of the atomic operation provided by the embodiment of the present disclosure in an actual scene.
[0119] The execution method of the atomic operation provided by the embodiment of the present disclosure also aims to solve at least one of the following three problems: 1, optimizing the return path bandwidth waste situation of the variable atomic operation without return value; 2, supporting the vector atomic operation; 3, aligning the non-aligned virtual address downward, and actively reporting an exception when the non-aligned problem occurs.
[0120] The specific scheme of the execution method of the atomic operation provided by the embodiment of the present disclosure is as follows: To address the issue of wasted return path bandwidth in optimizing atomic operations on variables with no return value, this embodiment of the disclosure solves this problem by adding return control information, as shown in Table 2 below: Table 2
[0121] Example settings for return control information of the return path are shown in Table 3 below: Table 3
[0122] like Figure 5 As shown, related technologies, after a scalar atomic operation without a return value is completed, return the original value stored at the specified address before the atomic operation to the programmable pipeline, but do not write it back, resulting in wasted bandwidth in the return path. However, this embodiment adds return control information so that after a scalar atomic operation without a return value is completed, it does not return the original value and directly releases the register resources corresponding to the scalar atomic operation without a return value. This reduces power consumption in the return path and minimizes waste of register resources and return path bandwidth.
[0123] To ensure compatibility with global vector atomic operations, examples of the modified scheme are shown in Table 4 below: Table 4
[0124] like Figure 6 As shown, the specific scheme for vector atomic operations may include: After receiving an execution request for a vector atomic operation, the LSU reads the payload (operand) from the load memory unit according to the extended size in the execution request, and sends the atomic operation, extended size, and payload to the adjacent address merging unit; the adjacent address merging unit determines whether there are other requests adjacent to the memory address of the current vector atomic operation. If there are other requests adjacent to the memory address of the current vector atomic operation, the requests are merged, and the vector atomic operation corresponding to the merged request is processed through various levels of cache and memory; if there are no other requests adjacent to the memory address of the current vector atomic operation, the current vector atomic operation is processed through various levels of cache and memory; after the vector atomic operation is completed, the original value is returned as needed.
[0125] To provide users with a user-friendly global atomic operation experience and prevent downstream atomic operation execution modules from crashing due to receiving non-standard inputs, in this embodiment of the present disclosure, when the LSU receives an atomic operation using an unaligned memory virtual address, it aligns the memory virtual address downwards and reports the exception, making it convenient for users to query through software.
[0126] like Figure 7As shown in the formula: (virtual address % data type of atomic operation) == 0, it is judged whether the memory address corresponding to the atomic operation is a processable address, if the memory address corresponding to the atomic operation is a processable address, the memory address corresponding to the atomic operation is left shifted according to the data type of the atomic operation, to obtain an aligned virtual address; if the memory address corresponding to the atomic operation is not a processable address, an exception is reported.
[0127] Embodiments of the present disclosure take a five-stage pipeline as an example to describe the execution method of the atomic operation provided by the embodiments of the present disclosure. As shown in the formula: (virtual address % data type of atomic operation) == 0, it is judged whether the memory address corresponding to the atomic operation is a processable address, if the memory address corresponding to the atomic operation is a processable address, the memory address corresponding to the atomic operation is left shifted according to the data type of the atomic operation, to obtain an aligned virtual address; if the memory address corresponding to the atomic operation is not a processable address, an exception is reported. Figure 8 As shown in the formula: (virtual address % data type of atomic operation) == 0, it is judged whether the memory address corresponding to the atomic operation is a processable address, if the memory address corresponding to the atomic operation is a processable address, the memory address corresponding to the atomic operation is left shifted according to the data type of the atomic operation, to obtain an aligned virtual address; if the memory address corresponding to the atomic operation is not a processable address, an exception is reported.
[0128] As shown in the formula: (virtual address % data type of atomic operation) == 0, it is judged whether the memory address corresponding to the atomic operation is a processable address, if the memory address corresponding to the atomic operation is a processable address, the memory address corresponding to the atomic operation is left shifted according to the data type of the atomic operation, to obtain an aligned virtual address; if the memory address corresponding to the atomic operation is not a processable address, an exception is reported. Figure 9 As shown in the formula: (virtual address % data type of atomic operation) == 0, it is judged whether the memory address corresponding to the atomic operation is a processable address, if the memory address corresponding to the atomic operation is a processable address, the memory address corresponding to the atomic operation is left shifted according to the data type of the atomic operation, to obtain an aligned virtual address; if the memory address corresponding to the atomic operation is not a processable address, an exception is reported.
[0129] It should be noted that the optimization of the non-return atomic operation mainly reflects in the return control information, and the LSU only configures the return control information to be sent to the downstream according to whether the destination operand is empty. The change of the vector atomic operation will affect the data amount of the input and output through the return control information; the address alignment and the exception reporting need to be performed after the address calculation. The embodiments of the present disclosure need to cooperate with the adjacent address merging unit, and higher processing performance can be achieved.
[0130] This disclosure, based on global atomic operation scenarios, addresses technical problems in related technologies by adding return control information, optimizing paths without return values, and address preprocessing. Specifically: 1. Adjustment of control information for global atomic operations with no return value: Reduce power consumption of the return path and release bandwidth of the return path at the cost of adding 1 bit of control information; 2. Supports global vector atomic operations: Reuses loading and storing request control information, improving the utilization rate of interface control information; 3. Virtual address alignment preprocessing, and timely reporting of exceptions when misalignment occurs, making it easy for users to query through the software, effectively preventing downstream modules performing atomic operations from crashing due to receiving non-standard inputs.
[0131] Exemplary technical points of the embodiments of this disclosure are shown in Table 5 below: Table 5
[0132] The technical effects achievable by the embodiments of this disclosure include, but are not limited to, those shown in Table 6 below: Table 6
[0133] Based on the foregoing embodiments, this disclosure provides an execution device for atomic operations. The device includes the included units and the modules included in each unit, which can be implemented by a processor in a computer device; of course, it can also be implemented by specific logic circuits. In the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0134] Figure 10 This is a schematic diagram of the composition structure of an atomic operation execution device provided in an embodiment of the present disclosure, as shown below. Figure 10 As shown, the atomic operation execution device 1000 includes: a reading module 1010 and a processing module 1020, wherein: The read module 1010 is configured to, in response to a first execution request of a vector atomic operation, read a first payload from one or more first registers in a load storage unit based on an extended size in the first execution request; the extended size is determined based on the number and data type of the vector. The processing module 1020 is configured to perform the vector atomic operation according to the first payload.
[0135] In some embodiments, the processing module 1020 is further configured to determine first return control information based on a first bit field in the first execution request, the first bit field being used to represent whether a destination operand corresponding to the vector atomic operation is empty, and write back the operand corresponding to the vector atomic operation to the programmable pipeline in the load-store unit when the execution of the vector atomic operation is completed, in a case where the first return control information represents that the operand corresponding to the vector atomic operation is to be written back to the programmable pipeline.
[0136] In some embodiments, the processing module 1020 is further configured to define a bit in first state value as the first return control information in a case where the bit in first state value exists in bypass information in a control signal transmitted by the load-store unit to each level of cache, the first state value representing that the corresponding bit is not defined, and determine an identification value of the first return control information based on the first bit field.
[0137] In some embodiments, the processing module 1020 is further configured to configure the first return control information as a third identification value in a case where the first bit field is a first identification value, the first identification value representing that the destination operand corresponding to the vector atomic operation is empty, and the third identification value representing that the operand corresponding to the vector atomic operation is not to be written back to the programmable pipeline, and configure the first return control information as a fourth identification value in a case where the first bit field is a second identification value, the second identification value representing that the destination operand corresponding to the vector atomic operation is not empty, and the fourth identification value representing that the operand corresponding to the vector atomic operation is to be written back to the programmable pipeline.
[0138] In some embodiments, the processing module 1020 is further configured to determine a type of the atomic operation and second return control information based on a bit field in a second execution request of the atomic operation in response to the second execution request, the type of the atomic operation at least including a vector atomic operation and a scalar atomic operation, the second return control information representing whether an operand corresponding to the atomic operation is to be written back to the programmable pipeline, and perform the atomic operation based on the type of the atomic operation and the second return control information.
[0139] In some embodiments, the processing module 1020 is further configured to determine the type of the atomic operation based on a second bit field in the second execution request, the second bit field representing a bit number of the operand corresponding to the atomic operation, and determine the second return control information based on a third bit field in the second execution request, the third bit field representing whether a destination operand corresponding to the atomic operation is empty.
[0140] In some embodiments, the processing module 1020 is further configured to: in a case where it is determined, based on the first sub-bit field and the second sub-bit field in the second bit field, that the second bit field is of an extended size, determine that the type of the atomic operation is the vector atomic operation; the first sub-bit field indicates a data type size, and the second sub-bit field indicates a data bit width to be updated by the atomic operation; in a case where it is determined, based on the first sub-bit field and the second sub-bit field in the second bit field, that the second bit field is of an unextended size, determine that the type of the atomic operation is the scalar atomic operation; the unextended size is determined based on a number of bits of a scalar.
[0141] In some embodiments, the processing module 1020 is further configured to: in a case where a multiple relationship between the first sub-bit field and the second sub-bit field is 20, the second bit field is of an unextended size; in a case where the multiple relationship between the first sub-bit field and the second sub-bit field is 2n, the second bit field is of an extended size; n is a positive integer.
[0142] In some embodiments, the reading module 1010 is further configured to: in a case where the type of the atomic operation is the scalar atomic operation, read a second payload from one or more second registers in the load-store unit based on an unextended size in the second execution request; the unextended size is determined based on a number of bits of a scalar; and the processing module 1020 is further configured to: execute the scalar atomic operation on the memory according to the second payload and the second return control information.
[0143] In some embodiments, the processing module 1020 is further configured to: in a case where the second return control information is a third identification value, execute the scalar atomic operation on the memory according to the second payload and release resources in the programmable pipeline; and in a case where the second return control information is a fourth identification value, execute the scalar atomic operation on the memory according to the second payload and write back an operand corresponding to the scalar atomic operation to the programmable pipeline.
[0144] In some embodiments, the processing module 1020 is further configured to: determine, based on a start address and an extended size in the first execution request, a range of memory addresses to be updated by the vector atomic operation; and in a case where the range of memory addresses is a non-aligned virtual address, perform alignment processing on the range of memory addresses.
[0145] In some embodiments, the processing module 1020 is further configured to: determine whether the range of memory addresses is a processable address according to the virtual address corresponding to the range of memory addresses and the data type of the vector atomic operation; and perform alignment processing on the range of memory addresses according to the data type of the vector atomic operation, in a case where the range of memory addresses is a processable address.
[0146] In some embodiments, the reading module 1010 is further configured to: determine a register resource allocated to the vector atomic operation; determine a boundary of a write-back register corresponding to the vector atomic operation based on the operand corresponding to the vector atomic operation and the extension size; the boundary of the write-back register at least includes an upper boundary and a lower boundary; and read a first payload from one or more first registers in the load-store unit based on the extension size, in a case where it is determined that there is no write-back out-of-bound of the vector atomic operation based on the boundary of the write-back register and the register resource.
[0147] In some embodiments, the processing module 1020 is further configured to: determine that the first execution request is abnormal, and / or send prompt information representing the abnormality of the first execution request, in a case where the range of memory addresses is not a processable address, and / or the vector atomic operation has write-back out-of-bound.
[0148] In some embodiments, the processing module 1020 is further configured to: splice a plurality of first execution requests of the vector atomic operation in a case where there are a plurality of first execution requests of the vector atomic operation with contiguous addresses, to obtain a third execution request, based on the starting addresses and extension sizes of the plurality of first execution requests; determine the extension size of the third execution request based on the number and data type of the vector corresponding to the third execution request; and perform the corresponding vector atomic operation based on the extension size of the third execution request.
[0149] The above device embodiments are similar to the descriptions of the above method embodiments, and have similar beneficial effects to the method embodiments. In some embodiments, the device provided by the embodiments of the present disclosure has the functions or includes the modules for performing the methods described in the above method embodiments. For technical details not disclosed in the device embodiments of the present disclosure, please refer to the description of the method embodiments of the present disclosure.
[0150] It should be noted that, in the embodiments of the present disclosure, if the execution method of the atomic operation is implemented in the form of a software function module and is sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present disclosure can be embodied in the form of a software product in essence or the part that contributes to the related art, which is stored in a storage medium, includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present disclosure. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ReadOnly Memory, ROM), a magnetic disk or an optical disk, and various media that can store program codes. Thus, the embodiments of the present disclosure are not limited to any specific hardware, software or firmware, or any combination of hardware, software, firmware.
[0151] The embodiments of the present disclosure provide a computer device, including a memory and a processor, the memory stores a computer program capable of running on the processor, and the processor implements part or all of the steps of the above method when executing the program.
[0152] The embodiments of the present disclosure provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement part or all of the steps of the above method. The computer readable storage medium can be transitory or non-transitory.
[0153] The embodiments of the present disclosure provide a computer program, which includes computer readable code, and when the computer readable code runs in a computer device, a processor in the computer device executes part or all of the steps of the above method.
[0154] The embodiments of the present disclosure provide a computer program product, which includes a non-transitory computer readable storage medium storing a computer program, and when the computer program is read and executed by a computer, part or all of the steps of the above method are implemented. The computer program product can be specifically implemented by hardware, software or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium, and in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (Software Development Kit, SDK) and the like.
[0155] It should be noted that the above description of the various embodiments tends to emphasize differences between the various embodiments, and the same or similar elements can be mutually referred to. The above description of the device, storage medium, computer program and computer program product embodiments is similar to the description of the method embodiments, and has similar beneficial effects as the method embodiments. For technical details of the device, storage medium, computer program and computer program product embodiments of the present disclosure, please refer to the description of the method embodiments of the present disclosure.
[0156] It should be noted that, Figure 11 A hardware entity diagram of a computer device in the embodiments of the present disclosure is shown in FIG. 11, which includes a processor 1101, a communication interface 1102 and a memory 1103, wherein: Figure 11 The processor 1101 generally controls the overall operation of the computer device 1100. The processor 1101 generally controls the overall operation of the computer device 1100.
[0157] The communication interface 1102 can enable the computer device to communicate with other terminals or servers through a network.
[0158] The memory 1103 is configured to store instructions and applications executable by the processor 1101, and can also cache data to be processed by the processor 1101 and modules in the computer device 1100 (for example, image data, audio data, voice communication data and video communication data) that have been processed or have been processed, which can be implemented by FLASH or Random Access Memory (RAM). The processor 1101, the communication interface 1102 and the memory 1103 can transmit data through the bus 1104.
[0159] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in one or more embodiments of the present disclosure. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present disclosure, the size of the sequence number of each step / process does not mean the execution order, and the execution order of each step / process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure. The above sequence number of the embodiments of the present disclosure is only for description, and does not represent the advantages and disadvantages of the embodiments.
[0160] It should be noted that, in the present document, the terms "comprising", "containing" or any other similar term are intended to encompass non-exclusive inclusion, such that processes, methods, articles, or apparatuses that comprise a list of elements are not limited to those elements, but can also include other elements not expressly listed, or also include elements inherent in such processes, methods, articles, or apparatuses. Without further limitation, an element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0161] In several embodiments provided by the present disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the various components shown or discussed can be through some interface, indirect coupling or communication connection between devices or units, which can be electrical, mechanical or other forms.
[0162] The units described above as separate components can or can not be physically separate, and the components shown as units can or can not be physical units; they can be located in one place or distributed on multiple network units; and part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0163] In addition, each functional unit in each embodiment of the present disclosure can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be realized in the form of hardware or in the form of hardware plus software functional unit.
[0164] Those of ordinary skill in the art can understand that all or part of the steps of the above method embodiments can be completed by program instruction related hardware, and the aforementioned program can be stored in a computer readable storage medium, and the program executes the steps of the above method embodiments when executed; and the aforementioned storage medium includes: mobile storage device, read only memory (Read Only Memory, ROM), magnetic disc or optical disc, and various storage medium that can store program codes.
[0165] Alternatively, the above-mentioned integrated units of the present disclosure, if implemented in the form of software function modules and sold or used as independent products, can also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present disclosure can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the methods described in the various embodiments of the present disclosure. The aforementioned storage medium includes: mobile storage devices, ROM, magnetic disks or optical disks, and various media that can store program codes.
[0166] The above is only an embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present disclosure, which should be covered within the protection scope of the present disclosure.
Claims
1. A method of performing an atomic operation, the method comprising: The execution method of the atomic operation comprises: in response to a first execution request of a vector atomic operation, reading a first payload from one or more first registers in a load-store unit based on an extension size in the first execution request; the extension size is determined based on a number of vectors and a data type; performing the vector atomic operation according to the first payload.
2. The method according to claim 1, wherein, The execution method of the atomic operation further comprises: determining first return control information based on a first bit field in the first execution request; the first bit field is used to represent whether a destination operand corresponding to the vector atomic operation is empty; in a case where the first return control information represents that the operand corresponding to the vector atomic operation is to be written back to a programmable pipeline in the load-store unit, writing back the operand corresponding to the vector atomic operation to the programmable pipeline when the vector atomic operation is executed.
3. The method of claim 2, wherein the atomic operation is a load-exclusive (lx) operation. The determining of the first return control information based on the first bit field in the first execution request comprises: in a case where a bit in bypass information in a control signal transmitted by the load-store unit to each level of cache is in a first state value, defining the bit in the first state value as the first return control information; the first state value represents that the corresponding bit is not defined; determining an identification value of the first return control information based on the first bit field.
4. The method of claim 3, wherein the atomic operation is a load-exclusive (lx) operation. The determining of the identification value of the first return control information based on the first bit field comprises: in a case where the first bit field is a first identification value, configuring the first return control information as a third identification value; the first identification value represents that the destination operand corresponding to the vector atomic operation is empty, and the third identification value represents that the operand corresponding to the vector atomic operation is not written back to the programmable pipeline; in a case where the first bit field is a second identification value, configuring the first return control information as a fourth identification value; the second identification value represents that the destination operand corresponding to the vector atomic operation is not empty, and the fourth identification value represents that the operand corresponding to the vector atomic operation is written back to the programmable pipeline.
5. The method according to any one of claims 1 to 4, wherein, The execution method of the atomic operation further comprises: in response to a second execution request of an atomic operation, determining a type of the atomic operation and second return control information based on a bit field in the second execution request; the type of the atomic operation at least comprises a vector atomic operation and a scalar atomic operation; the second return control information represents whether an operand corresponding to the atomic operation is to be written back to a programmable pipeline in a load-store unit; performing the atomic operation based on the type of the atomic operation and the second return control information.
6. The method of claim 5, wherein the atomic operation is a load-exclusive (lx) operation. The determining of the type of the atomic operation and the second return control information based on the bit field in the second execution request comprises: determining the type of the atomic operation based on a second bit field in the second execution request; the second bit field represents a bit number of the operand corresponding to the atomic operation; determining the second return control information based on a third bit field in the second execution request; the third bit field represents whether a destination operand corresponding to the atomic operation is empty.
7. The method of claim 6, wherein the atomic operation is a load-exclusive (lx) operation. The type of the atomic operation is determined based on a second bit field in the second execution request, including: In a case where the second bit field is determined to be an extended size based on a first sub-bit field and a second sub-bit field in the second bit field, the type of the atomic operation is determined to be the vector atomic operation; the first sub-bit field represents a data type size, and the second sub-bit field represents a data bit width to be updated by the atomic operation; In a case where the second bit field is determined to be an unextended size based on a first sub-bit field and a second sub-bit field in the second bit field, the type of the atomic operation is determined to be the scalar atomic operation; the unextended size is determined based on a number of bits of a scalar.
8. The atomic operation execution method of claim 7, wherein: In the case where a multiple relationship between the first sub-bit field and the second sub-bit field is 2 0 , the second bit field is an unexpanded size; A multiple relationship between the first sub-bit field and the second sub-bit field is 2 n In the case where the multiple relationship between the first sub-bit field and the second sub-bit field is 2, the second bit field is of an extended size; n is a positive integer.
9. The method of claim 5, wherein the atomic operation is a load-exclusive (lx) operation. The atomic operation is executed based on the type of the atomic operation and the second return control information, including: In a case where the type of the atomic operation is the scalar atomic operation, a second payload is read from one or more second registers in the load storage unit based on an unextended size in the second execution request; the unextended size is determined based on a number of bits of a scalar; The scalar atomic operation is executed on the memory according to the second payload and the second return control information.
10. The method of claim 9, wherein the atomic operation is a load-exclusive (lx) operation. The scalar atomic operation is executed on the memory according to the second payload and the second return control information, including: In a case where the second return control information is a third identification value, the scalar atomic operation is executed on the memory according to the second payload, and resources in the programmable pipeline are released; In a case where the second return control information is a fourth identification value, the scalar atomic operation is executed on the memory according to the second payload, and an operand corresponding to the scalar atomic operation is written back to the programmable pipeline.
11. The method according to any one of claims 1 to 4, wherein, Before the first payload is read from one or more first registers in the load storage unit based on the extended size in the first execution request, the atomic operation execution method further includes: A range of memory addresses to be updated by the vector atomic operation is determined based on a start address and the extended size in the first execution request; In a case where the range of memory addresses is a non-aligned virtual address, the range of memory addresses is aligned.
12. The method of claim 11, wherein the atomic operation is a load-exclusive (lx) operation. The range of memory addresses is aligned, including: Whether the range of memory addresses is a processable address is determined according to a virtual address corresponding to the range of memory addresses and a data type of the vector atomic operation; In a case where the range of memory addresses is a processable address, the range of memory addresses is aligned according to the data type of the vector atomic operation.
13. The method according to any one of claims 1 to 4, wherein The first payload is read from one or more first registers in the load storage unit based on the extended size in the first execution request, including: A register resource allocated to the vector atomic operation is determined; determine a boundary of a write back register corresponding to the vector atomic operation based on the operand corresponding to the vector atomic operation and the extension size; the boundary of the write back register comprises at least an upper boundary and a lower boundary; in a case that it is determined that there is no write back out of bound of the vector atomic operation based on the boundary of the write back register and the register resource, read a first payload from one or more first registers in the load store unit based on the extension size.
14. The method of claim 12, wherein the atomic operation is a load-exclusive (lx) operation. The method for performing the atomic operation further comprises: in a case that the range of the memory address is not a processable address and / or the vector atomic operation has write back out of bound, determine that the first execution request has an exception, and / or send prompt information representing the exception of the first execution request.
15. The method according to any one of claims 1 to 4, wherein the atomic operation is an atomic compare-and-swap operation. The method for performing the atomic operation further comprises: in a case that there are multiple first execution requests of the vector atomic operation with contiguous addresses, splice the multiple first execution requests based on the start addresses and the extension sizes of the multiple first execution requests to obtain a third execution request; determine the extension size of the third execution request based on the number of vectors and the data type corresponding to the third execution request; perform the corresponding vector atomic operation based on the extension size of the third execution request.
16. An execution device for atomic operations, characterized in that, The apparatus for performing the atomic operation comprises: a reading module configured to read a first payload from one or more first registers in a load store unit based on an extension size in a first execution request of a vector atomic operation; the extension size is determined based on a number of vectors and a data type; a processing module configured to perform the vector atomic operation based on the first payload. 17.A computer device, comprising a memory and a processor, wherein the memory stores a computer program capable of running on the processor, and the computer device is characterized in that, The processor performs the program to implement the steps of the method in any one of claims 1 to 15.
18. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 15.
19. A computer program product, characterised in that, The computer program product comprises a non-transitory computer readable storage medium storing a computer program, and the computer program is read and executed by a computer to implement the steps of the method in any one of claims 1 to 15.
Citation Information
Patent Citations
Instructions and logic to provide atomic range operations
CN107430508A
Method for performing atomic operations and related products thereof
CN117908959A
System, method and device for executing atomic operation
CN118377741A
Instruction processing device and method, processor, electronic equipment and storage medium
CN118672655A
Data access mode derivation method of computational graph and related product
CN118916081A