Search

CN-122023106-A - Method, apparatus, device, readable storage medium and program product for implementing out-of-order access view counter

CN122023106ACN 122023106 ACN122023106 ACN 122023106ACN-122023106-A

Abstract

The application relates to a method, a device, equipment, a readable storage medium and a program product for realizing an unordered access view counter. The method comprises the steps that under the condition that an unordered access view UAV with a counter needs to be accessed, a thread sends an access request aiming at the UAV counter to a load storage unit, the load storage unit inquires a resource descriptor corresponding to the UAV according to the access request aiming at the UAV counter, the load storage unit obtains a target value of an address information indication position through atomic operation and feeds the target value back to the thread, and the thread determines an offset address according to the target value and executes reading and writing operation on a UAV cache according to the offset address. Therefore, the resource descriptor can be used for storing the address information of the UAV counter, the counter is updated through atomic operation, a special counter hardware component is not required to be designed, the hardware is changed little, any number of counters can be realized, the expansibility is strong, and the method is simpler and more flexible.

Inventors

  • ZHANG HUAISHENG
  • CHEN XIANGXIANG
  • LI LEI
  • LI QIANG

Assignees

  • 格兰菲智能科技股份有限公司

Dates

Publication Date
20260512
Application Date
20260104

Claims (11)

  1. 1. A method for implementing an out-of-order access view counter, the method comprising: In the event that an unordered access view UAV with a counter needs to be accessed, the thread sends an access request to the UAV counter to the load store unit; The loading storage unit inquires a resource descriptor corresponding to the UAV according to the access request aiming at the UAV counter, and address information of the UAV counter is stored in the resource descriptor; The loading storage unit obtains a target value of the address information indication position through atomic operation, and feeds back the target value to the thread; and the thread determines an offset address according to the target value, and performs read-write operation on the UAV cache according to the offset address.
  2. 2. The method of claim 1, wherein the thread sending an access request for a UAV counter to a load store unit comprises: the thread sends an access request for the UAV counter to the load storage unit through an atomic operation instruction, wherein the atomic operation instruction comprises a counter identifier, and the counter identifier is used for indicating whether the atomic operation is for the UAV counter.
  3. 3. The method of claim 2, wherein the atomic operation instruction further comprises an atomic operation of: Adding an operation to the UAV counter to indicate allocation of a unit space, and/or, And performing a decrementing operation on the UAV counter for indicating that one unit space is released.
  4. 4. The method of claim 1, wherein the resource descriptor for the UAV further comprises at least one of a base address, a range, a data type, and a structural unit of the UAV.
  5. 5. The method of any of claims 1-4, wherein before the thread sends an access request to the UAV counter to the load store unit, the method further comprises: creating at least one native buffer by driving, the native buffer for recording individual UAV counters of the current task, each UAV counter counting using units of a first preset length; The method comprises the steps of allocating a unit with a first preset length from a cache space of a UAV counter to record address information of the UAV counter by driving, wherein the address information of the UAV counter is obtained by determining according to a starting address of a primary buffer, a number of the UAV counter and the first preset length; And allocating a unit with a second preset length from the resource descriptors corresponding to the UAVs to record the address information of the UAV counter by driving.
  6. 6. The method of claim 5, wherein after the load store unit obtains the target value for the address information indication location via an atomic operation, the method further comprises: The loading storage unit updates the numerical value of the UAV counter through an atomic operation, and fills the updated numerical value into the position indicated by the address information in the original buffer.
  7. 7. The method of claim 6, wherein the loading the memory unit to update the value of the UAV counter through an atomic operation comprises: the load store unit performs an operation on the UAV counter based on the target value to obtain an updated value, or And the loading storage unit performs one subtracting operation on the UAV counter on the basis of the target value to obtain an updated value.
  8. 8. An apparatus for implementing an unordered access view counter, the apparatus comprising: the sending module is used for sending an access request for the UAV counter to the loading storage unit through a thread under the condition that the UAV with the unordered access view of the counter needs to be accessed; The inquiring module is used for inquiring a resource descriptor corresponding to the UAV according to the access request aiming at the UAV counter through the loading and storing unit, and address information of the UAV counter is stored in the resource descriptor; The acquisition module is used for acquiring a target value of the address information indication position through the atomic operation executed by the loading and storing unit and feeding back the target value to the thread; and the reading module is used for determining an offset address according to the target value through a thread and executing reading and writing operations on the UAV cache according to the offset address.
  9. 9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
  10. 10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
  11. 11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.

