Thread bundle execution method and device, computer equipment, readable storage medium and program product

By constructing target thread bundles and establishing mapping relationships, the problem of low execution efficiency of thread bundles in existing technologies is solved, and efficient parallel computing of general-purpose processors in the field of graphics rendering is realized.

CN118916098APending Publication Date: 2024-11-08GLENFLY TECH CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411002315.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

The lack of efficient thread bundle execution methods in existing technologies results in low computational efficiency of general-purpose processors in the field of graphics rendering.

Method used

By receiving tasks to be processed, constructing target thread bundles and allocating target resources, establishing a mapping relationship between thread bundle information and resources, obtaining the target resources corresponding to the information of each thread bundle in parallel execution, executing and saving the output data, and releasing the thread bundles.

Benefits of technology

It improves the computational efficiency of general-purpose processors in the field of graphics rendering, and enables the parallel execution of multiple thread bundles and efficient utilization of resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916098A_ABST
    Figure CN118916098A_ABST
Patent Text Reader

Abstract

The invention relates to a thread bundle execution method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: receiving a to-be-processed task by adopting the method; constructing a target thread bundle based on the to-be-processed task, allocating a target resource to the target thread bundle to obtain thread bundle information, and establishing a mapping relationship between the thread bundle information and the target resource; and obtaining the target resource corresponding to each piece of thread beam information based on each mapping relationship, and executing a target thread beam corresponding to the thread beam information based on the target resource. Through the method, the thread bundle can be efficiently executed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of graphics processor technology, and in particular to a warp execution method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] With the development of graphics processing technology, general-purpose processors are increasingly used in the field of graphics rendering. In order to fully utilize the computing power of general-purpose processors and achieve efficient graphics rendering, the design advantages of Single Instruction Multiple Data (SIMD) are widely adopted.

[0003] At present, in order to fully utilize the design advantages of SIMD, general-purpose processors divide a fixed number of threads into a warp and execute instructions at the granularity of the warp. However, there is a lack of an efficient warp execution method. Summary of the invention

[0004] Based on this, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium and computer program product that can efficiently execute thread warps in response to the above technical problems.

[0005] In a first aspect, the present application provides a warp execution method, comprising:

[0006] Receive pending tasks;

[0007] constructing a target warp based on the task to be processed, allocating target resources to the target warp, obtaining warp information, and establishing a mapping relationship between the warp information and the target resources;

[0008] The target resources corresponding to each of the thread warp information are acquired based on each of the mapping relationships, and the target thread warp corresponding to the thread warp information is executed based on the target resources.

[0009] According to the above-mentioned thread execution method, the target resources include target execution resources and target storage space; the thread bundle information includes a thread bundle identifier and a storage space location of thread bundle output data; the thread bundle identifier is obtained after allocating the target execution resources to the target thread bundle; the storage space location of the thread bundle output data is obtained after allocating the target storage space to the target thread bundle.

[0010] In one embodiment, acquiring the target resources corresponding to each of the thread warp information based on each of the mapping relationships, and executing the target thread warp corresponding to the thread warp information in the target resources includes:

[0011] Executing the target thread bundle through the target execution resource to obtain output data;

[0012] Saving the output data to the target storage space corresponding to the storage space location of the thread warp output data;

[0013] The output data is read from the target storage space, and the target warp is released.

[0014] In one embodiment, the warp information further includes a warp execution end flag; after the output data is saved to a target storage space corresponding to a storage space location of the warp output data, the method further includes:

[0015] If the output data has been stored, setting the thread warp execution end flag to be valid;

[0016] The step of reading the output data from the target storage space and releasing the target thread warp comprises:

[0017] If the warp execution end flag is set to be valid, the output data is read from the target storage space, and the target warp is released.

[0018] In one embodiment, the step of reading the output data from the target storage space and releasing the target thread warp according to the thread warp execution end flag includes:

[0019] If the thread warp execution end flag is valid, read the output data from the target storage space, and modify the number of threads of the target thread warp;

[0020] If the number of threads of the target warp is a second preset number, the target warp is released.

[0021] In one embodiment, releasing the target warp includes:

[0022] The target storage space and the target execution resource are released and the valid flag of the thread warp is set to invalid.

[0023] In one embodiment, constructing a target warp based on the task to be processed includes:

[0024] Update the number of threads corresponding to the current warp to be constructed according to the task to be processed;

[0025] If the number of threads corresponding to the current warp to be constructed is a first preset number, the warp to be constructed is used as a target warp.

[0026] A thread warp execution device, the device comprising:

[0027] A receiving module, used for receiving tasks to be processed;

[0028] A construction module, configured to construct a target warp based on the task to be processed, allocate target resources to the target warp, obtain warp information, and update the warp information to a warp table;

