Instruction sequence generation method and device, electronic equipment and storage medium

By dividing the calculation graph of the neural network model into subgraphs and generating instruction sequences based on hardware resource information, combined with reinforcement learning optimization, the problem of poor instruction sequence performance in the existing technology is solved, and efficient instruction generation and execution are achieved.

CN118567654APending Publication Date: 2024-08-30BEIJING HORIZON INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410675109.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

When the existing technology compiles a neural network model into a hardware-executable instruction sequence, it is difficult to obtain an instruction sequence with optimal performance, and pruning is often used to reduce the search cost, resulting in performance degradation.

Method used

By dividing the calculation graph of the neural network model to be compiled into multiple calculation subgraphs, and generating the optimal instruction subsequence based on each calculation subgraph and hardware resource status information, the target instruction sequence is determined, and the reinforcement learning model is used to optimize the instructions. generation process.

Benefits of technology

It improves the overall execution performance of the instruction sequence, reduces the search cost, does not rely on model pruning, and ensures the effective generation of model performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567654A
    Figure CN118567654A
Patent Text Reader

Abstract

The embodiment of the invention discloses an instruction sequence generation method and device, electronic equipment and a storage medium, and the method comprises the steps: determining a calculation graph corresponding to a to-be-compiled neural network model and resource state information of hardware of a to-be-executed instruction sequence; segmenting the calculation graph, and determining a plurality of calculation sub-graphs; generating instruction subsequences corresponding to the calculation sub-graphs based on the calculation sub-graphs and the resource state information; and based on each instruction sub-sequence, determining a target instruction sequence corresponding to the to-be-compiled neural network model. According to the embodiment of the invention, the overall execution performance of the instruction sequence can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to neural network model compilation technology, and in particular to a method, device, electronic device and storage medium for generating an instruction sequence. Background Art

[0002] In the compiler, the neural network model to be compiled is usually converted into an intermediate representation (or computational graph) that is completely unbound or less bound to hardware information, so as to facilitate some general conversions and optimizations. These intermediate representations ultimately need to be mapped to the actual hardware, that is, the computational graph is converted into a hardware executable instruction sequence to complete the generation of the instruction sequence. How to obtain the optimal instruction sequence has become a technical problem that needs to be solved urgently.

[0003] %n@@

[0004] In order to solve the above technical problems, the embodiments of the present disclosure provide a method, device, electronic device and storage medium for generating an instruction sequence, which can obtain an instruction sequence with optimal or better performance and improve the performance of the instruction sequence.

[0005] The first aspect of the present disclosure provides a method for generating an instruction sequence, comprising: determining a computational graph corresponding to a neural network model to be compiled and resource status information of hardware to execute the instruction sequence; dividing the computational graph to determine a plurality of computational subgraphs; based on each of the computational subgraphs and the resource status information, generating an instruction subsequence corresponding to each of the computational subgraphs; based on each of the instruction subsequences, determining a target instruction sequence corresponding to the neural network model to be compiled.

[0006] The second aspect of the present disclosure provides an instruction sequence generation device, including: a first processing module, used to determine the calculation graph corresponding to the neural network model to be compiled and the resource status information of the hardware to execute the instruction sequence; a second processing module, used to divide the calculation graph to determine a plurality of calculation subgraphs; a third processing module, used to generate an instruction subsequence corresponding to each calculation subgraph based on each calculation subgraph and the resource status information; a fourth processing module, used to determine the target instruction sequence corresponding to the neural network model to be compiled based on each instruction subsequence.

[0007] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute the method for generating an instruction sequence described in any of the above embodiments of the present disclosure.

[0008] The fourth aspect of the present disclosure provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the method for generating an instruction sequence described in any of the above embodiments of the present disclosure.

[0009] A fifth aspect of the present disclosure provides a computer program product. When instructions in the computer program product are executed by a processor, the method for generating an instruction sequence provided in any of the above embodiments of the present disclosure is executed.

[0010] Based on the instruction sequence generation method, device, electronic device and storage medium provided by the above embodiments of the present disclosure, by dividing the computational graph corresponding to the neural network model to be compiled into multiple computational sub-graphs, it is convenient to determine the instruction sub-sequence with the best performance according to the resource occupation of the hardware by the computational sub-graphs, and then obtain the target instruction sequence corresponding to the neural network model to be compiled based on the optimal instruction sub-sequence of each computational sub-graph, which can effectively improve the overall execution performance of the instruction sequence. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 This is an exemplary application scenario of the method for generating an instruction sequence provided by the present disclosure;

[0012] Figure 2 is a flowchart of a method for generating an instruction sequence provided by an exemplary embodiment of the present disclosure;

[0013] Figure 3 is a flowchart of a method for generating an instruction sequence provided by another exemplary embodiment of the present disclosure;

[0014] Figure 4 It is a schematic diagram of a generation process of an instruction subsequence corresponding to a computation subgraph provided by an exemplary embodiment of the present disclosure;

[0015] Figure 5 is a schematic diagram of a generation process of an instruction subsequence corresponding to a computation subgraph provided by another exemplary embodiment of the present disclosure;

[0016] Figure 6 is a schematic diagram of a training process of a policy network provided by an exemplary embodiment of the present disclosure;

[0017] Figure 7 is a principle block diagram of instruction sequence generation based on reinforcement learning provided by an exemplary embodiment of the present disclosure;

[0018] Figure 8 It is a structural schematic diagram of a device for generating an instruction sequence provided by an exemplary embodiment of the present disclosure;

[0019] Fig. 9is a schematic diagram of the structure of an instruction sequence generation device provided by another exemplary embodiment of the present disclosure;

[0020] Fig.10 It is a structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0021] To explain the present disclosure, example embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. It should be understood that the present disclosure is not limited to the example embodiments.

[0022] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.

[0023] SUMMARY OF THE DISCLOSURE

