Task execution method, graphics processor, electronic device and storage medium

By allocating the execution unit according to the storage location of the computational data in the GPU, the problem of low data handling efficiency is solved, and the effect of improving the execution efficiency of GPU tasks is achieved.

CN115951998BActive Publication Date: 2025-05-30ILUVATAR COREX INC SHANGHAI
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211715952.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2025-05-30
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

When existing GPUs execute tasks, the efficiency of data transfer from storage devices to execution units is low, which affects the execution efficiency of tasks.

Method used

By obtaining the operation data set and its storage location in the task instruction, and assigning the execution unit to the task according to the target data location, ensuring the minimum data transfer distance, thereby improving data transfer efficiency.

Benefits of technology

It effectively reduces the data handling distance, improves data handling efficiency, and thus improves the GPU's task execution efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115951998B_ABST
    Figure CN115951998B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention provide a task execution method, a graphics processing unit, an electronic device, and a storage medium, which relate to the field of electronic technologies. Among them, the task execution method includes: obtaining a task instruction, where the task instruction includes an operation data set required for executing the task; obtaining data storage locations of each operation data in the operation data set to obtain a plurality of target data locations; and allocating execution units for the task according to the target data locations. Compared with the prior art, the task execution method, the graphics processing unit, the electronic device, and the storage medium provided by the embodiments of the present invention have the advantages of improving the transfer efficiency during the process of transferring data from a storage device to an execution unit, thereby improving the execution efficiency of the GPU for tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electronic technologies, and in particular, to a task execution method, a graphics processing unit, an electronic device, and a storage medium. Background Art

[0002] With the generalization trend of the GPU (graphics processing unit), the types and quantities of dedicated logic operation units inside the GPU are continuously increasing. From the initial general operation units, special function units, to high-performance operation units, tensor operation units, etc., all are to let dedicated units perform dedicated operations to achieve the optimal efficiency. The logic operation units are combined with each other to form a large number of execution units for executing operation tasks.

[0003] In the GPU, there are thousands of execution units. The data required when executing tasks is usually placed in storage devices such as video memory. When each thread executes, it is necessary to transfer the data from the storage device to the execution unit first. Therefore, the transfer efficiency during the process of transferring data from the storage device to the execution unit directly affects the execution efficiency of the GPU for tasks. Summary of the Invention

[0004] The purpose of the present invention is to provide a task execution method, a graphics processing unit, an electronic device, and a storage medium, which can improve the transfer efficiency during the process of transferring data from the storage device to the execution unit, thereby improving the execution efficiency of the GPU for tasks.

[0005] In a first aspect, an embodiment of the present invention provides a task allocation method, which is applied to a graphics processing unit. The method includes: obtaining a task instruction, where the task instruction includes an operation data set required for executing the task; obtaining data storage locations of each operation data in the operation data set to obtain a plurality of target data locations; and allocating an execution unit for the task according to the target data locations.

[0006] In some embodiments, the allocating an execution unit for the task according to the target data locations includes: obtaining an execution unit with the smallest sum of distances from each of the target data locations as a target execution unit; and allocating the task to the target execution unit. Taking the execution unit with the smallest sum of distances from each target data location as the target execution unit and allocating the task to the target execution unit, during the calculation process of the target execution unit for executing the task, the data transfer distance for transferring the operation data at the target data location to the target execution unit is the smallest, thereby effectively reducing the transfer distance during the process of transferring data from the storage device to the execution unit. The reduction of the transfer distance can effectively improve the transfer efficiency, and the improvement of the data transfer efficiency can improve the execution efficiency of the graphics processing unit for tasks.

[0007] In some embodiments, allocating execution units for the task according to the target data location includes: obtaining the number of execution units required to execute the task; constructing a number of execution unit groups according to the number of execution units, where each execution unit group includes the number of execution units; obtaining the execution unit group with the minimum sum of distances to each of the target data locations as the target execution unit group; and allocating the task to each execution unit in the target execution unit group. By constructing execution unit groups based on the number of execution units required to execute the instruction task and taking the execution unit group with the minimum sum of distances to each target data location as the target execution unit group, the data transfer distance between the target execution unit group and each target data location is reduced, thereby improving the data transfer efficiency. The improvement of the data transfer efficiency drives the overall improvement of the task execution efficiency.

