CN110928833B - Adaptive algorithm operation device and adaptive algorithm operation method - Google Patents

Adaptive algorithm operation device and adaptive algorithm operation method Download PDF

Info

Publication number
CN110928833B
CN110928833B CN201911136120.3A CN201911136120A CN110928833B CN 110928833 B CN110928833 B CN 110928833B CN 201911136120 A CN201911136120 A CN 201911136120A CN 110928833 B CN110928833 B CN 110928833B
Authority
CN
China
Prior art keywords
algorithm
information
scheduling
state
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911136120.3A
Other languages
Chinese (zh)
Other versions
CN110928833A (en
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anhui Cambricon Information Technology Co Ltd
Original Assignee
Anhui Cambricon Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anhui Cambricon Information Technology Co Ltd filed Critical Anhui Cambricon Information Technology Co Ltd
Priority to CN202011570149.5A priority Critical patent/CN112905524A/en
Priority to CN201911136120.3A priority patent/CN110928833B/en
Publication of CN110928833A publication Critical patent/CN110928833A/en
Application granted granted Critical
Publication of CN110928833B publication Critical patent/CN110928833B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/76Architectures of general purpose stored program computers
    • G06F15/78Architectures of general purpose stored program computers comprising a single central processing unit

Abstract

The application relates to an algorithm self-adapting device, an algorithm self-adapting method, an operation engine, a data operation method, a self-adapting algorithm operation device and a self-adapting algorithm operation method. The algorithm self-adaptive device can match reasonable resources for the algorithm to be processed, and the problem that the algorithm execution is influenced by the dynamic balance difference in the algorithm operation process is avoided.

Description

Adaptive algorithm operation device and adaptive algorithm operation method
Technical Field
The present application relates to the field of computer equipment technology, and in particular, to an algorithm adaptive device, an algorithm adaptive method, an arithmetic engine, a data arithmetic method, an adaptive algorithm arithmetic device, and an adaptive algorithm arithmetic method.
Background
When the algorithm of the traditional arithmetic device is used, the processing flow is generally as follows: loading instructions, loading data, completing calculation, outputting results and storing data.
However, the real-world algorithm generally has the characteristics of large data volume, irregular data structure and large calculation amount; moreover, in actual operation, the area, power consumption, packaging technology, etc. of the operation device are limited, and the internal storage unit, the internal operation unit, and the external storage unit of the operation device cannot be completely matched with the corresponding algorithms one by one. The problems of poor dynamic balance algorithm effect, large data access amount and insufficient computing power in algorithm processing of the traditional computing device are solved.
Disclosure of Invention
In view of the above, it is necessary to provide an algorithm adaptive device, an algorithm adaptive method, an operation engine, a data operation method, an adaptive algorithm operation device, and an adaptive algorithm operation method, which are capable of achieving high performance, in order to solve the above-described technical problems.
An adaptive algorithm operation device comprises an algorithm adaptive device and an operation engine which are connected with each other, wherein,
the algorithm self-adaptive device is used for obtaining an algorithm descriptor according to an algorithm, obtaining an algorithm executor according to the algorithm descriptor and sending the algorithm executor to an operation engine so as to enable the operation engine to execute relevant operations according to the algorithm executor, wherein the algorithm descriptor comprises topological structure information, data flow structure information and calculation flow structure information of the algorithm, and the algorithm executor comprises execution state information and execution operation information;
the operation engine is used for analyzing the received algorithm executors to obtain current execution state information and current execution operation information, and executing related operations according to the execution state information and the current execution operation information.
In one embodiment, the algorithm adaptive device is specifically configured to obtain an algorithm scheduler according to the algorithm descriptor; obtaining the number of algorithm executors, the execution state information and the execution operation information of each algorithm executor according to the scheduling state information and the function information in the algorithm dispatchers; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son.
In one embodiment, the system further comprises a result analyzer, wherein the result analyzer is connected with the operation engine and the adaptive device,
the result analyzer is used for analyzing whether an operation result output by the operation engine is the final result of the algorithm dispatcher or not, and if the operation result is not the final result of the algorithm dispatcher, the operation engine is controlled to execute the operation according to the dispatching state information and the function information in the algorithm dispatcher so as to obtain the number of the algorithm executors, the execution state information and the execution operation information of each algorithm executor; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son.
In one embodiment, the result analyzer is further configured to analyze whether the operation result is a final result of the algorithm descriptor if the operation result is the final result of the algorithm scheduler, and terminate the operation if the operation result is the final result of the algorithm descriptor.
In one embodiment, the result analyzer is further configured to control the algorithm adaptive device to execute the step of obtaining the algorithm dispatcher according to the algorithm descriptor if the operation result is not the final result of the algorithm descriptor.
In one embodiment, the algorithm descriptor further includes control flow structure information; the scheduling device is specifically configured to determine the number of the algorithm schedulers according to topology structure information of the algorithm descriptors, determine scheduling state information of each algorithm scheduler according to data flow information of the algorithm descriptors, determine function information of each algorithm scheduler according to control flow structure information and calculation flow structure information of the algorithm descriptors, and obtain at least one algorithm scheduler according to the number of the algorithm schedulers, the scheduling state information of each algorithm scheduler, and the function information.
In one embodiment, the scheduling apparatus is further configured to schedule the scheduling type information for the algorithm scheduling entity, and determine the execution type information of the algorithm execution entity according to the scheduling type information for the algorithm scheduling entity, where the execution type information is used to determine hardware resources for executing the sub-related operations by the corresponding algorithm.
In one embodiment, the scheduling device comprises an algorithm description sub-analyzing component and an algorithm scheduling sub-generating component, wherein,
the algorithm descriptor analysis component is used for analyzing the algorithm descriptor, extracting topological structure information of the algorithm, and mapping the data space distribution of the algorithm to a space state table according to the topological structure information of the algorithm;
extracting data flow information of the algorithm, and mapping data time distribution of the algorithm to a time state table according to the data flow information; extracting control flow information of the algorithm, and mapping a control process of the algorithm to a control state table according to the control flow information; extracting operation flow information of the algorithm, and mapping the operation process of the algorithm to an operation state table according to the operation flow information;
the algorithm scheduling son generating component is used for determining the number of generated algorithm scheduling sons according to the space state table; obtaining scheduling state information of the algorithm scheduler according to the time state table; and obtaining the function information of the algorithm dispatcher according to the control state table and the operation state table.
In one embodiment, the scheduling apparatus further comprises an algorithm scheduling sub-analysis component and an algorithm execution sub-generation component, the algorithm scheduling sub-analysis component is respectively connected with the algorithm execution sub-generation component and the algorithm scheduling sub-generation component, wherein,
the algorithm scheduling sub-analysis component is used for judging data dependence according to the scheduling state and the functional information of the algorithm scheduling sub-and adding dependence mapping information to the corresponding algorithm scheduling sub-according to the result of the data dependence judgment;
the algorithm scheduling sub generating component is used for analyzing the algorithm scheduling sub added with the dependency mapping information to obtain the function information and the dependency mapping information, and generating at least one algorithm executive sub according to the function information and the dependency mapping information.
In one embodiment, the algorithm scheduling sub-analysis component is further configured to send the algorithm scheduling sub-which has no dependency to the different algorithm execution sub-generation component according to the result of the data dependency judgment.
In one embodiment, the algorithm scheduler generating component is further configured to update information in the spatial state table, the temporal state table, the control state table, and the operation state table after each time the algorithm scheduler is scheduled.
In one embodiment, the scheduling status information includes a waiting scheduling status, a scheduling cycle status, or a scheduling end status, and the time status table includes the scheduling times of each algorithm scheduler; and the algorithm scheduling sub generating component is used for correspondingly updating the scheduling state information of each algorithm scheduling sub according to the scheduling times of each algorithm scheduling sub in the time state table.
In one embodiment, the algorithm scheduler generating unit is configured to set the scheduling state information of a certain algorithm scheduler as a waiting schedule if the certain algorithm scheduler waits for updating the function information; if a certain algorithm scheduler is in a scheduled state and the scheduling times in the scheduling state information do not reach a preset threshold value, setting the scheduling state information of the certain algorithm scheduler as a scheduling cycle; and if the scheduling times in the scheduling state information of one algorithm scheduling son reach the preset threshold, setting the scheduling state information of the algorithm scheduling son as scheduling end.
In one embodiment, the operation engine comprises a parsing device, a control device and an operation device, which are connected in sequence, wherein,
the analysis device is used for analyzing the received algorithm executors to obtain current execution state information and current execution operation information;
the control device is used for controlling the arithmetic device to enter one of a starting state, a circulating state or an ending state according to the current execution state information, and then controlling the arithmetic device to execute the related operation according to the current execution operation information;
the arithmetic device is used for executing the related operation in the entering state.
In one embodiment, the operation engine is further configured to update the execution state information of the algorithm executor after completing the operation to be executed in the current state, and determine a next state entered by the operation device, where the next state is one of a start state, a loop state, or an end state.
In one embodiment, the control device is further configured to control the arithmetic device to output an arithmetic result if all the execution state information of the algorithm executor is updated.
In one embodiment, the control device is specifically configured to:
if the arithmetic device is controlled to enter the starting state according to the current execution state information, controlling the arithmetic device to execute the operation of the starting state, wherein the operation of the starting state comprises one or more of initializing computing resources, I/O resources or controlling resources;
if the arithmetic device is controlled to enter a cycle state according to the current execution state information, the arithmetic device is controlled to execute the operation of the cycle state, wherein the operation of the cycle state comprises the parallel execution of one or more of calculation operation, I/O operation or control operation in the cycle state;
and if the arithmetic device is controlled to enter the end state according to the current execution state information, controlling the arithmetic device to execute the operation of the end state, wherein the operation of the end state comprises one or more of parallel execution of calculation operation, I/O operation or control operation in the end state.
In one embodiment, the ending state operation further comprises: and releasing one or more of the computing resources, the I/O resources or the control resources.
An adaptive algorithm operation method, comprising:
obtaining an algorithm descriptor according to an algorithm, and obtaining an algorithm executor according to the algorithm descriptor, wherein the algorithm descriptor comprises topological structure information, data flow structure information and calculation flow structure information of the algorithm, and the algorithm executor comprises execution state information and execution operation information;
analyzing the received algorithm executive to obtain the current execution state information and the current execution operation information, and executing the relevant operation according to the execution state information and the current execution operation information to obtain the operation result.
In one embodiment, the obtaining an algorithm descriptor according to an algorithm, and obtaining an algorithm executor according to the algorithm descriptor includes:
obtaining an algorithm dispatcher according to the algorithm descriptor;
obtaining the number of algorithm executors, the execution state information and the execution operation information of each algorithm executor according to the scheduling state information and the function information in the algorithm dispatchers;
and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son.
In one embodiment, the method further comprises:
analyzing whether the operation result is the final result of the algorithm dispatcher;
if the operation result is not the final result of the algorithm scheduling son, returning to execute the scheduling state information and the function information in the algorithm scheduling son to obtain the number of the algorithm executing son, the execution state information and the execution operation information of each algorithm executing son; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son.
In one embodiment, the method further comprises:
if the operation result is the final result of the algorithm dispatcher, analyzing whether the operation result is the final result of the algorithm descriptor, and if the operation result is the final result of the algorithm descriptor, terminating the operation.
In one embodiment, the method further comprises:
and if the operation result is not the final result of the algorithm descriptor, controlling the algorithm self-adaptive device to execute the step of obtaining the algorithm scheduling sub according to the algorithm descriptor.
In one embodiment, the algorithm descriptor further includes control flow structure information, and the obtaining an algorithm scheduler according to the algorithm descriptor includes:
determining the number of the algorithm dispatchers according to the topological structure information of the algorithm descriptors;
determining scheduling state information of each algorithm scheduler according to the data flow information of the algorithm descriptors;
determining the function information of each algorithm scheduling sub according to the control flow structure information and the calculation flow structure information of the algorithm descriptors;
and obtaining at least one algorithm scheduling son according to the number of the algorithm scheduling son, the scheduling state information and the function information of each algorithm scheduling son.
In one embodiment, the method further comprises:
and scheduling type information is distributed to the algorithm scheduling sub, and the execution type information of the algorithm execution sub is determined according to the scheduling type information of the algorithm scheduling sub, wherein the execution type information is used for determining hardware resources of the corresponding algorithm execution sub-correlation operation.
In one embodiment, the algorithm descriptor further includes control flow structure information,
the determining the number of the algorithm dispatchers according to the topological structure information of the algorithm descriptors comprises the following steps:
analyzing the algorithm descriptor, extracting topological structure information of the algorithm from an analysis result, and mapping the data space distribution of the algorithm to a space state table according to the topological structure information of the algorithm; determining the number of generated algorithm dispatchers according to the space state table;
the determining the scheduling state information of each algorithm scheduler according to the data flow information of the algorithm descriptor includes:
extracting data flow information of the algorithm from the analysis result, and mapping the data time distribution of the algorithm to a time state table according to the data flow information;
obtaining scheduling state information of the algorithm scheduler according to the time state table;
the determining the function information of each algorithm scheduling sub according to the control flow structure information and the calculation flow structure information of the algorithm descriptors comprises the following steps:
extracting control flow information of the algorithm from the analysis result, and mapping a control process of the algorithm to a control state table according to the control flow information;
extracting operation flow information of the algorithm from the analysis result, and mapping the operation process of the algorithm to an operation state table according to the operation flow information;
and obtaining the function information of the algorithm dispatcher according to the control state table and the operation state table.
In one embodiment, the number of algorithm executors, the execution state information of each algorithm executor, and the execution operation information are obtained according to the scheduling state information and the function information in the algorithm scheduler; obtaining at least one algorithm executor according to the number of the algorithm executors, the execution state information of each algorithm executor, and the execution operation information, including:
performing data dependence judgment according to the scheduling state and the functional information of the algorithm scheduling son, and adding dependence mapping information in the corresponding algorithm scheduling son according to the result of the data dependence judgment;
and analyzing the algorithm scheduling sub added with the dependency mapping information to obtain the function information and the dependency mapping information, and generating at least one algorithm executive sub according to the function information and the dependency mapping information.
In one embodiment, the algorithm scheduler generating component is further configured to update information in the spatial state table, the temporal state table, the control state table, and the operation state table after each time the algorithm scheduler is scheduled.
In one embodiment, the scheduling status information includes a waiting scheduling status, a scheduling cycle status, or a scheduling end status, and the time status table includes the scheduling times of each algorithm scheduler; the method further comprises the following steps: and correspondingly updating the scheduling state information of each algorithm scheduling sub according to the scheduling times of each algorithm scheduling sub in the time state table.
In one embodiment, the updating the scheduling status information of each algorithm scheduler according to the scheduling times of each algorithm scheduler in the time status table correspondingly includes:
if one algorithm scheduling son waits for updating the function information, setting the scheduling state information of the algorithm scheduling son as waiting scheduling;
if a certain algorithm scheduler is in a scheduled state and the scheduling times in the scheduling state information do not reach a preset threshold value, setting the scheduling state information of the certain algorithm scheduler as a scheduling cycle;
and if the scheduling times in the scheduling state information of one algorithm scheduling son reach the preset threshold, setting the scheduling state information of the algorithm scheduling son as scheduling end.
In one embodiment, the performing, according to the execution state information and the current execution operation information, a relevant operation to obtain an operation result includes:
and determining to enter one of a starting state, a circulating state or an ending state according to the current execution state information, and then executing relevant operation according to the current execution operation information in the entered state.
In one embodiment, the method further comprises:
and after the operation to be executed in the current state is finished, updating the execution state information of the algorithm execution sub-unit, and determining the next state to enter, wherein the next state is one of a starting state, a circulating state or an ending state.
In one embodiment, the method further comprises:
and if the execution state information of the algorithm execution son is completely updated, outputting an operation result.
In one embodiment, the executing the relevant operation according to the current execution operation information in the entered state includes:
if the arithmetic device is controlled to enter the starting state according to the current execution state information, controlling the arithmetic device to execute the operation of the starting state, wherein the operation of the starting state comprises one or more of initializing computing resources, I/O resources or controlling resources;
if the arithmetic device is controlled to enter a cycle state according to the current execution state information, the arithmetic device is controlled to execute the operation of the cycle state, wherein the operation of the cycle state comprises the parallel execution of one or more of calculation operation, I/O operation or control operation in the cycle state;
and if the arithmetic device is controlled to enter the end state according to the current execution state information, controlling the arithmetic device to execute the operation of the end state, wherein the operation of the end state comprises one or more of parallel execution of calculation operation, I/O operation or control operation in the end state.
In one embodiment, the ending state operation further comprises: and releasing one or more of the computing resources, the I/O resources or the control resources.
The algorithm self-adapting device, the algorithm self-adapting method, the operation engine, the data operation method, the self-adapting algorithm operation device and the self-adapting algorithm operation method can extract the topological structure, time flow, control flow and data flow information of the algorithm through the algorithm analysis device, then obtain the algorithm executer based on the extracted information, and the algorithm executer can be executed after being sent to the operation engine, thereby realizing the relevant operation of the algorithm. The algorithm self-adaptive device can match reasonable resources for the algorithm to be processed, and the problem that the algorithm execution is influenced by the dynamic balance difference in the algorithm operation process is avoided.
Drawings
FIG. 1 is a diagram illustrating an embodiment of an algorithm adaptive device;
FIG. 2 is a schematic diagram of an algorithm adaptive device according to another embodiment;
FIG. 3 is a schematic diagram of an embodiment of an operation engine;
FIG. 4 is a schematic diagram of an adaptive algorithm computing device according to another embodiment;
FIG. 5 is a schematic flow chart diagram of an algorithm adaptation method in one embodiment;
FIG. 6 is a schematic flow chart illustrating a step of refining step S520 in one embodiment;
FIG. 7 is a flow diagram illustrating a method for data manipulation according to one embodiment;
FIG. 8 is a schematic flow chart diagram illustrating a method for adaptive algorithm operation in accordance with one embodiment;
FIG. 9 is a flowchart illustrating a method for adaptive algorithm operation according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Fig. 1 is a schematic structural diagram of an algorithm adaptive apparatus 100 proposed in one embodiment of the present application. The algorithm adaptive device 100 includes: the algorithm analysis device 110 and the scheduling device 120 are connected with each other, wherein,
the algorithm analysis device 110 is configured to obtain an algorithm descriptor according to an algorithm, where the algorithm descriptor includes topology structure information, data flow structure information, and calculation flow structure information of the algorithm. The topological structure information describes the macroscopic composition of the algorithm, which may be the spatial distribution of the data and operations of the algorithm. The data stream structure information describes the temporal distribution of data participating in the algorithmic computation. Optionally, the data stream structure information includes, but is not limited to, an input data stream and an output data stream. Optionally, the calculation flow structure information describes the specific operation process involved by the data of the algorithm, which includes but is not limited to addition, subtraction, multiplication, division, and the like.
The scheduling device 120 is configured to obtain an algorithm executor according to the algorithm descriptor, and send the algorithm executor to an operation engine, so that the operation engine executes a relevant operation according to the algorithm executor, where the algorithm executor includes execution state information and execution operation information. The execution state information is used to describe the state in which the algorithm executors are located. The state described by the algorithm executor may characterize whether the operations of the algorithm executor are executed, and the progress of the execution of the operations. The execution operation information is used to describe the specific operation of the algorithm execution sub-unit,
the algorithm self-adaptive device in the embodiment of the application can extract the topological structure, time flow, control flow and data flow information of the algorithm through the algorithm analysis device, then obtains the algorithm executor based on the extracted information, and the algorithm executor can be executed after being sent to the operation engine, so that the relevant operation of the algorithm is realized. The algorithm self-adaptive device can match reasonable resources for the algorithm to be processed, and the problem that the algorithm execution is influenced by the dynamic balance difference in the algorithm operation process is avoided.
Specifically, the scheduling device 120 is configured to determine the number of the algorithm executors according to the topology structure information of the algorithm descriptor; determining the execution state information of each algorithm executor according to the data stream structure information in the algorithm descriptor; determining the execution operation information of each algorithm executor according to the calculation flow structure information in the algorithm descriptor; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son.
Further, the scheduling device 120 is further configured to allocate execution type information for the algorithm execution sub-allocation. The execution type of the algorithm executor may be a cluster, a unit or a core, and the execution type information is used to determine information of resources required by the operation of the algorithm executor.
In one optional embodiment, the scheduling device 120 may also be configured to obtain an algorithm scheduler according to the algorithm descriptor; and obtaining the number of algorithm executors, the execution state information and the execution operation information of each algorithm executor according to the scheduling state information and the function information in the algorithm schedulers, and obtaining at least one algorithm executor according to the number of the algorithm executors, the execution state information and the execution operation information of each algorithm executor. Optionally, the scheduling state information is a state in which the algorithmic scheduler is located and related information, and the state may include a wait scheduling state, a scheduling cycle state, and a scheduling end state. Wherein, the algorithm scheduler is in a waiting scheduling state, which indicates that the algorithm scheduler waits for updating the function information and the like. The algorithm scheduler is in a scheduling loop state, which indicates that the algorithm scheduler is in a repeated scheduling process. The algorithm scheduler is in a scheduling end state, which indicates that the number of times that the algorithm scheduler is repeatedly scheduled reaches a preset threshold value. Further, the scheduling status information may further include the number of times the algorithm scheduler is repeatedly scheduled when the algorithm scheduler is in the scheduling loop state. Alternatively, when the algorithmic schedule child enters the schedule end state, the schedule number of the algorithmic schedule child entering the schedule end state is updated (schedule information).
Further, when the number of times of scheduling is used as the status parameter of the updating algorithm scheduler, for one algorithm scheduler, the scheduling type of the algorithm scheduler does not change every time of scheduling, but the function information of the algorithm scheduler may change. The lifecycle of a schedule may be as follows:
a scheduling waiting state- > a scheduling loop state (updating the scheduling times, updating the function information) - - > a scheduling ending state- > a plurality of subsequent processes- - > updating the scheduler (in the previous step of exiting) - - > a scheduling waiting state- > a scheduling loop state (updating the scheduling times, updating the function information) - - > a scheduling ending state- >. a scheduling loop state (the scheduling times, updating the function information) - - > a scheduling ending state- >. the scheduling times reach a threshold value, and the function information is reset) - - > the scheduling is ended.
In one optional embodiment, the algorithm descriptor may further include control flow structure information. At this time, the scheduling device 120 may be configured to determine the number of the algorithm schedulers according to topology structure information of the algorithm descriptor, determine scheduling state information of each algorithm scheduler according to data flow information of the algorithm descriptor, determine function information of each algorithm scheduler according to control flow structure information and calculation flow structure information of the algorithm descriptor, and obtain at least one algorithm scheduler according to the number of the algorithm schedulers, the scheduling state information of each algorithm scheduler, and the function information. Wherein the control flow structure information describes the control process of the algorithm, which includes but is not limited to the loop, jump, pause, etc. process of the algorithm. The function information of the algorithm scheduler comprises data addresses (input/output) of data in the algorithm, data shape, I/O information (such as data transfer in a storage space), operation information (such as addition, subtraction or combination of multiple operations), and control information (such as description of the relationship between the I/O and the operation information, namely the sequence of related operations).
Further, the scheduling device 120 is further configured to schedule the scheduling type information for the algorithm scheduling sub, and determine the execution type information of the algorithm executing sub according to the scheduling type information for the algorithm scheduling sub, where the execution type information is used to determine the hardware resource of the corresponding algorithm executing sub-related operation.
As shown in fig. 2, the scheduling apparatus 120 may include an algorithm description sub-analyzing part 121 and an algorithm schedule sub-generating part 122. Wherein the content of the first and second substances,
the algorithm descriptor resolving component 121 is configured to resolve the algorithm descriptor, extract topological structure information of the algorithm, and map data space distribution of the algorithm to a space state table according to the topological structure information of the algorithm. The spatial state table contains the spatial distribution information of the algorithm. And extracting data flow information of the algorithm, and mapping the data time distribution of the algorithm to a time state table according to the data flow information. The time state table contains time information for the algorithm. And extracting control flow information of the algorithm, and mapping the control process of the algorithm to a control state table according to the control flow information. The control state table contains control information for the algorithm. And extracting the operation flow information of the algorithm, and mapping the operation process of the algorithm to an operation state table according to the operation flow information. The operation state table contains operation information of the algorithm.
The algorithm scheduler generating component 122 is configured to determine the number of generated algorithm schedulers according to the spatial state table; obtaining scheduling state information of the algorithm scheduler according to the time state table; and obtaining the function information of the algorithm dispatcher according to the control state table and the operation state table.
The scheduling device in this embodiment maps different types of information in the algorithm descriptor to corresponding table entries of the state table, so that the information describing the algorithm can be processed finely, an excellent scheduling result is obtained, and the processing efficiency of the algorithm is further improved.
Further, with continuing reference to fig. 2, the scheduling device 120 further includes an algorithm scheduling sub-analyzing unit 123 and an algorithm execution sub-generating unit 124, wherein the algorithm scheduling sub-analyzing unit 123 is respectively connected to the algorithm execution sub-generating unit 124 and the algorithm scheduling sub-generating unit 122. The algorithm scheduling sub-analyzing component 123 is configured to perform data dependency judgment according to the scheduling state and the function information of the algorithm scheduling sub, and add dependency mapping information to the corresponding algorithm scheduling sub according to the result of the data dependency judgment. Specifically, the scheduling sub analyzing unit 123 performs data dependency judgment according to the scheduling state and the function information of the algorithm scheduling sub, updates the dependency lookup table of the algorithm scheduling sub according to the result of the data dependency judgment, and then adds dependency mapping information to each algorithm scheduling sub according to the dependency lookup table.
The algorithm scheduling unit 124 is configured to parse the algorithm scheduling unit added with the dependency mapping information to obtain the function information and the dependency mapping information, and generate at least one algorithm executor according to the function information and the dependency mapping information.
Optionally, the algorithm scheduling sub-analyzing component 123 is further configured to send the algorithm scheduling sub-component without dependency to a different algorithm execution sub-generating component according to the result of obtaining the data dependency judgment. Therefore, when the algorithm executive son generating component generates the algorithm executive son, the algorithm executive son generating component can process the information with simpler data dependency relationship, reduce the data processing amount required for ensuring the algorithm logic to be correct and improve the processing efficiency.
In one embodiment, in order to more reasonably utilize resources, when the scheduling type is allocated to each algorithm scheduling subunit, the algorithm scheduling subunit analyzing component 123 is further configured to analyze the algorithm scheduling subunit to obtain the scheduling type of the algorithm scheduling subunit, and cache the algorithm scheduling subunit to different queues according to the scheduling type.
In one optional embodiment, the algorithm scheduler generating component 122 is further configured to send the algorithm scheduler to the corresponding algorithm scheduler parsing component according to a specific flag bit in the function information of the algorithm scheduler.
In one optional embodiment, since the algorithm adaptive device of the present application processes the algorithm, the information of the algorithm has a time sequence characteristic and needs to be processed sequentially, and after the algorithm scheduler is obtained, especially the algorithm scheduler including the scheduling loop state is scheduled repeatedly. Since the information in the scheduler changes with time at different times, the algorithm scheduler generating component 122 of the present application is further configured to update the information in the spatial state table, the temporal state table, the control state table, and the operation state table after each time the algorithm scheduler is scheduled. According to the embodiment, each piece of information is dynamically processed according to the algorithm processing progress, and the resource space is effectively utilized.
Optionally, when the time status table includes the scheduling times of each algorithm scheduler, the algorithm scheduler generating unit 122 may update the scheduling status information of each algorithm scheduler according to the scheduling times of each algorithm scheduler in the time status table. Specifically, the algorithm scheduler generating unit 122 is configured to, if a certain algorithm scheduler waits for updating of the function information, set the scheduling state information of the certain algorithm scheduler as a waiting schedule; if a certain algorithm scheduler is in a scheduled state and the scheduling times in the scheduling state information do not reach a preset threshold value, setting the scheduling state information of the certain algorithm scheduler as a scheduling cycle; and if the scheduling times in the scheduling state information of one algorithm scheduling son reach the preset threshold, setting the scheduling state information of the algorithm scheduling son as scheduling end.
Based on the same inventive concept, as shown in fig. 3, the present application further provides an operation engine 200, wherein the operation engine 200 includes an analysis device 210, a control device 220, and an operation device 230, which are connected in sequence. Wherein the content of the first and second substances,
the parsing device 210 is configured to parse the received algorithm executor to obtain current execution state information and current execution operation information.
The control device 220 is used for controlling the computing device to enter a start state, a loop state or an end state according to the current execution state information, and then controlling the computing device to execute the relevant operation according to the current execution operation information. Specifically, if the arithmetic device is controlled to enter a starting state according to the current execution state information, the arithmetic device is controlled to execute the operation of the starting state, wherein the operation of the starting state comprises initialization calculation or parallel calculation. And if the arithmetic device is controlled to enter a loop state according to the current execution state information, controlling the arithmetic device to execute the operation of the loop state, wherein the operation of the loop state comprises parallel computation. And if the arithmetic device is controlled to enter the end state according to the current execution state information, controlling the arithmetic device to execute the operation of the end state, wherein the operation of the end state comprises parallel computation.
And an operation device 230 for executing the related operation in the operation state.
Optionally, the control device 220 is further configured to update the execution state information of the algorithm executor after completing the operation to be executed in the current state, and determine a next state entered by the operation device, where the next state is one of a start state, a loop state, or an end state.
Furthermore, the control device is also used for controlling the arithmetic device to output the arithmetic result if the execution state information of the algorithm executive is completely updated.
The operation engine in this embodiment selects an entered state according to the algorithm execution sub-selection, for example, enters a loop state when an operation in the algorithm needs to be executed iteratively, and repeatedly calls a resource to execute a corresponding operation until all operations in the loop state are completed. This can reduce inter-chip data exchange during algorithm processing, which not only saves bandwidth resources but also improves data processing efficiency.
Based on the same inventive concept, as shown in fig. 4, the present application further provides an adaptive algorithm computing device 10, which is characterized by comprising an algorithm adaptive device 100 and a computing engine 200 connected with each other. The algorithm adaptive device 100 is configured to obtain an algorithm executor according to an algorithm. The operation engine 200 is used to perform sub-execution dependent operations according to the algorithm.
In the above embodiments, the structure and the use of the algorithm adaptive device 100 and the operation engine 200 have been described in detail, and for details, refer to the algorithm operation engine 200 and the related embodiments of the algorithm adaptive device 100, which are not described herein again.
Optionally, with continued reference to fig. 4, the adaptive algorithm computing device 10 further comprises a result analyzer 300, which connects the computing engine 200 and the adaptive device 100. The result analyzer 300 is configured to analyze whether the operation result is the final result of the algorithm scheduler, and if the operation result is not the final result of the algorithm scheduler, control the operation engine 200 to execute the algorithm according to the scheduling state information and the function information in the algorithm scheduler to obtain the number of algorithm executors, the execution state information of each algorithm executor, and the execution operation information; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son. Optionally, the result analyzer 300 may determine whether the operation result is a final result of the algorithm scheduler according to a preset condition or a preset threshold.
Further, the result analyzer 300 is further configured to analyze whether the operation result is the final result of the algorithm descriptor if the operation result is the final result of the algorithm scheduler, and terminate the operation if the operation result is the final result of the algorithm descriptor. Optionally, the result analyzer 300 may determine whether the operation result is the final result of the algorithm descriptor according to a preset condition or a preset threshold.
Furthermore, the result analyzer 300 is further configured to control the algorithm adaptive device to execute the step of obtaining the algorithm dispatcher according to the algorithm descriptor if the operation result is not the final result of the algorithm descriptor.
The adaptive algorithm operation device in the embodiment can finely perform adaptive processing on the algorithm, and efficiently and accurately obtain the operation result of the algorithm.
Based on the same inventive concept, in one embodiment, as shown in fig. 5, an algorithm adaptation method is further provided, which is executed by the algorithm adaptation apparatus 100 to perform an adaptation process on an algorithm, the method comprising,
step S510, obtaining at least one algorithm descriptor according to an algorithm, wherein the algorithm descriptor comprises topological structure information, control flow structure information, data flow structure information and calculation flow structure information of the algorithm.
Step S520, obtaining an algorithm executive according to the algorithm descriptor, and sending the algorithm executive to an operation engine so that the operation engine executes relevant operations according to the algorithm executive, wherein the algorithm executive comprises execution type information, execution state information and execution operation information.
In the algorithm adaptive method in this embodiment, the topology structure, the time flow, the control flow, and the data flow information of the algorithm may be extracted by the algorithm analysis device, and then an algorithm executor may be obtained based on the extracted information, and the algorithm executor may be sent to the operation engine and then executed, thereby implementing the relevant operations of the algorithm. The algorithm self-adaptive device can match reasonable resources for the algorithm to be processed, and the problem that the algorithm execution is influenced by the dynamic balance difference in the algorithm operation process is avoided.
In one optional embodiment, the step S520 may include: determining the number of the algorithm executors according to the topological structure information of the algorithm descriptors; determining the execution state information of each algorithm executor according to the data stream structure information in the algorithm descriptor; determining the execution operation information of each algorithm executor according to the calculation flow structure information in the algorithm descriptor; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son. Specifically, data dependence judgment is carried out according to the scheduling state and the function information of the algorithm scheduling son, and dependence mapping information is added to the corresponding algorithm scheduling son according to the result of the data dependence judgment; and analyzing the algorithm scheduling sub added with the dependency mapping information to obtain the function information and the dependency mapping information, and generating at least one algorithm executive sub according to the function information and the dependency mapping information. Further, the dependency relationship lookup table of the algorithm scheduler may be updated according to the result of the data dependency judgment, and then dependency mapping information may be added to each algorithm scheduler according to the dependency relationship lookup table. Alternatively, the dependency lookup table may record the result of the data dependency determination.
Further, the algorithm adaptive method may further include: and allocating execution type information for the algorithm execution sub-units, wherein the execution type information is used for determining hardware resources of the corresponding algorithm execution sub-correlation operation.
In another alternative embodiment, as shown in fig. 6, the step S520 may include: step S521, obtaining an algorithm dispatcher according to the algorithm descriptor; step S522, obtaining the number of algorithm executors, the execution state information and the execution operation information of each algorithm executor according to the scheduling state information and the function information in the algorithm dispatchers; step S523, obtaining at least one algorithm executor according to the number of algorithm executors, the execution state information of each algorithm executor, and the execution operation information.
Optionally, the algorithm descriptor further includes control flow structure information, in which case step S520 may include: determining the number of the algorithm dispatchers according to the topological structure information of the algorithm descriptors; determining scheduling state information of each algorithm scheduler according to the data flow information of the algorithm descriptors; determining the function information of each algorithm scheduling sub according to the control flow structure information and the calculation flow structure information of the algorithm descriptors; and obtaining at least one algorithm scheduling son according to the number of the algorithm scheduling son, the scheduling state information and the function information of each algorithm scheduling son.
In one optional embodiment, the algorithm adaptive method may further include: and scheduling type information is distributed to the algorithm scheduling sub, and the execution type information of the algorithm execution sub is determined according to the scheduling type information of the algorithm scheduling sub, wherein the execution type information is used for determining hardware resources of the corresponding algorithm execution sub-correlation operation.
In one optional embodiment, the algorithm descriptor further includes control flow structure information, in which case step S520 may include: analyzing the algorithm descriptor; extracting topological structure information of the algorithm, and mapping data space distribution of the algorithm to a space state table according to the topological structure information of the algorithm; extracting data flow information of the algorithm, and mapping data time distribution of the algorithm to a time state table according to the data flow information; extracting control flow information of the algorithm, and mapping a control process of the algorithm to a control state table according to the control flow information; extracting operation flow information of the algorithm, and mapping the operation process of the algorithm to an operation state table according to the operation flow information; the algorithm scheduling son generating component is used for determining the number of generated algorithm scheduling sons according to the space state table; obtaining scheduling state information of the algorithm scheduler according to the time state table; and obtaining the function information of the algorithm dispatcher according to the control state table and the operation state table.
In one embodiment, after parsing the algorithm scheduler, the algorithm adaptive method may further include: obtaining the scheduling type of the algorithm scheduling son according to the analysis result of the algorithm scheduling son; and scheduling the sub-cache to different queues according to the scheduling type. Because different scheduling types correspond to different resource requirements, algorithms of different scheduling types are used for scheduling the sub-queue for caching, and reasonable allocation of resources is facilitated.
In one embodiment, the algorithm adaptive method may further include: and sending the algorithm scheduling sub to a corresponding algorithm scheduling sub analysis component according to a specific zone bit in the function information of the algorithm scheduling sub.
In one embodiment, the algorithm adaptive method may further include: updating information in the spatial state table, the temporal state table, the control state table, and the operational state table after each time an algorithm scheduler is scheduled.
In one embodiment, when the time status table includes the scheduling times of each scheduling sub of the algorithm, the algorithm adaptive method may further include: and correspondingly updating the scheduling state information of each algorithm scheduling sub according to the scheduling times of each algorithm scheduling sub in the time state table.
Specifically, if a certain algorithm scheduler waits for updating the function information, the scheduling state information of the certain algorithm scheduler is waiting for scheduling; if a certain algorithm scheduler is in a scheduled state and the scheduling times in the scheduling state information do not reach a preset threshold value, setting the scheduling state information of the certain algorithm scheduler as a scheduling cycle; and if the scheduling times in the scheduling state information of one algorithm scheduling son reach the preset threshold, setting the scheduling state information of the algorithm scheduling son as scheduling end.
For specific execution components of each step of the algorithm adaptive method, reference may be made to the above definition of the algorithm adaptive apparatus 100, and details are not described here.
Based on the same inventive concept, as shown in fig. 7, the present application further provides, in an embodiment, a data operation method, which is executed by an operation engine 200, and includes:
step S610, analyzing the received algorithm executors to obtain current execution state information and current execution operation information. Wherein the algorithm execution sub-includes execution state information and execution operation information. Optionally, the algorithm executor may further include execution type information. The algorithm executor may be obtained by an algorithm adaptive method in any of the embodiments described above. For a specific obtaining process, reference may be made to the above specific description of the algorithm adaptive apparatus 100 and the algorithm adaptive method, which is not described herein again.
Step S620, determining to enter a starting state, a circulating state or an ending state according to the current execution state information; and then, executing relevant operation according to the current execution operation information.
In the data operation method in this embodiment, the state entered by the sub-selection is executed according to the algorithm, for example, when the operation in the algorithm needs to be executed iteratively, the data operation method enters a loop state, and repeatedly calls the resource to execute the corresponding operation until all operations in the loop state are completed. This can reduce inter-chip data exchange during algorithm processing, which not only saves bandwidth resources but also improves data processing efficiency.
Optionally, the data operation method may further include: and after finishing the operation to be executed in the current state, updating the execution state information of the algorithm execution sub-unit, and determining the next state entered by the arithmetic device, wherein the next state is one of a starting state, a circulating state or an ending state.
Optionally, the data operation method may further include: and if the execution state information of the algorithm execution son is completely updated, controlling the arithmetic device to output an arithmetic result.
In one optional embodiment, step S620 includes: and if the starting state is determined to be entered according to the current execution state information, controlling the arithmetic device to execute the operation of the starting state, wherein the operation of the starting state comprises initialization calculation or parallel calculation. And if the loop state is determined to be entered according to the current execution state information, controlling the operation device to execute the operation of the loop state, wherein the operation of the loop state comprises parallel computation. And if the end state is determined to be entered according to the current execution state information, controlling the arithmetic device to execute the operation of the end state, wherein the operation of the end state comprises parallel computation.
For specific execution components of each step of the data operation method, reference may be made to the above definition of the operation engine 200, which is not described herein again.
Based on the same inventive concept, as shown in fig. 8, the present application further proposes, in an embodiment, an adaptive algorithm operation method, which can be executed by an adaptive algorithm operation device 10, and includes:
and step S500, acquiring an algorithm executive.
Specifically, the algorithm adaptive device 100 processes the algorithm to be processed to obtain an algorithm executor. More specifically, at least one algorithm descriptor is obtained according to an algorithm, wherein the algorithm descriptor comprises topological structure information, data flow structure information and calculation flow structure information of the algorithm; and obtaining an algorithm executor according to the algorithm descriptor. Specifically, the algorithm adaptive device 100 obtains an algorithm scheduler according to the algorithm descriptor; obtaining the number of algorithm executors, the execution state information and the execution operation information of each algorithm executor according to the scheduling state information and the function information in the algorithm dispatchers; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son. Further, the algorithm adaptive apparatus 100 may perform the following steps to obtain the algorithm scheduler: analyzing the algorithm descriptor; extracting topological structure information of the algorithm, and mapping data space distribution of the algorithm to a space state table according to the topological structure information of the algorithm; extracting data flow information of the algorithm, and mapping data time distribution of the algorithm to a time state table according to the data flow information; extracting control flow information of the algorithm, and mapping a control process of the algorithm to a control state table according to the control flow information; extracting operation flow information of the algorithm, and mapping the operation process of the algorithm to an operation state table according to the operation flow information; the algorithm scheduling son generating component is used for determining the number of generated algorithm scheduling sons according to the space state table; obtaining scheduling state information of the algorithm scheduler according to the time state table; and obtaining the function information of the algorithm dispatcher according to the control state table and the operation state table.
In the above embodiments, the obtaining device and the obtaining process of the algorithm executor have been described in detail, and for details, refer to the algorithm adaptive device 100 and the related embodiments of the algorithm adaptive method, which are not described herein again.
And S600, processing the algorithm executors to obtain an operation result.
Specifically, the arithmetic engine processes the algorithm executor to obtain an arithmetic result. More specifically, analyzing the received algorithm executors to obtain current execution state information and current execution operation information; and controlling the arithmetic device to enter a starting state, a circulating state or an ending state according to the current execution state information, and then controlling the arithmetic device to execute related arithmetic according to the current execution operation information to obtain an arithmetic result. Further, after completing the operation to be executed in the current state, the arithmetic engine updates the execution state information of the algorithm execution unit, and determines the next state to enter, where the next state is one of a start state, a loop state, or an end state. Furthermore, the operation engine outputs the operation result after the execution state information of the algorithm executor is updated.
In the above embodiments, the process of performing data operation based on the algorithm executor has been described in detail, and for details, refer to the algorithm operation engine 200 and the related embodiments of the data operation method, which are not described herein again.
For specific executing components of each step of the adaptive algorithm calculating method, reference may be made to the above definition of the adaptive algorithm calculating device 10, and details are not described herein again.
The adaptive algorithm operation method in the embodiment can finely perform adaptive processing on the algorithm, and efficiently and accurately obtain the operation result of the algorithm.
In one embodiment, as shown in fig. 9, the adaptive algorithm operation method may further include:
step S710, analyzing whether the operation result is the final result of the algorithm scheduler.
If the operation result is not the final result of the algorithm dispatcher, returning to the execution step S522, and obtaining the number of the algorithm executors, the execution state information and the execution operation information of each algorithm executor according to the dispatching state information and the function information in the algorithm dispatcher; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son.
Referring to fig. 8, in an embodiment, the adaptive algorithm operation method may further include: if the operation result is the final result of the algorithm dispatcher, step S720 is executed to analyze whether the operation result is the final result of the algorithm descriptor. If the operation result is the final result of the algorithm descriptor, step S730 is executed to terminate the operation.
Referring to fig. 7, in an embodiment, the adaptive algorithm operation method may further include: and if the operation result is not the final result of the algorithm descriptor, controlling the algorithm self-adaptive device to execute the step S521, and obtaining an algorithm dispatcher according to the algorithm descriptor. It should be understood that although the various steps in the flow charts of fig. 5-9 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 5-9 may include at least one sub-step or at least one stage, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (31)