[0024] In the process of implementing the present disclosure, the inventors found that in the compiler, the neural network model to be compiled is usually converted into an intermediate representation (or computational graph) that is completely unbound or less bound to hardware information, so as to facilitate some general conversions and optimizations. These intermediate representations ultimately need to be mapped to the actual hardware, that is, the computational graph is converted into a hardware executable instruction sequence to complete the generation of the instruction sequence. The hardware may include, for example, processors (CPUs), neural network processors, memories and other hardware on devices such as vehicle-mounted terminals and mobile phone terminals. In the related art, the search cost of generating an instruction sequence is usually reduced by pruning the neural network model, which easily leads to a decrease in the performance of the instruction sequence.

[0025] Exemplary Overview

[0026] The embodiments of the present disclosure may mainly include two stages, namely a compilation stage and a running stage; wherein, in the compilation stage, the instruction sequence generation method provided by the embodiments of the present disclosure may be executed to generate instructions for performing neural network operations; in the running stage, the image processing method provided by the embodiments of the present disclosure may be executed based on the instructions generated in the compilation stage to realize the operation processing of image frames, thereby avoiding the waste of computing resources.

[0027] Figure 1 This is an exemplary application scenario of the method for generating an instruction sequence provided by the present disclosure. Figure 1As shown, in the compilation process of the neural network model, the instruction sequence generation device (hereinafter referred to as the device) of the embodiment of the present disclosure can be used to execute the instruction sequence generation method of the embodiment of the present disclosure, and the device may include a conversion module 11 and an optimization mapping module 12. The neural network model to be compiled can be converted into an intermediate representation of the calculation graph by the conversion module 11, and then the calculation graph can be segmented by the optimization mapping module 12 to determine multiple calculation subgraphs, and the optimal instruction subsequences corresponding to each calculation subgraph are generated based on the resource status information of the hardware of each calculation subgraph and the instruction sequence to be executed. Based on the optimal instruction subsequences, the optimal target instruction sequence corresponding to the neural network model to be compiled is determined, thereby obtaining the model instruction sequence with the best performance and improving the execution performance of the instruction sequence. The instruction sequence generation method disclosed in the present disclosure divides the calculation graph corresponding to the neural network model to be compiled into multiple calculation subgraphs, so as to facilitate the determination of the instruction subsequence with the best performance according to the resource occupancy of the hardware of the instruction sequence to be executed by the calculation subgraph, thereby effectively improving the overall execution performance of the instruction sequence, and generating the corresponding instruction subsequence with the calculation subgraph as the granularity, reducing the search cost, and realizing the effective generation of the instruction sequence without relying on the pruning of the model, which can effectively guarantee the model performance. The instruction sequence generation method disclosed in the present invention can be applied to the compilation process of any neural network model.

[0028] Exemplary Methods

[0029] Figure 2 1 is a flow chart of a method for generating an instruction sequence provided by an exemplary embodiment of the present disclosure. This embodiment can be applied to electronic devices, such as servers, terminal devices, etc. Figure 2 As shown, the method of the embodiment of the present disclosure may include the following steps:

[0030] Step 201, determine the resource status information of the hardware of the computation graph corresponding to the neural network model to be compiled and the instruction sequence to be executed.

[0031] Among them, the neural network model to be compiled (referred to as model) can be any neural network model, for example, the neural network model to be compiled can be a target detection model, a semantic segmentation model, a classification model, etc., and is not specifically limited. The neural network model to be compiled can be a neural network model obtained by pre-training. The calculation graph is an intermediate representation between a high-level language and a machine-executable language. The calculation graph may include one or more operator nodes and the connection relationship between each operator node. Operator nodes may include, for example, data loading nodes, data computing nodes, data storage nodes, etc. The data loading node is used to load tensors, weights, and other data for data computing nodes. The data computing node may include operators for various calculations in the model. For example, the data computing node may include nodes for operators such as matrix multiplication, convolution, corresponding element addition, pooling, and corresponding element multiplication. The data storage node is a node for storing the calculation results of the data computing node. The connection relationship between the operator nodes can represent the calculation order between the operator nodes. The hardware of the instruction sequence to be executed (referred to as the target hardware in the embodiment of the present disclosure) is the hardware on the target machine to which the neural network model to be compiled is to be deployed. For example, the target hardware may be the hardware in terminal devices such as vehicle-mounted computing devices and mobile phones. Specifically, the target hardware may include hardware such as processors (CPUs), neural network processors (NPUs), and memories. Resource status information may include relevant status information of resources such as computing resources and storage resources of the target hardware. Specifically, the resource status information may include information such as resource size, resource type, resource occupation status, and fastest resource release time. Computing resources may include processing units of the target hardware, and processing units may include, for example, convolution (conv) computing units, lookup tables (Look Up Table, abbreviated as: LUT) units, etc. Storage resources may include storage units of the target hardware, and storage units may include, for example, L1 Sram, L2 Sram, etc. L1 Sram represents a static random access memory as a first-level cache, and L2 Sram represents a static random access memory as a second-level cache.

[0032] In some optional embodiments, the neural network model to be compiled can be converted into a computational graph according to a conversion relationship (or conversion rule) between the language corresponding to the neural network model to be compiled and the computational graph.

[0033] In some optional embodiments, resource status information of the target hardware may be obtained based on the actual situation of the target hardware.

[0034] Step 202, split the computation graph to determine multiple computation subgraphs.

[0035] Among them, the computation subgraph may include a graphical representation of the computation sequence of one or more groups of operator nodes composed of data loading nodes, data computing nodes, and data storage nodes in the computation graph. The computation graph includes multiple computation subgraphs. That is, the computation graph is divided into multiple computation subgraphs.

[0036] In some optional embodiments, multiple computational subgraphs may be determined based on dependencies between operator nodes in a computational graph, and the multiple computational subgraphs have corresponding data dependencies, for example, the output of one computational subgraph serves as the input of another computational subgraph.

[0037] Step 203: Based on each computing subgraph and resource status information, generate instruction subsequences corresponding to each computing subgraph.

[0038] Among them, according to each computing subgraph and resource status information, the optimal resource allocation situation can be determined for each computing subgraph, so as to generate an instruction subsequence corresponding to each computing subgraph.