[0008] In some embodiments, allocating execution units for the task according to the target data location includes: splitting the task to obtain a number of subtasks; obtaining the task data required for each subtask from the operation dataset to form a sub-dataset, where the sub-dataset corresponds to the subtask one by one, and obtaining the storage location of the operation data in each sub-dataset as the sub-data location; and allocating execution units for each subtask according to the sub-data location. By dividing the instruction task into a number of subtasks and allocating subtask execution units for each subtask respectively, since the subtask execution unit is the execution unit with the minimum distance to the operation data corresponding to the subtask, the execution efficiency of each subtask can be improved, and the improvement of the execution efficiency of each subtask ultimately improves the execution efficiency of the entire task as a whole.

[0009] In some embodiments, allocating execution units for each subtask according to the sub-data location includes: for any one of the subtasks, obtaining the sub-dataset corresponding to the subtask as the target sub-dataset; obtaining the execution unit with the minimum sum of distances to the sub-data locations of the task data in the target sub-dataset as the subtask execution unit corresponding to the subtask; and allocating the subtask to the subtask execution unit. Taking the execution unit with the minimum sum of distances to each operation data location in the target sub-dataset as the subtask execution unit and allocating the subtask to the subtask execution unit, during the calculation process of the subtask execution unit for executing the subtask, the data transfer distance for transferring the operation data at the target data location to the subtask execution unit is the minimum, thereby effectively reducing the transfer distance during the process of transferring data from the storage device to the subtask execution unit. The reduction of the transfer distance can effectively improve the transfer efficiency, and the improvement of the data transfer efficiency can improve the execution efficiency of the graphics processor for the subtask.

[0010] In some embodiments, allocating execution units for each of the subtasks according to the sub-data positions includes: for any one of the subtasks, obtaining the number of execution units required for the subtask as the subtask execution unit number; constructing a plurality of execution unit groups in the graphics processor according to the subtask execution unit number; obtaining the execution unit group with the smallest sum of distances to the sub-data positions of the task data in the target sub-dataset as the target subtask execution unit group corresponding to the subtask; and allocating the subtask to each execution unit in the target subtask execution unit group.

[0011] In some embodiments, before allocating the subtask to each execution unit in the target subtask execution unit group, the method further includes: determining whether each execution unit in the target subtask execution unit group is allocated to other subtasks; if any execution unit in the target subtask execution unit group is allocated to other subtasks, after removing the execution unit allocated to other subtasks, re-obtaining the target subtask execution unit group. By determining whether each execution unit in the target subtask execution unit group is allocated to other subtasks, the situation that the same execution unit is allocated to multiple different subtasks and affects the task execution efficiency is avoided.

[0012] In a second aspect, an embodiment of the present invention provides a graphics processor, including: a task instruction obtaining module, configured to obtain a task instruction, where the task instruction includes an operation dataset required for executing the task; a data position obtaining module, configured to obtain the data storage positions of the respective operation data in the operation dataset to obtain a plurality of target data positions; and a task allocation module, configured to allocate execution units for the task according to the target data positions.

[0013] In some embodiments, the task allocation module includes an execution unit number obtaining sub-module and a task allocation sub-module; the execution unit number obtaining sub-module is configured to obtain the number of execution units required for executing the task; the task allocation sub-module is configured to construct a plurality of execution unit groups according to the execution unit number, where each execution unit group includes the execution units of the execution unit number, obtain the execution unit group with the smallest sum of distances to each of the target data positions as the target execution unit group, and allocate the task to each execution unit in the target execution unit group.

[0014] In some embodiments, the task allocation module includes a task splitting sub-module and a task assignment sub-module; the task splitting sub-module is configured to split the task to obtain a plurality of subtasks; the task assignment sub-module is configured to obtain, from the operation data set, the task data required for each of the subtasks to form a sub-data set, where the sub-data set corresponds to the subtask one by one, obtain the storage location of the operation data in each of the sub-data sets as the sub-data location, and allocate execution units for each of the subtasks according to the sub-data location.

[0015] In a third aspect, an embodiment of the present invention provides an electronic device, including: at least one graphics processor; and a memory communicatively connected to the at least one graphics processor; wherein, the memory stores a task executable by the at least one graphics processor, and the task is executed by the at least one graphics processor so that the at least one graphics processor can execute the task execution method as described above.