[0029] The execution module is used to respectively obtain the target resources corresponding to each of the thread warp information in the thread warp table, and execute the target thread warp corresponding to the thread warp information in the target resource.

[0030] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in any one of the above embodiments when executing the computer program.

[0031] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method in any one of the above embodiments.

[0032] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the steps of the method in any one of the above embodiments are implemented.

[0033] The above-mentioned thread warp execution method, apparatus, computer device, computer-readable storage medium and computer program product, after receiving the task to be processed, construct a corresponding target thread warp for the task to be processed, allocate target resources to the target thread warp, obtain thread warp information, and establish a mapping relationship between the thread warp information and the target resources, so that the target resources corresponding to the thread warp information can be obtained respectively, so as to execute multiple target thread warps in parallel based on different target resources, so as to improve execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0035] Figure 1 is a flowchart of a warp execution method in one embodiment;

[0036] Figure 2 A schematic diagram of a thread bundle table in one embodiment;

[0037] Figure 3 is a schematic diagram of an intermediate execution state of a warp table in one embodiment;

[0038] Figure 4 A schematic diagram of the structure and execution of a thread bundle in one embodiment;

[0039] Figure 5 is a flowchart of a method for executing a warp in another embodiment;

[0040] Figure 6 is a structural block diagram of a thread warp execution device in one embodiment;

[0041] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0043] In an exemplary embodiment, Figure 1 , provides a warp execution method, which is described by taking the method applied to a general processor as an example, and includes the following steps S102 to S106. Among them:

[0044] Step S102, receiving tasks to be processed.

[0045] Among them, the pending tasks refer to tasks that need to be executed by a general-purpose processor, which can be computing tasks, resource management tasks, API calls, graphics rendering, etc., and can be set specifically according to the actual application scenario.

[0046] For example, if the task to be processed is vertex operation, the operation of each vertex is regarded as a thread. When the general processor receives the operation of a vertex, it regards it as a task to be processed. Among them, the vertex is the basic unit of geometric images. In the graphics rendering process, the vertex shader is responsible for geometric transformation and attribute calculation of each vertex. The calculation of each vertex is independent of each other, that is, the processing of one vertex does not depend on the processing of other vertices, so the processing of vertices can be performed in parallel.

[0047] In other embodiments, if the task to be processed is a large task, the task to be processed can be decomposed into smaller subtasks that can be executed in parallel, and each subtask can be regarded as a thread.

[0048] Step S104: construct a target warp based on the task to be processed, allocate target resources to the target warp, obtain warp information, and establish a mapping relationship between the warp information and the target resources.

[0049] The thread warp information corresponds to the target thread warp one by one, and the thread warp information is used to instruct the general-purpose processor to execute a specific target thread warp. For example, the general-purpose processor can obtain the target resource corresponding to the thread warp information and the thread warp corresponding to the thread warp information through the thread warp information, and then execute the thread warp in the target resource.

[0050] Furthermore, the thread warp information may also include multiple identification types, each identification type being used to instruct the general-purpose processor to execute each step in the target thread.

[0051] Among them, the target resources refer to the resources required for the general-purpose processor to execute the target thread bundle, and the target resources include but are not limited to memory, registers, input / output interfaces and bus bandwidth, etc., that is, all resources required for executing the target thread bundle as understood by those skilled in the art. Optionally, after receiving the task to be processed, the general-purpose processor will construct the thread corresponding to the task to be processed and the threads corresponding to other received tasks to be processed into a target thread bundle. In other words, a target thread bundle is obtained by combining multiple tasks to be processed. In this way, constructing multiple threads into thread bundles can more effectively utilize the parallel processing capabilities of the processor.

[0052] When the target thread bundle is built, the target resources are allocated to the target thread bundle, and the general processor executes the target thread bundle based on the target resources. After the target resources are allocated to the target thread bundle, the thread bundle information can be obtained. At this point, the mapping relationship between the thread bundle information and the target resources can be established.

[0053] Optionally, the mapping relationship between the thread bundle information and the target resource can be identified by a thread bundle table, which is used to manage each thread bundle. The thread bundle table records the thread bundle information corresponding to each thread bundle. Exemplarily, each row in the thread bundle table stores a thread bundle information, and each thread bundle information corresponds to a thread bundle.

[0054] Optionally, before constructing the target warp, a warp table may be pre-set. This table includes multiple initial warp information, for example, the initial warp information is 0. Subsequently, after the target resource is allocated to the target warp, the initial warp information may be updated to the actual warp information. This is done to ensure that the execution state and location of each warp in the system can be accurately identified and managed, so as to effectively perform parallel computing or processing.

[0055] Optionally, the target warp can be constructed by controlling the table allocation pointer. For example, after the first target warp is constructed, the table allocation pointer is pointed to the next row to start constructing the next target warp. In this way, even if the target resource allocation is unsuccessful, the receiving of pending tasks will not be stopped, thereby affecting the construction of the next target warp.

[0056] Step S106 , acquiring target resources corresponding to each warp information based on each mapping relationship, and executing the target warp corresponding to the warp information based on the target resources.

[0057] Since the target resource and the target warp correspond to the warp information, the target warp is executed based on the corresponding target resource through the warp information. By establishing a mapping relationship, the warp information, the target resource and the target warp are all one-to-one corresponding, so after obtaining the warp information, the target warp to be executed and the specific location of the target warp to be executed can be obtained.

[0058] Optionally, there are three thread bundles in the current mapping relationship. In combination with the above embodiment, there are three thread bundles in the thread bundle table. The general processor can obtain the target resources corresponding to the thread bundle information based on the thread bundle table, and execute the thread bundle corresponding to the thread bundle information based on the target resources. Since the target resources used by each thread bundle are independent of each other, they can be executed in parallel. Optionally, the execution of the target thread bundle can be controlled by allocating a pointer. For example, there are three thread bundles in the thread bundle table, and the allocation pointer points to the first row in the thread bundle table. The general processor obtains the target resource corresponding to the thread bundle information, and executes the target thread bundle corresponding to the thread bundle information based on the target resource. When the target thread bundle starts to be executed, the allocation pointer points to the next row, and the next target thread bundle starts to be executed. At this time, when the general processor starts to execute the second target thread bundle, it may still be executing the first target thread bundle, that is, the general processor is executing the first target thread bundle and the second target thread bundle at the same time. Since the target resources of the first target thread bundle and the second target thread bundle are different, that is, the first target thread bundle and the second target thread bundle are executed in different target resources. Therefore, even if the first target thread bundle has not ended, it will not affect the start of the second target thread bundle. In this way, the parallelism of executing the target thread warp can be improved.

[0059] In the above embodiment, after constructing the target warp, the warp information corresponding to the target warp is saved in the warp table, so that each target warp can be executed in parallel according to the warp information in the warp table, thereby improving the efficiency of the general processor in executing the target warp.

[0060] In one embodiment, the target resources include target execution resources and target storage space; the thread bundle information includes the thread bundle identifier and the storage space location of the thread bundle output data; the thread bundle identifier is obtained after allocating the target execution resources to the target thread bundle; the target storage space is obtained after allocating the target storage space to the target thread bundle.

[0061] Among them, the target execution resource refers to the data required for storing the target thread bundle during the execution. For example, temporary data, such as intermediate calculation results, local variables, etc., need to be frequently accessed during the execution of the target thread bundle. Therefore, it is necessary to allocate target execution resources to the target thread bundle in order to improve the computing efficiency. After allocating the target execution resource to the target thread bundle, the thread bundle identifier can be obtained. The subsequent general-purpose processor can obtain the corresponding target resource according to the thread bundle identifier during the execution of the target thread bundle. Among them, the storage space refers to the output data generated after the target thread bundle is executed. Similarly, after allocating the target storage space to the target thread bundle, the storage space location of the thread bundle output data can be obtained. After storing the output data of the target thread bundle, the subsequent general-purpose processor can store the output data in the corresponding space according to the storage space.

[0062] In one embodiment, the above-mentioned method of obtaining target resources corresponding to each thread bundle information based on each mapping relationship, and executing the target thread bundle corresponding to the thread bundle information based on the target resource, includes: obtaining the target execution resource according to the thread bundle identifier, and processing the target thread bundle based on the target execution resource to obtain output data; saving the output data to a target storage space corresponding to the storage space location of the thread bundle output data; reading the output data from the target storage space, and releasing the target thread bundle.

[0063] In this embodiment, the life cycle of a general-purpose processor executing a target warp is described. When the general-purpose processor executes multiple warps at the same time, the above steps are also executed at the same time.

[0064] Optionally, when the general processor starts to execute a target thread bundle, it will obtain the execution target execution resource according to the thread bundle identifier, and use the target execution resource to process the target thread bundle to obtain the output data corresponding to the target thread. After obtaining the output data, the output data will be saved in the storage space corresponding to the storage space position of the thread bundle output data. If the subsequent module needs to use the output data, the data is read from the storage space corresponding to the storage space position of the thread bundle output data, and after the data is read, the target thread bundle is released, and the life cycle of the target thread bundle ends.

[0065] In the above embodiment, by matching the thread bundle with a specific execution resource, it can be ensured that each thread bundle can run on the resource that best suits its needs, thereby improving the overall computing efficiency. In addition, the output data is saved in a storage space corresponding to the storage space location of the thread bundle output data, so that the data can be read from the corresponding storage space according to the storage space location of the thread bundle output data. In this way, the data can be read accurately and the output data can be serialized. In this way, there is no need to add an additional unit to record the construction order of the thread bundle in the subsequent reading process, which increases the hardware complexity.

[0066] Furthermore, in one embodiment, after the output data is saved to the target storage space corresponding to the storage space location of the thread bundle output data, it also includes: if the output data has been completely stored in the target storage space, setting the thread bundle execution end flag to valid; reading the output data from the target storage space and releasing the target thread bundle, including: if the thread bundle execution end flag is set to valid, reading the output data from the target storage space and releasing the target thread bundle.

[0067] Optionally, if all output data has been stored in the target storage space, it means that all output data has been prepared, and the output data can be read from the target storage space. Therefore, after all output data has been stored in the target storage space, the warp execution end flag is set to be valid. If the thread number warp information is detected to be valid, the output data is read from the target storage space, and the target storage space is released after the output data is read, and the target warp is released.

[0068] In this way, when the output data is ready, the output data is read and the thread warp execution end flag is set to be valid, so that the data can be read according to the thread warp identifier in the future. In addition, since the thread execution end flag is recorded in the mapping relationship, the state of the target thread warp can also be obtained in real time through the thread warp execution end flag.

[0069] Further, in one embodiment, according to the thread bundle execution end flag, reading the output data from the target storage space and releasing the target thread bundle includes: if the thread bundle execution end flag is valid, reading the output data from the target storage space and modifying the number of threads of the target thread bundle; if the number of threads of the target thread bundle is a second preset number, releasing the target thread bundle;

[0070] When the thread bundle information is valid, the output data is read from the target storage space, and the number of threads of the target thread bundle is modified. For example, when the output data of a vertex is read from the target storage space, the number of threads of the target thread bundle is reduced by 1. When the number of threads of the target thread bundle is reduced to a second preset number, the target thread bundle is released. At this time, it means that the output data of the target thread bundle has been read and the target thread bundle has been executed, so the target thread bundle needs to be released. The second preset number is a pre-set indicator for judging whether the output data has been read. For example, the second preset number can be set to 0.

[0071] In this way, under the premise that the output data has been prepared, the output data is read, and the number of threads is modified according to the read output data, and when the number of threads is equal to the second preset number, the target thread warp is released, and the entire life cycle of the target thread warp is completed.

[0072] Furthermore, in one embodiment, releasing the target warp includes: releasing the target storage space and setting the warp valid flag to invalid.

[0073] When the output data of the target warp has been completely read, it is necessary to release the resources occupied by the target warp, that is, release the target storage space and the target execution resources for subsequent execution of the target warp.

[0074] At the same time, the warp valid flag needs to be set to invalid for managing subsequent target warps. Optionally, when it is detected that the warp valid flag changes from valid to invalid, the release pointer is moved from the warp table to the position corresponding to the next warp.

[0075] In the above embodiment, the target storage resources and target execution resources occupied by the target warp are released so as to be used for executing the next target warp. In addition, the warp valid flag is set to invalid so as to facilitate the construction of the next target warp.

[0076] In one embodiment, constructing a target warp based on the task to be processed includes: updating the number of threads corresponding to the current warp to be constructed according to the task to be processed; and using the warp to be constructed as the target warp if the number of threads corresponding to the current warp to be constructed is a first preset number.

[0077] The current warp to be constructed refers to a warp that is being constructed but not yet completed; and the first preset number refers to a pre-set indicator for determining whether the current warp to be constructed has been completed. For example, the first preset number is set to 32 or 64.

[0078] After receiving the pending task, the pending task is added to the current warp to be constructed, and the number of threads in the warp to be constructed is updated. That is, the number of threads in the current number of threads to be constructed + 1. If the number of threads corresponding to the current warp to be constructed is the first preset number, it is determined that the current warp to be constructed has completed construction, and the warp to be constructed is used as the target warp.

[0079] Furthermore, in one embodiment, the thread warp information also includes a thread warp valid flag; the thread warp valid flag in the thread warp table is read, and the target thread warp is constructed according to the thread warp valid flag in the thread warp table. Exemplarily, if the thread warp valid flag of the current thread warp to be constructed indicated by the allocation pointer is valid, it means that the current thread warp to be constructed has received some tasks to be processed. At this time, it is only necessary to increase the number of threads corresponding to the thread warp to be constructed by 1. If the updated number of threads is equal to the first preset number, it means that the current thread warp has been constructed. If the thread warp valid flag of the current thread warp to be constructed indicated by the allocation pointer is invalid, it means that the current thread warp to be constructed has not received tasks to be processed. At this time, the thread warp valid flag is changed from invalid to valid, and the number of threads of the current thread warp to be constructed is updated.

[0080] In the above embodiment, a target warp is constructed based on the tasks to be processed, so that multiple tasks to be processed can be executed simultaneously, thereby more effectively utilizing the parallel processing capability of the processor.

[0081] In one exemplary embodiment, the warp table is as follows: Figure 2 As shown, Figure 2 FIG. 1 is a schematic diagram of a thread warp table in an embodiment.

[0082] In this embodiment, the thread bundle information includes a thread bundle valid flag, the number of vertices, the storage space location of the thread bundle output data, the thread bundle identifier, and the thread bundle execution end flag. Among them, the number of vertices represents the number of threads in the thread bundle. It should be noted that after the thread bundle to be constructed is constructed, it is the target thread bundle, so the number of threads of the thread bundle to be constructed and the number of threads of the target thread bundle both refer to the number of vertices. Among them, the thread bundle storage space location corresponds to the storage space location of the thread bundle output data in the above embodiment. When the thread bundle table is in the initialization state, that is, when any target thread bundle has not been constructed, the thread bundle information is 0.

[0083] Continue to combine Figure 3 , Figure 3The figure is a schematic diagram of the intermediate execution state of a thread bundle table in an embodiment. When the table allocation pointer points to the i-th row in the thread bundle table, the general processor will construct the target thread bundle in the i-th row. When receiving vertices, read the thread bundle valid flag in the i-th row. If the thread bundle valid flag is invalid, for example, 0, it means that the thread bundle to be constructed currently has not received vertices. At this time, the number of vertices of the thread bundle to be constructed currently is increased by 1, and the thread bundle valid flag is set to 1, indicating that the thread bundle to be constructed currently has received some vertices. If the number of vertices accumulates to the corresponding first preset number, the thread bundle to be constructed currently is used as the target thread bundle, and the table allocation pointer is moved down to construct the next target thread bundle, so that the target thread bundle can be executed and constructed simultaneously.

[0084] When the target warp is constructed, the target storage space is allocated to the target warp, that is, the position currently pointed to by the allocation pointer is allocated to the target warp, and the storage position corresponding to the target storage space is obtained. After the target storage space is allocated to the target warp, the allocation pointer is moved down, so that the target storage space can be allocated to the next target warp.

[0085] After allocating storage space for the target thread bundle, the target execution resource is allocated to the target thread bundle to obtain the thread bundle identifier. After obtaining the thread bundle identifier, the target thread bundle is executed according to the target thread bundle identifier to obtain output data, and the output data is stored in the target storage space corresponding to the storage space position of the thread bundle output data. When all the output data is stored in the target storage space, the thread bundle execution end flag is set to valid, for example, 1. When the thread bundle execution end flag is set to valid, it means that the output data has been fully prepared. At this time, the output data can be read from the storage space, and the number of thread bundles of the target thread bundle is reduced. When the number of target thread bundles is 0, it means that the output data has been fully read. At this time, the life cycle of the target thread bundle has ended, and the target storage space and target execution resources corresponding to the target thread bundle need to be released. Afterwards, the thread bundle valid flag is set to invalid, and the table release pointer and the release pointer of the storage position are moved to the current position, so that the corresponding row in the thread bundle table and the storage position pointed to by the release pointer can be reserved for the new thread bundle formed later.

[0086] In the above embodiment, by setting the thread warp table, the general purpose processor can obtain the target resource based on the thread warp information to execute multiple target thread warps in parallel. In addition, by setting the thread warp information, the state of the target thread warp can be obtained in real time through the thread warp information. Figure 4 As shown, Figure 4 FIG. 1 is a schematic diagram of warp construction and execution in one embodiment.

[0087] In this embodiment, the warp device includes a wave constructor unit (WCU), a resource allocator unit (RAU), a warp dispatch unit WDU, an instruction execution unit IEU, a vertex attribute storage space VAS and a subsequent module (Black Unit, BU).

[0088] The thread warp construction unit WCU is used to collect vertices, that is, to collect tasks to be processed, and divide a fixed number of vertices k into a thread warp. k is generally 32 or 64. For the convenience of description, k is described as 32 in this embodiment, and attribute storage space is allocated to the successfully constructed thread warp. In addition, resources and thread warp identification numbers are applied to the resource allocation unit RAU. k is a first preset number.

[0089] The Resource Allocate Unit (RAU) is used to respond to the resource application request of the warp construction unit WCU, allocate register resources and warp identification numbers to the warp, and return the warp identification numbers to the warp construction unit.

[0090] The warp dispatching unit WDU is used to receive the warp identification number from the warp construction unit, reasonably dispatch the received warp, and send instructions to the instruction execution unit IEU.

[0091] The instruction execution unit IEU is responsible for executing the instructions issued by the warp scheduling unit WDU, and outputting the results of the output instructions to the vertex attribute storage space VAS.