[0039] In some optional embodiments, in the process of converting each computational subgraph into an instruction sequence executable by hardware, the best option can be determined from a variety of optimization options to meet the performance requirements of the hardware executing the instruction sequence. For example, the operations included in the computational subgraph can be split, actual space can be allocated for data, and the scheduling order can be determined for instructions. The best choice of the computational subgraph can be found from these selection spaces through an optimization search method (such as a heuristic search method such as a tree search), thereby generating an optimal instruction subsequence corresponding to the computational subgraph, and then obtaining a target instruction sequence corresponding to the neural network model to be compiled.

[0040] In some optional embodiments, instruction subsequences corresponding to each computational subgraph may also be generated based on a reinforcement learning model.

[0041] Step 204: Based on each instruction subsequence, determine the target instruction sequence corresponding to the neural network model to be compiled.

[0042] After obtaining the instruction subsequences of each computational subgraph, the sequence of each instruction subsequence can be obtained according to the data dependency relationship between the computational subgraphs, thereby obtaining the target instruction sequence corresponding to the neural network model to be compiled.

[0043] The method for generating an instruction sequence provided in this embodiment, by dividing the computation graph corresponding to the neural network model to be compiled into multiple computation subgraphs, facilitates determining the instruction subsequence with the best performance according to the resource occupation of the hardware by the computation subgraph, and then obtains the target instruction sequence corresponding to the neural network model to be compiled based on the optimal instruction subsequence of each computation subgraph, which can effectively improve the overall execution performance of the instruction sequence. And the corresponding instruction subsequence is generated with the computation subgraph as the granularity, which reduces the search cost, and can achieve effective generation of the instruction sequence without relying on pruning the model, which can effectively guarantee the model performance.

[0044] In some optional embodiments, generating the instruction subsequences corresponding to the computation subgraphs based on the computation subgraphs and the resource status information in step 203 may include:

[0045] Based on each computational subgraph and resource status information, a reinforcement learning method is used to generate instruction subsequences corresponding to each computational subgraph. Specifically, based on the dependency relationship between each computational subgraph and the resource status information updated in real time, the candidate action set of each computational subgraph can be determined in turn. The candidate action set can include optional action information corresponding to the computational subgraph. Each action information corresponds to an intermediate instruction or instruction. The intermediate instruction is an instruction close to the intermediate representation of the machine executable instruction, which can be converted into a corresponding instruction. The action information can be structured data, and the action information can include one or more optional optimization items. The optimization items can include, for example, elements corresponding to relevant information such as instruction category, selected tensor for calculation, size of calculation data, storage address of generated data, etc. The generation problem of instruction subsequences is converted into a reinforcement learning environment, and the optional space of instruction subsequences is converted into a candidate action space of reinforcement learning, so as to obtain the optimal instruction subsequence of the computational subgraph from the candidate action set using the reinforcement learning model. After obtaining the optimal instruction subsequence of each computational subgraph, the optimal instruction sequence of the neural network model to be compiled is obtained based on the optimal instruction subsequence of each computational subgraph, thereby improving the generation efficiency of the instruction sequence.

[0046] Figure 3 It is a flowchart of a method for generating an instruction sequence provided by another exemplary embodiment of the present disclosure.

[0047] In some optional embodiments, such as Figure 3 As shown in the above Figure 2 Based on the illustrated embodiment, step 203 of generating instruction subsequences corresponding to each computing subgraph based on each computing subgraph and resource status information may include:

[0048] Step 2031, determine the current computing subgraph and current resource status information.

[0049] The current computation subgraph is determined based on the dependency relationship between the computation subgraphs in the computation graph, and the current resource status information is determined based on the resource status information of the hardware.

[0050] In some optional embodiments, each computation subgraph may be used as the current computation subgraph in turn according to the dependency relationship of each computation subgraph in the computation graph. The current resource status information is real-time resource status information after the resource status information of the hardware is updated in real time according to the occupation of resources by the generated instruction subsequence. That is, the current resource status information may include currently occupied resource information and currently idle resource information.

[0051] In some optional embodiments, the computation subgraph where the starting operator node of the computation graph is located (which may be referred to as the first computation subgraph) may be first used as the current computation subgraph, and the initial resource status information (i.e., the resource status information of the hardware determined in step 201) may be used as the current resource status information. After obtaining the instruction subsequence of the first computation subgraph, the current resource status information may be updated according to the resource occupancy of the instruction subsequence of the first computation subgraph, and the updated current resource status information may be obtained, so as to determine the current resource status information corresponding to the second computation subgraph based on the updated current resource status information. The second computation subgraph whose input data depends on the first computation subgraph may be used as the current computation subgraph, and the updated current resource status information may be used as the current resource status information. By analogy, each computation subgraph may be used as the current computation subgraph in turn based on the input dependency.

[0052] Step 2032, determine the current action set based on the current computation subgraph and current resource status information.

[0053] Among them, the current action set includes at least one candidate action information. The action information can be structured data, which can correspond to an intermediate instruction or a machine instruction. The intermediate instruction is an intermediate representation close to the machine instruction, and each intermediate instruction can correspond to a machine instruction. The action information may include selectable optimization items. The optimization items may include, for example, one or more of the action type, the tensor selected for calculation, the size of the calculation data, the storage address of the calculation result data, etc. The action type may include, for example, load, calculate, store, skip, etc. Loading refers to loading the data (or tensor) to be calculated, calculating refers to calculating the loaded data to be calculated, and storing refers to storing the calculation results. Skipping means not executing the action. There is at least one different optimization item between any two candidate action information in the current action set, for example, the action type between the two candidate action information is different or the size of the calculation data is different, etc., to represent different selectable action information.

[0054] In some optional embodiments, each action information may be represented as a vector including one or more elements (which may be referred to as an action vector). Different elements of the vector represent different optimization options. For example, the above-mentioned action type, the tensor selected for calculation, the size of the calculation data, and the storage address of the calculation result data are respectively used as elements of the vector to form a structured action vector.

[0055] In some optional embodiments, the current action set is used as the current action space of the reinforcement learning environment, and the generation of the instruction subsequence is converted into the action generation process of reinforcement learning, which can effectively improve the search efficiency of the optimal instruction sequence.