[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing a computer program, where the computer program is executed by a graphics processor to implement the task execution method as described above.

[0017] Compared with the prior art, in the task execution method, graphics processor, electronic device, and storage medium provided by the embodiments of the present invention, after obtaining a task instruction, the graphics processor parses the task instruction to obtain an operation data set required for executing the task included in the task instruction, and obtains the data storage location of each operation data in the operation data set. The data storage location of each operation data can be used as a target data location, so as to obtain a plurality of target data locations. Finally, execution units are allocated for the task according to the target data locations. The execution units obtain each operation data required for executing the task from the target data locations, and finally perform corresponding operations according to these operation data to complete the task assigned by the task instruction. Since the execution units are allocated according to the storage location of the operation data, the transfer efficiency during the process of transferring data from the storage device to the execution units can be improved, thereby improving the execution efficiency of the GPU for tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, and thus should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0019] Figure 1 It is a schematic flowchart of the task execution method provided by Embodiment 1 of the present invention;

[0020] Figure 2 It is a schematic flowchart of the task execution method provided in the second embodiment of the present invention;

[0021] Figure 3 It is a schematic diagram of a task in the task execution method provided in the second embodiment of the present invention;

[0022] Figure 4 It is a schematic diagram of the task allocation result in the task execution method provided in the second embodiment of the present invention;

[0023] Figure 5 It is a schematic structural diagram of a graphics processing unit provided in the third embodiment of the present invention;

[0024] Figure 6 It is a schematic structural diagram of an electronic device provided in the fourth embodiment of the present invention. Detailed implementation manners

[0025] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. The components of the embodiments of the present invention described and illustrated herein can be arranged and designed in various different configurations.

[0026] Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed present invention, but merely represents selected embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.

[0027] It should be noted that the features in the embodiments of the present invention can be combined with each other without conflict.

[0028] The first embodiment of the present invention provides a task execution method, which is applied to a graphics processing unit, as Figure 1 shown, and specifically includes the following steps:

[0029] Step S101: Obtain a task instruction, where the task instruction includes an operation data set required for executing the task.

[0030] Specifically, the task instruction is an instruction sent by other electronic devices such as a central processing unit (CPU) received by the graphics processing unit. The task instruction includes the task that the graphics processing unit needs to execute. In fact, the process of the graphics processing unit executing a task is a process of data operation. Therefore, while the task instruction indicates the task to be executed, it also includes the operation data required to execute this task. All the operation data required to execute this task together constitute an operation data set.

[0031] Step S102: Obtain the data storage locations of each operation data in the operation data set to obtain multiple target data locations.

[0032] Specifically, due to the limited storage space in the graphics processing unit, the operation data included in the operation data set is usually not stored in the graphics processing unit, but in the video memory outside the graphics processing unit. During the process of the graphics processing unit executing a task, it is necessary to first transfer the operation data required to execute the task from the video memory to the execution unit of the graphics processing unit, and then the execution unit can perform corresponding data operations on the operation data to complete the execution process of the task. Therefore, the task instruction also includes the data storage locations of each operation data in the operation data set. By parsing the task instruction, the data storage locations of each operation data in the operation data set can be obtained. Taking the data storage locations of each operation data as the target data locations, multiple target data locations are obtained.

[0033] Step S103: Allocate an execution unit for the task according to the target data location.

[0034] In some embodiments of the present invention, an execution unit can be allocated for the task according to the distance between the target data location and the execution unit. Specifically, calculate the distances between each execution unit and each target data location, and take the execution unit with the smallest sum of distances from each target data location as the target execution unit, and allocate the task to the target execution unit. Wherein, the distance between the execution unit and the target data location is the distance required to transfer the data at the target data location to the execution unit. Taking the execution unit with the smallest sum of distances from each target data location as the target execution unit and allocating the task to the target execution unit, during the calculation process of the target execution unit executing the task, the data transfer distance for transferring the operation data at the target data location to the target execution unit is the smallest, thereby effectively reducing the transfer distance during the process of transferring data from the storage device to the execution unit. The reduction of the transfer distance can effectively improve the transfer efficiency, and the improvement of the data transfer efficiency can improve the execution efficiency of the graphics processing unit for the task.