Description

Method, apparatus, device, readable storage medium and program product for implementing out-of-order access view counter Technical Field The present application relates to the field of image processing technology, and in particular, to a method, an apparatus, a computer device, a computer readable storage medium, and a computer program product for implementing a random access view counter. Background Graphics processor (Graphics Processing Unit, GPU) is a special purpose chip that performs graphics, image processing on a computer, workstation, gaming machine, mobile terminal, etc. The basic Unit of Execution computation in the GPU is a thread, and since many threads exist at the same time, the threads can be executed in parallel by an Execution Unit (EU) in the GPU. These threads are able to access the cache space simultaneously, and these accesses are out of order, so such cache space accessed is also referred to as an out-of-order access view (Unordered ACCESS VIEW, UAV). In the related art, in order to prevent the overlapping of read and write data when the threads access the same UAV buffer, UAV counters are introduced in some drawing calculation engines. Each thread needs to assign a number from the counter, and then use the number to calculate the UAV address and then perform read-write processing. However, the above scheme is limited by hardware logic, the number of proprietary counters is limited, and the flexibility is low. Disclosure of Invention In view of the foregoing, it is desirable to provide a method, apparatus, computer device, computer readable storage medium, and computer program product for implementing a random access view counter that can implement any number of counter functions without designing proprietary counter hardware components. In a first aspect, the present application provides a method for implementing an unordered access view counter, the method comprising: In the event that an unordered access view UAV with a counter needs to be accessed, the thread sends an access request to the UAV counter to the load store unit; The loading storage unit inquires a resource descriptor corresponding to the UAV according to the access request aiming at the UAV counter, and address information of the UAV counter is stored in the resource descriptor; The loading storage unit obtains a target value of the address information indication position through atomic operation, and feeds back the target value to the thread; and the thread determines an offset address according to the target value, and performs read-write operation on the UAV cache according to the offset address. In one embodiment, the thread sends an access request for a UAV counter to a load store unit, comprising: the thread sends an access request for the UAV counter to the load storage unit through an atomic operation instruction, wherein the atomic operation instruction comprises a counter identifier, and the counter identifier is used for indicating whether the atomic operation is for the UAV counter. In one embodiment, the atomic operation instruction further includes an atomic operation of: Adding an operation to the UAV counter to indicate allocation of a unit space, and/or, And performing a decrementing operation on the UAV counter for indicating that one unit space is released. In one embodiment, the resource descriptor corresponding to the UAV further comprises at least one item of information of a base address, a range, a data type and a structural unit of the UAV. In one embodiment, before the thread sends an access request to the UAV counter to the load store unit, the method further comprises: creating at least one native buffer by driving, the native buffer for recording individual UAV counters of the current task, each UAV counter counting using units of a first preset length; The method comprises the steps of allocating a unit with a first preset length from a cache space of a UAV counter to record address information of the UAV counter by driving, wherein the address information of the UAV counter is obtained by determining according to a starting address of a primary buffer, a number of the UAV counter and the first preset length; And allocating a unit with a second preset length from the resource descriptors corresponding to the UAVs to record the address information of the UAV counter by driving. In one embodiment, after the load store unit obtains the target value of the address information indication location through an atomic operation, the method further comprises: The loading storage unit updates the numerical value of the UAV counter through an atomic operation, and fills the updated numerical value into the position indicated by the address information in the original buffer. In one embodiment, the load store unit updates the value of the UAV counter by an atomic operation, comprising: the load store unit performs an operation on the UAV counter based on the target value to obtain an updated value, or