[0056] Step 2033, based on the current computation subgraph, the current resource status information and the current action set, determine the current instruction subsequence corresponding to the current computation subgraph.

[0057] Among them, based on the current computational subgraph, the current resource state information and the current action set, the current instruction subsequence corresponding to the current computational subgraph can be obtained by iteratively selecting actions according to the action selection strategy of reinforcement learning. Since the action selection strategy of reinforcement learning is a strategy for learning to select the optimal action based on hardware resources, the instructions in the current instruction subsequence are optimized instructions based on the actual state of the hardware resources, which can effectively guarantee the performance of the current instruction subsequence.

[0058] Step 2034, in response to the termination condition not being met, the current resource status information is updated according to the resource information occupied by the current instruction subsequence, the updated resource status information is obtained, and the instruction subsequence corresponding to the next computation subgraph is determined based on the updated resource status information.

[0059] Among them, the end condition may include that the current calculation subgraph is the last calculation subgraph corresponding to the calculation graph, or the current calculation subgraph includes the end operator node of the calculation graph, etc., which can represent the conditions for completing the generation of instruction subsequences of all calculation subgraphs. The specific end condition is not limited. If the end condition is not met, it means that there are still calculation subgraphs that have not generated instruction subsequences. Then, the current resource status information is updated according to the resource information occupied by the current instruction subsequence, and the updated resource status information is obtained, and then the instruction subsequence corresponding to the next calculation subgraph is determined based on the updated resource status information. The instruction subsequence corresponding to the next calculation subgraph can be obtained according to the process of the current instruction subsequence mentioned above, and the details will not be repeated one by one. According to the above process, until the end condition is met, the instruction subsequences corresponding to each calculation subgraph are obtained.

[0060] This embodiment converts the optimization selection of the computational subgraph into the optional action space (i.e., action set) of reinforcement learning, thereby converting the generation process of the instruction subsequence of the computational subgraph into the action selection process of reinforcement learning. Compared with other search methods, the generation efficiency of the optimal instruction sequence can be further improved.

[0061] Figure 4 It is a schematic diagram of the generation process of an instruction subsequence corresponding to a computation subgraph provided by an exemplary embodiment of the present disclosure.

[0062] In some optional embodiments, the computation subgraph includes at least one computation task. Figure 4 As shown, step 2033 of determining the current instruction subsequence corresponding to the current computation subgraph based on the current computation subgraph, the current resource state information and the current action set may include the following steps:

[0063] Step 20331, based on the current computing subgraph, the current resource status information and the completion status information of each computing task of the current computing subgraph, determine the current action information from the current action set.

[0064] Step 20332, based on the current action information, determine the current instruction and the resource configuration information corresponding to the current instruction.

[0065] Step 20333, based on the current instruction and the resource configuration information corresponding to the current instruction, update the current resource status information and the completion status information of each computing task, and repeat the step of determining the current action information from the current action set based on the current computing subgraph, the current resource status information and the completion status information of each computing task of the current computing subgraph.

[0066] Step 20334, in response to completing each computing task of the current computing subgraph, based on the instructions determined each time, obtain the current instruction subsequence corresponding to the current computing subgraph.

[0067] Among them, the computing task refers to the task of tensor calculation that the computing subgraph needs to complete, and the computing task is recorded in units of independent data blocks of tensors. Each tensor may include one or more data blocks. In the case of multiple data blocks, the calculation of the tensor may be divided into the calculation of multiple data blocks. The division of the data blocks can be implemented according to the operations supported by the processing unit in the hardware. For example, the addition of corresponding elements can be divided into the addition of corresponding elements between two tensors of larger size and between multiple pairs of two tensors of smaller size. Then each tensor of larger size corresponds to multiple tensors of smaller size (ie, data blocks). The completion status information of the computing task may include two states: completed and uncompleted. Each operator node corresponds to one or more computing tasks, such as computing tasks for loading tensor data (load), tasks for tensor calculation, tasks for storing calculation results, and the like.

[0068] In some optional embodiments, an optimal strategy may be determined based on reinforcement learning, and optimal current action information may be determined from a current action set based on the optimal strategy.

[0069] In some optional embodiments, the current action information may be structured data, and the current instruction corresponding to the current action information may be obtained by parsing the structured data of the current action information. The current instruction is a machine executable instruction (i.e., a hardware executable instruction). The current instruction may include an instruction corresponding to the current computing task. After the current instruction is determined, the resource configuration information corresponding to the current instruction may be determined according to the current instruction. The resource configuration information may include storage resources, processing resources, etc. corresponding to the current instruction. The storage resources corresponding to the current instruction may be determined according to the data size involved in the current instruction, and the processing resources corresponding to the current instruction may include a processing unit type, occupied time information, etc. The processing unit type may be determined according to the instruction type corresponding to the current instruction, and the occupied time information may be obtained by simulating the execution of the current instruction, i.e., calculating the execution time of the current instruction according to the calculation rule corresponding to the current instruction. The current resource status information and the completion status information of the computing task may be updated according to the current instruction and the resource configuration information corresponding to the current instruction, and the status information of the resource corresponding to the current instruction in the current resource status information may be updated to be occupied, i.e., the completion status information of the computing task corresponding to the current instruction may be updated to be completed, so as to ensure the real-time, accuracy and reliability of the resource status information and the completion status information of the computing task.

[0070] In some optional embodiments, during the generation of the instruction sequence, the release time of the occupied resources can be determined in real time according to the occupation time of the resources by the instructions of the configured resources. Then, during the subsequent instruction sequence generation process, the resources are configured for the subsequent instructions in real time according to the release time of the occupied resources to ensure the utilization rate of the resources. The release time of the occupied resources can be represented by the fastest release time of the resources in the resource status information.

[0071] In some optional embodiments, after updating the current resource status information and the completion status information of each computing task, the updated current resource status information can be used as the current resource status information, and the updated completion status information of each computing task can be used as the completion status information of each computing task, and then the steps of determining the current action information from the current action set based on the current computing subgraph, the current resource status information and the completion status information of each computing task of the current computing subgraph and subsequent steps are repeated to obtain a new current instruction (i.e., the next instruction of the above current instruction), and so on, until each computing task of the current computing subgraph is completed and the instructions corresponding to each computing task are obtained. The instructions determined each time are formed into a current instruction subsequence corresponding to the current computing subgraph in the order of acquisition.

[0072] In some optional embodiments, Figure 5 is a schematic diagram of a generation process of an instruction subsequence corresponding to a computation subgraph provided by another exemplary embodiment of the present disclosure, such as Figure 5 As shown, the process of generating the instruction subsequence corresponding to the computation subgraph may include the following steps:

[0073] Step 2033a, based on the current computing subgraph, the current resource status information and the completion status information of each computing task of the current computing subgraph, determine the current action information from the current action set.

[0074] Step 2033b: Determine the current instruction and the resource configuration information corresponding to the current instruction based on the current action information.

[0075] Step 2033c: Update the current resource status information and the completion status information of each computing task according to the current instruction and the resource configuration information corresponding to the current instruction.

[0076] Step 2033d, determine whether the calculation tasks of the current calculation subgraph are completed. If the calculation tasks of the current calculation subgraph are not completed, go to step 2033a; if the calculation tasks of the current calculation subgraph are completed, go to step 2033e.

[0077] Step 2033e, based on the instructions determined each time, obtain the current instruction subsequence corresponding to the current computation subgraph.

[0078] The specific operations of step 2033a to step 2033e can be found in the above content and will not be repeated here.

[0079] This embodiment determines the optimal action from candidate actions according to the computing tasks in the computing subgraph, combining the computing subgraph and real-time resource status information, thereby obtaining instructions corresponding to each computing task, and then obtaining the instruction subsequence corresponding to the computing subgraph, thereby realizing the effective generation of the instruction subsequence of the computing subgraph and improving the generation efficiency of the instruction sequence.

[0080] In some optional embodiments, determining the current instruction and the resource configuration information corresponding to the current instruction based on the current action information may include:

[0081] The current action information is decoded based on the decoding rules to obtain the current instruction and the resource configuration information corresponding to the current instruction.

[0082] Among them, the decoding rules can be set according to the actual structured data of the action information. For example, the decoding rules may include the actual meanings corresponding to the elements at different positions in the action information, such as the first element corresponding to the instruction category, the second element corresponding to the tensor selected for calculation, the third element corresponding to the size of the calculation data, the fourth element corresponding to the address information, etc., and the corresponding elements are decoded from the current action information according to the decoding rules to obtain the resource configuration information corresponding to the current instruction of the current instruction set. Among them, the current instruction can be obtained according to the instruction category, the tensor selected for calculation, the size of the calculation data, etc., and the resource configuration information corresponding to the current instruction can be obtained according to the resource-related information such as the address information.

[0083] According to the current instruction and the resource configuration information corresponding to the current instruction, updating the current resource status information and the completion status information of each computing task may include:

[0084] Based on the current instruction, update the completion status of the computing task corresponding to the current instruction in the completion status information of each computing task, obtain the updated completion status information of each computing task, and use the updated completion status information of each computing task as the completion status information of each computing task; based on the resource configuration information corresponding to the current instruction, update the current resource status information, obtain the updated current resource status information, and use the updated current resource status information as the current resource status information.

[0085] After obtaining the optimal current action information, this embodiment obtains the current instruction by decoding, and can update the resource status information and the completion status information of the computing task in real time according to the current instruction, thereby ensuring the accuracy and effectiveness of the resource status information and the completion status information of the computing task.

[0086] In some optional embodiments, based on the current computing subgraph, the current resource status information, and the completion status information of each computing task of the current computing subgraph, determining the current action information from the current action set may include:

[0087] The pre-trained strategy network is used to process the current computing subgraph, the current resource status information, and the completion status information of each computing task to obtain the current action information.

[0088] Among them, the policy network is a pre-trained neural network that simulates the policy function, and the policy network can be expressed as π(a|s,θ). θ represents the network parameters, a represents the action (corresponding to the action information of the embodiment of the present disclosure), and s represents the state. The state may include the computational subgraph, resource state information, and the completion state information of each computing task in the computational subgraph. The policy network is used to predict the optimal action a under state s. Therefore, the pre-trained policy network can be used to predict the action of the current computational subgraph, the current resource state information, and the completion state information of each computing task to obtain the optimal current action information.

[0089] This embodiment determines the current action information based on a pre-trained policy network, and determines the optimal action based on a reinforcement learning algorithm based on policy learning, which can further improve the action prediction efficiency and the robustness of the current action information, thereby further improving the overall performance of the instruction sequence.

[0090] In some optional embodiments, the policy network is obtained in the following manner: based on the computational graph and resource status information, the policy network to be trained is trained to obtain a trained policy network.

[0091] The strategy network to be trained can adopt any implementable neural network, which is not limited by the embodiments of the present disclosure. Based on the calculation graph and resource status information, the training input data of the strategy network to be trained can be determined, and the training action information can be obtained by processing the training input data through the strategy network to be trained, and then the rewards of the predicted training action information can be continuously updated based on the objective function of maximizing the cumulative reward. After the training is completed, a trained strategy network is obtained for determining the optimal action in the compilation process.

[0092] This embodiment obtains a policy network by training the resource status information of the computation graph and the hardware of the instruction sequence to be executed, so that the policy network can learn how to determine the optimal action, thereby providing an effective policy network for mapping the computation graph to the instruction sequence.

[0093] Figure 6 Schematic diagram of a training process of a policy network provided by an exemplary embodiment of the present disclosure.

[0094] In some optional embodiments, such as Figure 6 As shown, based on the computational graph and resource status information, training the strategy network to be trained to obtain a trained strategy network may include:

[0095] Step 301, determine current training state information.

[0096] The current training state information includes the current training calculation graph and the current training resource state information. The current training calculation graph is determined based on the calculation graph. The current training resource state information is determined based on the resource state information of the hardware.

[0097] In some optional embodiments, the current training computation graph may be marked with the completion status of the computation task.