[0035] It is understandable that taking the execution unit with the minimum sum of distances to each target data position as the target execution unit and allocating the task to the target execution unit are only specific illustrative examples in some embodiments of the present invention. In some other embodiments of the present invention, the target execution unit can also be determined by other methods. For example, the target execution unit can be determined according to the data transfer smoothness of the data transfer channels between the target data positions and each execution unit in the graphics processing unit.

[0036] Furthermore, in some embodiments of the present invention, multiple execution units can be used to execute the tasks assigned by the task instructions in parallel. At this time, the number of execution units required to execute the tasks assigned by the task instructions is obtained, and several execution unit groups are constructed according to the number of execution units. Each execution unit group includes the required number of execution units; the distances between each execution unit group and each target data position are calculated respectively, and finally the execution unit group with the minimum sum of distances to each target data position is used as the target execution unit group, and the task is assigned to the target execution unit group. By constructing the execution unit group according to the number of execution units required to execute the instruction task and using the execution unit group with the minimum sum of distances to each target data position as the target execution unit group, the data transfer distance between the target execution unit group and each target data position is reduced, thereby improving the data transfer efficiency, and the improvement of the data transfer efficiency drives the overall improvement of the task execution efficiency.

[0037] Compared with the prior art, in the task execution method provided in the first embodiment of the present invention, after the graphics processing unit obtains the task instruction, it parses the task instruction to obtain the operation data set required to execute the task, and obtains the data storage positions of each operation data in the operation data set. The data storage position of each operation data can be used as the target data position, so as to obtain multiple target data positions. Finally, the execution unit is allocated for the task according to the target data position. The execution unit obtains each operation data required to execute the task from the target data position, and finally performs corresponding operations according to these operation data to complete the task assigned by the task instruction. Since the execution unit is allocated according to the storage position of the operation data, the transfer efficiency during the process of transferring data from the storage device to the execution unit can be improved, thereby improving the execution efficiency of the GPU for the task.

[0038] The second embodiment of the present invention provides a task execution method, which is applied to a graphics processing unit, as Figure 2 shown, and specifically includes the following steps:

[0039] Step S201: Obtain a task instruction, where the task instruction includes an operation data set required to execute a task.

[0040] Step S202: Obtain the data storage locations of the respective operation data in the operation dataset to obtain a plurality of target data locations.

[0041] It can be understood that steps S201 and S202 in the task execution method provided in the second embodiment of the present invention are substantially the same as steps S101 and S102 in the first embodiment. For specific details, reference may be made to the specific description in the foregoing first embodiment, and details will not be elaborated herein.

[0042] Step S203: Split the task to obtain a number of subtasks.

[0043] Specifically, in some embodiments of the present invention, the task may be split according to a split instruction sent by a superior control device such as a processor CPU. Usually, the task Q sent by a superior control device such as a processor CPU is represented by three dimensions X / Y / Z. As Figure 3 shown, Figure 3 each point in represents a thread task sent by a superior control device such as a processor CPU. The data processed by each thread task in the figure is different. The task unit executed by the graphics processor hardware is a thread subset. Therefore, the graphics processor hardware needs to split the large host task into one thread subset K after another and then distribute them to each execution unit for processing. In some embodiments of the present invention, the thread subset is the subtask.

[0044] Step S204: Obtain the task data required for each subtask from the operation dataset to form a sub-dataset.

[0045] Specifically, each subtask only executes a partial operation process of the entire task, and thus only needs to use partial operation data. For each subtask, obtain the partial operation data required to execute the subtask to form a sub-dataset. Each subtask separately obtains its corresponding sub-dataset, and each sub-dataset corresponds to only one unique subtask.

[0046] Furthermore, some subtasks may use the same operation data. Therefore, in some embodiments of the present invention, the same operation data may exist in multiple sub-datasets.

[0047] Step S205: Obtain the storage locations of the operation data in each sub-dataset as sub-data locations.

[0048] Step S206: Allocate execution units for each subtask according to the sub-data locations.

[0049] Specifically, in this step, the process of allocating execution units for each subtask is carried out independently. That is, for any subtask, when allocating an execution unit for it, first obtain the corresponding sub-dataset of the subtask as the target sub-dataset, then obtain the storage locations of each operation data in the target sub-dataset, calculate the distances between each execution unit and the storage locations of each operation data in the target sub-dataset respectively, and finally use the execution unit with the smallest sum of distances from the storage locations of each operation data in the target sub-dataset as the subtask execution unit corresponding to the target sub-dataset, and allocate the subtask to the subtask execution unit. Using the execution unit with the smallest sum of distances from the storage locations of each operation data in the target sub-dataset as the subtask execution unit and allocating the subtask to the subtask execution unit, during the calculation process of the subtask execution unit for the subtask, the data transfer distance for transporting the operation data at the target data location to the subtask execution unit is the smallest, thus effectively reducing the transfer distance during the process of transferring data from the storage device to the subtask execution unit. The reduction of the transfer distance can effectively improve the transfer efficiency, and the improvement of the data transfer efficiency can improve the execution efficiency of the graphics processor for the subtask.

[0050] Compared with the prior art, in the task execution method provided in the second embodiment of the present invention, the instruction task is divided into several subtasks, and a subtask execution unit is allocated for each subtask respectively. Since the subtask execution unit is the execution unit with the smallest distance from the operation data corresponding to the subtask, the execution efficiency of each subtask can be improved, and the improvement of the execution efficiency of each subtask ultimately improves the execution efficiency of the entire task as a whole.

[0051] Further, in some embodiments of the present invention, for any subtask, obtain the number of execution units required for the subtask as the number of subtask execution units, and construct several execution unit groups in the graphics processor according to the number of subtask execution units; obtain the execution unit group with the smallest sum of distances from the sub-data locations of the task data in the target sub-dataset as the target subtask execution unit group corresponding to the subtask; and allocate the subtask to each execution unit in the target subtask execution unit group. As Figure 4 shown is a schematic diagram of a specific allocation effect. Among them, A, B, and C are subtasks, M is an execution unit, a, b, and c are execution unit groups, and 1, 2, 3, 4, 5, and 6 are different task data respectively.

[0052] Further, in some embodiments of the present invention, after obtaining the target subtask execution unit group with the smallest sum of distances to the sub-data positions of the task data in the target sub-dataset as the target subtask execution unit group corresponding to the subtask, the following steps are further included: determining whether each execution unit in the target subtask execution unit group corresponding to the subtask currently undergoing execution unit allocation has been allocated to other subtasks, that is, determining whether the same execution unit has been allocated to execute two or more subtasks. If there is an execution unit in the target subtask execution unit group corresponding to the subtask currently undergoing execution unit allocation that has been allocated to other subtasks, it is necessary to remove the execution unit in the target subtask execution unit group that has been allocated to process other subtasks and re-obtain the target subtask execution unit group. It can be understood that re-obtaining the target subtask execution unit group can obtain, from the other execution units except the removed execution units, the execution unit group with the smallest sum of distances to the sub-data positions of the task data in the target sub-dataset as the new target subtask execution unit group corresponding to the subtask. By determining whether each execution unit in the target subtask execution unit group has been allocated to other subtasks, the situation where the same execution unit is allocated to multiple different subtasks and affects the task execution efficiency can be avoided.

[0053] Embodiment 3 of the present invention provides a graphics processing unit, specifically as Figure 5 shown, including: a task instruction acquisition module 501, which is used to acquire task instructions, and the task instructions include the operation dataset required for executing the task; a data position acquisition module 502, which is used to acquire the data storage positions of each operation data in the operation dataset to obtain a plurality of target data positions; a task allocation module 503, which is used to allocate execution units for the task according to the target data positions; and an execution unit 504, which is used to execute the allocated task.

[0054] Compared with the prior art, in the graphics processor provided in the third embodiment of the present invention, after the task instruction acquisition module 501 acquires a task instruction, it parses the task instruction to obtain the operation data set required for executing the task included in the task instruction. The data location acquisition module 502 acquires the data storage locations of the respective operation data in the operation data set. The data storage location of each operation data can be used as the target data location, so as to obtain a plurality of target data locations. Finally, the task allocation module 503 allocates execution units for the task according to the target data locations. The execution unit 504 acquires the respective operation data required for executing the task from the target data locations, and finally performs corresponding operations according to these operation data to complete the task assigned by the task instruction. Since the execution unit 504 is allocated according to the storage location of the operation data, the transfer efficiency during the process of transferring data from the storage device to the execution unit can be improved, thereby improving the execution efficiency of the GPU for tasks.