[0092] Among them, the vertex attribute storage space VAS is responsible for receiving the results of the output instructions sent by the instruction execution unit IEU, and storing the results in the vertex attribute storage space. When all the output data of a thread bundle is received, the thread bundle construction unit WCU is notified that the output data of the corresponding thread bundle has been stored in the attribute storage space.

[0093] Among them, the subsequent module (Black Unit, BU) is used to read the vertex attributes output by the thread warp, and after the reading is completed, it is responsible for notifying the thread warp construction unit WCU to release the vertex attribute storage space of the corresponding thread warp.

[0094] Continue to combine Figure 5 , Figure 5 For Figure 4 A flowchart of a method for processing thread warp execution in FIG.

[0095] Step 1: The thread bundle construction unit collects k vertices each time to form a thread bundle, and records the valid information, vertex number information and ready information of the thread bundle in the thread bundle table; among them, the valid information is set to 1, the vertex number is set to 32, and the ready information is set to 0.

[0096] Step 2: After the warp is constructed successfully, the warp construction unit allocates attribute storage space VASID to the warp and records it in the warp table.

[0097] Step 3: After the warp construction unit successfully allocates the VASID to the warp, the warp construction unit WCU applies for register resources and the warp identification number from the resource allocation unit RAU.

[0098] Step 4: After the warp construction unit WCU receives the warp identification number waveID sent back by the resource allocation unit RAU, it records the waveID in the warp table and sends it to the warp scheduling unit WDU.

[0099] Step 5: After the warp dispatching unit WDU receives the waveID, it dispatches and sends the received warp instructions to the IEU.

[0100] Step 6: When the IEU receives the output instruction, it is responsible for sending the result of the output instruction to the attribute storage space VAS.

[0101] Step 7: When the VAS receives all the output data of a certain thread bundle, it notifies the WCU unit that the output data of the thread bundle has been fully prepared; the WCU unit receives the signal and sets the corresponding thread bundle ready information in the thread bundle table to 1.

[0102] Step 8: When the subsequent module BU detects that the ready information of the thread warp in the WCU unit is 1, it can read and use the output data of the thread warp.

[0103] Step 9: After the BU finishes reading the output data of a vertex, it sends a release signal to the WCU. After receiving the release signal, the WCU reduces the number of vertices k of the corresponding thread bundle by 1; when k is reduced to 0, the attribute storage space corresponding to the thread bundle is released, and the valid information of the thread bundle in the thread bundle table is set to 0. When the valid information is 0, the corresponding row in the thread bundle table can be reserved for the new thread bundle to be formed later.

[0104] Thus, when a warp completes the construction of a target warp but encounters a warp application for register resources or a warp identification failure, the warp construction unit will not stop the warp construction behavior, that is, will not stop collecting new vertices.

[0105] In this way, after the thread warp is sent to the thread warp scheduling unit, the current thread warp still exists in the thread warp construction unit. It is not necessary to add an additional unit to record the construction order of the thread warp in the subsequent module responsible for reading the thread warp output data in order to serialize the output data, thereby avoiding increasing the hardware complexity of the subsequent module for reading the thread warp output data.

[0106] In the above embodiment, a warp table is used to record the warp valid flags, vertex numbers, storage space locations of warp output data, warp identifiers, and warp execution end flags of multiple warps; after the warp is constructed successfully and each resource and warp identifier is applied successfully, the warp identifier is sent to the warp scheduling unit; the warp scheduling unit is responsible for sending warp instructions to the instruction execution unit, and after all instructions of the warp are executed, the warp construction unit is notified that the warp execution is completed. This method simplifies the hardware logic of the warp construction unit managing resources, is also conducive to the parallel execution of warps by general-purpose processors, and ensures the serialization of output data.

[0107] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0108] Based on the same inventive concept, the embodiment of the present application also provides a thread warp execution device for implementing the thread warp execution method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more thread warp execution device embodiments provided below can refer to the limitations of the thread warp execution method above, and will not be repeated here.

[0109] In an exemplary embodiment, Figure 6 As shown, a thread warp execution device is provided, including: a receiving module 610, a construction module 620 and an execution module 630, wherein:

[0110] The receiving module 610 is used to receive tasks to be processed.

[0111] The construction module 620 is used to construct a target warp based on the task to be processed, allocate target resources to the target warp, obtain warp information, and establish a mapping relationship between the warp information and the target resources.

[0112] The execution module 630 is configured to obtain target resources corresponding to each thread warp information based on each mapping relationship, and execute the target thread warp corresponding to the thread warp information based on the target resources.

[0113] In one embodiment, the execution module includes:

[0114] The thread warp execution unit is used to execute the target thread warp through the target execution resource to obtain output data.

[0115] The storage unit is used to save the output data to a target storage space corresponding to the storage space position of the thread warp output data.

[0116] The release unit is used to read the output data from the target storage space and release the target thread warp.

[0117] In one embodiment, the execution module further includes:

[0118] The flag setting unit is used to set the thread warp execution end flag to be valid if the output data has been stored.

[0119] In one embodiment, the release unit is further configured to read the output data from the target storage space and release the target warp if the warp execution end flag is set to be valid.

[0120] In one embodiment, the release unit further comprises:

[0121] The modification unit is used for reading output data from the target storage space and modifying the number of threads of the target thread warp if the thread warp execution end flag is valid.

[0122] The thread warp releasing unit is configured to release the target thread warp if the number of threads of the target thread warp is a second preset number.

[0123] In one embodiment, the warp release unit is further configured to release the target storage space and the target execution resource and set the warp valid flag to invalid.

[0124] In one embodiment, the above-mentioned construction module includes:

[0125] The updating unit is used to update the number of threads corresponding to the current thread warp to be constructed according to the tasks to be processed.

[0126] The thread warp construction unit is configured to use the thread warp to be constructed as a target thread warp if the number of threads corresponding to the thread warp to be constructed is a first preset number.

[0127] Each module in the above-mentioned thread bundle construction device can be implemented in whole or in part by software, hardware or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.

[0128] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store tasks to be processed. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a thread bundle construction method is implemented.

[0129] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0130] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: receiving a task to be processed; constructing a target thread bundle based on the task to be processed, allocating target resources to the target thread bundle, obtaining thread bundle information, and establishing a mapping relationship between the thread bundle information and the target resources; respectively obtaining target resources corresponding to each thread bundle information based on each mapping relationship, and executing the target thread bundle corresponding to the thread bundle information based on the target resources.

[0131] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the target resources include target execution resources and target storage space; the thread bundle information includes the thread bundle identifier and the storage space location of the thread bundle output data; the thread bundle identifier is obtained after allocating the target execution resources to the target thread bundle; the storage space location of the thread bundle output data is obtained after allocating the target storage space to the target thread bundle.

[0132] In one embodiment, when the processor executes the computer program, the following steps are also implemented: executing the target thread warp through the target execution resource to obtain output data; saving the output data to the target storage space corresponding to the storage space location of the thread warp output data; reading the output data from the target storage space, and releasing the target thread warp.

[0133] In one embodiment, when the processor executes the computer program, the following steps are also implemented: if the output data has been stored, the thread warp execution end flag is set to valid; the output data is read from the target storage space and the target thread warp is released, including: if the thread warp execution end flag is set to valid, the output data is read from the target storage space and the target thread warp is released.

[0134] In one embodiment, when executing the computer program, the processor further implements the following steps: according to the thread bundle execution end flag, read the output data from the target storage space, and release the target thread bundle, including: if the thread bundle execution end flag is valid, read the output data from the target storage space, and modify the number of threads of the target thread bundle; if the number of threads of the target thread bundle is a second preset number, release the target thread bundle.

[0135] In one embodiment, when executing the computer program, the processor further implements the following steps: releasing the target warp, including: releasing the target storage space and the target execution resource and setting the warp valid flag to invalid.

[0136] In one embodiment, when the processor executes the computer program, the following steps are further implemented: updating the number of threads corresponding to the current warp to be constructed according to the task to be processed; if the number of threads corresponding to the current warp to be constructed is a first preset number, taking the warp to be constructed as the target warp.

[0137] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: receiving a task to be processed; constructing a target thread bundle based on the task to be processed, allocating target resources to the target thread bundle, obtaining thread bundle information, and establishing a mapping relationship between the thread bundle information and the target resources; respectively obtaining target resources corresponding to each thread bundle information based on each mapping relationship, and executing the target thread bundle corresponding to the thread bundle information based on the target resources.

[0138] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: executing the target thread warp through the target execution resource to obtain output data; saving the output data to the target storage space corresponding to the storage space location of the thread warp output data; reading the output data from the target storage space, and releasing the target thread warp.

[0139] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: if the output data has been stored, the thread warp execution end flag is set to valid; the output data is read from the target storage space and the target thread warp is released, including: if the thread warp execution end flag is set to valid, the output data is read from the target storage space and the target thread warp is released.

[0140] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: according to the thread bundle execution end flag, output data is read from the target storage space, and the target thread bundle is released, including: if the thread bundle execution end flag is valid, the output data is read from the target storage space, and the number of threads of the target thread bundle is modified; if the number of threads of the target thread bundle is a second preset number, the target thread bundle is released.

[0141] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: releasing the target thread warp, including: releasing the target storage space and the target execution resource and setting the thread warp valid flag to invalid.

[0142] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: updating the number of threads corresponding to the current warp to be constructed according to the task to be processed; if the number of threads corresponding to the current warp to be constructed is a first preset number, taking the warp to be constructed as the target warp.

[0143] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the following steps: receiving a task to be processed; constructing a target thread bundle based on the task to be processed, allocating a target resource to the target thread bundle, obtaining thread bundle information, and establishing a mapping relationship between the thread bundle information and the target resource; respectively obtaining a target resource corresponding to each thread bundle information based on each mapping relationship, and executing the target thread bundle corresponding to the thread bundle information based on the target resource.

[0144] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: executing the target thread warp through the target execution resource to obtain output data; saving the output data to the target storage space corresponding to the storage space location of the thread warp output data; reading the output data from the target storage space, and releasing the target thread warp.

[0145] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: if the output data has been stored, the thread warp execution end flag is set to valid; the output data is read from the target storage space and the target thread warp is released, including: if the thread warp execution end flag is set to valid, the output data is read from the target storage space and the target thread warp is released.

[0146] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: according to the thread bundle execution end flag, output data is read from the target storage space, and the target thread bundle is released, including: if the thread bundle execution end flag is valid, the output data is read from the target storage space, and the number of threads of the target thread bundle is modified; if the number of threads of the target thread bundle is a second preset number, the target thread bundle is released.

[0147] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: releasing the target thread warp, including: releasing the target storage space and the target execution resource and setting the thread warp valid flag to invalid.

[0148] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: updating the number of threads corresponding to the current warp to be constructed according to the task to be processed; if the number of threads corresponding to the current warp to be constructed is a first preset number, taking the warp to be constructed as the target warp.

[0149] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0150] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0151] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0152] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A warp execution method, characterized in that: The method comprises: Receive pending tasks; constructing a target warp based on the task to be processed, allocating target resources to the target warp, obtaining warp information, and establishing a mapping relationship between the warp information and the target resources; The target resources corresponding to each of the thread warp information are acquired based on each of the mapping relationships, and the target thread warp corresponding to the thread warp information is executed based on the target resources.

2. The thread execution method according to claim 1, characterized in that: The target resources include target execution resources and target storage space; the thread bundle information includes a thread bundle identifier and a storage space location of thread bundle output data; the thread bundle identifier is obtained after the target execution resources are allocated to the target thread bundle; the storage space location of the thread bundle output data is obtained after the target storage space is allocated to the target thread bundle.

3. The thread warp execution method according to claim 2, characterized in that: Acquiring the target resources corresponding to each of the thread warp information based on each of the mapping relationships respectively, and executing the target thread warp corresponding to the thread warp information in the target resources based on the target resources, including: Acquire the target execution resource according to the thread warp identifier, and process the target thread warp based on the target execution resource to obtain output data; Saving the output data to the target storage space corresponding to the storage space location of the thread warp output data; The output data is read from the target storage space, and the target thread warp is released.

4. The thread warp execution method according to claim 3, characterized in that: The thread warp information also includes a thread warp execution end flag; after the output data is saved to the target storage space corresponding to the storage space position of the thread warp output data, it also includes: If the output data has been stored, setting the thread warp execution end flag to be valid; The step of reading the output data from the target storage space and releasing the target thread warp comprises: If the warp execution end flag is set to be valid, the output data is read from the target storage space, and the target warp is released.

5. The thread warp execution method according to claim 4, characterized in that: The step of reading the output data from the target storage space according to the warp execution end flag and releasing the target warp comprises: If the thread warp execution end flag is valid, read the output data from the target storage space, and modify the number of threads of the target thread warp; If the number of threads of the target warp is a second preset number, the target warp is released.

6. The thread warp execution method according to claim 5, characterized in that: The releasing the target thread warp comprises: The target storage space and the target execution resource are released and the valid flag of the thread warp is set to invalid.

7. The warp execution method according to claim 1, characterized in that: The constructing a target thread warp based on the task to be processed includes: Update the number of threads corresponding to the current warp to be constructed according to the task to be processed; If the number of threads corresponding to the current warp to be constructed is a first preset number, the warp to be constructed is used as a target warp.

8. A thread warp execution device, characterized in that: The device comprises: A receiving module, used for receiving tasks to be processed; A construction module, configured to construct a target warp based on the task to be processed, allocate target resources to the target warp, obtain warp information, and establish a mapping relationship between the warp information and the target resources; An execution module is used to obtain the target resources corresponding to each of the thread warp information based on each of the mapping relationships, and execute the target thread warp corresponding to the thread warp information based on the target resources.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Thread bundle scheduling method and device, graphics processor and computer equipment

    CN119862010A

  • Method, computing device, medium and program product for executing kernel function

    CN120371482A

  • Method, computing device, medium and program product for executing kernel function

    CN120371482B

  • Task processing method and apparatus, device, and storage medium

    WO2026107843A1