1. An adaptive algorithm operation device, comprising an algorithm adaptive device and an operation engine connected to each other, wherein,
the algorithm self-adaptive device is used for obtaining an algorithm descriptor according to an algorithm, obtaining an algorithm executor according to the algorithm descriptor and sending the algorithm executor to an operation engine so as to enable the operation engine to execute relevant operations according to the algorithm executor, wherein the algorithm descriptor comprises topological structure information, data flow structure information and calculation flow structure information of the algorithm, and the algorithm executor comprises execution state information and execution operation information;
the operation engine is used for analyzing the received algorithm executors to obtain current execution state information and current execution operation information, and executing related operations according to the execution state information and the current execution operation information;
the algorithm descriptor further includes control flow structure information; the algorithm self-adaptive device comprises a scheduling device, wherein the scheduling device is specifically used for determining the number of algorithm scheduling units according to topological structure information of an algorithm descriptor, determining scheduling state information of each algorithm scheduling unit according to data flow information of the algorithm descriptor, determining function information of each algorithm scheduling unit according to control flow structure information and calculation flow structure information of the algorithm descriptor, and obtaining at least one algorithm scheduling unit according to the number of the algorithm scheduling units, the scheduling state information and the function information of each algorithm scheduling unit;
the scheduling device is further configured to schedule scheduling type information for the algorithm scheduling sub-allocation, and determine execution type information of the algorithm execution sub-allocation according to the algorithm scheduling sub-allocation scheduling type information, where the execution type information is used to determine hardware resources for the corresponding algorithm to execute the sub-correlation operation.
2. The apparatus according to claim 1, wherein said algorithm adaptation means is specifically configured to derive an algorithm scheduler from said algorithm descriptor; obtaining the number of algorithm executors, the execution state information and the execution operation information of each algorithm executor according to the scheduling state information and the function information in the algorithm dispatchers; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son.
3. The apparatus of claim 2, further comprising a result analyzer, the result analyzer coupled to the operation engine and the adaptive apparatus,
the result analyzer is used for analyzing whether an operation result output by the operation engine is the final result of the algorithm dispatcher or not, and if the operation result is not the final result of the algorithm dispatcher, the operation engine is controlled to execute the operation according to the dispatching state information and the function information in the algorithm dispatcher so as to obtain the number of the algorithm executors, the execution state information and the execution operation information of each algorithm executor; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son.
4. The apparatus of claim 3, wherein the result analyzer is further configured to analyze whether the operation result is a final result of the algorithm descriptor if the operation result is a final result of the algorithm scheduler, and terminate the operation if the operation result is a final result of the algorithm descriptor.
5. The apparatus of claim 4, wherein the result analyzer is further configured to control the algorithm adaptive apparatus to perform the step of obtaining an algorithm scheduler according to the algorithm descriptor if the operation result is not the final result of the algorithm descriptor.
6. The apparatus of claim 1, wherein the scheduling means comprises an algorithm descriptor parsing component and an algorithm schedule generating component, wherein,
the algorithm descriptor analysis component is used for analyzing the algorithm descriptor, extracting topological structure information of the algorithm, and mapping the data space distribution of the algorithm to a space state table according to the topological structure information of the algorithm;
extracting data flow information of the algorithm, and mapping data time distribution of the algorithm to a time state table according to the data flow information; extracting control flow information of the algorithm, and mapping a control process of the algorithm to a control state table according to the control flow information; extracting operation flow information of the algorithm, and mapping the operation process of the algorithm to an operation state table according to the operation flow information;
the algorithm scheduling son generating component is used for determining the number of generated algorithm scheduling sons according to the space state table; obtaining scheduling state information of the algorithm scheduler according to the time state table; and obtaining the function information of the algorithm dispatcher according to the control state table and the operation state table.
7. The apparatus according to claim 6, wherein the scheduling apparatus further comprises an algorithm scheduling sub-analyzing section and an algorithm execution sub-generating section, the algorithm scheduling sub-analyzing section respectively connecting the algorithm execution sub-generating section and the algorithm scheduling sub-generating section, wherein,
the algorithm scheduling sub-analysis component is used for judging data dependence according to the scheduling state and the functional information of the algorithm scheduling sub-and adding dependence mapping information to the corresponding algorithm scheduling sub-according to the result of the data dependence judgment;
the algorithm scheduling sub generating component is used for analyzing the algorithm scheduling sub added with the dependency mapping information to obtain the function information and the dependency mapping information, and generating at least one algorithm executive sub according to the function information and the dependency mapping information.
8. The apparatus according to claim 7, wherein the algorithm scheduling sub-analyzing component is further configured to send the algorithm scheduling sub-that has no dependency to the different algorithm execution sub-generating component according to the result of the data dependency judgment.
9. The apparatus of claim 6, wherein the algorithm scheduler generating component is further configured to update the information in the spatial state table, the temporal state table, the control state table, and the operation state table after each time an algorithm scheduler is scheduled.
10. The apparatus of claim 9, wherein the scheduling status information comprises a waiting scheduling status, a scheduling cycle status or a scheduling end status, and the time status table contains the scheduling times of each of the algorithm schedules; and the algorithm scheduling sub generating component is used for correspondingly updating the scheduling state information of each algorithm scheduling sub according to the scheduling times of each algorithm scheduling sub in the time state table.
11. The apparatus according to claim 10, wherein the algorithm scheduler generating means is configured to set the scheduling status information of a certain algorithm scheduler as the waiting schedule if the certain algorithm scheduler is waiting to update the function information; if a certain algorithm scheduler is in a scheduled state and the scheduling times in the scheduling state information do not reach a preset threshold value, setting the scheduling state information of the certain algorithm scheduler as a scheduling cycle; and if the scheduling times in the scheduling state information of a certain algorithm scheduling son reach the preset threshold, setting the scheduling state information of the certain algorithm scheduling son as scheduling end.
12. The apparatus of claim 3, wherein the operation engine comprises a parsing means, a control means and an operation means connected in sequence,
the analysis device is used for analyzing the received algorithm executors to obtain current execution state information and current execution operation information;
the control device is used for controlling the arithmetic device to enter one of a starting state, a circulating state or an ending state according to the current execution state information, and then controlling the arithmetic device to execute the related operation according to the current execution operation information;
the arithmetic device is used for executing the related operation in the entering state.
13. The apparatus of claim 12, wherein the operation engine is further configured to update the execution state information of the algorithm executor after completing the operation to be executed in the current state, and determine a next state entered by the operation apparatus, wherein the next state is one of a start state, a loop state, or an end state.
14. The apparatus according to claim 13, wherein the control device is further configured to control the arithmetic device to output the arithmetic result if all the execution status information of the algorithm executors is updated.
15. The device according to any of claims 12 to 14, wherein the control device is specifically configured to:
if the arithmetic device is controlled to enter the starting state according to the current execution state information, controlling the arithmetic device to execute the operation of the starting state, wherein the operation of the starting state comprises one or more of initializing computing resources, I/O resources or controlling resources;
if the arithmetic device is controlled to enter a cycle state according to the current execution state information, the arithmetic device is controlled to execute the operation of the cycle state, wherein the operation of the cycle state comprises the parallel execution of one or more of calculation operation, I/O operation or control operation in the cycle state;
and if the arithmetic device is controlled to enter the end state according to the current execution state information, controlling the arithmetic device to execute the operation of the end state, wherein the operation of the end state comprises one or more of parallel execution of calculation operation, I/O operation or control operation in the end state.
16. The apparatus of claim 15, wherein the end state operations further comprise: and releasing one or more of the computing resources, the I/O resources or the control resources.
17. An adaptive algorithm operation method, comprising:
obtaining an algorithm descriptor according to an algorithm, and obtaining an algorithm executor according to the algorithm descriptor, wherein the algorithm descriptor comprises topological structure information, data flow structure information and calculation flow structure information of the algorithm, and the algorithm executor comprises execution state information and execution operation information;
analyzing the received algorithm executer to obtain current execution state information and current execution operation information, and executing related operations according to the execution state information and the current execution operation information to obtain an operation result;
the obtaining of the algorithm descriptor according to the algorithm and the obtaining of the algorithm executor according to the algorithm descriptor include:
obtaining an algorithm dispatcher according to the algorithm descriptor;
the algorithm descriptor further comprises control flow structure information, and the obtaining of the algorithm scheduler according to the algorithm descriptor comprises the following steps:
determining the number of the algorithm dispatchers according to the topological structure information of the algorithm descriptors;
determining scheduling state information of each algorithm scheduler according to the data flow information of the algorithm descriptors;
determining the function information of each algorithm scheduling sub according to the control flow structure information and the calculation flow structure information of the algorithm descriptors;
obtaining at least one algorithm scheduling son according to the number of the algorithm scheduling son, the scheduling state information and the function information of each algorithm scheduling son;
and scheduling type information is distributed to the algorithm scheduling sub, and the execution type information of the algorithm execution sub is determined according to the scheduling type information of the algorithm scheduling sub, wherein the execution type information is used for determining hardware resources of the corresponding algorithm execution sub-correlation operation.
18. The method of claim 17, wherein the deriving an algorithm descriptor from an algorithm, deriving an algorithm executor from the algorithm descriptor, further comprises:
obtaining the number of algorithm executors, the execution state information and the execution operation information of each algorithm executor according to the scheduling state information and the function information in the algorithm dispatchers;
and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son.
19. The method of claim 18, further comprising:
analyzing whether the operation result is the final result of the algorithm dispatcher;
if the operation result is not the final result of the algorithm scheduling son, returning to execute the scheduling state information and the function information in the algorithm scheduling son to obtain the number of the algorithm executing son, the execution state information and the execution operation information of each algorithm executing son; and obtaining at least one algorithm executive son according to the number of the algorithm executive sons, the execution state information and the execution operation information of each algorithm executive son.
20. The method of claim 19, further comprising:
if the operation result is the final result of the algorithm dispatcher, analyzing whether the operation result is the final result of the algorithm descriptor, and if the operation result is the final result of the algorithm descriptor, terminating the operation.
21. The method of claim 20, further comprising:
and if the operation result is not the final result of the algorithm descriptor, controlling an algorithm self-adaptive device to execute the step of obtaining an algorithm scheduling sub according to the algorithm descriptor.
22. The method of claim 17, wherein the algorithm descriptor further includes control flow structure information,
the determining the number of the algorithm dispatchers according to the topological structure information of the algorithm descriptors comprises the following steps:
analyzing the algorithm descriptor, extracting topological structure information of the algorithm from an analysis result, and mapping the data space distribution of the algorithm to a space state table according to the topological structure information of the algorithm; determining the number of generated algorithm dispatchers according to the space state table;
the determining the scheduling state information of each algorithm scheduler according to the data flow information of the algorithm descriptor includes:
extracting data flow information of the algorithm from the analysis result, and mapping the data time distribution of the algorithm to a time state table according to the data flow information;
obtaining scheduling state information of the algorithm scheduler according to the time state table;
the determining the function information of each algorithm scheduling sub according to the control flow structure information and the calculation flow structure information of the algorithm descriptors comprises the following steps:
extracting control flow information of the algorithm from the analysis result, and mapping a control process of the algorithm to a control state table according to the control flow information;
extracting operation flow information of the algorithm from the analysis result, and mapping the operation process of the algorithm to an operation state table according to the operation flow information;
and obtaining the function information of the algorithm dispatcher according to the control state table and the operation state table.
23. The method according to claim 22, wherein the number of algorithm executors, the execution state information and the execution operation information of each algorithm executor are obtained according to the scheduling state information and the function information in the algorithm scheduler; obtaining at least one algorithm executor according to the number of the algorithm executors, the execution state information of each algorithm executor, and the execution operation information, including:
performing data dependence judgment according to the scheduling state and the functional information of the algorithm scheduling son, and adding dependence mapping information in the corresponding algorithm scheduling son according to the result of the data dependence judgment;
and analyzing the algorithm scheduling sub added with the dependency mapping information to obtain the function information and the dependency mapping information, and generating at least one algorithm executive sub according to the function information and the dependency mapping information.
24. The method of claim 23, wherein the algorithm scheduler generation component is further configured to update information in the spatial state table, the temporal state table, the control state table, and the operational state table after each algorithm scheduler is scheduled.
25. The method of claim 24, wherein the scheduling status information comprises a waiting scheduling status, a scheduling cycle status or a scheduling end status, and the time status table contains the scheduling times of each of the algorithm schedules; the method further comprises the following steps: and correspondingly updating the scheduling state information of each algorithm scheduling sub according to the scheduling times of each algorithm scheduling sub in the time state table.
26. The method according to claim 25, wherein said updating the scheduling status information of each said algorithm scheduler according to the scheduling times of each said algorithm scheduler in the time status table correspondingly comprises:
if a certain algorithm scheduler waits for updating the function information, setting the scheduling state information of the certain algorithm scheduler as a waiting schedule;
if a certain algorithm scheduler is in a scheduled state and the scheduling times in the scheduling state information do not reach a preset threshold value, setting the scheduling state information of the certain algorithm scheduler as a scheduling cycle;
and if the scheduling times in the scheduling state information of a certain algorithm scheduling son reach the preset threshold, setting the scheduling state information of the certain algorithm scheduling son as scheduling end.
27. The method of claim 19, wherein performing the associated operation according to the execution status information and the current execution operation information to obtain the operation result comprises:
and determining to enter one of a starting state, a circulating state or an ending state according to the current execution state information, and then executing relevant operation according to the current execution operation information in the entered state.
28. The method of claim 27, further comprising:
and after the operation to be executed in the current state is finished, updating the execution state information of the algorithm execution sub-unit, and determining the next state to enter, wherein the next state is one of a starting state, a circulating state or an ending state.
29. The method of claim 28, further comprising:
and if the execution state information of the algorithm execution son is completely updated, outputting an operation result.
30. The method according to any of claims 27-29, wherein performing the associated operation according to the currently executing operation information in the entered state comprises:
if the arithmetic device is controlled to enter the starting state according to the current execution state information, controlling the arithmetic device to execute the operation of the starting state, wherein the operation of the starting state comprises one or more of initializing computing resources, I/O resources or controlling resources;
if the arithmetic device is controlled to enter a cycle state according to the current execution state information, the arithmetic device is controlled to execute the operation of the cycle state, wherein the operation of the cycle state comprises the parallel execution of one or more of calculation operation, I/O operation or control operation in the cycle state;
and if the arithmetic device is controlled to enter the end state according to the current execution state information, controlling the arithmetic device to execute the operation of the end state, wherein the operation of the end state comprises one or more of parallel execution of calculation operation, I/O operation or control operation in the end state.
31. The method of claim 30, wherein the ending state operations further comprise: and releasing one or more of the computing resources, the I/O resources or the control resources.
CN201911136120.3A 2019-11-19 2019-11-19 Adaptive algorithm operation device and adaptive algorithm operation method Active CN110928833B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011570149.5A CN112905524A (en) 2019-11-19 2019-11-19 Adaptive algorithm operation method and device
CN201911136120.3A CN110928833B (en) 2019-11-19 2019-11-19 Adaptive algorithm operation device and adaptive algorithm operation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911136120.3A CN110928833B (en) 2019-11-19 2019-11-19 Adaptive algorithm operation device and adaptive algorithm operation method

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202011570149.5A Division CN112905524A (en) 2019-11-19 2019-11-19 Adaptive algorithm operation method and device