[0055] Further, in some embodiments of the present invention, the task allocation module 503 includes an execution unit number acquisition sub-module 505 and a task allocation sub-module 506. Among them, the execution unit number acquisition sub-module 505 is used to acquire the number of execution units required for executing the task; the task allocation sub-module 506 is used to construct a number of execution unit groups according to the number of execution units. Each execution unit group includes the number of execution units required for the task. The execution unit group with the smallest sum of distances to each target data location is acquired as the target execution unit group, and the task is allocated to each execution unit in the target execution unit group. The execution unit number acquisition sub-module 505 constructs the execution unit group according to the number of execution units required for executing the instruction task. The task allocation sub-module 506 takes the execution unit group with the smallest sum of distances to each target data location as the target execution unit group, thereby reducing the data transfer distance between the target execution unit group and each target data location, and further improving the data transfer efficiency. The improvement of the data transfer efficiency drives the overall improvement of the task execution efficiency.

[0056] Further, in some other embodiments of the present invention, the task allocation module 503 further includes a task splitting sub-module 507; the task splitting sub-module 507 is used to split the task to obtain a number of subtasks; the task allocation sub-module 506 is further used to acquire the task data required for each subtask from the operation data set to form a sub-data set. The sub-data set corresponds to the subtask one by one. The storage locations of the operation data in each sub-data set are acquired as sub-data locations, and execution units are allocated for each subtask according to the sub-data locations.

[0057] It is not difficult to find that Embodiment 3 of the present invention is an embodiment of the device corresponding to Embodiment 1 and Embodiment 2 of the present invention. Therefore, the technical details and technical content in Embodiment 3 of the present invention can also be applied to Embodiment 1 and Embodiment 2, and have the same technical effects as Embodiment 1. Similarly, the technical details and technical content in Embodiment 1 and Embodiment 2 of the present invention can also be applied to this Embodiment 3 and have the same technical effects, which will not be elaborated here.

[0058] Embodiment 4 of the present application provides an electronic device, as Figure 6 shown, including: at least one graphics processor 601; and a memory 602 communicatively connected to the at least one graphics processor 601; wherein, the memory 602 stores instructions executable by the at least one graphics processor 601, and the instructions are executed by the at least one graphics processor 601 so that the at least one graphics processor 601 can execute the task execution method as described above.

[0059] Among them, the memory 602 can be a Read-Only Memory (ROM), a Random Access Memory (RAM), or other memories 602. In the embodiments of the present application, the memory 602 is used to store data, various algorithms, and commands, such as the algorithm for determining the IO voltage (current) range in the embodiments of the present application, as well as the entire process and final results.

[0060] In the embodiments of the present application, the memory 602 can include physical devices for storing information, usually storing information after digitization and then using media such as electricity, magnetism, or optics. The memory 602 of this embodiment can also include: devices for storing information using electrical energy, such as RAM and ROM; devices for storing information using magnetic energy, such as hard disks, floppy disks, magnetic tapes, magnetic core memories 602, magnetic bubble memories 602, and USB flash drives; devices for storing information using optical methods, such as CDs or DVDs. Of course, there are also other types of memories 602, such as quantum memories 602 and graphene memories 602, etc.

[0061] The graphics processor 601 is configured to read a computer program from the memory 602 and execute the computer program to implement the task execution method provided in the foregoing embodiments.

[0062] Embodiment 5 of the present application provides a computer storage medium, on which a computer program is stored, and when the computer program is executed by a graphics processor, it can implement the methods of any of the embodiments included in the method of obtaining a drive signal as described above.

[0063] In several embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of this application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and a module, a program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0064] In addition, each functional module in various embodiments of this application may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.

[0065] If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of this application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0066] The above are only the embodiments of this application and are not used to limit the protection scope of this application. For those skilled in the art, this application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included in the protection scope of this application. It should be noted that similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0067] The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

[0068] It should be noted that, in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including an..." does not exclude the existence of another identical element in the process, method, article or device including the element.

Claims

1. A task execution method, characterized in that, it is applied to a graphics processing unit, and the graphics processing unit includes a plurality of execution units for executing arithmetic tasks, and the method includes: Obtain a task instruction, where the task instruction includes an arithmetic data set required for executing the task; Obtain the data storage locations of each arithmetic data in the arithmetic data set to obtain a plurality of target data locations; Allocate an execution unit for the task according to the target data location; The allocating an execution unit for the task according to the target data location includes: Obtain the execution unit with the smallest sum of distances from each of the target data locations as the target execution unit; Allocate the task to the target execution unit.

2. The method according to claim 1, characterized in that, the allocating an execution unit for the task according to the target data location includes: Obtain the number of execution units required for executing the task; Construct a number of execution unit groups according to the number of execution units, and each execution unit group includes the number of execution units; Obtain the execution unit group with the smallest sum of distances from each of the target data locations as the target execution unit group; Allocate the task to each execution unit in the target execution unit group.

3. The method according to claim 1, characterized in that, the allocating an execution unit for the task according to the target data location includes: Split the task to obtain a number of subtasks; Obtain the task data required for each subtask from the arithmetic data set to form a sub-data set, where the sub-data set corresponds to the subtask one by one, and obtain the storage locations of the arithmetic data in each sub-data set as sub-data locations; Allocate an execution unit for each subtask according to the sub-data location.

4. The method according to claim 3, characterized in that, the allocating an execution unit for each subtask according to the sub-data location includes: For any one of the subtasks, obtain the sub-data set corresponding to the subtask as the target sub-data set; Obtain the execution unit with the smallest sum of distances from the sub-data locations of the task data in the target sub-data set as the subtask execution unit corresponding to the subtask; Allocate the subtask to the subtask execution unit.

5. The method according to claim 4, characterized in that, the allocating an execution unit for each subtask according to the sub-data location includes: For any one of the subtasks, obtain the number of execution units required for the subtask as the subtask execution unit number; Construct a number of execution unit groups in the graphics processing unit according to the subtask execution unit number; Obtain the execution unit group with the smallest sum of distances from the sub-data locations of the task data in the target sub-data set as the target subtask execution unit group corresponding to the subtask; Allocate the subtask to each execution unit in the target subtask execution unit group.

6. The method according to claim 5, characterized in that, before the allocating the subtask to each execution unit in the target subtask execution unit group, the method further includes: Determine whether each execution unit in the target subtask execution unit group is assigned to other subtasks; If any execution unit in the target subtask execution unit group is assigned to other subtasks, after removing the execution unit assigned to other subtasks, re-obtain the target subtask execution unit group.

7. A graphics processor, characterized in that, comprising: a plurality of execution units for executing arithmetic tasks; a task instruction acquisition module, the task instruction acquisition module is used to acquire task instructions, and the task instructions include an arithmetic data set required for executing the task; a data location acquisition module, the data location acquisition module is used to acquire the data storage locations of each arithmetic data in the arithmetic data set to obtain a plurality of target data locations; a task allocation module, the task allocation module includes an execution unit number acquisition sub-module and a task allocation sub-module; the execution unit number acquisition sub-module is used to acquire the number of execution units required for executing the task; the task allocation sub-module is used to construct a number of execution unit groups according to the number of execution units, the execution unit group includes the execution units of the number of execution units, acquire the execution unit group with the smallest sum of distances from each of the target data locations as the target execution unit group, and allocate the task to each execution unit in the target execution unit group.

8. The graphics processor according to claim 7, characterized in that, the task allocation module includes a task splitting sub-module and a task allocation sub-module; the task splitting sub-module is used to split the task to obtain a number of subtasks; the task allocation sub-module is used to acquire the task data required for each subtask from the arithmetic data set to form a sub-data set, the sub-data set corresponds to the subtask one by one, acquire the storage locations of the arithmetic data in each sub-data set as sub-data locations, and allocate execution units for each subtask according to the sub-data locations.

9. An electronic device, characterized in that, comprising: at least one graphics processor; and a memory communicatively connected to the at least one graphics processor; wherein, the memory stores tasks executable by the at least one graphics processor, and the tasks are executed by the at least one graphics processor so that the at least one graphics processor can execute the task execution method according to any one of claims 1 to 6.

10. A computer-readable storage medium storing a computer program, characterized in that, the computer program is executed by a graphics processor to implement the task execution method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Task execution method and storage device

    CN113821311A