[0098] In some optional embodiments, the current training computation graph may be one of the multiple computation subgraphs determined based on the computation graph, for example, the current training computation graph may be the starting computation subgraph or other computation subgraphs in the multiple computation subgraphs. The current training resource status information may be resource status information updated in real time during the training process according to the occupation of resources by the determined training action information.

[0099] Step 302: Process the current training state information using the strategy network to be trained to obtain current training action information.

[0100] Among them, the current training state information can be input into the strategy network to be trained to obtain action distribution information, which includes the selection probability of each action information in the candidate training action set, and then the current training action information can be obtained according to the action distribution information.

[0101] Step 303: determine the reward corresponding to the current training action information.

[0102] Among them, the reward corresponding to the current action information can be calculated based on the performance of the current training action information and the performance of the instruction corresponding to the simulated execution of the current training action information (such as computing time, storage space occupancy, etc.) to meet the user's performance requirements. For example, if the user needs higher computing efficiency and sufficient storage space, the reward corresponding to the current training action information can be calculated based on the computing time and space occupancy of the simulated execution instruction.

[0103] Step 304, determining next training state information based on the current training action information.

[0104] Among them, the completion status of the computing task and the current training resource status information in the current training computing graph can be updated according to the current training action information, and then the next training state information is determined according to the updated completion status of the computing task and the current training resource status information. If all computing tasks in the current training computing graph have been completed, the training computing graph included in the next training state is the next computing subgraph, otherwise the next training computing graph is still the current training computing graph.

[0105] Step 305, taking the next training state information as the current training state information, and repeating step 302 to process the current training state information using the strategy network to be trained to obtain the current training action information.

[0106] The termination condition of the repeated execution is that the number of iterations reaches the total number of iterations threshold or other conditions. After determining the next training state information, the next training state information is used as the current training state information, and steps 302 to 305 are repeatedly executed until the number of iterations reaches the total number of iterations threshold, and the training state information, training action information and reward of each iteration are obtained.

[0107] Step 306: Based on the training state information, training action information, and rewards corresponding to the training action information of each iteration, the network parameters of the policy network to be trained are updated to obtain an updated policy network to be trained.

[0108] Among them, the loss can be calculated based on the training state information, training action information and reward of each iteration with the goal of maximizing the cumulative reward, and then the network parameters of the strategy network to be trained are updated according to the loss to obtain the updated strategy network to be trained.

[0109] In some optional embodiments, any gradient method can be used to update the network parameters. The loss is calculated with the goal of maximizing the cumulative reward, the gradient is obtained through back propagation, and the network parameters are updated based on the gradient and the reward. For example, the update of the network parameters can be expressed as follows:

[0110]

[0111] Among them, π(,θ) represents the policy network, θ represents the network parameters (i.e., learning parameters) of the policy network to be trained, and θ can be a random value at the beginning. new represents the updated network parameters, β is the learning rate, n is the total iteration threshold, γ is the discount coefficient, r i represents the reward of step i, a i represents the action of step i (i.e., training action information), s i represents the state of the i-th step (i.e., training state information), π(a i |s i ,θ) represents the policy network under the network parameter θ, based on the state s i Predicted action a i .

[0112] The cumulative reward R can be expressed as follows:

[0113]

[0114] The parameters can refer to the above content.

[0115] In some optional embodiments, the policy gradient method may include a PPO (Proximal Policy Optimization) method, a Monte Carlo tree method, etc., without specific limitation.

[0116] Step 307: Determine a trained policy network based on the updated policy network to be trained.

[0117] After obtaining the updated policy network to be trained, it can be judged or tested whether the updated policy network to be trained meets the training end condition. If the training end condition is met, the updated policy network to be trained can be used as the trained policy network; if the training end condition is not met, the updated policy network to be trained can continue to be trained according to the above process until the training end condition is met to obtain the trained policy network. The training end condition may include the convergence of cumulative rewards, the number of training times reaching a preset number of thresholds, etc., which are not specifically limited.

[0118] This embodiment trains the policy network by maximizing rewards, so that the trained policy network can obtain optimal action information according to input state information, thereby improving the accuracy, effectiveness and robustness of the policy network.

[0119] In some optional embodiments, the generation of the optimal instruction sequence can also be achieved through a reinforcement learning algorithm based on optimal action value function learning, a reinforcement learning algorithm combining strategy learning with optimal action value function learning, etc., which is not limited to the above-mentioned reinforcement learning algorithm based on strategy learning. Among them, the reinforcement learning algorithm based on optimal action value function learning can refer to simulating the action value function through a neural network to form an action value network, and determining the optimal action based on the action value network, that is, obtaining the optimal instruction corresponding to each computing task, and obtaining the optimal instruction subsequence corresponding to the computing subgraph.

[0120] In some optional embodiments, Figure 7 FIG. 1 is a block diagram of the principle of generating an instruction sequence based on reinforcement learning provided by an exemplary embodiment of the present disclosure. Figure 7 As shown, the generation process of the instruction sequence may include: the reinforcement learning agent (Agent) 41 generates the current action according to the computational subgraph A and the real-time resource status information B, the decoder 42 decodes the current action to obtain the intermediate instruction IR, the intermediate instruction mapping unit 43 maps the intermediate instruction IR to the current instruction executable by the machine, and the analyzer 44 updates the resource status information and the completion status information of the computing task in the computational subgraph A according to the current instruction and the resource configuration information corresponding to the current instruction. The analyzer 44 can also determine the current action set according to the current computational subgraph A and the current resource status information B and provide it to the reinforcement learning agent 41. The optimal instruction subsequence of each computational subgraph can be obtained by iterating the above process.

[0121] In practical applications, the decoder may also directly decode the current action to obtain the current instruction executable by the machine without going through the process of the intermediate instruction IR, and the specific details are not limited.

[0122] Compared with heuristic search, generating instruction subsequences of computational subgraphs through reinforcement learning models (or algorithms) can effectively reduce search time, improve search efficiency, and better meet the needs of batch processing of large amounts of data. And through reinforcement learning, the robustness of the optimal action can be improved.

[0123] The above-mentioned embodiments of the present disclosure may be implemented separately or in any combination without conflict. The specific configuration may be based on actual needs and the present disclosure does not limit this.

[0124] Any method for generating an instruction sequence provided in the embodiments of the present disclosure may be executed by any appropriate device with data processing capabilities, including but not limited to: a terminal device and a server, etc. Alternatively, any method for generating an instruction sequence provided in the embodiments of the present disclosure may be executed by a processor, such as the processor executing any method for generating an instruction sequence mentioned in the embodiments of the present disclosure by calling a corresponding instruction stored in a memory. This will not be described in detail below.

[0125] Exemplary Devices

[0126] Figure 8 is a schematic diagram of the structure of an instruction sequence generation device provided by an exemplary embodiment of the present disclosure. The device of this embodiment can be used to implement the corresponding method embodiment of the present disclosure, such as Figure 8 The device shown may include: a first processing module 51 , a second processing module 52 , a third processing module 53 and a fourth processing module 54 .

[0127] The first processing module 51 can be used to determine the resource status information of the hardware of the computation graph and the instruction sequence to be executed corresponding to the neural network model to be compiled.

[0128] The second processing module 52 may be used to segment the computation graph and determine a plurality of computation subgraphs.

[0129] The third processing module 53 may be used to generate instruction subsequences corresponding to the respective computing subgraphs based on the computing subgraphs and resource status information.

[0130] The fourth processing module 54 may be used to determine a target instruction sequence corresponding to the neural network model to be compiled based on each instruction subsequence.

[0131] In some optional embodiments, the third processing module 53 may be specifically used to generate instruction subsequences corresponding to each computing subgraph respectively by using a reinforcement learning method based on each computing subgraph and resource status information.

[0132] Fig. 9 It is a structural diagram of an instruction sequence generation device provided by another exemplary embodiment of the present disclosure.

[0133] In some optional embodiments, such as Fig. 9 As shown in the above Figure 8 On the basis of the illustrated embodiment, the third processing module 53 may include: a first determining unit 531 , a second determining unit 532 , a first processing unit 533 , and a second processing unit 534 .

[0134] The first determining unit 531 may be used to determine the current computing subgraph and current resource status information.

[0135] The current computation subgraph is determined based on the dependency relationship of each computation subgraph in the computation graph. The current resource status information is determined based on the resource status information of the target terminal device.

[0136] The second determining unit 532 may be configured to determine a current action set based on the current computation subgraph and current resource status information.

[0137] The current action set includes at least one candidate action information.

[0138] The first processing unit 533 may be configured to determine a current instruction subsequence corresponding to the current computing subgraph based on the current computing subgraph, current resource status information, and a current action set.

[0139] The second processing unit 534 can be used to update the current resource status information according to the resource information occupied by the current instruction subsequence in response to the termination condition not being met, obtain the updated resource status information, and determine the instruction subsequence corresponding to the next calculation subgraph based on the updated resource status information.

[0140] In some optional embodiments, the computation subgraph includes at least one computation task. The first processing unit 533 can be specifically used for:

[0141] Based on the current computing subgraph, current resource status information and completion status information of each computing task of the current computing subgraph, current action information is determined from the current action set; based on the current action information, the current instruction and the resource configuration information corresponding to the current instruction are determined; according to the current instruction and the resource configuration information corresponding to the current instruction, the current resource status information and the completion status information of each computing task are updated, and the step of determining the current action information from the current action set based on the current computing subgraph, current resource status information and completion status information of each computing task of the current computing subgraph is repeatedly performed; in response to completing each computing task of the current computing subgraph, a current instruction subsequence corresponding to the current computing subgraph is obtained based on the instruction determined each time.

[0142] In some optional embodiments, the first processing unit 533 may be specifically configured to: decode the current action information based on a decoding rule to obtain the current instruction and resource configuration information corresponding to the current instruction.

[0143] The first processing unit 533 can be specifically used for: based on the current instruction, updating the completion status of the computing task corresponding to the current instruction in the completion status information of each computing task, obtaining the updated completion status information of each computing task, and using the updated completion status information of each computing task as the completion status information of each computing task; based on the resource configuration information corresponding to the current instruction, updating the current resource status information, obtaining the updated current resource status information, and using the updated current resource status information as the current resource status information.

[0144] In some optional embodiments, the first processing unit 533 may be specifically used to: utilize a pre-trained strategy network to process the current computing subgraph, current resource status information, and completion status information of each computing task to obtain current action information.

[0145] In some optional embodiments, such as Fig. 9 As shown, the apparatus of the embodiment of the present disclosure may further include a policy network training module 55, which may be used to obtain a policy network in the following manner: based on a computational graph and resource status information, the policy network to be trained is trained to obtain a trained policy network.

[0146] In some optional embodiments, the policy network training module 55 can be specifically used to: determine the current training state information. The current training state information includes the current training calculation graph and the current training resource state information. The current training calculation graph is determined based on the calculation graph. The current training resource state information is determined based on the resource state information of the target terminal device. The current training state information is processed using the policy network to be trained to obtain the current training action information. Determine the reward corresponding to the current training action information. Determine the next training state information based on the current training action information. Take the next training state information as the current training state information, and repeat the step of processing the current training state information using the policy network to be trained to obtain the current training action information. The end condition of the repeated execution is that the number of iterations reaches the total number of iterations threshold. Based on the training state information, training action information and the reward corresponding to the training action information of each iteration, the network parameters of the policy network to be trained are updated to obtain the updated policy network to be trained. Based on the updated policy network to be trained, the trained policy network is determined.

[0147] The beneficial technical effects corresponding to the exemplary embodiment of the present device can be found in the corresponding beneficial technical effects of the above exemplary method section, which will not be repeated here.

[0148] Exemplary Electronic Devices

[0149] Fig.10 It is a structural diagram of an electronic device provided by an embodiment of the present disclosure, including at least one processor 91 and a memory 92.

[0150] The processor 91 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 90 to perform desired functions.

[0151] The memory 92 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 91 may execute one or more computer program instructions to implement the methods and / or other desired functions of the various embodiments of the present disclosure described above.

[0152] In one example, the electronic device 90 may further include: an input device 93 and an output device 94 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0153] The input device 93 may also include, for example, a keyboard, a mouse, etc.

[0154] The output device 94 can output various information to the outside, and may include, for example, a display, a speaker, a printer, a communication network and its connected remote output devices, etc.

[0155] Of course, to simplify, Fig.10 Only some of the components related to the present disclosure in the electronic device 90 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 90 may also include any other appropriate components.

[0156] Exemplary computer program products and computer-readable storage media

[0157] In addition to the above methods and devices, embodiments of the present disclosure may also provide a computer program product, including computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the methods of various embodiments of the present disclosure described in the above “Exemplary Methods” section.

[0158] The computer program product may be written in any combination of one or more programming languages ​​to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0159] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the processor executes the steps in the method of various embodiments of the present disclosure described in the above “Exemplary Method” section.

[0160] Computer readable storage media can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium is, for example, but not limited to, a system, device or device including electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0161] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and cannot be considered as necessary for each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, rather than limitation, and the above details do not limit the present disclosure to being implemented by adopting the above specific details.

[0162] Those skilled in the art may make various changes and modifications to the present disclosure without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the present disclosure claims and their equivalents, the present disclosure is also intended to include these modifications and variations.

Claims

1. A method for generating an instruction sequence, comprising: Determine the computation graph corresponding to the neural network model to be compiled and the resource status information of the hardware to execute the instruction sequence; Splitting the computation graph to determine a plurality of computation subgraphs; Based on each of the computing subgraphs and the resource status information, generate instruction subsequences corresponding to each of the computing subgraphs; Based on each of the instruction subsequences, a target instruction sequence corresponding to the neural network model to be compiled is determined.

2. The method according to claim 1, wherein: The generating, based on each of the computation subgraphs and the resource status information, instruction subsequences corresponding to each of the computation subgraphs respectively comprises: Determine a current computing subgraph and current resource status information; the current computing subgraph is determined based on the dependency relationship of each computing subgraph in the computing graph; the current resource status information is determined based on the resource status information of the hardware; Determine a current action set based on the current computation subgraph and the current resource state information; the current action set includes at least one candidate action information; Determine a current instruction subsequence corresponding to the current computation subgraph based on the current computation subgraph, the current resource state information and the current action set; In response to the termination condition not being met, the current resource status information is updated according to the resource information occupied by the current instruction subsequence, the updated resource status information is obtained, and the instruction subsequence corresponding to the next computation subgraph is determined based on the updated resource status information.

3. The method according to claim 2, wherein: The computation subgraph includes at least one computation task, and determining a current instruction subsequence corresponding to the current computation subgraph based on the current computation subgraph, the current resource state information, and the current action set includes: Determining current action information from the current action set based on the current computing subgraph, the current resource status information, and completion status information of each computing task of the current computing subgraph; Based on the current action information, determining a current instruction and resource configuration information corresponding to the current instruction; According to the current instruction and the resource configuration information corresponding to the current instruction, the current resource status information and the completion status information of each computing task are updated, and the step of repeatedly performing the step of determining the current action information from the current action set based on the current computing subgraph, the current resource status information and the completion status information of each computing task of the current computing subgraph is repeatedly performed; In response to completing each computing task of the current computing subgraph, based on each determined instruction, the current instruction subsequence corresponding to the current computing subgraph is obtained.

4. The method according to claim 3, wherein: The determining, based on the current action information, a current instruction and resource configuration information corresponding to the current instruction includes: Decoding the current action information based on a decoding rule to obtain the current instruction and resource configuration information corresponding to the current instruction; The updating of the current resource status information and the completion status information of each computing task according to the current instruction and the resource configuration information corresponding to the current instruction includes: Based on the current instruction, updating the completion status of the computing task corresponding to the current instruction in the completion status information of each computing task, obtaining the updated completion status information of each computing task, and using the updated completion status information of each computing task as the completion status information of each computing task; Based on the resource configuration information corresponding to the current instruction, the current resource status information is updated to obtain the updated current resource status information, and the updated current resource status information is used as the current resource status information.

5. The method according to claim 3, wherein: The determining the current action information from the current action set based on the current computing subgraph, the current resource status information, and the completion status information of each computing task of the current computing subgraph includes: The current computing subgraph, the current resource status information and the completion status information of each computing task are processed using a pre-trained strategy network to obtain the current action information.

6. The method according to claim 5, wherein: The policy network is obtained by: Based on the computation graph and the resource status information, the strategy network to be trained is trained to obtain the trained strategy network.

7. The method according to claim 6, wherein: The step of training the strategy network to be trained based on the computation graph and the resource status information to obtain the trained strategy network includes: Determine current training state information; the current training state information includes a current training calculation graph and current training resource state information; the current training calculation graph is determined based on the calculation graph; the current training resource state information is determined based on the resource state information of the hardware; Processing the current training state information using the strategy network to be trained to obtain current training action information; Determine a reward corresponding to the current training action information; Determine next training state information based on the current training action information; Using the next training state information as the current training state information, and repeatedly performing the step of using the strategy network to be trained to process the current training state information to obtain current training action information; Based on the training state information, the training action information and the reward corresponding to the training action information of each iteration, the network parameters of the strategy network to be trained are updated to obtain an updated strategy network to be trained; Based on the updated policy network to be trained, the trained policy network is determined.

8. A device for generating an instruction sequence, comprising: A first processing module is used to determine the computation graph corresponding to the neural network model to be compiled and the resource status information of the hardware to execute the instruction sequence; A second processing module is used to divide the computation graph into multiple computation subgraphs. A third processing module, configured to generate instruction subsequences corresponding to the computation subgraphs based on the computation subgraphs and the resource status information; The fourth processing module is used to determine the target instruction sequence corresponding to the neural network model to be compiled based on each of the instruction subsequences.

9. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the method according to any one of claims 1 to 7.

10. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1 to 7.

Citation Information

Cited By

  • AI model optimization deployment method for improving hardware throughput rate

    CN118963778A

  • A method for optimizing AI model deployment to improve hardware throughput

    CN118963778B