Data processing method and related device
By configuring dynamic task queues and signal tasks on the hardware scheduler of the AI chip, splitting large networks into multiple logical queues realizes the function of saving more networks in the AI chip, solves the problem of AI chip hardware performance limitations, and improves performance and storage efficiency.
Patent Information
- Application Number
- CN202410204554.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-24
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-02-24
AI Technical Summary
When the AI chip processes the task queue, due to limited hardware performance, it cannot save overly large networks and too many networks at the same time. As a result, it takes a long time for the host to dispatch tasks to the AI chip, affecting overall performance.
By configuring the address of the dynamic configuration task queue on the hardware scheduler, and using the method of releasing signal tasks and waiting for signal tasks, a large network is divided into sub-networks, stored in multiple logical queues, and through setting tasks and releasing signal tasks. Sequential execution enables tasks in multiple physical queues to be executed in a specified order, increasing the size and number of networks that the AI chip can save.
Without changing the hardware design of the AI chip, the size and number of networks that can be stored in the AI chip are greatly increased, hardware costs are reduced, and the impact of host dispatch time on overall performance is optimized.
Smart Images

Figure CN118051334B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electronic digital data processing, and in particular to a data processing method and related devices. Background Art
[0002] Artificial Intelligence (AI) chips generally use parallel architecture design to achieve high performance. It takes some time for the host to dispatch tasks to the AI chip. In order to optimize the impact of the host dispatch time on the performance of the AI chip, many tasks, that is, a network, are often dispatched as a whole and saved to the AI chip, which greatly reduces the impact of the host dispatch time. However, due to the limitations of the AI chip hardware scheduler, the size and number of networks that can be stored in the AI chip are limited. Summary of the invention
[0003] In view of this, the present application provides a data processing method and related devices, which innovatively configure the artificial intelligence chip in hardware and also perform corresponding innovative data processing methods in execution, which can greatly increase the size of the network that can be stored in the AI chip, and the hardware cost is relatively low.
[0004] In a first aspect, an embodiment of the present application provides a data processing method, which is applied to an artificial intelligence chip, wherein the artificial intelligence chip includes a hardware scheduler, wherein the hardware scheduler is configured to support dynamic configuration of an address in a task queue during execution, and the configuration can be encapsulated into a task; the hardware scheduler is configured to support a release signal task and a wait signal task, wherein the wait signal task is executed after the release signal task is executed; the method includes:
[0005] If the size of the first to-be-processed network is greater than the preset queue capacity and less than or equal to two of the preset queue capacities, split the first to-be-processed network into a first to-be-processed sub-network and a second to-be-processed sub-network, and the size of the first to-be-processed sub-network and the size of the second to-be-processed sub-network are less than or equal to the preset queue capacities;
[0006] storing a first task set in a first logic queue, wherein the first task set includes, in sequence, a first waiting signal task, the first to-be-processed subnetwork, and a second release signal task; and storing a second task set in a second logic queue, wherein the second task set includes, in sequence, a third waiting signal task, the second to-be-processed subnetwork, and a fourth release signal task;
[0007] The third task set is stored in the first physical queue, and the third task set includes a first setting task, a first release signal task, a second wait signal task, a second setting task, a third release signal task and a fourth wait signal task in sequence, the first setting task is used to set the first logical queue to the second physical queue, the second setting task is used to set the second logical queue to the second physical queue, the execution order of the first wait signal task is one place after the execution order of the first release signal task, the execution order of the second wait signal task is one place after the execution order of the second release signal task, the execution order of the third wait signal task is one place after the execution order of the third release signal task, and the execution order of the fourth wait signal task is one place after the execution order of the fourth release signal task.
[0008] In a second aspect, an embodiment of the present application provides a data processing device, which is applied to an artificial intelligence chip, wherein the artificial intelligence chip includes a hardware scheduler, wherein the hardware scheduler is configured to support dynamic configuration of an address in a task queue during execution, and the configuration can be encapsulated into a task; the hardware scheduler is configured to support a release signal task and a wait signal task, wherein the wait signal task is executed after the release signal task is executed; the device includes:
[0009] for splitting the first to-be-processed network into a first to-be-processed sub-network and a second to-be-processed sub-network if the size of the first to-be-processed network is greater than a preset queue capacity and less than or equal to two of the preset queue capacities, wherein the size of the first to-be-processed sub-network and the size of the second to-be-processed sub-network are less than or equal to the preset queue capacities;
[0010] A first scheduling unit is configured to store a first task set in a first logic queue, wherein the first task set sequentially includes a first waiting signal task, the first to-be-processed subnetwork, and a second release signal task; and store a second task set in a second logic queue, wherein the second task set sequentially includes a third waiting signal task, the second to-be-processed subnetwork, and a fourth release signal task;
[0011] The second scheduling unit is used to store the third task set in the first physical queue, and the third task set includes a first setting task, a first release signal task, a second wait signal task, a second setting task, a third release signal task and a fourth wait signal task in sequence. The first setting task is used to set the first logical queue to the second physical queue, and the second setting task is used to set the second logical queue to the second physical queue. The execution order of the first wait signal task is one place after the execution order of the first release signal task, the execution order of the second wait signal task is one place after the execution order of the second release signal task, the execution order of the third wait signal task is one place after the execution order of the third release signal task, and the execution order of the fourth wait signal task is one place after the execution order of the fourth release signal task.
[0012] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps of any method in the first aspect of the embodiment of the present application.
[0013] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in any method of the first aspect of the embodiment of the present application.
[0014] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiment of the present application. The computer program product may be a software installation package.
[0015] It can be seen that the above-mentioned data processing method and related devices are applied to an artificial intelligence chip, and the artificial intelligence chip includes a hardware scheduler, and the hardware scheduler is configured to support dynamic configuration of the address in the task queue during execution, and the configuration can be encapsulated into a task; the hardware scheduler is configured to support a release signal task and a wait signal task, and the wait signal task is executed after the release signal task is executed; if the size of the first network to be processed is greater than the preset queue capacity and less than or equal to the two preset queue capacities, the first network to be processed is split into a first sub-network to be processed and a second sub-network to be processed, and the size of the first sub-network to be processed and the size of the second sub-network to be processed are less than or equal to the preset queue capacity; the first task set is stored in the first logical queue, and the first task set includes the first wait signal task, the first sub-network to be processed, and the second release signal task in sequence; and the second task set is stored in the second logical queue , the second task set includes the third waiting signal task, the second to-be-processed sub-network and the fourth release signal task in sequence; the third task set is stored in the first physical queue, the third task set includes the first setting task, the first release signal task, the second waiting signal task, the second setting task, the third release signal task and the fourth waiting signal task in sequence, the first setting task is used to set the first logical queue to the second physical queue, the second setting task is used to set the second logical queue to the second physical queue, the execution order of the first waiting signal task is one place after the execution order of the first release signal task, the execution order of the second waiting signal task is one place after the execution order of the second release signal task, the execution order of the third waiting signal task is one place after the execution order of the third release signal task, and the execution order of the fourth waiting signal task is one place after the execution order of the fourth release signal task. Two physical queues can be used to accommodate networks of any size, which greatly increases the size of the network that can be stored in the AI chip, and the hardware cost is low. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0017] Figure 1 A system architecture diagram of a data processing method provided in an embodiment of the present application;
[0018] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0019] Figure 3 A flowchart of a data processing method provided in an embodiment of the present application;
[0020] Figure 4 A visual schematic diagram of a data processing method provided in an embodiment of the present application;
[0021] Figure 5 A flowchart of another data processing method provided in an embodiment of the present application;
[0022] Figure 6 A visual schematic diagram of another data processing method provided in an embodiment of the present application;
[0023] Figure 7 A block diagram of the functional units of a data processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0026] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article indicates that the associated objects before and after are in an "or" relationship. The "plurality" appearing in the embodiments of the present application refers to two or more.
[0027] In the embodiments of the present application, "at least one item" or similar expressions refer to any combination of these items, including any combination of single items or plural items, and refer to one or more, and multiple refers to two or more. For example, at least one item of a, b, or c can represent the following seven situations: a, b, c, a and b, a and c, b and c, a, b, and c. Among them, each of a, b, and c can be an element or a set containing one or more elements.
[0028] The "connection" that appears in the embodiments of the present application refers to various connection methods such as direct connection or indirect connection to achieve communication between devices, and the embodiments of the present application do not impose any limitations on this.
[0029] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0030] The following is an explanation of the relevant contents, concepts, meanings, technical issues, technical solutions, beneficial effects, etc. involved in the embodiments of the present application.
[0031] At present, when AI chips process one or more task queues, they will use a first-in-first-out method to execute tasks in the task queues. In order to improve performance, a parallel architecture is generally adopted. However, it still takes some dispatch time for the host to dispatch tasks to the AI chip. When the dispatched tasks are small and numerous, these dispatch times have a greater impact on the overall performance. In order to optimize the impact of dispatch time on the overall performance, many tasks are often packaged into a network, and the network is dispatched as a whole and saved to the AI chip. As the number of dispatches decreases, the dispatch time is significantly reduced.
[0032] However, the hardware performance of AI chips themselves is limited, and they cannot store networks that are too large or too many networks at the same time.
[0033] To solve the above problems, the embodiments of the present application provide a data processing method and related devices, which can greatly increase the size of the network stored in the AI chip without changing the hardware design of the AI chip. Furthermore, it can also greatly increase the number of networks that can be stored in the AI chip.
[0034] Combine the following Figure 1 The system architecture of a data processing method provided in an embodiment of the present application is described. Figure 1A system architecture diagram of a data processing method provided in an embodiment of the present application, wherein the architecture is applied to an AI chip 100 and includes a hardware scheduler 110.
[0035] The hardware scheduler 110 is configured to execute tasks in the task queue in a round-robin manner, that is, tasks in the same task queue are executed sequentially; the hardware scheduler 110 is configured to allow tasks in multiple physical queues to be executed in a specified order.
[0036] Specifically, a release signal task can be set in physical queue 1, and a wait signal task can be set in physical queue 2. The wait signal task can only be executed after the release signal task is completed. In this way, tasks in multiple physical queues can be executed in a specified order.
[0037] The hardware scheduler 110 may support dynamic configuration of the address of the task queue, that is, the hardware scheduler 110 may set another storage address as a physical queue during operation, and this setting operation may be executed by the hardware scheduler 110 as a task.
[0038] The AI chip of the embodiment of the present application may include two physical queues and multiple logical queues. The physical queues can be understood as queues of tasks being executed, and the logical queues can be understood as queues of tasks to be executed.
[0039] Combine the following Figure 2 The electronic device in the embodiment of the present application is described. Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the electronic device includes one or more processors 210, a memory 220, a communication module 230, and one or more programs 221. The processor 210 is connected to the memory 220 and the communication module 230 through an internal communication bus. The electronic device 200 is equipped with an AI chip 100.
[0040] The one or more programs 221 are stored in the memory 220 and configured to be executed by the processor 210. The one or more programs 221 include instructions for executing any step in the method embodiment.
[0041] Among them, the processor 210 can be, for example, a central processing unit (CPU), a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, units and circuits described in conjunction with the disclosure of this application. The processor 210 can also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The communication unit can be a communication module 230, a transceiver, a transceiver circuit, etc., and the storage unit can be a memory 220.
[0042] The memory 220 may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0043] It is understandable that the electronic device 200 may include more or fewer structural elements than those in the above structural block diagram, for example, including a power module, physical buttons, Wi-Fi module, speaker, Bluetooth module, sensor, display module, projection module, etc., which are not limited here. It is understandable that the electronic device 200 may be a device equipped with the AI chip in the embodiment of the present application, which is not specifically limited here.
[0044] After understanding the software and hardware architecture of the embodiment of the present application, Figure 3 A data processing method in an embodiment of the present application is described. Figure 3 A flowchart of a data processing method provided in an embodiment of the present application specifically includes the following steps:
[0045] Step 301: If the size of the first to-be-processed network is larger than a preset queue capacity and smaller than or equal to two of the preset queue capacities, split the first to-be-processed network into a first to-be-processed sub-network and a second to-be-processed sub-network.
[0046] The size of the first to-be-processed sub-network and the size of the second to-be-processed sub-network are less than or equal to the preset queue capacity. The preset queue capacity may be determined by the carrying upper limit of a logical queue.
[0047] Among them, the first network to be processed may include multiple tasks to be processed, the multiple tasks to be processed are arranged in a first order, the first sub-network to be processed includes the first part of the multiple tasks to be processed, the second sub-network to be processed includes the second part of the multiple tasks to be processed, the first part is arranged in the first order, the second part is arranged in the first order, and the second part is located after the first part. It can be understood that when splitting the first network to be processed, the order of the tasks therein is not changed, but it is divided into two parts, so that the size of the first sub-network to be processed is less than or equal to the preset queue capacity, and the size of the second sub-network to be processed is less than or equal to the preset queue capacity.
[0048] It should be noted that the case where the size of the first network to be processed is less than or equal to the capacities of two preset queues is limited here. When the size of the first network to be processed is greater than the capacities of two preset queues and less than or equal to the capacities of three preset queues, the first network to be processed can be split into three sub-networks to be processed, and the size of each sub-network to be processed is also less than or equal to the capacities of the preset queues, and so on. The splitting method in which the size of the first network to be processed is greater than the capacities of three preset queues and less than or equal to the capacities of four preset queues is not repeated here.
[0049] It can be seen that in this way, when the first network to be processed is relatively large, the first network to be processed can be split into multiple parts, so as to facilitate subsequent task storage and execution.
[0050] Step 302: store the first task set in a first logical queue, and store the second task set in a second logical queue.
[0051] Among them, the first task set includes the first waiting signal task, the first to be processed sub-network and the second release signal task in sequence, and the second task set includes the third waiting signal task, the second to be processed sub-network and the fourth release signal task in sequence. The first waiting signal task needs to wait for the completion of the first release signal task before it can be executed, and the third waiting signal task can only be executed after the third waiting signal task is executed, and the fourth waiting signal task can only be executed after the fourth release signal task is executed.
[0052] It can be understood that the first logical queue and the second logical queue have not been set to the physical queue, so the tasks in the first logical queue and the second logical queue will not be executed.
[0053] In a possible embodiment, a second number of logical queues can be applied for according to the size of the network to be processed and the preset queue capacity, and the second number is the quotient of the size of the network to be processed and the preset queue capacity rounded up. For example, if the size of the network to be processed is x and the preset queue capacity is x, three logical queues can be applied for storing the network to be processed divided into three parts. In this way, the accurate number of logical queues can be determined to save storage space.
[0054] It should be noted that the case where the size of the first network to be processed is less than or equal to the capacities of two preset queues is limited here. When the size of the first network to be processed is greater than the capacities of two preset queues and less than or equal to the capacities of three preset queues, the three split sub-networks to be processed can be placed in three logical queues respectively, and so on. The storage method of the case where the size of the first network to be processed is greater than the capacities of three preset queues and less than or equal to the capacities of four preset queues is not repeated here.
[0055] It can be seen that storing the first task set in the first logical queue and storing the second task set in the second logical queue can provide support for the subsequent execution of the large network in a specified order.
[0056] Step 303: store the third task set into the first physical queue.
[0057] Among them, the third task set includes a first setting task, a first release signal task, a second wait signal task, a second setting task, a third release signal task and a fourth wait signal task in sequence, the first setting task is used to set the first logical queue to the second physical queue, the second setting task is used to set the second logical queue to the second physical queue, the execution order of the first wait signal task is one place after the execution order of the first release signal task, the execution order of the second wait signal task is one place after the execution order of the second release signal task, the execution order of the third wait signal task is one place after the execution order of the third release signal task, and the execution order of the fourth wait signal task is one place after the execution order of the fourth release signal task.
[0058] It can be understood that since the first task of the first logical queue is the first waiting signal task, when the first logical queue is set to the second physical queue, it is still necessary to wait for the first release signal task in the first physical queue to be completed before starting to execute the tasks in the second physical queue. Specifically, the tasks in the first physical queue and the second physical queue are executed in the order of the first setting task, the first release signal task, the first waiting signal task, the first sub-network to be processed, the second release signal task, the second waiting signal task, the second setting task, the third release signal task, the third waiting signal task, the second sub-network to be processed, the fourth release signal task and the fourth waiting signal task.
[0059] It should be noted that since the hardware scheduler can only determine the status of tasks in the physical queue, and the logical queue of the second task set may not have been set as a physical queue, it is necessary to add a fourth release signal task and a fourth wait signal task. By judging the status of the fourth wait signal task, it is possible to determine whether the entire network has been executed.
[0060] For ease of understanding, the following Figure 4 For example, first, in logical queue 1, wait signal task 1, the first part of the network, and release signal task 2 are dispatched in sequence; in logical queue 2, wait signal task 3, the second part of the network, and release signal task 4 are dispatched in sequence; in logical queue N, wait signal task α, the Nth part of the network, and release signal task β are dispatched. This is until all network contents are placed in the logical queue.
[0061] Then, in physical queue 1, setup task 1 is dispatched to set logical queue 1 to physical queue 2, and then a release signal task 1 is dispatched corresponding to the wait signal task 1 in logical queue 1, and then a wait signal task 2 is dispatched corresponding to the release signal task 2 in logical queue 1; further, setup task 2 is continued to be dispatched in physical queue 1 to set logical queue 2 to physical queue 2, and then a release signal task 3 is dispatched corresponding to the wait signal task 3 in logical queue 2, and then a wait signal task 4 is dispatched corresponding to the release signal task 4 in logical queue 2; and so on, setup task N is continued to be dispatched to set logical queue N to physical queue 2, and then a release signal task α is dispatched corresponding to the wait signal task α in logical queue N, and then a wait signal task β is dispatched corresponding to the release signal task β in logical queue N; until all logical queues of the network are set to the physical queues, and the accurate execution of the large network is completed.
[0062] It can be seen that through the above method, even for overly large networks, only two physical queues need to be occupied, which greatly increases the size of the network that can be stored in the AI chip, and the hardware cost is relatively low.
[0063] Combine the following Figure 5 Another data processing method in the embodiment of the present application is described. Figure 5 A flowchart of another data processing method provided in an embodiment of the present application specifically includes the following steps:
[0064] Step 501: if the size of the first network to be processed and the size of the second network to be processed are both less than or equal to the preset queue capacity, the fourth task set is stored in the first logical queue, and the fifth task set is stored in the second logical queue.
[0065] Among them, the fourth task set includes the first waiting signal task, the first to-be-processed network and the second release signal task in sequence; the fifth task set includes the third waiting signal task, the second to-be-processed network and the fourth release signal task in sequence.
[0066] Among them, the first network to be processed includes multiple first tasks to be processed, and the multiple first tasks to be processed are arranged in a third order; the second network to be processed includes multiple second tasks to be processed, and the multiple second tasks to be processed are arranged in a fourth order; the priority of the second network to be processed is located after the priority of the first network to be processed.
[0067] It can be understood that the first logical queue and the second logical queue have not been set to the physical queue, so the tasks in the first logical queue and the second logical queue will not be executed.
[0068] In a possible embodiment, a first number of logical queues can be applied according to the number of networks to be processed, and the first number is equal to the number of networks to be processed. For example, if the number of networks to be processed is y, y logical queues can be applied to store the y networks to be processed respectively. In this way, the accurate number of logical queues can be determined, saving storage space.
[0069] It should be noted that the number of networks to be processed is limited to 2 here. When the number of networks to be processed is 3, the three networks to be processed can be put into three logical queues respectively, and so on, which will not be repeated here.
[0070] It can be seen that if the size of the first network to be processed and the size of the second network to be processed are both less than or equal to the preset queue capacity, storing the fourth task set in the first logical queue and storing the fifth task set in the second logical queue can provide support for the subsequent execution of multiple networks in a specified order.
[0071] Step 502: store the sixth task set into the first physical queue.
[0072] Among them, the sixth task set includes the first setting task, the first release signal task, the second wait signal task, the second setting task, the third release signal task and the fourth wait signal task in sequence.
[0073] Among them, the first setting task is used to set the first logical queue to the second physical queue, the second setting task is used to set the second logical queue to the second physical queue, the execution order of the first wait-for-signal task is one place after the execution order of the first release-signal task, the execution order of the second wait-for-signal task is one place after the execution order of the second release-signal task, the execution order of the third wait-for-signal task is one place after the execution order of the third release-signal task, and the execution order of the fourth wait-for-signal task is one place after the execution order of the fourth release-signal task.
[0074] Among them, the tasks in the first physical queue and the second physical queue are executed in the order of the first setting task, the first release signal task, the first waiting signal task, the first network to be processed, the second release signal task, the second waiting signal task, the second setting task, the third release signal task, the third waiting signal task, the second network to be processed, the fourth release signal task and the fourth waiting signal task.
[0075] For ease of understanding, the following Figure 6For example, first, in logic queue 1, wait signal task 1, the first network, and release signal task 2 are dispatched in sequence; in logic queue 2, wait signal task 3, the second network, and release signal task 4 are dispatched in sequence; in logic queue N, wait signal task α, the Nth network, and release signal task β are dispatched. This continues until all networks are placed in the logic queues.
[0076] Then, in physical queue 1, setup task 1 is dispatched to set logical queue 1 to physical queue 2, and then a release signal task 1 is dispatched corresponding to the wait signal task 1 in logical queue 1, and then a wait signal task 2 is dispatched corresponding to the release signal task 2 in logical queue 1; further, setup task 2 is continued to be dispatched in physical queue 1 to set logical queue 2 to physical queue 2, and then a release signal task 3 is dispatched corresponding to the wait signal task 3 in logical queue 2, and then a wait signal task 4 is dispatched corresponding to the release signal task 4 in logical queue 2; and so on, setup task N is continued to be dispatched to set logical queue N to physical queue 2, and then a release signal task α is dispatched corresponding to the wait signal task α in logical queue N, and then a wait signal task β is dispatched corresponding to the release signal task β in logical queue N; until all logical queues of the network are set to the physical queue, and accurate execution of multiple networks is completed.
[0077] It can be seen that through the above method, only two physical queues need to be occupied for too many networks, which can greatly increase the number of networks that can be stored in the AI chip, and the hardware cost is low.
[0078] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to realize the above functions, the electronic device includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0079] The embodiment of the present application can divide the electronic device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0080] In the case of dividing each functional module into corresponding functional modules, Figure 7 A functional unit composition block diagram of a data processing device provided in an embodiment of the present application is applied to an artificial intelligence chip, wherein the artificial intelligence chip includes a hardware scheduler, wherein the hardware scheduler is configured to support dynamic configuration of addresses in a task queue during execution, and the configuration can be encapsulated into a task; the hardware scheduler is configured to support a release signal task and a wait signal task, wherein the wait signal task is executed after the release signal task is executed; the data processing device 700 includes:
[0081] A splitting unit 710 is configured to split the first to-be-processed network into a first to-be-processed sub-network and a second to-be-processed sub-network if the size of the first to-be-processed network is greater than a preset queue capacity and is less than or equal to two of the preset queue capacities, wherein the size of the first to-be-processed sub-network and the size of the second to-be-processed sub-network are less than or equal to the preset queue capacities;
[0082] The first scheduling unit 720 is used to store a first task set in a first logical queue, wherein the first task set includes, in sequence, a first waiting signal task, the first to-be-processed subnetwork, and a second release signal task; and store a second task set in a second logical queue, wherein the second task set includes, in sequence, a third waiting signal task, the second to-be-processed subnetwork, and a fourth release signal task;
[0083] The second scheduling unit 730 is used to store the third task set in the first physical queue, and the third task set includes a first setting task, a first release signal task, a second wait signal task, a second setting task, a third release signal task and a fourth wait signal task in sequence. The first setting task is used to set the first logical queue to the second physical queue, and the second setting task is used to set the second logical queue to the second physical queue. The execution order of the first wait signal task is one place after the execution order of the first release signal task, the execution order of the second wait signal task is one place after the execution order of the second release signal task, the execution order of the third wait signal task is one place after the execution order of the third release signal task, and the execution order of the fourth wait signal task is one place after the execution order of the fourth release signal task.
[0084] It can be seen that through the above-mentioned data processing method and related devices, first, it is applied to an artificial intelligence chip, and the artificial intelligence chip includes a hardware scheduler, and the hardware scheduler is configured to support dynamic configuration of the address in the task queue during execution, and the configuration can be encapsulated into a task; the hardware scheduler is configured to support a release signal task and a wait signal task, and the wait signal task is executed after the release signal task is executed; if the size of the first to-be-processed network is greater than the preset queue capacity and is less than or equal to the two preset queue capacities, the first to-be-processed network is split into a first to-be-processed sub-network and a second to-be-processed sub-network, and the size of the first to-be-processed sub-network and the size of the second to-be-processed sub-network are less than or equal to the preset queue capacity; the first task set is stored in the first logical queue, and the first task set includes the first wait signal task, the first to-be-processed sub-network and the second release signal task in sequence; and the second task set is stored in the second logical queue The second task set includes the third waiting signal task, the second to-be-processed sub-network and the fourth release signal task in sequence; the third task set is stored in the first physical queue, the third task set includes the first setting task, the first release signal task, the second waiting signal task, the second setting task, the third release signal task and the fourth waiting signal task in sequence, the first setting task is used to set the first logical queue to the second physical queue, the second setting task is used to set the second logical queue to the second physical queue, the execution order of the first waiting signal task is one place after the execution order of the first release signal task, the execution order of the second waiting signal task is one place after the execution order of the second release signal task, the execution order of the third waiting signal task is one place after the execution order of the third release signal task, and the execution order of the fourth waiting signal task is one place after the execution order of the fourth release signal task. Two physical queues can be used to accommodate networks of any size, which greatly increases the size of the network that can be stored in the AI chip, and the hardware cost is low.
[0085] In a possible embodiment, the first scheduling unit 720 is also used to: if the size of the first network to be processed and the size of the second network to be processed are both less than or equal to the preset queue capacity, store the fourth task set in the first logical queue, the fourth task set sequentially including the first waiting signal task, the first network to be processed and the second release signal task; and store the fifth task set in the second logical queue, the fifth task set sequentially including the third waiting signal task, the second network to be processed and the fourth release signal task; the second scheduling unit 730 is also used to: store the sixth task set in the first physical queue, the sixth task set sequentially including the first setting task, the first release signal task, the second waiting signal task, the second setting task, the third release signal task and the fourth waiting signal task.
[0086] It can be seen that through the above-mentioned data processing method and related devices, the size of the network stored in the AI chip can be greatly increased without changing the hardware design of the AI chip. Furthermore, the number of networks that can be stored in the AI chip can be greatly increased.
[0087] It should be noted that the specific implementation of each operation can adopt the corresponding description of the method embodiment shown above, and the data processing device 700 can be used to execute the above method embodiment of the present application, which will not be described in detail.
[0088] An embodiment of the present application also provides a chip, including a processor, a memory, and a computer program or instructions stored in the memory, wherein the processor executes the computer program or instructions to implement the steps described in the above method embodiment.
[0089] An embodiment of the present application also provides a chip module, including a transceiver component and a chip, the chip including a processor, a memory and a computer program or instructions stored in the memory, wherein the processor executes the computer program or instructions to implement the steps described in the above method embodiment.
[0090] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps of any method recorded in the above method embodiment, and the above computer includes an electronic device.
[0091] The embodiment of the present application also provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, the computer program is operable to cause a computer to execute some or all of the steps of any method described in the method embodiment. The computer program product may be a software installation package, and the computer includes an electronic device.
[0092] It should be noted that, for the above-mentioned various embodiments, for the sake of simple description, they are all expressed as a series of action combinations. Those skilled in the art should be aware that the present application is not limited by the described order of actions, because some steps in the embodiments of the present application can be performed in other orders or simultaneously. In addition, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions, steps, modules or units involved are not necessarily required by the embodiments of the present application.
[0093] In the above embodiments, the embodiments of the present application have different focuses on the description of each embodiment. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0094] The steps of the method or algorithm described in the embodiments of the present application can be implemented in hardware or by executing software instructions by a processor. The software instructions can be composed of corresponding software modules, and the software modules can be stored in RAM, flash memory, ROM, EPROM, electrically erasable programmable read-only memory (electrically EPROM, EEPROM), registers, hard disks, mobile hard disks, read-only compact disks (CD-ROMs) or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a terminal device or a management device. Of course, the processor and the storage medium can also be present in a terminal device or a management device as discrete components.
[0095] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server, or data center to another website site, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0096] The modules / units included in the devices and products described in the above embodiments may be software modules / units or hardware modules / units, or may be partially software modules / units and partially hardware modules / units. For example, for the devices and products applied to or integrated in the chip, the modules / units included therein may all be implemented in the form of hardware such as circuits, or at least some of the modules / units may be implemented in the form of software programs, which run on the processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits; for the devices and products applied to or integrated in the chip module, the modules / units included therein may all be implemented in the form of hardware such as circuits, and different modules / units may be located in the same component (such as a chip, circuit module, etc.) or in different components of the chip module, or at least some of the modules / units may be implemented in the form of software programs. The software programs run on the processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits. It is implemented in the form of a software program, which runs on a processor integrated inside the chip module, and the remaining (if any) modules / units can be implemented in hardware such as circuits; for various devices and products applied to or integrated in the terminal equipment, the various modules / units contained therein can be implemented in hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or in different components in the terminal equipment, or, at least some modules / units can be implemented in the form of a software program, which runs on a processor integrated inside the terminal equipment, and the remaining (if any) modules / units can be implemented in hardware such as circuits.
[0097] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of the embodiments of the present application. It should be understood that the above description is only the specific implementation method of the embodiments of the present application and is not intended to limit the protection scope of the embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the embodiments of the present application should be included in the protection scope of the embodiments of the present application.
Claims
1. A data processing method, characterized in that: Applied to an artificial intelligence chip, the artificial intelligence chip includes a hardware scheduler, the hardware scheduler is configured to support dynamic configuration of addresses in a task queue during execution, and the configuration can be encapsulated into a task; The hardware scheduler is configured to support a release signal task and a wait signal task, wherein the wait signal task is executed after the release signal task is executed; the method comprises: If the size of the first to-be-processed network is greater than the preset queue capacity and less than or equal to two of the preset queue capacities, split the first to-be-processed network into a first to-be-processed sub-network and a second to-be-processed sub-network, and the size of the first to-be-processed sub-network and the size of the second to-be-processed sub-network are less than or equal to the preset queue capacities; storing a first task set in a first logic queue, wherein the first task set includes, in sequence, a first waiting signal task, the first to-be-processed subnetwork, and a second release signal task; and storing a second task set in a second logic queue, wherein the second task set includes, in sequence, a third waiting signal task, the second to-be-processed subnetwork, and a fourth release signal task; The third task set is stored in the first physical queue, and the third task set includes a first setting task, a first release signal task, a second wait signal task, a second setting task, a third release signal task and a fourth wait signal task in sequence, the first setting task is used to set the first logical queue to the second physical queue, the second setting task is used to set the second logical queue to the second physical queue, the execution order of the first wait signal task is one place after the execution order of the first release signal task, the execution order of the second wait signal task is one place after the execution order of the second release signal task, the execution order of the third wait signal task is one place after the execution order of the third release signal task, and the execution order of the fourth wait signal task is one place after the execution order of the fourth release signal task.
2. The method according to claim 1, characterized in that: The method further comprises: If the size of the first to-be-processed network and the size of the second to-be-processed network are both less than or equal to the preset queue capacity, storing a fourth task set in the first logical queue, the fourth task set sequentially including the first waiting signal task, the first to-be-processed network, and the second release signal task; and storing a fifth task set in the second logical queue, the fifth task set sequentially including the third waiting signal task, the second to-be-processed network, and the fourth release signal task; A sixth task set is stored in the first physical queue, wherein the sixth task set sequentially includes the first setting task, the first release signal task, the second wait signal task, the second setting task, the third release signal task and the fourth wait signal task.
3. The method according to claim 1, characterized in that The method further comprises: Execute tasks in the first physical queue and the second physical queue in the order of the first setting task, the first release signal task, the first waiting signal task, the first sub-network to be processed, the second release signal task, the second waiting signal task, the second setting task, the third release signal task, the third waiting signal task, the second sub-network to be processed, the fourth release signal task and the fourth waiting signal task.
4. The method according to claim 2, characterized in that: The method further comprises: Execute tasks in the first physical queue and the second physical queue in the order of the first setting task, the first release signal task, the first waiting signal task, the first network to be processed, the second release signal task, the second waiting signal task, the second setting task, the third release signal task, the third waiting signal task, the second network to be processed, the fourth release signal task and the fourth waiting signal task.
5. The method according to claim 1, characterized in that The first network to be processed includes multiple tasks to be processed, and the multiple tasks to be processed are arranged in a first order. The first sub-network to be processed includes a first part of the multiple tasks to be processed, and the second sub-network to be processed includes a second part of the multiple tasks to be processed. The first part is arranged in the first order, and the second part is arranged in the first order, and the second part is located after the first part.
6. The method according to claim 2, characterized in that The first network to be processed includes multiple first tasks to be processed, and the multiple first tasks to be processed are arranged in a third order. The second network to be processed includes multiple second tasks to be processed, and the multiple second tasks to be processed are arranged in a fourth order. The priority of the second network to be processed is located after the priority of the first network to be processed.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Apply a first number of logical queues according to the number of networks to be processed, where the first number is equal to the number of networks to be processed; or, A second number of logical queues is applied for according to the size of the network to be processed and the preset queue capacity, where the second number is the quotient of the size of the network to be processed and the preset queue capacity rounded up.
8. A data processing device, characterized in that: Applied to an artificial intelligence chip, the artificial intelligence chip includes a hardware scheduler, the hardware scheduler is configured to support dynamic configuration of addresses in a task queue during execution, and the configuration can be encapsulated into a task; The hardware scheduler is configured to support a release signal task and a wait signal task, wherein the wait signal task is executed after the release signal task is executed; The device comprises: a splitting unit, configured to split the first to-be-processed network into a first to-be-processed sub-network and a second to-be-processed sub-network if the size of the first to-be-processed network is greater than a preset queue capacity and is less than or equal to two of the preset queue capacities, wherein the size of the first to-be-processed sub-network and the size of the second to-be-processed sub-network are less than or equal to the preset queue capacities; A first scheduling unit is configured to store a first task set in a first logic queue, wherein the first task set sequentially includes a first waiting signal task, the first to-be-processed subnetwork, and a second release signal task; and store a second task set in a second logic queue, wherein the second task set sequentially includes a third waiting signal task, the second to-be-processed subnetwork, and a fourth release signal task; The second scheduling unit is used to store the third task set in the first physical queue, and the third task set includes a first setting task, a first release signal task, a second wait signal task, a second setting task, a third release signal task and a fourth wait signal task in sequence. The first setting task is used to set the first logical queue to the second physical queue, and the second setting task is used to set the second logical queue to the second physical queue. The execution order of the first wait signal task is one place after the execution order of the first release signal task, the execution order of the second wait signal task is one place after the execution order of the second release signal task, the execution order of the third wait signal task is one place after the execution order of the third release signal task, and the execution order of the fourth wait signal task is one place after the execution order of the fourth release signal task.
9. An electronic device, characterized in that: include: A processor, a memory, and one or more programs; the one or more programs are stored in the memory and are configured to be executed by the processor, the programs comprising instructions for executing the steps in the method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The computer storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.