Publications (2)

Publication Number Publication Date
CN110928833A CN110928833A (en) 2020-03-27
CN110928833B true CN110928833B (en) 2021-01-22

Family

ID=69850315

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201911136120.3A Active CN110928833B (en) 2019-11-19 2019-11-19 Adaptive algorithm operation device and adaptive algorithm operation method
CN202011570149.5A Pending CN112905524A (en) 2019-11-19 2019-11-19 Adaptive algorithm operation method and device

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202011570149.5A Pending CN112905524A (en) 2019-11-19 2019-11-19 Adaptive algorithm operation method and device

Country Status (1)

Country Link
CN (2) CN110928833B (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7904187B2 (en) * 1999-02-01 2011-03-08 Hoffberg Steven M Internet appliance system and method
CN109213581B (en) * 2017-07-05 2021-06-08 上海寒武纪信息科技有限公司 Data processing device and method
US10553207B2 (en) * 2017-12-29 2020-02-04 Facebook, Inc. Systems and methods for employing predication in computational models
CN110210614B (en) * 2019-05-31 2020-08-25 中科寒武纪科技股份有限公司 Operation method, device and related product
CN110322010B (en) * 2019-07-02 2021-06-25 深圳忆海原识科技有限公司 Pulse neural network operation system and method for brain-like intelligence and cognitive computation
CN110377340B (en) * 2019-07-24 2021-06-01 中科寒武纪科技股份有限公司 Operation method, device and related product

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
A Library for Deep Learning Processor;Lan, HY等;《JOURNAL OF COMPUTER SCIENCE AND TECHNOLOGY》;20170331;第32卷(第2期);第286-296页 *

Also Published As

Publication number Publication date
CN112905524A (en) 2021-06-04
CN110928833A (en) 2020-03-27

Similar Documents

Publication Publication Date Title
CN107885595B (en) Resource allocation method, related equipment and system
US11062201B2 (en) Chip and chip-based data processing method
CN110069341B (en) Method for scheduling tasks with dependency relationship configured according to needs by combining functions in edge computing
CN110209472B (en) Task data processing method and board card
CN109033540B (en) Excitation management method and system in chip random verification process
CN112199196B (en) Resource allocation method, medium and server
CN113037800A (en) Job scheduling method and job scheduling device
CN105389204A (en) Multiple-resource partial order scheduling policy
CN110928833B (en) Adaptive algorithm operation device and adaptive algorithm operation method
CN110941584B (en) Operation engine and data operation method
CN110633106B (en) Algorithm adaptive device and algorithm adaptive method
CN111381946B (en) Task processing method and device and related products
CN111061618A (en) Cloud platform simulation system, cloud platform performance test method and computer equipment
CN112817722A (en) Time-sharing scheduling method based on priority, terminal and storage medium
CN115729705A (en) Distributed task batch processing method, device, equipment and storage medium
CN110825502B (en) Neural network processor and task scheduling method for neural network processor
CN113159657B (en) Execution resource allocation method, device and storage medium for procedures
CN115129481A (en) Computing resource allocation method and device and electronic equipment
Qasim et al. Dynamic mapping of application workflows in heterogeneous computing environments
CN112667397B (en) Machine learning system and resource allocation method thereof
CN113015254B (en) GPP resource-based waveform deployment method, device, equipment and medium
CN111382857A (en) Task processing device, neural network processor chip, combination device and electronic equipment
WO2024087844A1 (en) Graph neural network training method and system, and abnormal account identification method
US20230401091A1 (en) Method and terminal for performing scheduling
CN113282383A (en) Task scheduling method, task processing method and related products

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20201215

Address after: Room 611-194, R & D center building, China (Hefei) international intelligent voice Industrial Park, 3333 Xiyou Road, hi tech Zone, Hefei City, Anhui Province

Applicant after: Anhui Cambrian Information Technology Co., Ltd

Address before: 100190 room 644, research complex, 6 South Road, Haidian District Science Academy, Beijing.

Applicant before: Zhongke Cambrian Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant