WO2022000371A1 - Interface generation method and device, and computer-readable storage medium - Google Patents

Interface generation method and device, and computer-readable storage medium Download PDF

Info

Publication number
WO2022000371A1
WO2022000371A1 PCT/CN2020/099739 CN2020099739W WO2022000371A1 WO 2022000371 A1 WO2022000371 A1 WO 2022000371A1 CN 2020099739 W CN2020099739 W CN 2020099739W WO 2022000371 A1 WO2022000371 A1 WO 2022000371A1
Authority
WO
WIPO (PCT)
Prior art keywords
instruction
interface
assembly
preset
target
Prior art date
Application number
PCT/CN2020/099739
Other languages
French (fr)
Chinese (zh)
Inventor
沈桂旭
刘延昭
董岚
Original Assignee
深圳市大疆创新科技有限公司
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 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2020/099739 priority Critical patent/WO2022000371A1/en
Publication of WO2022000371A1 publication Critical patent/WO2022000371A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode

Definitions

  • the present invention belongs to the technical field of instructions, and in particular, relates to an interface generation method, an apparatus and a computer-readable storage medium.
  • the interface defining the assembly instruction is usually written manually according to the content of each assembly instruction. In this way, when the assembly instruction is used for driving, the chip can be quickly driven by directly calling the assembly instruction interface.
  • this manual writing method has high cost and low efficiency.
  • the present invention provides an interface generation method, device and computer-readable storage medium, so as to solve the problems of manual interface writing, high cost and low efficiency.
  • an embodiment of the present invention provides an interface generation method, which includes:
  • the category indication information of the target assembly instruction determine a preset general instruction interface that matches the category indication information, and obtain a target general instruction interface; wherein, different types of instruction information correspond to different preset general instruction interfaces;
  • a dedicated instruction interface for describing the target assembly instruction is generated.
  • an embodiment of the present invention provides an interface generation apparatus, the apparatus includes: a memory and a processor,
  • the memory for storing program codes
  • the processor calls the program code, and when the program code is executed, is configured to perform the following operations:
  • the category indication information of the target assembly instruction determine a preset general instruction interface that matches the category indication information, and obtain a target general instruction interface; wherein, different types of instruction information correspond to different preset general instruction interfaces;
  • a dedicated instruction interface for describing the target assembly instruction is generated.
  • an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the foregoing interface generation method is implemented.
  • a target assembly instruction may be obtained, and according to the category indication information of the target assembly instruction, a preset general instruction interface matching the category indication information may be determined to obtain the target general instruction interface; wherein, different types of indication information correspond to different
  • the preset general instruction interface of the target assembly instruction generates a special instruction interface for describing the target assembly instruction according to the content of the target assembly instruction and the target general instruction interface.
  • the user does not need to manually write the definition interface, and the dedicated instruction interface of the target assembly instruction can be automatically generated. Therefore, to a certain extent, the cost can be reduced and the efficiency can be improved.
  • FIG. 1 is a flow chart of steps of a method for generating an interface provided by an embodiment of the present application
  • FIG. 2 is an abstract schematic diagram of a preset general command interface provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of an interface for generating a general command provided by an embodiment of the present application.
  • FIG. 4 is an abstract schematic diagram of a dedicated instruction interface provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of an interface structure provided by an embodiment of the present application.
  • FIG. 6 is a schematic design diagram of a generation tool provided by an embodiment of the present application.
  • FIG. 7 is a block diagram of an interface generation apparatus provided by an embodiment of the present application.
  • FIG. 8 is a block diagram of a computing processing device provided by an embodiment of the present application.
  • FIG. 9 is a block diagram of a portable or fixed storage unit according to an embodiment of the present application.
  • the chip can be a chip accelerator.
  • chip accelerators are used to support efficient image processing and data operations.
  • a chip accelerator is a special chip, which is usually a dedicated hardware circuit that can be used to implement various functions, so as to obtain higher performance or better energy efficiency than general-purpose microprocessors when performing a set of operations Compare.
  • the driving chip When the driving chip is working, it can be divided into register driving and instruction driving according to the driving mode.
  • the register-driven mode the operation of the accelerator is controlled through the configuration register.
  • the instruction-driven mode the drive needs to be implemented through the assembly instructions supported by the accelerator, that is, to implement accelerator scheduling.
  • the accelerator may include an accelerator module, and various types of accelerator modules can be dispatched through assembly instructions supported by the accelerator, so as to control the accelerator to execute operations corresponding to the assembly instructions.
  • the assembly instruction can be embedded in the native code of the accelerator through mixed programming, so that the operation logic indicated by the assembly instruction is associated with the processing logic of the native code, thereby realizing the scheduling of the assembly instruction in the native code. , which drives the accelerator to perform the corresponding operation.
  • the file in the native code of the accelerator is jointly compiled with the assembler file corresponding to the assembly instruction, so as to realize the scheduling of the assembly instruction in the native code, thereby realizing the scheduling of the accelerator.
  • a mixed programming method of C language programming and assembly programming can usually be adopted.
  • a C language software development system such as keil C
  • embedding can be implemented in the following ways:
  • the inline assembly keyword "__asm" can be used to embed assembly in C:
  • the interface of the assembly instruction is often defined.
  • the interface of the assembler instruction can be directly called, and the assembler instruction can be used for scheduling by running the interface.
  • the interface that defines the assembly instructions is manually written.
  • the number of assembly instructions is often large, which will consume higher labor costs and lower efficiency.
  • the embodiments of the present application provide an interface generation method for automatically generating an interface, so as to reduce costs and improve efficiency.
  • the interface generation method is described in detail below.
  • FIG. 1 is a flowchart of steps of an interface generation method provided by an embodiment of the present application. As shown in FIG. 1 , the method may include:
  • Step 101 obtaining target assembly instructions.
  • the target assembly instruction may be an assembly instruction that needs to generate an interface. There can be one or more target assembly instructions.
  • the target assembly instruction may be actively read from a preset position, or the target assembly instruction input by the user may be received, which is not limited in this embodiment of the present application.
  • Step 102 According to the category indication information of the target assembly instruction, determine a preset general instruction interface that matches the category indication information, and obtain a target general instruction interface; wherein, different types of instruction information correspond to different preset general instruction interfaces .
  • the category indication information may be used to indicate the category to which the assembly instruction belongs. Assembly instructions with the same class designation belong to the same class. Assembly instructions of the same class can have the same content.
  • the preset general instruction interface corresponding to the category indication information of this category can be used to represent the same content that this category of assembly instructions has in common.
  • the determined target general instruction interface that matches the category indication information of the target assembly instruction can be used to characterize the same content shared by other similar assembly instructions in the target assembly instruction, that is, at least can be used to characterize the same content of the target assembly instruction. Part of the target assembly instruction.
  • Step 103 Generate a dedicated instruction interface for describing the target assembly instruction according to the content of the target assembly instruction and the target general instruction interface.
  • the dedicated instruction interface can represent the content of the target assembly instruction and its assembly embedded code, so that the chip can be driven to execute the operation indicated by the target assembly instruction by subsequently calling the dedicated instruction interface.
  • the target general instruction interface can be used to represent part of the content in the target assembly instruction, that is, part of the content in the target assembly instruction has been pre-interfaced. Therefore, by combining the content of the target assembly instruction and the target general instruction interface to generate a dedicated instruction interface, the generation efficiency can be improved to a certain extent.
  • a general instruction interface can describe the same content that a class of assembly instructions has in common, when a dedicated instruction interface is generated for multiple assembly instructions, the general instruction interface can be reused, thereby improving the generation of dedicated instruction interfaces for multiple assembly instructions. time efficiency.
  • the target general instruction interface is obtained by obtaining the target assembly instruction, and according to the category indication information of the target assembly instruction, determining a preset general instruction interface that matches the category indication information;
  • different types of indication information correspond to different preset general instruction interfaces, and according to the content of the target assembly instruction and the target general instruction interface, a dedicated instruction interface for describing the target assembly instruction is generated.
  • the user does not need to manually write the definition interface, and the dedicated instruction interface of the target assembly instruction can be automatically generated. Therefore, to a certain extent, the cost can be reduced and the efficiency can be improved.
  • the category indication information may include the number of operands included in the target assembly instruction and the chip identifier of the chip to which it belongs.
  • the operands can be divided into source operands and destination operands.
  • the chip to which it belongs may be a chip that supports the target assembly instruction.
  • the chip identification can be an identification that can uniquely represent the chip. Since the number of operands between assembly instructions and the chip identification of the chip to which they belong is often the same, the number of operands and the chip identification of the chip to which they belong are used as the category instruction information to improve the accuracy of assembly instructions to a certain extent. Classification effect.
  • the identifiers can be numbers, characters, special symbols, and so on.
  • the above-mentioned preset general command interface can be implemented through the following sub-steps (1) to (3):
  • Sub-step (1) configure m ports for the assembly instructions of each preset category supported by the preset chip; the assembly instructions of the same preset category contain the same number of operands, and the m is not less than the preset category The number of operands contained in the assembly instruction.
  • the preset chip may be one or more chips specified in advance. Preset categories may be pre-divided according to operands of assembly instructions.
  • Step A Divide the assembly instructions that include the same operand in the assembly instructions supported by the preset chip into the same category to get the preset category. Specifically, the number of operands included in each assembly instruction supported by the preset chip may be determined first. Then, the assembly instructions with the same number of operands are divided into one category. For example, assume that the default chip is an accelerator.
  • the instructions in the accelerator instruction pool that is, the assembly instructions supported by the accelerator, can be classified according to operands. It is assumed that among the supported assembly instructions, there is an assembly instruction including one operand, an assembly instruction including two operands, ..., an assembly instruction including N operands. Then, N preset categories can be obtained by division: single-operand category, double-operand category, ..., N-operand category.
  • operands can be input or output through ports. Ports can be recorded in registers.
  • vmadd [0].char,[1].char,[2].char as an example, the assembly instruction is used to implement the accelerator's processing of adding a char type vector.
  • vmadd represents the mnemonic of the assembly instruction
  • [1].char and [2].char represent the source operand of type char, that is, the addend of vector addition.
  • the source operands come from the input ports recorded in internal register 1 and internal register 2 respectively, and the type of vector data is char. [0].char represents the destination operand of type char, that is, the result of vector addition.
  • the destination operand can be output to the output port recorded in internal register 0.
  • port configuration can be performed in units of categories. Taking the category as a unit, configure the port for each category, and the assembly instructions in one category share the port, which can improve the port utilization to a certain extent, thereby saving port resources.
  • x ports can be configured for the preset category, where x represents the number of operations corresponding to the preset category. In this way, the problem of occupying too many ports and leading to waste of resources can be avoided.
  • a single-operand class can be configured with a single port
  • a double-operand class can be configured with a dual port
  • an N-operand class can be configured with N ports.
  • configure the number of ports greater than x so as to avoid the problem that the ports are occupied and other assembly instructions in the category cannot be executed to a certain extent.
  • Sub-step (2) configure an assembly instruction conversion interface; the assembly instruction conversion interface is used to generate an assembly embedded code according to the assembly instruction; the assembly embedded code is used to embed the assembly instruction into the native chip of the preset chip. in the code.
  • the assembly instruction conversion interface may be used to provide a method for mapping assembly embedded codes according to assembly instructions.
  • the assembly instruction conversion interface may be implemented by macros, that is, the assembly instruction conversion interface may be a macro-type interface.
  • the general code segment of the assembly embedded code When configuring the assembly instruction conversion interface, you can first define internal parameters inside the interface: the general code segment of the assembly embedded code. Wherein, the general code segment may be manually set, or obtained by analyzing the same part in multiple assembler embedded codes. Then define the processing method, input and output of the interface. Wherein, the processing method may be a combination of internal parameters and input, the input may be an assembly instruction, and the output may be an assembly embedded code. It should be noted that, since assembly instructions are often character strings, the input may be a character string representing an assembly instruction.
  • the assembly instruction conversion interface may be an inline assembly interface.
  • inline assembly represents a way of inserting assembly language in C language.
  • the inline assembly interface can be used to generate assembly embedded code that can embed assembly instructions into native code developed based on C language in an inline assembly manner.
  • the chip is often developed based on the C language.
  • inline assembly in the C language
  • no additional compiler and linker are required, and the variables in the C language can be used. Therefore, this application implements the In the example, by configuring the inline assembly interface, it can be ensured that the generated general instruction interface has the ability to generate the assembly instructions to be embedded in the native code of the chip in the form of inline assembly, thereby improving the convenience of running the code to a certain extent.
  • Sub-step (3) Generate the preset general instruction interface according to the port information of the m ports, the assembly instruction conversion interface and the chip identifier of the preset chip.
  • the port information of the port may be the port identifier.
  • the port information, the assembly instruction conversion interface and the chip identification of the chip to which the assembly instruction belongs can be combined and spliced according to the preset interface format according to the preset format, so as to realize the modeling of the general instruction interface. to get the preset general command interface.
  • the preset general command interface may also be constructed by manual coding according to the logic of generating the preset general command interface shown in the embodiment of the present application, which is not limited in the embodiment of the present application.
  • Fig. 2 is an abstract schematic diagram of a preset general command interface provided by an embodiment of the present application.
  • module is used to represent the chip identification
  • the number of v is used to represent the number of operands
  • instr_asm is used to represent the assembly instruction conversion interface.
  • opnd is used to represent port information.
  • other forms may also be used to represent, which is not limited in this embodiment of the present application.
  • the generated preset general instruction interface can be expressed as “module_v(instr_asm,opnd)", and for the two-operand instructions in the two-operand category, the preset general instruction interface can be expressed as is “module_vv(instr_asm,opnd1,opnd2)", for N-operand instructions in the N-operand category, the generated preset general instruction interface can be expressed as "module_v...v(instr_asm,opnd1,opnd2,...,opndN)" .
  • the interface format of these general instruction interfaces may be expressed as "module_v..v”
  • the input parameters may be assembly instructions and corresponding specific vector ports.
  • FIG. 3 is a schematic diagram of an interface for generating a general command provided by an embodiment of the present application.
  • the operation of "instruction operand classification" can be realized through the above-mentioned step A
  • the operation of "instruction parameter configuration interface support” can be realized through the above-mentioned sub-step (1)
  • the “instruction-in-instruction” operation can be realized through the above-mentioned sub-step (2).
  • the operation of "connection interface support” is implemented, and the operation of "model splicing" is realized through the above sub-step (3).
  • a general instruction interface is established for each category by classifying the operand instructions.
  • all the assembly instructions supported by the chip can be described and modeled uniformly through a small number of interfaces, and the convenience of the follow-up is simple and fast.
  • the generation-specific instruction interface For example, assuming that the chip supports single-operand instructions, two-operand instructions, and three-operand instructions, only three general instruction interfaces need to be provided: "module_v, module_vv, module_vvv".
  • the category indication information of the target assembly instruction determine a preset general instruction interface that matches the category indication information, and obtain the operation of the target general instruction interface, which can be performed through the following sub-steps (4) to (6) accomplish:
  • Sub-step (4) For any one of the preset general command interfaces, obtain the number of chip identifiers and port information defined in the preset general command interface, as the comparison chip identifiers and the number of comparisons.
  • the preset general command interface can be parsed, and then the chip identification can be extracted therefrom, and the port information can be extracted to determine the quantity of the port information, and then the comparison chip identification and the comparison quantity can be obtained. For example, assuming that the defined chip identifier is "module" and the number is 3, then the comparison chip identifier of the preset general command interface may be "module", and the comparison number may be 3.
  • Sub-step (5) Compare the comparison quantity and the comparison chip identifier with the number of operands included in the target assembly instruction and the chip identifier of the chip to which the target assembly instruction belongs, respectively.
  • the number of operands included in the target assembly instruction and the chip identifier of the chip to which the target assembly instruction belongs may be determined first. For example, the operands contained in the target assembly instruction can be extracted, and then the number of the extracted operands can be counted. According to the preset correspondence between the chip identifier and the assembly instruction, the chip identifier corresponding to the target assembly instruction is searched for.
  • the number of comparisons is compared with the number of operands contained in the target assembly instruction to determine whether the two are the same.
  • the comparison chip identification is compared with the chip identification of the chip to which the target assembly instruction belongs to determine whether the two are the same.
  • Sub-step (6) if the comparison quantity is the same as the number of operands included in the target assembly instruction, and the comparison chip identification is the same as the chip identification of the belonging chip, then the preset general instruction interface is used. Identify the generic instruction interface for the target.
  • the target assembly instruction belongs to the category corresponding to the preset general instruction interface, and then the preset general instruction interface can be determined as the target general instruction interface.
  • the target general-purpose instruction can be more accurately determined. instruction.
  • the step of generating a dedicated instruction interface for describing the target assembly instruction can be implemented through the following sub-steps (7) to (8):
  • Sub-step (7) According to the content of the target assembly instruction and the target general instruction interface, generate an interface name, an interface parameter list and an assembly embedded code of the dedicated instruction interface.
  • the interface name can be used to represent a dedicated instruction interface for easy invocation.
  • the interface parameter list can be used to represent the parameters that will be used when the dedicated command interface is processed.
  • the assembly embedded code of the dedicated instruction interface can be used to embed the target assembly instruction into the native code of the corresponding chip.
  • sub-steps (7a) to (7b) can be used to generate the interface name, interface parameter list and assembly embedded code of the dedicated instruction interface:
  • the mnemonic may be an English word or its abbreviation indicating the function of the instruction.
  • the operand type may be the data type of each operand involved in the target assembly instruction.
  • the flag register also known as the program status word, can be used to store condition flags and control flag registers to reflect the result of instruction execution.
  • the flag register information may be information capable of identifying the flag register, such as the number, symbol, name, and the like of the flag register. It should be noted that, when the flag register information is not included in the assembly instruction, the interface name can be generated only according to the mnemonic, that is, the operand type.
  • the abbreviated characters corresponding to each of the operand types can be obtained; the abbreviated characters can be combined into an abbreviated string; , the abbreviated character string and the flag register information are combined to obtain the interface name.
  • the abbreviated characters corresponding to each operand type in the target assembly instruction can be searched according to the preset correspondence between the operand types and the abbreviated characters, and then these corresponding abbreviations are sorted according to the order in which the operand types appear in the assembly instruction.
  • the characters are combined into an abbreviated string.
  • the corresponding relationship between the preset type and the abbreviated characters may be as follows:
  • the target assembly instruction is "vacmps[0].char,[1].int,[2].int ge", where the operand types are: char, int, int, and the corresponding operand types can be obtained by searching
  • the abbreviated characters are: c, i, i. Combining these abbreviated characters can get the abbreviated string: "cii”.
  • the separator when combining the mnemonic, the abbreviated string and the flag register information, the separator can be used to connect the mnemonic, the abbreviated string and the flag register information in sequence, and then the interface is obtained. name.
  • the specific content of the separator may be preset according to actual requirements, and the connection sequence during connection may also be other sequences, which are not limited in this embodiment of the present application.
  • the delimiter is the underscore “_”
  • the target assembly instruction is "vacmps[0].char,[1].int,[2].int ge”
  • its mnemonic is “vacmps”
  • the operation The abbreviation string corresponding to the number type is "cii”
  • the flag register information is "ge”
  • the interface name can be obtained: "vacmps_cii_ge”.
  • an assembly instruction can be specifically characterized to a certain extent. Therefore, according to the combination of these information, the present application can ensure that the interface name can more accurately represent the target assembly instruction by generating the interface name.
  • an immediate number is equivalent to a constant, which is a number that can directly appear in an assembly instruction without being stored in a register or memory.
  • different assembly instructions have different functions. Therefore, some assembly instructions will include one of operands and immediate values, or both.
  • the interface parameter list may be generated according to both, and if only one is included, the interface parameter list may be generated according to the included one.
  • the included immediate data and operand port information corresponding to each operand can be added to the list.
  • the information of each operand port may be information of a port configured for the operand in advance, and the target general instruction interface may be called to obtain the information of each operand port.
  • its interface parameter list can be expressed as "int dstPort,int src0Port,int src1Port” , int dstPort, int src0Port, int src1Port represent the destination operand, respectively, the corresponding operand port information of source operand 1 and source operand 2.
  • the target general instruction interface may be called, the target assembly instruction may be used as the input of the target general instruction interface, and then the output may be used as the assembly embedded code corresponding to the target assembly instruction.
  • an inline assembly interface may be defined in the target general instruction interface.
  • the target assembly instruction can be converted into inline assembly code based on the inline assembly interface defined in the target general instruction interface to obtain the assembly embedded code.
  • the target assembly instruction can be used as the input of the inline assembly interface, and the assembly embedded code can be obtained by combining the general code segment defined in the inline assembly interface with the target assembly instruction.
  • the assembly embedded code generated by the inline assembly interface can embed assembly instructions into the native code developed based on the C language in the form of inline assembly, thereby improving the convenience of code operation to a certain extent.
  • the target general-purpose instruction interface may be invoked in a macro calling manner or an interface function calling manner.
  • the interface function calling method allocates a temporary memory unit for processing when the code is running.
  • the interface function method can be an intrinsic function.
  • the macro calling method also known as macro expansion, is performed when the code is compiled, and does not need to allocate memory units. Since the macro call method is expanded in the compilation stage, in the embodiment of the present application, the target general instruction interface is called by the macro call method, which can save the code running time to a certain extent. Further, when the target general instruction interface is called by using the interface function calling method, expansion in the compilation phase can be avoided, thereby ensuring the efficiency of the compilation phase.
  • Sub-step (8) Generate the dedicated instruction interface according to the interface name, the interface parameter list and the assembler embedded code.
  • the interface name, the interface parameter list, and the assembly embedded code may be spliced together to obtain the dedicated instruction interface.
  • internal splicing can be performed in the general command interface.
  • the return value of the dedicated instruction interface that is, the type of the output parameter, can be set to void in advance.
  • FIG. 4 is an abstract schematic diagram of a special-purpose instruction interface provided by an embodiment of the present application, and FIG. 4 is used to represent parts with common characteristics in the special-purpose instruction interfaces belonging to the same category of instructions. where "instruction" is used to represent the instruction name, for example, the instruction's mnemonic.
  • the number of x represents the number of abbreviated strings, and opnd is used to represent port information.
  • the dedicated instruction interface can be abstracted as "instruction_x(opnd)", and for the two-operand instructions in the two-operand category, the dedicated instruction interface can be abstracted as "instruction_xx(opnd1, opnd2) ", for N-operand instructions in the N-operand category, the dedicated general-purpose instruction interface can be abstracted as "instruction_x...x(opnd1,opnd2,...,opndN)".
  • the interface format of these general instruction interfaces may be expressed as "module_v..v”, and the input parameters may be assembly instructions and corresponding specific vector ports.
  • a mixed instruction pool may be generated according to the assembly instructions supported by each preset chip; the assembly instruction included in the mixed instruction pool is used as the target assembly instruction, and the The target assembly instruction is obtained from the mixed instruction pool.
  • the preset chip may be one or more chips specified by the user according to actual requirements.
  • the assembly instructions supported by these chips can be stored in the same file, resulting in a mixed instruction pool.
  • the mixed instruction pool can be traversed, and one assembly instruction is fetched each time as a target assembly instruction.
  • the multiple-to-many assembly instructions can be more evenly obtained.
  • the assembly instruction generation interface supported by each chip avoids generating the interface only for the assembly instruction supported by one of the chips, resulting in that the assembly instructions supported by the other chips cannot be processed in time.
  • the parallel generation configuration information may be used to indicate whether a preset waiting command needs to be packaged for the dedicated command interface at present.
  • the configuration information generated in parallel may be set according to actual requirements, and it may be the value of a preset flag bit.
  • the parallel generation configuration information can be obtained by reading the value of the preset flag bit.
  • the configuration information generated in parallel is a specified value, it can be considered that a preset waiting command needs to be packaged for the dedicated command interface at present. Therefore, it is possible to further encapsulate a preset waiting command for the dedicated command interface.
  • the preset waiting instruction can be encapsulated inside the interface, and when the dedicated instruction interface is called by encapsulating the preset waiting instruction, it will wait for the completion of the dedicated instruction interface inside the interface, and then execute other commands.
  • the dedicated instruction interface of the call that is, implements the blocking mode or the serial mode, thereby avoiding the parallel execution of the interface, causing the problem of interface conflict.
  • the preset waiting instruction is not encapsulated, then when the dedicated instruction interface is called, it will not wait for the dedicated instruction interface to complete within the interface, that is, the non-blocking mode or the parallel mode is implemented.
  • the specified value can be set according to the actual situation, and the specified value can be a number, a character, a character string, and so on. By way of example, the specified value may be "wait".
  • a second specified value can also be set, and in the case that the configuration information generated in parallel is the second specified value, the operation of encapsulating the preset waiting instruction for the dedicated instruction interface can be not performed, that is, only the generation does not include the preset waiting instruction.
  • Dedicated instruction switching for instructions can be set according to the actual situation, and the specified value can be a number, a character, a character string, and so on.
  • the specified value may be "wait”.
  • a second specified value can also be set, and in the case that the configuration information generated in parallel is the second specified value, the operation of encapsulating
  • the second specified value may be "nowait”.
  • a third specified value can also be set, and in the case that the configuration information generated in parallel is the third specified value, according to the dedicated instruction interface, a dedicated instruction interface encapsulated with a preset waiting instruction can be generated at the same time, and a preset waiting instruction is not encapsulated.
  • Dedicated command interface for waiting commands Illustratively, the third specified value may be "all”.
  • Step A Acquire designation information according to the dedicated command interface; the designation information at least includes port information in the dedicated command interface and types of output parameters.
  • the specified information may be information set according to actual requirements, and may also include other information in addition to the port information and the type of output parameters, which is not limited in this embodiment of the present application.
  • each port information can be extracted from the dedicated command interface, and the preset output parameter type can be obtained.
  • Step B Combine the specified information according to a preset annotation generation tool to obtain an interface annotation of the dedicated command interface.
  • the annotation generating tool may be a pre-selected tool for generating annotations, for example, a doxygen tool, and correspondingly, the specified information may be information that complies with the rule requirements of the doxygen tool.
  • the annotation generation tool can automatically parse the specified types of information, and arrange and combine them according to preset rules.
  • the specified information can be output to an annotation generation tool, and the specified information can be combined by the annotation generation tool to obtain interface annotations, and these interface annotations form an annotation document.
  • the interface annotation of the special instruction interface is automatically generated according to the annotation generation tool, so that the special instruction interface to be called can be conveniently selected according to the interface annotation in the future, thereby improving the efficiency of interface calling.
  • VALU_vvv("vacmps[0].char,[1].int,[2].int ge",dstPort,src0Port,src1Port) represents the calling target general instruction interface.
  • "vacmps[0].char,[1].int,[2].int ge” in the target general instruction interface is used to convert the target assembly instruction into assembly embedded code
  • VALU indicates the chip identification
  • "dstPort,src0Port, src1Port” indicates port information.
  • the interface prototype of this assembly instruction in the specific model can be expressed as: void vacmps_cii_ge(int dstPort,int src0Port,int src1Port);
  • the target assembly instruction containing three operands by calling the general instruction interface corresponding to the three operands, the underlying assembly scheduling and configuration can be completed, and the specific interface of the abstract encapsulation target assembly instruction can be realized, that is, Dedicated command interface.
  • steps C to D may also be performed:
  • Step C For any of the preset chips, define a dedicated command interface corresponding to the preset chip at the designated position of the native code of the preset chip, and obtain an interface model of the preset chip; It is assumed that the dedicated instruction interface corresponding to the chip is generated according to the target assembly instruction belonging to the preset chip.
  • the specified location may be preset.
  • the specified location may be a header file (include.).
  • the dedicated command interface corresponding to the preset chip can be written into a specified location, so as to realize the construction of the interface model of the preset chip, and obtain the interface models corresponding to different preset chips. That is, according to the preset chips, the interface model of each preset chip is obtained.
  • Step D when receiving an instruction calling request, obtain a dedicated instruction interface matching the instruction calling request from the interface model of the target preset chip; the chip identifier of the target preset chip is in the instruction calling request. The included chip ID matches.
  • the instruction invocation request may be sent when a dedicated instruction interface needs to be invoked. If an instruction call request is received, it can be considered that there is a dedicated instruction interface that needs to be called.
  • the instruction invocation request may contain a chip identifier to indicate which chip the instruction invocation request is used to invoke the dedicated instruction interface of the assembly instruction supported by the chip.
  • a dedicated instruction interface matching the instruction invocation request can be obtained from the interface model in which the chip identification matches the chip identification contained in the instruction invocation request.
  • the instruction invocation request may also include the name of the dedicated instruction interface, and the dedicated instruction interface with the same name included in the instruction invocation request in the interface model may be determined as the dedicated instruction interface matching the instruction invocation request.
  • the interface model of each preset chip is constructed according to the preset chip classification, so that when the dedicated command interface is called later, the corresponding interface model can be conveniently searched and called, and the calling efficiency can be improved to a certain extent.
  • the dedicated instruction interface after generating the dedicated instruction interface, you may further: obtain a preset output path; and output the dedicated instruction interface according to the preset output path.
  • the preset output path may be preset.
  • the dedicated command interface When the dedicated command interface is output, the dedicated command interface can be output to the preset position according to the preset output path.
  • the preset output path is used to output the dedicated command interface according to the preset output path, so that the dedicated command interface can be directly outputted to the preset position, thereby facilitating storage.
  • FIG. 5 is a schematic structural diagram of an interface provided by an embodiment of the present application.
  • the bottom-level assembly instruction may be a target assembly instruction, and the bottom-level assembly configuration may represent a related configuration, for example, configured port information.
  • the general programming model in the first layer may be a target general instruction interface and the specific programming model in the second layer may be a dedicated instruction interface.
  • the underlying assembly instruction is "vmadd[0].char,[1].char,[2].char”
  • the underlying assembly configuration can be expressed as “outVEU_INST0_MAP0,r0”
  • the general programming model can be expressed as "VEU_vvv( "vmadd[0].char,[1].char,[2].char”,dstPort,src0Port,src1Port)”
  • the specific programming model can be expressed as "Vmadd_ccc(dstPort,src0Port,src1Port)”.
  • an automated generation tool may also be constructed according to the above processing logic for generating a dedicated instruction interface.
  • the automatic generation tool When the automatic generation tool is running, the above steps can be implemented.
  • the automatic generation tool can support command line parameter control.
  • the following is part of the command line:
  • FIG. 6 is a schematic design diagram of a generation tool provided by an embodiment of the present application.
  • the generation tool can generate a mixed instruction pool according to the instruction pools corresponding to the X accelerators. That is, according to the assembly instructions supported by each preset chip, a mixed instruction pool is generated. Then, the target assembly instruction is obtained from the mixed instruction pool, and a dedicated instruction interface is generated through subsequent operations. Interface annotations and interface models for each accelerator can also be generated later.
  • FIG. 7 is a block diagram of an interface generation apparatus provided by an embodiment of the present application. As shown in FIG. 7 , the apparatus may include: a memory 201 and a processor 202 .
  • the memory 201 is used to store program codes.
  • the processor 202 calls the program code, and when the program code is executed, is configured to perform the following operations: obtain a target assembly instruction;
  • the matching preset general-purpose instruction interface obtains the target general-purpose instruction interface; wherein, different types of indication information correspond to different preset general-purpose instruction interfaces; according to the content of the target assembly instruction and the target general-purpose instruction interface, generate a description for A dedicated instruction interface for the target assembly instruction.
  • the category indication information includes the number of operands included in the target assembly instruction and the chip identifier of the chip to which it belongs.
  • the processor 202 is further configured to: configure m ports for the assembly instructions of each preset category supported by the preset chip; the assembly instructions of the same preset category contain the same number of operands, the m is not less than the number of operands contained in the assembly instructions of the preset category; configure an assembly instruction conversion interface; the assembly instruction conversion interface is used to generate an assembly embedded code according to the assembly instruction; the assembly embedded code is used to convert The assembly instruction is embedded in the native code of the preset chip;
  • the preset general instruction interface is generated according to the port information of the m ports, the assembly instruction conversion interface, and the chip identifier of the preset chip.
  • the assembly instruction conversion interface is an inline assembly interface.
  • the processor 202 is further configured to: classify the assembly instructions that include the same operand among the assembly instructions supported by the preset chip into the same category to obtain the preset category.
  • the processor 202 is specifically configured to: generate an interface name, an interface parameter list, and an assembly embedded code of the dedicated instruction interface according to the content of the target assembly instruction and the target general instruction interface; The interface name, the interface parameter list and the assembler embedded code are used to generate the dedicated instruction interface.
  • the processor 202 is specifically configured to: generate the interface name of the dedicated instruction interface according to the mnemonic, operand type and flag register information in the target assembly instruction; call the target general instruction an interface to generate an interface parameter list of the dedicated instruction interface according to the operand port information and/or immediate data in the target assembly instruction, and convert the target assembly instruction into an assembly embedded code.
  • the processor 202 is specifically configured to: obtain the abbreviated characters corresponding to each of the operand types; combine the abbreviated characters into an abbreviated character string; , the abbreviated character string and the flag register information are combined to obtain the interface name.
  • the processor 202 is specifically configured to: call the target general instruction interface in a macro calling manner or an interface function calling manner.
  • an inline assembly interface is defined in the target general instruction interface; the processor 202 is specifically configured to: convert the target assembly instruction based on the inline assembly interface defined in the target general instruction interface for inline assembly code.
  • the processor 202 is specifically configured to: for any of the preset general-purpose command interfaces, obtain the number of chip identifiers and port information defined in the preset general-purpose command interface, as the comparison chip identifiers and comparisons.
  • the processor 202 is specifically configured to: generate a mixed instruction pool according to the assembly instructions supported by each preset chip; The target assembly instruction is obtained from the instruction pool.
  • the processor 202 is further configured to: for any of the preset chips, define a dedicated instruction interface corresponding to the preset chip at a designated position of the native code of the preset chip, and obtain the preset chip.
  • the interface model of the preset chip; the dedicated instruction interface corresponding to the preset chip is generated according to the target assembly instruction belonging to the preset chip; when receiving an instruction call request, the interface model of the target preset chip is obtained.
  • a dedicated instruction interface matching the instruction invocation request is obtained; the chip identification of the target preset chip matches the chip identification contained in the instruction invocation request.
  • the processor 202 is further configured to: acquire specified information according to the dedicated instruction interface; the specified information at least includes port information and the type of output parameters in the dedicated instruction interface; The annotation generation tool combines the specified information to obtain the interface annotation of the dedicated instruction interface.
  • the processor 202 is further configured to: obtain preset parallel generation configuration information; if the parallel generation configuration information is a specified value, encapsulate a preset waiting instruction for the dedicated instruction interface; It is assumed that the waiting instruction is used to indicate that when the dedicated instruction interface is called, after the execution of the dedicated instruction interface is completed, other called dedicated instruction interfaces are executed.
  • the processor 202 is further configured to: acquire a preset output path; and output the dedicated instruction interface according to the preset output path.
  • the operations performed by the above-mentioned apparatus are similar to the corresponding steps in the above-mentioned method, and can achieve the same technical effect. To avoid repetition, details are not repeated here.
  • the embodiments of the present application also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, each step in the above-mentioned interface generation method is implemented, and can To achieve the same technical effect, in order to avoid repetition, details are not repeated here.
  • the device embodiments described above are only illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed over multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort.
  • Various component embodiments of the present application may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof.
  • FIG. 8 is a block diagram of a computing processing device provided by an embodiment of the present application. As shown in FIG. 8 , FIG.
  • the computing processing device traditionally includes a processor 310 and a computer program product or computer readable medium in the form of a memory 320 .
  • the memory 320 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the memory 320 has storage space 330 for program code for performing any of the method steps in the above-described methods.
  • the storage space 330 for program codes may include various program codes for implementing various steps in the above methods, respectively. These program codes can be read from or written to one or more computer program products.
  • These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such computer program products are typically portable or fixed storage units as described with reference to FIG. 9 .
  • the storage unit may have storage segments, storage spaces, etc. arranged similarly to the memory 320 in the computing processing device of FIG. 8 .
  • the program code may, for example, be compressed in a suitable form.
  • the storage unit includes computer readable code, ie code readable by a processor such as 310 for example, which when executed by a computing processing device, causes the computing processing device to perform each of the methods described above. step.
  • any reference signs placed between parentheses shall not be construed as limiting the claim.
  • the word “comprising” does not exclude the presence of elements or steps not listed in a claim.
  • the word “a” or “an” preceding an element does not exclude the presence of a plurality of such elements.
  • the application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware.
  • the use of the words first, second, and third, etc. do not denote any order. These words can be interpreted as names.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

An interface generation method and device, and a computer-readable storage medium. The method comprises: acquiring a target assembly instruction (101); determining, according to class indication information of the target assembly instruction, a preconfigured universal instruction interface matching the class indication information, and acquiring a target universal instruction interface, different class indication information corresponding to different preconfigured universal instruction interfaces (102); and generating, according to content of the target assembly instruction and the target universal instruction interface, a dedicated instruction interface for describing the target assembly instruction (103). By means of the method, a user does not need to manually program and define an interface, and a dedicated instruction interface of a target assembly instruction is automatically generated. As a result, costs are reduced, and efficiency is improved.

Description

接口生成方法、装置及计算机可读存储介质Interface generation method, apparatus, and computer-readable storage medium 技术领域technical field
本发明属于指令技术领域,特别是涉及一种接口生成方法、装置及计算机可读存储介质。The present invention belongs to the technical field of instructions, and in particular, relates to an interface generation method, an apparatus and a computer-readable storage medium.
背景技术Background technique
目前,芯片的应用越来越广泛。在驱动芯片时,经常会使用汇编指令进行驱动。随着芯片所支持的汇编指令的数量越来越多,如何提高基于汇编指令进行芯片驱动的效率,成为人们广泛关注的问题。At present, the application of chips is more and more extensive. When driving a chip, assembly instructions are often used for driving. With the increasing number of assembly instructions supported by the chip, how to improve the efficiency of chip driving based on assembly instructions has become a widely concerned issue.
现有技术中,通常是根据每条汇编指令的内容,手动编写定义该汇编指令的接口。这样,使用汇编指令进行驱动时,通过直接调用汇编指令接口即可实现快速驱动芯片。但是,这种手动编写的方式,成本较大,效率较低。In the prior art, the interface defining the assembly instruction is usually written manually according to the content of each assembly instruction. In this way, when the assembly instruction is used for driving, the chip can be quickly driven by directly calling the assembly instruction interface. However, this manual writing method has high cost and low efficiency.
发明内容SUMMARY OF THE INVENTION
本发明提供一种接口生成方法、装置及计算机可读存储介质,以便解决手动编写接口,成本较大,效率较低的问题。The present invention provides an interface generation method, device and computer-readable storage medium, so as to solve the problems of manual interface writing, high cost and low efficiency.
为了解决上述技术问题,本发明是这样实现的:In order to solve the above-mentioned technical problems, the present invention is achieved in this way:
第一方面,本发明实施例提供了一种接口生成方法,该方法包括:In a first aspect, an embodiment of the present invention provides an interface generation method, which includes:
获取目标汇编指令;Get the target assembly instructions;
根据所述目标汇编指令的类别指示信息,确定与所述类别指示信息相匹配的预设通用指令接口,得到目标通用指令接口;其中,不同类别指示信息对应不同的预设通用指令接口;According to the category indication information of the target assembly instruction, determine a preset general instruction interface that matches the category indication information, and obtain a target general instruction interface; wherein, different types of instruction information correspond to different preset general instruction interfaces;
根据所述目标汇编指令的内容及所述目标通用指令接口,生成用于描述所述目标汇编指令的专用指令接口。According to the content of the target assembly instruction and the target general instruction interface, a dedicated instruction interface for describing the target assembly instruction is generated.
第二方面,本发明实施例提供了一种接口生成装置,所述装置包括:存储器和处理器,In a second aspect, an embodiment of the present invention provides an interface generation apparatus, the apparatus includes: a memory and a processor,
所述存储器,用于存储程序代码;the memory for storing program codes;
所述处理器,调用所述程序代码,当所述程序代码被执行时,用于执行以下操作:The processor calls the program code, and when the program code is executed, is configured to perform the following operations:
获取目标汇编指令;Get the target assembly instructions;
根据所述目标汇编指令的类别指示信息,确定与所述类别指示信息相匹配的预设通用指令接口,得到目标通用指令接口;其中,不同类别指示信息对应不同的预设通用指令接口;According to the category indication information of the target assembly instruction, determine a preset general instruction interface that matches the category indication information, and obtain a target general instruction interface; wherein, different types of instruction information correspond to different preset general instruction interfaces;
根据所述目标汇编指令的内容及所述目标通用指令接口,生成用于描述所述目标汇编指令的专用指令接口。According to the content of the target assembly instruction and the target general instruction interface, a dedicated instruction interface for describing the target assembly instruction is generated.
第三方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现上述接口生成方法。In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the foregoing interface generation method is implemented.
在本申请实施例中,可以获取目标汇编指令,根据目标汇编指令的类别指示信息,确定与类别指示信息相匹配的预设通用指令接口,得到目标通用指令接口;其中,不同类别指示信息对应不同的预设通用指令接口,根据目标汇编指令的内容及目标通用指令接口,生成用于描述 目标汇编指令的专用指令接口。本申请实施例中,无需用户手动编写定义接口,可以自动生成目标汇编指令的专用指令接口。因此,一定程度上可以降低成本,提高效率。In the embodiment of the present application, a target assembly instruction may be obtained, and according to the category indication information of the target assembly instruction, a preset general instruction interface matching the category indication information may be determined to obtain the target general instruction interface; wherein, different types of indication information correspond to different The preset general instruction interface of the target assembly instruction generates a special instruction interface for describing the target assembly instruction according to the content of the target assembly instruction and the target general instruction interface. In the embodiment of the present application, the user does not need to manually write the definition interface, and the dedicated instruction interface of the target assembly instruction can be automatically generated. Therefore, to a certain extent, the cost can be reduced and the efficiency can be improved.
附图说明Description of drawings
图1是本申请实施例提供的一种接口生成方法的步骤流程图;1 is a flow chart of steps of a method for generating an interface provided by an embodiment of the present application;
图2是本申请实施例提供的一种预设通用指令接口的抽象示意图;2 is an abstract schematic diagram of a preset general command interface provided by an embodiment of the present application;
图3是本申请实施例提供的一种生成通用指令接口的示意图;3 is a schematic diagram of an interface for generating a general command provided by an embodiment of the present application;
图4是本申请实施例提供的一种专用指令接口的抽象示意图;4 is an abstract schematic diagram of a dedicated instruction interface provided by an embodiment of the present application;
图5是本申请实施例提供的一种接口结构示意图;5 is a schematic diagram of an interface structure provided by an embodiment of the present application;
图6是本申请实施例提供的一种生成工具的设计示意图;6 is a schematic design diagram of a generation tool provided by an embodiment of the present application;
图7是本申请实施例提供的一种接口生成装置的框图;7 is a block diagram of an interface generation apparatus provided by an embodiment of the present application;
图8为本申请实施例提供的一种计算处理设备的框图;FIG. 8 is a block diagram of a computing processing device provided by an embodiment of the present application;
图9为本申请实施例提供的一种便携式或者固定存储单元的框图。FIG. 9 is a block diagram of a portable or fixed storage unit according to an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
为了便于理解本申请,下面先对本申请实施例涉及的一种应用场景进行说明。在该应用场景中,芯片可以为芯片加速器。具体的,为了提高芯片的运算处理效率,芯片加速器越来越多的出现在芯片设计中。例如,在机器学习、人工智能等领域,会使用芯片加速器以支持高效的图像处理与数据运算。其中,芯片加速器是一种特殊芯片,它通常是一块专用的硬件电路,可用于实现各种功能,以便于在执行一组操作时,获得比通用微处理器更高的性能或更好的能效比。In order to facilitate the understanding of the present application, an application scenario involved in the embodiments of the present application is first described below. In this application scenario, the chip can be a chip accelerator. Specifically, in order to improve the computing processing efficiency of the chip, more and more chip accelerators appear in the chip design. For example, in the fields of machine learning and artificial intelligence, chip accelerators are used to support efficient image processing and data operations. Among them, a chip accelerator is a special chip, which is usually a dedicated hardware circuit that can be used to implement various functions, so as to obtain higher performance or better energy efficiency than general-purpose microprocessors when performing a set of operations Compare.
在驱动芯片进行工作时,按照驱动方式可分为寄存器驱动和指令驱动。在寄存器驱动方式中,是通过配置寄存器来控制加速器运行。在指令驱动方式中,则需要通过加速器所支持的汇编指令实现驱动,即,实现加速器调度。其中,加速器可以包含加速器模块,通过加速器所支持的汇编指令可以调度各类加速器模块,以实现控制加速器执行该汇编指令对应的操作。When the driving chip is working, it can be divided into register driving and instruction driving according to the driving mode. In the register-driven mode, the operation of the accelerator is controlled through the configuration register. In the instruction-driven mode, the drive needs to be implemented through the assembly instructions supported by the accelerator, that is, to implement accelerator scheduling. The accelerator may include an accelerator module, and various types of accelerator modules can be dispatched through assembly instructions supported by the accelerator, so as to control the accelerator to execute operations corresponding to the assembly instructions.
进一步地,通过汇编指令调度加速器时,可以通过混合编程,将该汇编指令嵌入加速器的原生代码中,使得汇编指令指示的操作逻辑与原生代码的处理逻辑关联,进而实现在原生代码中调度汇编指令,驱动加速器执行相应的操作。或者是将加速器的原生代码中的文件与该汇编指令对应的汇编程序文件进行联合编译,以实现在原生代码中调度汇编指令,进而实现调度加速器。示例的,假设加速器是在C编程环境下开发的,想要调度该加速器的字符型(char)加法运算,那么通常可以采用C语言编程和汇编混合编程的方式。例如,在一种C语言软件开发 系统中,例如keil C中,可以通过以下方式实现嵌入:Further, when the accelerator is scheduled through the assembly instruction, the assembly instruction can be embedded in the native code of the accelerator through mixed programming, so that the operation logic indicated by the assembly instruction is associated with the processing logic of the native code, thereby realizing the scheduling of the assembly instruction in the native code. , which drives the accelerator to perform the corresponding operation. Alternatively, the file in the native code of the accelerator is jointly compiled with the assembler file corresponding to the assembly instruction, so as to realize the scheduling of the assembly instruction in the native code, thereby realizing the scheduling of the accelerator. By way of example, assuming that the accelerator is developed in a C programming environment, and it is desired to schedule the character type (char) addition operation of the accelerator, a mixed programming method of C language programming and assembly programming can usually be adopted. For example, in a C language software development system, such as keil C, embedding can be implemented in the following ways:
#pragma ASM#pragma ASM
;Assembler code;Assembler code
e#pragma ENDASMe#pragma ENDASM
在另一种C语言软件开发系统中,例如ARM C中,可以使用内嵌汇编关键字“__asm”在C中嵌入汇编:In another C language software development system, such as ARM C, the inline assembly keyword "__asm" can be used to embed assembly in C:
__asm{;Assembler code}__asm{;Assembler code}
由于通过直接编写来实现嵌入或联合编译所耗费的工作量往往较大,效率较低。因此,为了提高调度效率,往往会定义汇编指令的接口。在需要使用该汇编指令进行加速器调度时,可以直接调用该汇编指令的接口,通过运行该接口,实现使用该汇编指令进行调度。Because the workload of embedding or joint compilation by direct writing is often large, the efficiency is low. Therefore, in order to improve the scheduling efficiency, the interface of the assembly instruction is often defined. When the assembler instruction needs to be used for accelerator scheduling, the interface of the assembler instruction can be directly called, and the assembler instruction can be used for scheduling by running the interface.
在一种生成接口的实现方式中,是手动编写定义汇编指令的接口。但汇编指令的数量往往较多,这样会耗费较高的人工成本,效率较低。有鉴于此,本申请实施例提供一种用于自动生成接口的接口生成方法,以降低成本,提高效率。In one implementation of generating the interface, the interface that defines the assembly instructions is manually written. However, the number of assembly instructions is often large, which will consume higher labor costs and lower efficiency. In view of this, the embodiments of the present application provide an interface generation method for automatically generating an interface, so as to reduce costs and improve efficiency.
下面对该接口生成方法进行详细说明。The interface generation method is described in detail below.
图1是本申请实施例提供的一种接口生成方法的步骤流程图,如图1所示,该方法可以包括:FIG. 1 is a flowchart of steps of an interface generation method provided by an embodiment of the present application. As shown in FIG. 1 , the method may include:
步骤101、获取目标汇编指令。 Step 101 , obtaining target assembly instructions.
本申请实施例中,目标汇编指令可以是需要生成接口的汇编指令。目标汇编指令可以为一个或多个。获取目标汇编指令时,可以从预设位置主动读取目标汇编指令,也可以是接收用户输入的目标汇编指令,本申请实施例对对此不作限定。In this embodiment of the present application, the target assembly instruction may be an assembly instruction that needs to generate an interface. There can be one or more target assembly instructions. When acquiring the target assembly instruction, the target assembly instruction may be actively read from a preset position, or the target assembly instruction input by the user may be received, which is not limited in this embodiment of the present application.
步骤102、根据所述目标汇编指令的类别指示信息,确定与所述类别指示信息相匹配的预设通用指令接口,得到目标通用指令接口;其中,不同类别指示信息对应不同的预设通用指令接口。Step 102: According to the category indication information of the target assembly instruction, determine a preset general instruction interface that matches the category indication information, and obtain a target general instruction interface; wherein, different types of instruction information correspond to different preset general instruction interfaces .
本申请实施例中,类别指示信息可以用于表示汇编指令所属的类别。类别指示信息相同的汇编指令属于同一类别。同一类别的汇编指令可以存在相同的内容。该类别的类别指示信息对应的预设通用指令接口可以用于表征这一类汇编指令共同具备的相同内容。In this embodiment of the present application, the category indication information may be used to indicate the category to which the assembly instruction belongs. Assembly instructions with the same class designation belong to the same class. Assembly instructions of the same class can have the same content. The preset general instruction interface corresponding to the category indication information of this category can be used to represent the same content that this category of assembly instructions has in common.
相应地,确定的与该目标汇编指令的类别指示信息相匹配的目标通用指令接口,可以用于表征该目标汇编指令中与其他同类汇编指令共同具备的相同内容,即,至少可以用于表征该目标汇编指令中的部分内容。Correspondingly, the determined target general instruction interface that matches the category indication information of the target assembly instruction can be used to characterize the same content shared by other similar assembly instructions in the target assembly instruction, that is, at least can be used to characterize the same content of the target assembly instruction. Part of the target assembly instruction.
步骤103、根据所述目标汇编指令的内容及所述目标通用指令接口,生成用于描述所述目标汇编指令的专用指令接口。Step 103: Generate a dedicated instruction interface for describing the target assembly instruction according to the content of the target assembly instruction and the target general instruction interface.
本申请实施例中,专用指令接口可以表征目标汇编指令的内容及其汇编嵌入代码,这样,后续可以通过调用该专用指令接口,实现驱动芯片执行目标汇编指令指示的操作。由于目标通 用指令接口可以用于表征该目标汇编指令中的部分内容,即,目标汇编指令中的部分内容已经被预先接口化。因此,通过结合目标汇编指令的内容及目标通用指令接口,生成专用指令接口,一定程度上可以提高生成效率。且由于一个通用指令接口可以描述一类汇编指令共同具备的相同内容,因此,在针对多个汇编指令生成专用指令接口时,可以复用通用指令接口,进而提高针对多个汇编指令生成专用指令接口时的效率。In this embodiment of the present application, the dedicated instruction interface can represent the content of the target assembly instruction and its assembly embedded code, so that the chip can be driven to execute the operation indicated by the target assembly instruction by subsequently calling the dedicated instruction interface. Since the target general instruction interface can be used to represent part of the content in the target assembly instruction, that is, part of the content in the target assembly instruction has been pre-interfaced. Therefore, by combining the content of the target assembly instruction and the target general instruction interface to generate a dedicated instruction interface, the generation efficiency can be improved to a certain extent. And because a general instruction interface can describe the same content that a class of assembly instructions has in common, when a dedicated instruction interface is generated for multiple assembly instructions, the general instruction interface can be reused, thereby improving the generation of dedicated instruction interfaces for multiple assembly instructions. time efficiency.
综上所述,本申请实施例提供的接口生成方法,通过获取目标汇编指令,根据目标汇编指令的类别指示信息,确定与类别指示信息相匹配的预设通用指令接口,得到目标通用指令接口;其中,不同类别指示信息对应不同的预设通用指令接口,根据目标汇编指令的内容及目标通用指令接口,生成用于描述目标汇编指令的专用指令接口。本申请实施例中,无需用户手动编写定义接口,可以自动生成目标汇编指令的专用指令接口。因此,一定程度上可以降低成本,提高效率。To sum up, in the interface generation method provided by the embodiments of the present application, the target general instruction interface is obtained by obtaining the target assembly instruction, and according to the category indication information of the target assembly instruction, determining a preset general instruction interface that matches the category indication information; Wherein, different types of indication information correspond to different preset general instruction interfaces, and according to the content of the target assembly instruction and the target general instruction interface, a dedicated instruction interface for describing the target assembly instruction is generated. In the embodiment of the present application, the user does not need to manually write the definition interface, and the dedicated instruction interface of the target assembly instruction can be automatically generated. Therefore, to a certain extent, the cost can be reduced and the efficiency can be improved.
可选的,在本申请实施例的一种实现方式中,类别指示信息可以包括目标汇编指令包含的操作数的数量及所属芯片的芯片标识。其中,操作数可以分为源操作数、目的操作数。所属芯片可以是支持该目标汇编指令的芯片。芯片标识可以为能够唯一表示该芯片的标识。由于汇编指令之间操作数的数量及所属芯片的芯片标识相同的概率往往较大,因此,通过将操作数的数量及所属芯片的芯片标识作为类别指令信息,一定程度上可以提高对汇编指令的分类效果。Optionally, in an implementation manner of the embodiment of the present application, the category indication information may include the number of operands included in the target assembly instruction and the chip identifier of the chip to which it belongs. Among them, the operands can be divided into source operands and destination operands. The chip to which it belongs may be a chip that supports the target assembly instruction. The chip identification can be an identification that can uniquely represent the chip. Since the number of operands between assembly instructions and the chip identification of the chip to which they belong is often the same, the number of operands and the chip identification of the chip to which they belong are used as the category instruction information to improve the accuracy of assembly instructions to a certain extent. Classification effect.
该标识可以为数字、字符、特殊符号,等等。相应地,上述预设通用指令接口可以通过下述子步骤(1)~子步骤(3)实现:The identifiers can be numbers, characters, special symbols, and so on. Correspondingly, the above-mentioned preset general command interface can be implemented through the following sub-steps (1) to (3):
子步骤(1):为预设芯片所支持的各个预设类别的汇编指令配置m个端口;同一预设类别的汇编指令包含的操作数个数相同,所述m不小于所述预设类别的汇编指令包含的操作数个数。Sub-step (1): configure m ports for the assembly instructions of each preset category supported by the preset chip; the assembly instructions of the same preset category contain the same number of operands, and the m is not less than the preset category The number of operands contained in the assembly instruction.
本申请实施例中,预设芯片可以是预先指定的一个或多个芯片。预设类别可以是根据汇编指令的操作数预先划分的。可选的,本申请实施例中可以在本步骤之前通过下述操作实现划分预设类别:步骤A、将所述预设芯片所支持的汇编指令中包含相同个操作数的汇编指令划分至同一类别,得到所述预设类别。具体的,可以先确定该预设芯片所支持的每个汇编指令中包含的操作数的个数。然后将操作数个数相同的汇编指令划分为一个类别。示例的,假设预设芯片为加速器。那么可以对对加速器指令池中的指令,即,该加速器所支持的汇编指令,按照操作数进行分类。假设所支持的汇编指令中存在包含一个操作数的汇编指令、存在包含两个操作数的汇编指令、…、存在包含N个操作数的汇编指令。那么通过划分可以得到N个预设类别:单操作数类别、双操作数类别、…、N操作数类别。In this embodiment of the present application, the preset chip may be one or more chips specified in advance. Preset categories may be pre-divided according to operands of assembly instructions. Optionally, in this embodiment of the present application, before this step, the following operations may be used to achieve the division of preset categories: Step A: Divide the assembly instructions that include the same operand in the assembly instructions supported by the preset chip into the same category to get the preset category. Specifically, the number of operands included in each assembly instruction supported by the preset chip may be determined first. Then, the assembly instructions with the same number of operands are divided into one category. For example, assume that the default chip is an accelerator. Then, the instructions in the accelerator instruction pool, that is, the assembly instructions supported by the accelerator, can be classified according to operands. It is assumed that among the supported assembly instructions, there is an assembly instruction including one operand, an assembly instruction including two operands, ..., an assembly instruction including N operands. Then, N preset categories can be obtained by division: single-operand category, double-operand category, ..., N-operand category.
进一步地,操作数可以通过端口输入或输出。端口可以记录在寄存器中。示例的,以一条汇编指令:vmadd[0].char,[1].char,[2].char为例,该汇编指令用于实现加速器对char类型向量进行加法的处理。其中,vmadd表示汇编指令的助记符,[1].char和[2].char表示类型为char的源操作数,即,向量加法的加数。源操作数分别来源于内部寄存器1和内部寄存器2中记录的 输入端口,向量数据的类型为char。[0].char表示类型为char的目的操作数,即,向量加法的结果。目的操作数可以输出至内部寄存器0中记录的输出端口。Further, operands can be input or output through ports. Ports can be recorded in registers. As an example, take an assembly instruction: vmadd[0].char,[1].char,[2].char as an example, the assembly instruction is used to implement the accelerator's processing of adding a char type vector. Among them, vmadd represents the mnemonic of the assembly instruction, and [1].char and [2].char represent the source operand of type char, that is, the addend of vector addition. The source operands come from the input ports recorded in internal register 1 and internal register 2 respectively, and the type of vector data is char. [0].char represents the destination operand of type char, that is, the result of vector addition. The destination operand can be output to the output port recorded in internal register 0.
由于同一预设类别中的汇编指令包含的操作数个数,因此,可以以类别为单位进行端口配置。以类别为单位,针对每个类别配置端口,一个类别内的汇编指令共用端口,一定程度上可以提高端口利用率,进而节省端口资源。Due to the number of operands included in the assembly instructions in the same preset category, port configuration can be performed in units of categories. Taking the category as a unit, configure the port for each category, and the assembly instructions in one category share the port, which can improve the port utilization to a certain extent, thereby saving port resources.
在配置时,可以为预设类别配置x个端口,x表示该预设类别对应的操作数个数。这样,可以避免占用过多的端口,导致资源浪费的问题。示例的,对于单操作数类别可以配置单端口、双操作数类别可以配置双端口、…、N操作数类别可以配置N端口。或者,配置数量大于x的端口,进而一定程度上避免端口被占用,导致类别中的其他汇编指令无法执行的问题。During configuration, x ports can be configured for the preset category, where x represents the number of operations corresponding to the preset category. In this way, the problem of occupying too many ports and leading to waste of resources can be avoided. For example, a single-operand class can be configured with a single port, a double-operand class can be configured with a dual port, ..., an N-operand class can be configured with N ports. Alternatively, configure the number of ports greater than x, so as to avoid the problem that the ports are occupied and other assembly instructions in the category cannot be executed to a certain extent.
子步骤(2):配置汇编指令转换接口;所述汇编指令转换接口用于根据所述汇编指令生成汇编嵌入代码;所述汇编嵌入代码用于将所述汇编指令嵌入所述预设芯片的原生代码中。Sub-step (2): configure an assembly instruction conversion interface; the assembly instruction conversion interface is used to generate an assembly embedded code according to the assembly instruction; the assembly embedded code is used to embed the assembly instruction into the native chip of the preset chip. in the code.
本申请实施例中,汇编指令转换接口可以用于提供一种根据汇编指令映射汇编嵌入代码的方法。汇编指令转换接口可以通过宏实现,即,汇编指令转换接口可以为宏类型的接口。In this embodiment of the present application, the assembly instruction conversion interface may be used to provide a method for mapping assembly embedded codes according to assembly instructions. The assembly instruction conversion interface may be implemented by macros, that is, the assembly instruction conversion interface may be a macro-type interface.
配置汇编指令转换接口时,可以先在接口内部定义内部参数:汇编嵌入代码的通用代码段。其中,该通用代码段可以是人工设定的,或者是通过对多个汇编嵌入代码中的相同部分进行分析得到的。然后定义接口的处理方式、输入及输出。其中,处理方式可以为将内部参数与输入进行组合,输入可以为汇编指令,输出可以为汇编嵌入代码。需要说明的是,由于汇编指令往往为字符串,因此,输入可以为表示汇编指令的字符串。When configuring the assembly instruction conversion interface, you can first define internal parameters inside the interface: the general code segment of the assembly embedded code. Wherein, the general code segment may be manually set, or obtained by analyzing the same part in multiple assembler embedded codes. Then define the processing method, input and output of the interface. Wherein, the processing method may be a combination of internal parameters and input, the input may be an assembly instruction, and the output may be an assembly embedded code. It should be noted that, since assembly instructions are often character strings, the input may be a character string representing an assembly instruction.
可选的,该汇编指令转换接口可以为内联汇编接口。其中内联汇编表示在C语言中插入汇编语言的一种的方式。内联汇编接口可以用于生成能够将汇编指令以内联汇编的方式嵌入至基于C语言开发的原生代码中的汇编嵌入代码。Optionally, the assembly instruction conversion interface may be an inline assembly interface. Where inline assembly represents a way of inserting assembly language in C language. The inline assembly interface can be used to generate assembly embedded code that can embed assembly instructions into native code developed based on C language in an inline assembly manner.
在一种应用场景中,芯片往往是基于C语言开发的,在C语言中使用内联汇编时不需要额外的编译器和联接器,且可以使用在C语言中的变量,因此,本申请实施例中,通过配置内联汇编接口,可以确保生成的通用指令接口具备生成用于将汇编指令以内联汇编的方式嵌入芯片原生代码的能力,进而一定程度上可以提高代码运行的便捷度。In an application scenario, the chip is often developed based on the C language. When using inline assembly in the C language, no additional compiler and linker are required, and the variables in the C language can be used. Therefore, this application implements the In the example, by configuring the inline assembly interface, it can be ensured that the generated general instruction interface has the ability to generate the assembly instructions to be embedded in the native code of the chip in the form of inline assembly, thereby improving the convenience of running the code to a certain extent.
子步骤(3):根据所述m个端口的端口信息、所述汇编指令转换接口及所述预设芯片的芯片标识,生成所述预设通用指令接口。Sub-step (3): Generate the preset general instruction interface according to the port information of the m ports, the assembly instruction conversion interface and the chip identifier of the preset chip.
本申请实施例中,端口的端口信息可以是该端口标识。进一步地,生成预设通用指令接口时,可以按照预设接口格式,对端口信息、汇编指令转换接口及汇编指令所属芯片的芯片标识按照预设格式进行组合拼接,进而实现对通用指令接口建模,得到预设通用指令接口。需要说明的是,也可以按照本申请实施例示出的生成预设通用指令接口的逻辑,通过手动编码的方式构建预设通用指令接口,本申请实施例对此不作限定。In this embodiment of the present application, the port information of the port may be the port identifier. Further, when generating the preset general instruction interface, the port information, the assembly instruction conversion interface and the chip identification of the chip to which the assembly instruction belongs can be combined and spliced according to the preset interface format according to the preset format, so as to realize the modeling of the general instruction interface. to get the preset general command interface. It should be noted that, the preset general command interface may also be constructed by manual coding according to the logic of generating the preset general command interface shown in the embodiment of the present application, which is not limited in the embodiment of the present application.
示例的,以预设芯片为加速器module为例。图2是本申请实施例提供的一种预设通用指令 接口的抽象示意图。其中,“module”用于表示芯片标识,v的个数用于表示操作数的个数,“instr_asm”用于表示汇编指令转换接口。opnd用于表示端口信息。当然,也可以采用其他形式来表示,本申请实施例对此不作限定。As an example, take the preset chip as an accelerator module as an example. Fig. 2 is an abstract schematic diagram of a preset general command interface provided by an embodiment of the present application. Among them, "module" is used to represent the chip identification, the number of v is used to represent the number of operands, and "instr_asm" is used to represent the assembly instruction conversion interface. opnd is used to represent port information. Certainly, other forms may also be used to represent, which is not limited in this embodiment of the present application.
对于单操作数类别中的单操作数指令,生成的预设通用指令接口可以表示为“module_v(instr_asm,opnd)”,对于双操作数类别中的双操作数指令,预设通用指令接口可表示为“module_vv(instr_asm,opnd1,opnd2)”,对于N操作数类别中的N操作数指令,生成的预设通用指令接口可以表示为“module_v…v(instr_asm,opnd1,opnd2,…,opndN)”。其中,这些通用指令接口的接口格式可以表示为“module_v..v”,入参可以为汇编指令及对应的具体向量端口。For single-operand instructions in the single-operand category, the generated preset general instruction interface can be expressed as "module_v(instr_asm,opnd)", and for the two-operand instructions in the two-operand category, the preset general instruction interface can be expressed as is "module_vv(instr_asm,opnd1,opnd2)", for N-operand instructions in the N-operand category, the generated preset general instruction interface can be expressed as "module_v...v(instr_asm,opnd1,opnd2,...,opndN)" . The interface format of these general instruction interfaces may be expressed as "module_v..v", and the input parameters may be assembly instructions and corresponding specific vector ports.
进一步地,图3是本申请实施例提供的一种生成通用指令接口的示意图。本申请实施例中,可以通过上述步骤A实现“指令操作数分类”的操作,通过上述子步骤(1)实现“指令参数配置接口支持”的操作,通过上述子步骤(2)实现“指令内联接口支持”的操作,通过上述子步骤(3)实现“模型拼接”的操作。Further, FIG. 3 is a schematic diagram of an interface for generating a general command provided by an embodiment of the present application. In the embodiment of the present application, the operation of "instruction operand classification" can be realized through the above-mentioned step A, the operation of "instruction parameter configuration interface support" can be realized through the above-mentioned sub-step (1), and the "instruction-in-instruction" operation can be realized through the above-mentioned sub-step (2). The operation of "connection interface support" is implemented, and the operation of "model splicing" is realized through the above sub-step (3).
本申请实施例中,通过按照操作数指令分类,针对每个类别建立通用指令接口,这样,通过少量接口即可对芯片所支持的所有汇编指令进行统一描述建模,进而方便后续即为简便快速的生成专用指令接口。示例的,假设芯片支持单操作数的指令、双操作数的指令及三操作数的指令,那么只需要提供三个通用指令接口:“module_v、module_vv、module_vvv”。In the embodiment of the present application, a general instruction interface is established for each category by classifying the operand instructions. In this way, all the assembly instructions supported by the chip can be described and modeled uniformly through a small number of interfaces, and the convenience of the follow-up is simple and fast. The generation-specific instruction interface. For example, assuming that the chip supports single-operand instructions, two-operand instructions, and three-operand instructions, only three general instruction interfaces need to be provided: "module_v, module_vv, module_vvv".
可选的,根据目标汇编指令的类别指示信息,确定与类别指示信息相匹配的预设通用指令接口,得到目标通用指令接口的操作,可以通过下述子步骤(4)~子步骤(6)实现:Optionally, according to the category indication information of the target assembly instruction, determine a preset general instruction interface that matches the category indication information, and obtain the operation of the target general instruction interface, which can be performed through the following sub-steps (4) to (6) accomplish:
子步骤(4):对于任一所述预设通用指令接口,获取所述预设通用指令接口中定义的芯片标识及端口信息的数量,作为对比芯片标识及对比数量。Sub-step (4): For any one of the preset general command interfaces, obtain the number of chip identifiers and port information defined in the preset general command interface, as the comparison chip identifiers and the number of comparisons.
本申请实施例中,可以对预设通用指令接口进行解析,然后从中提取芯片标识,以及提取端口信息以确定端口信息的数量,进而得到对比芯片标识及对比数量。示例的,假设定义的芯片标识为“module”,数量为3,那么该预设通用指令接口的对比芯片标识可以为“module”,对比数量可以为3。In the embodiment of the present application, the preset general command interface can be parsed, and then the chip identification can be extracted therefrom, and the port information can be extracted to determine the quantity of the port information, and then the comparison chip identification and the comparison quantity can be obtained. For example, assuming that the defined chip identifier is "module" and the number is 3, then the comparison chip identifier of the preset general command interface may be "module", and the comparison number may be 3.
子步骤(5):将所述对比数量及所述对比芯片标识分别与所述目标汇编指令包含的操作数的数量及所述所属芯片的芯片标识进行比对。Sub-step (5): Compare the comparison quantity and the comparison chip identifier with the number of operands included in the target assembly instruction and the chip identifier of the chip to which the target assembly instruction belongs, respectively.
本申请实施例中,可以先确定目标汇编指令包含的操作数的数量,以及目标汇编指令所属芯片的芯片标识。示例的,可以提取目标汇编指令包含的操作数,然后统计提取到的操作数的数量。根据预设的芯片标识与汇编指令之间的对应关系,查找该目标汇编指令对应的芯片标识。In this embodiment of the present application, the number of operands included in the target assembly instruction and the chip identifier of the chip to which the target assembly instruction belongs may be determined first. For example, the operands contained in the target assembly instruction can be extracted, and then the number of the extracted operands can be counted. According to the preset correspondence between the chip identifier and the assembly instruction, the chip identifier corresponding to the target assembly instruction is searched for.
然后,将对比数量与目标汇编指令包含的操作数的数量进行比对,以确定两者是否相同。以及,将对比芯片标识与目标汇编指令所属芯片的芯片标识进行比对,以确定两者是否相同。Then, the number of comparisons is compared with the number of operands contained in the target assembly instruction to determine whether the two are the same. And, the comparison chip identification is compared with the chip identification of the chip to which the target assembly instruction belongs to determine whether the two are the same.
子步骤(6):若所述对比数量与所述目标汇编指令包含的操作数的数量相同,且所述对比芯片标识与所述所属芯片的芯片标识相同,则将所述预设通用指令接口确定为所述目标通用指 令接口。Sub-step (6): if the comparison quantity is the same as the number of operands included in the target assembly instruction, and the comparison chip identification is the same as the chip identification of the belonging chip, then the preset general instruction interface is used. Identify the generic instruction interface for the target.
本申请实施例中,如果数量及芯片标识均相同,则可以认为目标汇编指令属于该预设通用指令接口对应的类别,进而可以将该预设通用指令接口确定为目标通用指令接口。本申请通过将目标汇编指令包含的操作数的数量以及所属芯片的芯片标识,分别与各个预设通用指令接口中定义的芯片标识及端口信息的数量进行比对,可以较为准确的确定出目标通用指令。In the embodiment of the present application, if the quantity and the chip identifier are the same, it can be considered that the target assembly instruction belongs to the category corresponding to the preset general instruction interface, and then the preset general instruction interface can be determined as the target general instruction interface. In this application, by comparing the number of operands contained in the target assembly instruction and the chip identifier of the chip to which it belongs, respectively with the number of chip identifiers and port information defined in each preset general-purpose instruction interface, the target general-purpose instruction can be more accurately determined. instruction.
可选的,根据目标汇编指令的内容及目标通用指令接口,生成用于描述目标汇编指令的专用指令接口的步骤,可以通过下述子步骤(7)~子步骤(8)实现:Optionally, according to the content of the target assembly instruction and the target general instruction interface, the step of generating a dedicated instruction interface for describing the target assembly instruction can be implemented through the following sub-steps (7) to (8):
子步骤(7):根据所述目标汇编指令的内容及所述目标通用指令接口,生成所述专用指令接口的接口名称、接口参数列表及汇编嵌入代码。Sub-step (7): According to the content of the target assembly instruction and the target general instruction interface, generate an interface name, an interface parameter list and an assembly embedded code of the dedicated instruction interface.
其中,接口名称可以用于表示专用指令接口,以方便调用。接口参数列表可以用于表征专用指令接口处理时,会使用到的参数。专用指令接口的汇编嵌入代码可以用于将目标汇编指令嵌入所属芯片的原生代码中。Among them, the interface name can be used to represent a dedicated instruction interface for easy invocation. The interface parameter list can be used to represent the parameters that will be used when the dedicated command interface is processed. The assembly embedded code of the dedicated instruction interface can be used to embed the target assembly instruction into the native code of the corresponding chip.
可选的,可以通过下述子步骤(7a)~子步骤(7b)实现生成专用指令接口的接口名称、接口参数列表及汇编嵌入代码:Optionally, the following sub-steps (7a) to (7b) can be used to generate the interface name, interface parameter list and assembly embedded code of the dedicated instruction interface:
子步骤(7a):根据所述目标汇编指令中的助记符、操作数类型及标志寄存器信息,生成所述专用指令接口的接口名称。Sub-step (7a): Generate an interface name of the dedicated instruction interface according to the mnemonic, operand type and flag register information in the target assembly instruction.
本申请实施例中,助记符可以是助记符是表明指令功能的英语单词或其缩写。操作数类型可以是目标汇编指令中涉及到的各个操作数的数据类型。标志寄存器又称程序状态字,可以用于存放条件标志获控制标志寄存器,反映指令执行结果。标志寄存器信息可以是能够标识标志寄存器的信息,例如标志寄存器的编号、表示符、名称,等等。需要说明的是,在汇编指令中不包括标志寄存器信息时,可以仅根据助记符即操作数类型,生成接口名称。可选的,生成专用指令接口的接口名称时,可以获取各个所述操作数类型对应的缩写字符;将所述缩写字符组合为缩写字符串;根据预设的分割符,对所述助记符、所述缩写字符串及所述标志寄存器信息进行组合,得到所述接口名称。其中,可以根据预设的操作数类型与缩写字符的对应关系查找目标汇编指令中的每个操作数类型对应的缩写字符,然后按照操作数类型在汇编指令中的出现顺序,将这些对应的缩写字符组合为缩写字符串。示例的,在一种实现方式中,该预设的类型与缩写字符的对应关系可以所示:In this embodiment of the present application, the mnemonic may be an English word or its abbreviation indicating the function of the instruction. The operand type may be the data type of each operand involved in the target assembly instruction. The flag register, also known as the program status word, can be used to store condition flags and control flag registers to reflect the result of instruction execution. The flag register information may be information capable of identifying the flag register, such as the number, symbol, name, and the like of the flag register. It should be noted that, when the flag register information is not included in the assembly instruction, the interface name can be generated only according to the mnemonic, that is, the operand type. Optionally, when generating the interface name of the dedicated instruction interface, the abbreviated characters corresponding to each of the operand types can be obtained; the abbreviated characters can be combined into an abbreviated string; , the abbreviated character string and the flag register information are combined to obtain the interface name. Among them, the abbreviated characters corresponding to each operand type in the target assembly instruction can be searched according to the preset correspondence between the operand types and the abbreviated characters, and then these corresponding abbreviations are sorted according to the order in which the operand types appear in the assembly instruction. The characters are combined into an abbreviated string. For example, in an implementation manner, the corresponding relationship between the preset type and the abbreviated characters may be as follows:
操作数类型operand type 缩写字符abbreviated characters
bitbit bb
charchar cc
ucharuchar ucuc
shortshort ss
ushortushort usus
intint ii
uintuint uiui
floatfloat ff
half floathalf float hfhf
假设目标汇编指令为“vacmps[0].char,[1].int,[2].int ge”,其中,操作数类型分别为:char、int、int,通过查找可以得到各个操作数类型对应的缩写字符分别为:c、i、i,对这些缩写字符进行组合,可以得到缩写字符串:“cii”。Suppose the target assembly instruction is "vacmps[0].char,[1].int,[2].int ge", where the operand types are: char, int, int, and the corresponding operand types can be obtained by searching The abbreviated characters are: c, i, i. Combining these abbreviated characters can get the abbreviated string: "cii".
进一步地,根据预设的分割符,对助记符、缩写字符串及标志寄存器信息进行组合时,可以使用分割符按照助记符、缩写字符串及标志寄存器信息的顺序依次连接,进而得到接口名称。其中,分割符的具体内容可以是根据实际需求预先设定的,连接时的连接顺序也可以是其他顺序,本申请实施例对此不作限定。Further, according to the preset separator, when combining the mnemonic, the abbreviated string and the flag register information, the separator can be used to connect the mnemonic, the abbreviated string and the flag register information in sequence, and then the interface is obtained. name. The specific content of the separator may be preset according to actual requirements, and the connection sequence during connection may also be other sequences, which are not limited in this embodiment of the present application.
示例的,以分割符为下划线“_”,对于目标汇编指令为“vacmps[0].char,[1].int,[2].int ge”,它的助记符为“vacmps”,操作数类型对应的缩写字符串为“cii”,标志寄存器信息为“ge”,那么可以得到接口名称:“vacmps_cii_ge”。For example, the delimiter is the underscore "_", the target assembly instruction is "vacmps[0].char,[1].int,[2].int ge", its mnemonic is "vacmps", the operation The abbreviation string corresponding to the number type is "cii", and the flag register information is "ge", then the interface name can be obtained: "vacmps_cii_ge".
由于不同汇编指令的助记符、操作数类型及标志寄存器信息可能不同,这些信息组合之后,一定程度上可以特定的表征一条汇编指令。因此本申请根据这些信息组合,以生成接口名称的方式,可以确保接口名称能够较为准确的表示目标汇编指令。Since the mnemonic, operand type and flag register information of different assembly instructions may be different, after these information are combined, an assembly instruction can be specifically characterized to a certain extent. Therefore, according to the combination of these information, the present application can ensure that the interface name can more accurately represent the target assembly instruction by generating the interface name.
子步骤(7b):调用所述目标通用指令接口,以根据所述目标汇编指令中的操作数端口信息和/或立即数,生成所述专用指令接口的接口参数列表,,以及将所述目标汇编指令转换为汇编嵌入代码。Sub-step (7b): calling the target general-purpose instruction interface to generate an interface parameter list of the special-purpose instruction interface according to the operand port information and/or immediate data in the target assembly instruction, and converting the target Assembly instructions are converted into assembly embedded code.
本申请实施例中,立即数相当于常数,它是无需储在寄存器或存储器中,可以直接出现在汇编指令中的数。具体的,不同汇编指令的功能不同,因此,有些汇编指令中会包括操作数和立即数中的一种,或者两者都包括。相应地,本申请实施例中,可以在目标汇编指令包括两种时,根据两者生成接口参数列表,在仅包括一种时,根据包括的这一种生成接口参数列表。In this embodiment of the present application, an immediate number is equivalent to a constant, which is a number that can directly appear in an assembly instruction without being stored in a register or memory. Specifically, different assembly instructions have different functions. Therefore, some assembly instructions will include one of operands and immediate values, or both. Correspondingly, in the embodiment of the present application, when two kinds of target assembly instructions are included, the interface parameter list may be generated according to both, and if only one is included, the interface parameter list may be generated according to the included one.
在生成接口参数列表时,可以在列表中添加包括的立即数、各个操作数对应的操作数端口信息。其中,各个操作数端口信息可以是预先为该操作数配置的端口的信息,可以调用目标通用指令接口,以获取个操作数端口信息。示例的,同样以“vacmps[0].char,[1].int,[2].int ge”这条汇编指令为例,其接口参数列表可以表示为“int dstPort,int src0Port,int src1Port”,int dstPort,int src0Port,int src1Port分别代表目标操作数,源操作数1和源操作数2各自对应的操作数端口信息。本申请实施例中,可以调用目标通用指令接口,将目标汇编指令作为目标通用指令接口的输入,然后将其输出作为目标汇编指令对应的汇编嵌入代码。可选的,目标通用指令接口中可以定义有内联汇编接口。相应地,可以基于目标通用指令接口中定义的内联汇编接口,将目标汇编指令转换为内联汇编代码,得到汇编嵌入代码。示例的,可以将目标汇编指令作为内联汇编接口的输入,通过内联汇编接口中定义的通用代码段与目标汇编指令进行组合,即可得到汇编嵌入代码。通过内联汇编接口生成的汇编嵌入代码,可以将汇编指令以内联汇编的方式嵌入至基于C语言开发的原生代码中,进而一定程度上可以提高代码运行的便捷度。When generating an interface parameter list, the included immediate data and operand port information corresponding to each operand can be added to the list. The information of each operand port may be information of a port configured for the operand in advance, and the target general instruction interface may be called to obtain the information of each operand port. For example, also taking the assembly instruction "vacmps[0].char,[1].int,[2].int ge" as an example, its interface parameter list can be expressed as "int dstPort,int src0Port,int src1Port" , int dstPort, int src0Port, int src1Port represent the destination operand, respectively, the corresponding operand port information of source operand 1 and source operand 2. In the embodiment of the present application, the target general instruction interface may be called, the target assembly instruction may be used as the input of the target general instruction interface, and then the output may be used as the assembly embedded code corresponding to the target assembly instruction. Optionally, an inline assembly interface may be defined in the target general instruction interface. Correspondingly, the target assembly instruction can be converted into inline assembly code based on the inline assembly interface defined in the target general instruction interface to obtain the assembly embedded code. For example, the target assembly instruction can be used as the input of the inline assembly interface, and the assembly embedded code can be obtained by combining the general code segment defined in the inline assembly interface with the target assembly instruction. The assembly embedded code generated by the inline assembly interface can embed assembly instructions into the native code developed based on the C language in the form of inline assembly, thereby improving the convenience of code operation to a certain extent.
可选的,可以通过宏调用方式或接口函数调用方式,调用所述目标通用指令接口。其中, 接口函数调用方式在代码运行时分配临时的内存单元进行处理。接口函数方式可以为intrinsic函数。宏调用方式,又称宏展开,是在代码编译时进行的,且进行时不需要分配内存单元。由于宏调用方式在编译阶段就会展开,因此,本申请实施例中以宏调用方式调用目标通用指令接口,一定程度上可以节省代码运行时间。进一步地,使用接口函数调用方式调用目标通用指令接口时,可以避免在编译阶段进行展开,进而确保编译阶段的效率。Optionally, the target general-purpose instruction interface may be invoked in a macro calling manner or an interface function calling manner. Among them, the interface function calling method allocates a temporary memory unit for processing when the code is running. The interface function method can be an intrinsic function. The macro calling method, also known as macro expansion, is performed when the code is compiled, and does not need to allocate memory units. Since the macro call method is expanded in the compilation stage, in the embodiment of the present application, the target general instruction interface is called by the macro call method, which can save the code running time to a certain extent. Further, when the target general instruction interface is called by using the interface function calling method, expansion in the compilation phase can be avoided, thereby ensuring the efficiency of the compilation phase.
子步骤(8):根据所述接口名称、所述接口参数列表及所述汇编嵌入代码,生成所述专用指令接口。Sub-step (8): Generate the dedicated instruction interface according to the interface name, the interface parameter list and the assembler embedded code.
可选的,本申请实施例中,可以将所述接口名称、接口参数列表及汇编嵌入代码进行拼接,进而得到该专用指令接口。示例的,可以在通用指令接口中进行内部拼接。需要说明的是,由于专用指令接口是用于驱动芯片执行目标汇编指令的,因此可以预先将专用指令接口的返回值,即输出参数的类型设置为空(void)。图4是本申请实施例提供的一种专用指令接口的抽象示意图,图4用于对属于同一类别指令的专用指令接口中具有共同特点的部分进行表示。其中,“instruction”用于表示指令名称,例如,指令的助记符。x的数量表示缩写字符串的数量,opnd用于表示端口信息。对于单操作数类别中的单操作数指令,专用指令接口可以抽象为“instruction_x(opnd)”,对于双操作数类别中的双操作数指令,专用指令接口可以抽象为“instruction_xx(opnd1,opnd2)”,对于N操作数类别中的N操作数指令,专用通用指令接口可抽象为“instruction_x…x(opnd1,opnd2,…,opndN)”。其中,这些通用指令接口的接口格式可以表示为“module_v..v”,入参可以为汇编指令及对应的具体向量端口。Optionally, in this embodiment of the present application, the interface name, the interface parameter list, and the assembly embedded code may be spliced together to obtain the dedicated instruction interface. For example, internal splicing can be performed in the general command interface. It should be noted that, since the dedicated instruction interface is used to drive the chip to execute the target assembly instruction, the return value of the dedicated instruction interface, that is, the type of the output parameter, can be set to void in advance. FIG. 4 is an abstract schematic diagram of a special-purpose instruction interface provided by an embodiment of the present application, and FIG. 4 is used to represent parts with common characteristics in the special-purpose instruction interfaces belonging to the same category of instructions. where "instruction" is used to represent the instruction name, for example, the instruction's mnemonic. The number of x represents the number of abbreviated strings, and opnd is used to represent port information. For the single-operand instructions in the single-operand category, the dedicated instruction interface can be abstracted as "instruction_x(opnd)", and for the two-operand instructions in the two-operand category, the dedicated instruction interface can be abstracted as "instruction_xx(opnd1, opnd2) ", for N-operand instructions in the N-operand category, the dedicated general-purpose instruction interface can be abstracted as "instruction_x...x(opnd1,opnd2,...,opndN)". The interface format of these general instruction interfaces may be expressed as "module_v..v", and the input parameters may be assembly instructions and corresponding specific vector ports.
可选的,本申请实施例在获取目标汇编指令时,可以根据各个预设芯片所支持的汇编指令,生成混合指令池;将所述混合指令池中包含的汇编指令作为目标汇编指令,从所述混合指令池中获取所述目标汇编指令。其中,预设芯片可以是用户根据实际需求指定的一个或多个芯片。可以将这些芯片所支持的汇编指令存储在同一文件中,得到混合指令池。当然,也可以是仅对这些芯片所支持的汇编指令中需要生成接口的汇编指令进行存储,以避免执行不必要的接口生成操作。接着,可以遍历该混合指令池,每次从取出一条汇编指令,作为目标汇编指令。本申请在对多个芯片所支持的汇编指令生成接口的场景中,通过先将多个芯片所支持的汇编指令混合,然后依次遍历获取目标汇编指令进行处理,一定程度上可以较为均匀的对多个芯片所支持的汇编指令生成接口,避免仅对其中一个芯片所支持的汇编指令生成接口,导致其他芯片所支持的汇编指令无法及时得到处理。Optionally, when the embodiment of the present application acquires the target assembly instruction, a mixed instruction pool may be generated according to the assembly instructions supported by each preset chip; the assembly instruction included in the mixed instruction pool is used as the target assembly instruction, and the The target assembly instruction is obtained from the mixed instruction pool. The preset chip may be one or more chips specified by the user according to actual requirements. The assembly instructions supported by these chips can be stored in the same file, resulting in a mixed instruction pool. Of course, it is also possible to store only the assembly instructions that need to generate an interface among the assembly instructions supported by these chips, so as to avoid performing unnecessary interface generation operations. Next, the mixed instruction pool can be traversed, and one assembly instruction is fetched each time as a target assembly instruction. In the scenario of generating interfaces for assembly instructions supported by multiple chips, by first mixing the assembly instructions supported by multiple chips, and then traversing and acquiring target assembly instructions for processing, to a certain extent, the multiple-to-many assembly instructions can be more evenly obtained. The assembly instruction generation interface supported by each chip avoids generating the interface only for the assembly instruction supported by one of the chips, resulting in that the assembly instructions supported by the other chips cannot be processed in time.
可选的,在获取目标汇编指令之后,还可以:获取预设的并行生成配置信息;若所述并行生成配置信息为指定值,则为所述专用指令接口封装预设等待指令;所述预设等待指令用于指示在所述专用指令接口被调用的情况下,等待所述专用指令接口执行完毕之后,执行其他被调用的专用指令接口。Optionally, after acquiring the target assembly instruction, you can also: acquire preset parallel generation configuration information; if the parallel generation configuration information is a specified value, encapsulate a preset waiting instruction for the dedicated instruction interface; It is assumed that the waiting instruction is used to indicate that when the dedicated instruction interface is called, after the execution of the dedicated instruction interface is completed, other called dedicated instruction interfaces are executed.
本申请实施例中,并行生成配置信息可以用于表示当前是否需要为专用指令接口封装预设 等待指令。并行生成配置信息可以是根据实际需求设定的,它可以是预设标志位的值。相应地,可以通过读取该预设标志位的值,实现获取并行生成配置信息。In this embodiment of the present application, the parallel generation configuration information may be used to indicate whether a preset waiting command needs to be packaged for the dedicated command interface at present. The configuration information generated in parallel may be set according to actual requirements, and it may be the value of a preset flag bit. Correspondingly, the parallel generation configuration information can be obtained by reading the value of the preset flag bit.
进一步地,如果并行生成配置信息为指定值,则可以认为当前需要为专用指令接口封装预设等待指令。因此,可以进一步为专用指令接口封装预设等待指令。具体的,可以是在接口内部封装该预设等待指令,通过封装预设等待指令,使得该专用指令接口被调用的情况下,会在接口内部等待该专用指令接口完成,之后才会执行其他被调用的专用指令接口,即,实现阻塞模式或串行模式,进而避免并行执行接口,造成接口冲突的问题。反之,如果未封装预设等待指令,那么该专用指令接口被调用的情况下,就不会在接口内部等待该专用指令接口完成,即,实现非阻塞模式或并行模式。其中,指定值可以是根据实际情况设置,指定值可以为数字、字符、字符串,等等。示例的,指定值可以为“wait”。相应地,还可以设置第二指定值,在并行生成配置信息为第二指定值的情况下,可以在不执行为专用指令接口封装预设等待指令的操作,即,仅生成不包含预设等待指令的专用指令切换。示例的,第二指定值可以为“nowait”。进一步地,还可以设置第三指定值,在并行生成配置信息为第三指定值的情况下,可以根据专用指令接口,同时生成封装有预设等待指令的专用指令接口,以及未封装有预设等待指令的专用指令接口。示例的,第三指定值可以为“all”。Further, if the configuration information generated in parallel is a specified value, it can be considered that a preset waiting command needs to be packaged for the dedicated command interface at present. Therefore, it is possible to further encapsulate a preset waiting command for the dedicated command interface. Specifically, the preset waiting instruction can be encapsulated inside the interface, and when the dedicated instruction interface is called by encapsulating the preset waiting instruction, it will wait for the completion of the dedicated instruction interface inside the interface, and then execute other commands. The dedicated instruction interface of the call, that is, implements the blocking mode or the serial mode, thereby avoiding the parallel execution of the interface, causing the problem of interface conflict. On the contrary, if the preset waiting instruction is not encapsulated, then when the dedicated instruction interface is called, it will not wait for the dedicated instruction interface to complete within the interface, that is, the non-blocking mode or the parallel mode is implemented. The specified value can be set according to the actual situation, and the specified value can be a number, a character, a character string, and so on. By way of example, the specified value may be "wait". Correspondingly, a second specified value can also be set, and in the case that the configuration information generated in parallel is the second specified value, the operation of encapsulating the preset waiting instruction for the dedicated instruction interface can be not performed, that is, only the generation does not include the preset waiting instruction. Dedicated instruction switching for instructions. For example, the second specified value may be "nowait". Further, a third specified value can also be set, and in the case that the configuration information generated in parallel is the third specified value, according to the dedicated instruction interface, a dedicated instruction interface encapsulated with a preset waiting instruction can be generated at the same time, and a preset waiting instruction is not encapsulated. Dedicated command interface for waiting commands. Illustratively, the third specified value may be "all".
具体的,这几种指定值配置各自对应的情况可以分别为:Specifically, the corresponding situations of these several specified value configurations can be as follows:
wait:生成封装有预设等待指令的专用指令接口,生成的专用指令接口其内部等待指令完成。在接口被连续调用的情况下,它们会串行执行,不会并行执行。wait: Generates a dedicated command interface encapsulated with a preset waiting command, and the generated dedicated command interface internally waits for the command to complete. Where interfaces are called consecutively, they execute serially, not in parallel.
nowait:生成未封装有预设等待指令的专用指令接口,生成的专用指令接口其内部不等待指令完成,在接口被连续调用的情况下,它们会并行执行。nowait: Generates a dedicated command interface that is not encapsulated with preset waiting commands. The generated dedicated command interface does not wait for the command to complete. When the interface is called continuously, they will be executed in parallel.
all:生成封装有预设等待指令的专用指令接口和未封装有预设等待指令的专用指令接口的两套接口。后续可以由使用者自由切换使用。all: Generates two sets of interfaces of the dedicated command interface encapsulated with the preset waiting command and the dedicated command interface not encapsulated with the preset waiting command. Subsequent use can be freely switched by the user.
在生成专用指令接口之后,还可以通过执行下述步骤A~步骤B生成接口注释:After generating the dedicated command interface, you can also generate interface annotations by executing the following steps A to B:
步骤A、根据所述专用指令接口,获取指定信息;所述指定信息至少包括所述专用指令接口中的端口信息及输出参数的类型。Step A: Acquire designation information according to the dedicated command interface; the designation information at least includes port information in the dedicated command interface and types of output parameters.
本申请实施例中,指定信息可以是根据实际需求设定的信息,除了端口信息及输出参数的类型之外,还可以包含其他信息,本申请实施例对此不作限定。示例的,可以从专用指令接口中提取各个端口信息,以及获取预先设置的输出参数的类型。In this embodiment of the present application, the specified information may be information set according to actual requirements, and may also include other information in addition to the port information and the type of output parameters, which is not limited in this embodiment of the present application. For example, each port information can be extracted from the dedicated command interface, and the preset output parameter type can be obtained.
步骤B、根据预设的注释生成工具,对所述指定信息进行组合,得到所述专用指令接口的接口注释。Step B: Combine the specified information according to a preset annotation generation tool to obtain an interface annotation of the dedicated command interface.
本申请实施例中,注释生成工具可以是预先选定的用于生成注释的工具,例如,doxygen工具,相应地,指定信息可以是符合doxygen工具的规则要求的信息。注释生成工具中可以自动化对指定类型的信息进行解析,并按照预设规则进行排列组合。相应地,可以将指定信息输出 注释生成工具,由该注释生成工具对指定信息进行组合,进而得到接口注释,这些接口注释组成注释文档。本申请中根据注释生成工具自动化生成专用指令接口的接口注释,这样,使得后续可以根据接口注释便捷的选择要调用的专用指令接口,进而提高接口调用效率。In this embodiment of the present application, the annotation generating tool may be a pre-selected tool for generating annotations, for example, a doxygen tool, and correspondingly, the specified information may be information that complies with the rule requirements of the doxygen tool. The annotation generation tool can automatically parse the specified types of information, and arrange and combine them according to preset rules. Correspondingly, the specified information can be output to an annotation generation tool, and the specified information can be combined by the annotation generation tool to obtain interface annotations, and these interface annotations form an annotation document. In the present application, the interface annotation of the special instruction interface is automatically generated according to the annotation generation tool, so that the special instruction interface to be called can be conveniently selected according to the interface annotation in the future, thereby improving the efficiency of interface calling.
下面以目标汇编指令为“”vacmps[0].char,[1].int,[2].intge”为例,构建的专用指令接口的具体实现可以表示为:Taking the target assembly instruction as ""vacmps[0].char,[1].int,[2].intge" as an example, the specific implementation of the built-in dedicated instruction interface can be expressed as:
Figure PCTCN2020099739-appb-000001
Figure PCTCN2020099739-appb-000001
以“///”开头的行表示接口注释,“#”之后的内容表示专用指令接口。其中,VALU_vvv("vacmps[0].char,[1].int,[2].int ge",dstPort,src0Port,src1Port)表示调用的目标通用指令接口。目标通用指令接口中的"vacmps[0].char,[1].int,[2].int ge"用于表示将目标汇编指令转换为汇编嵌入代码,VALU表示芯片标识,“dstPort,src0Port,src1Port”表示端口信息。此条汇编指令在具体模型中的接口原型可以表示为:void vacmps_cii_ge(int dstPort,int src0Port,int src1Port);Lines starting with "///" indicate interface comments, and the content after "#" indicates dedicated instruction interfaces. Among them, VALU_vvv("vacmps[0].char,[1].int,[2].int ge",dstPort,src0Port,src1Port) represents the calling target general instruction interface. "vacmps[0].char,[1].int,[2].int ge" in the target general instruction interface is used to convert the target assembly instruction into assembly embedded code, VALU indicates the chip identification, "dstPort,src0Port, src1Port" indicates port information. The interface prototype of this assembly instruction in the specific model can be expressed as: void vacmps_cii_ge(int dstPort,int src0Port,int src1Port);
在该示例中,对于该包含三操作数的目标汇编指令而言,通过调用三操作数对应的通用指令接口,即可完成底层汇编调度与配置,实现抽象封装目标汇编指令的具体接口,即,专用指令接口。In this example, for the target assembly instruction containing three operands, by calling the general instruction interface corresponding to the three operands, the underlying assembly scheduling and configuration can be completed, and the specific interface of the abstract encapsulation target assembly instruction can be realized, that is, Dedicated command interface.
可选的,生成专用指令接口之后,还可以执行下述步骤C~步骤D:Optionally, after generating the dedicated command interface, the following steps C to D may also be performed:
步骤C、对于任一所述预设芯片,在所述预设芯片的原生代码的指定位置,定义所述预设芯片对应的专用指令接口,得到所述预设芯片的接口模型;所述预设芯片对应的专用指令接口是根据属于所述预设芯片的目标汇编指令生成的。Step C. For any of the preset chips, define a dedicated command interface corresponding to the preset chip at the designated position of the native code of the preset chip, and obtain an interface model of the preset chip; It is assumed that the dedicated instruction interface corresponding to the chip is generated according to the target assembly instruction belonging to the preset chip.
本申请实施例中,指定位置可以是预先设定的,示例的,指定位置可以为头文件(include.)。具体的,可以将预设芯片对应的专用指令接口写入指定位置,进而实现构建该预设芯片的接口模型,得到不同预设芯片各自对应的接口模型。即,按照预设芯片进行分类,得到各个预设芯片的接口模型In this embodiment of the present application, the specified location may be preset. For example, the specified location may be a header file (include.). Specifically, the dedicated command interface corresponding to the preset chip can be written into a specified location, so as to realize the construction of the interface model of the preset chip, and obtain the interface models corresponding to different preset chips. That is, according to the preset chips, the interface model of each preset chip is obtained.
步骤D、在接收到指令调用请求时,从目标预设芯片的接口模型中获取与所述指令调用请求相匹配的专用指令接口;所述目标预设芯片的芯片标识与所述指令调用请求中包含的芯片标识相匹配。Step D, when receiving an instruction calling request, obtain a dedicated instruction interface matching the instruction calling request from the interface model of the target preset chip; the chip identifier of the target preset chip is in the instruction calling request. The included chip ID matches.
本申请实施例中,指令调用请求可以是在需要调用某个专用指令接口时发送的。如果收到指令调用请求,则可以认为有专用指令接口需要被调用。指令调用请求中可以包含芯片标识,以表明该指令调用请求用于调用哪个芯片所支持的汇编指令的专用指令接口。相应地,可以将芯片标识与指令调用请求中包含的芯片标识相匹配的接口模型中获取与指令调用请求相匹配的专用指令接口。其中,指令调用请求中还可以包括专用指令接口的名称,可以将接口模型中与指令调用请求中包含的名称相同的专用指令接口,确定为取与指令调用请求相匹配的专用指令接口。本申请通过按照预设芯片分类构建各个预设芯片的接口模型,这样,在后期调用专用指令接口时,可以从对应的接口模型中便捷的进行查找调用,进而一定程度上可以提高调用效率。In this embodiment of the present application, the instruction invocation request may be sent when a dedicated instruction interface needs to be invoked. If an instruction call request is received, it can be considered that there is a dedicated instruction interface that needs to be called. The instruction invocation request may contain a chip identifier to indicate which chip the instruction invocation request is used to invoke the dedicated instruction interface of the assembly instruction supported by the chip. Correspondingly, a dedicated instruction interface matching the instruction invocation request can be obtained from the interface model in which the chip identification matches the chip identification contained in the instruction invocation request. The instruction invocation request may also include the name of the dedicated instruction interface, and the dedicated instruction interface with the same name included in the instruction invocation request in the interface model may be determined as the dedicated instruction interface matching the instruction invocation request. In the present application, the interface model of each preset chip is constructed according to the preset chip classification, so that when the dedicated command interface is called later, the corresponding interface model can be conveniently searched and called, and the calling efficiency can be improved to a certain extent.
可选的,生成专用指令接口之后,还可以:获取预设输出路径;根据所述预设输出路径,输出所述专用指令接口。本申请实施例中,预设输出路径可以是预先设定。输出专用指令接口时,可以按照预设输出路径,将专用指令接口输出至预设位置。本申请实施例中,通过预设输出路径并根据预设输出路径输出专用指令接口,使得专用指令接口可以被直接输出值预设位置,进而方便存储。示例的,图5是本申请实施例提供的一种接口结构示意图。其中,底层汇编指令可以为目标汇编指令,底层汇编配置可以表示相关配置,例如,配置的端口信息。第一层中的通用编程模型可以为目标通用指令接口第二层中的具体编程模型可以为专用指令接口。示例的,假设底层汇编指令为“vmadd[0].char,[1].char,[2].char”,底层汇编配置可以表示为“outVEU_INST0_MAP0,r0”,通用编程模型可以表示为“VEU_vvv(“vmadd[0].char,[1].char,[2].char”,dstPort,src0Port,src1Port)”,具体编程模型可以表示为“Vmadd_ccc(dstPort,src0Port,src1Port)”。Optionally, after generating the dedicated instruction interface, you may further: obtain a preset output path; and output the dedicated instruction interface according to the preset output path. In this embodiment of the present application, the preset output path may be preset. When the dedicated command interface is output, the dedicated command interface can be output to the preset position according to the preset output path. In the embodiment of the present application, the preset output path is used to output the dedicated command interface according to the preset output path, so that the dedicated command interface can be directly outputted to the preset position, thereby facilitating storage. By way of example, FIG. 5 is a schematic structural diagram of an interface provided by an embodiment of the present application. The bottom-level assembly instruction may be a target assembly instruction, and the bottom-level assembly configuration may represent a related configuration, for example, configured port information. The general programming model in the first layer may be a target general instruction interface and the specific programming model in the second layer may be a dedicated instruction interface. For example, assuming the underlying assembly instruction is "vmadd[0].char,[1].char,[2].char", the underlying assembly configuration can be expressed as "outVEU_INST0_MAP0,r0", and the general programming model can be expressed as "VEU_vvv( "vmadd[0].char,[1].char,[2].char",dstPort,src0Port,src1Port)", the specific programming model can be expressed as "Vmadd_ccc(dstPort,src0Port,src1Port)".
需要说明的是,本申请实施例中还可以根据上述生成专用指令接口的处理逻辑,构建自动化生成工具。该自动化生成工具在运行时,可以实现上述各个步骤。其中,该自动化生成工具可以支持命令行参数控制。示例的,下述为部分示意命令行:It should be noted that, in this embodiment of the present application, an automated generation tool may also be constructed according to the above processing logic for generating a dedicated instruction interface. When the automatic generation tool is running, the above steps can be implemented. Among them, the automatic generation tool can support command line parameter control. By way of example, the following is part of the command line:
Figure PCTCN2020099739-appb-000002
Figure PCTCN2020099739-appb-000002
通过上述命令行可以实现从芯片标识为veu、valu、vfpu的芯片中指定预设芯片,控制工具过滤掉其他的芯片,仅对指定的预设芯片所支持的汇编指令进行处理。设置并行生成配置信息,注释简化、接口函数调用方式和宏调用方式之间的切换配置、设置内部接口的intrinsic调用实现。自定义输出路径。由于指令池中包含的汇编指令发生变化时,构建的通用指令接口依旧可以适用于指令池,因此,本申请实施例中,通过构建通用指令接口,在构建的通用指令接口基础上生成专用指令接口,一定程度上可以提高专用指令接口的适应性,为接口生成提供更多的可能性。同时,通过构建的自动化生成工具,可以快速便捷的生成、更新汇编指令的专用指令接口,进而可以更好的满足开发需求。示例的,图6是本申请实施例提供的一种生成工具的设计示意图。以预设芯片为X个加速器为例,如图6所示,该生成工具可以根据这X个加速器各自对应的指令池,生成混合指令池。即,根据各个预设芯片所支持的汇编指令,生成混合指令池。然后从混合指令池中获取目标汇编指令,通过后续操作实现生成专用指令接口。之后还可以生成接口注释以及各个加速器的接口模型。Through the above command line, it is possible to specify a preset chip from the chips whose chip identifiers are veu, valu, and vfpu, and the control tool filters out other chips, and only processes the assembly instructions supported by the specified preset chip. Set parallel generation configuration information, annotation simplification, switch configuration between interface function call mode and macro call mode, and set intrinsic call implementation of internal interface. Custom output path. When the assembly instructions contained in the instruction pool change, the constructed general instruction interface can still be applied to the instruction pool. Therefore, in the embodiment of the present application, by constructing the general instruction interface, a special instruction interface is generated on the basis of the constructed general instruction interface. , to a certain extent, it can improve the adaptability of the dedicated instruction interface and provide more possibilities for interface generation. At the same time, through the built automatic generation tool, the special instruction interface of the assembly instruction can be quickly and conveniently generated and updated, which can better meet the development needs. By way of example, FIG. 6 is a schematic design diagram of a generation tool provided by an embodiment of the present application. Taking the preset chips as X accelerators as an example, as shown in FIG. 6 , the generation tool can generate a mixed instruction pool according to the instruction pools corresponding to the X accelerators. That is, according to the assembly instructions supported by each preset chip, a mixed instruction pool is generated. Then, the target assembly instruction is obtained from the mixed instruction pool, and a dedicated instruction interface is generated through subsequent operations. Interface annotations and interface models for each accelerator can also be generated later.
图7是本申请实施例提供的一种接口生成装置的框图,如图7所示,该装置可以包括:存储器201和处理器202。FIG. 7 is a block diagram of an interface generation apparatus provided by an embodiment of the present application. As shown in FIG. 7 , the apparatus may include: a memory 201 and a processor 202 .
所述存储器201,用于存储程序代码。所述处理器202,调用所述程序代码,当所述程序代码被执行时,用于执行以下操作:获取目标汇编指令;根据所述目标汇编指令的类别指示信息,确定与所述类别指示信息相匹配的预设通用指令接口,得到目标通用指令接口;其中,不同类别指示信息对应不同的预设通用指令接口;根据所述目标汇编指令的内容及所述目标通用指令接口,生成用于描述所述目标汇编指令的专用指令接口。可选的,所述类别指示信息包括所述目标汇编指令包含的操作数的数量及所属芯片的芯片标识。可选的,所述处理器202,还用于:为预设芯片所支持的各个预设类别的汇编指令配置m个端口;同一预设类别的汇编指令包含的操作数个数相同,所述m不小于所述预设类别的汇编指令包含的操作数个数;配置汇编指令转换接口;所述汇编指令转换接口用于根据所述汇编指令生成汇编嵌入代码;所述汇编嵌入代码用于将所述汇编指令嵌入所述预设芯片的原生代码中;The memory 201 is used to store program codes. The processor 202 calls the program code, and when the program code is executed, is configured to perform the following operations: obtain a target assembly instruction; The matching preset general-purpose instruction interface obtains the target general-purpose instruction interface; wherein, different types of indication information correspond to different preset general-purpose instruction interfaces; according to the content of the target assembly instruction and the target general-purpose instruction interface, generate a description for A dedicated instruction interface for the target assembly instruction. Optionally, the category indication information includes the number of operands included in the target assembly instruction and the chip identifier of the chip to which it belongs. Optionally, the processor 202 is further configured to: configure m ports for the assembly instructions of each preset category supported by the preset chip; the assembly instructions of the same preset category contain the same number of operands, the m is not less than the number of operands contained in the assembly instructions of the preset category; configure an assembly instruction conversion interface; the assembly instruction conversion interface is used to generate an assembly embedded code according to the assembly instruction; the assembly embedded code is used to convert The assembly instruction is embedded in the native code of the preset chip;
根据所述m个端口的端口信息、所述汇编指令转换接口及所述预设芯片的芯片标识,生成所述预设通用指令接口。可选的,所述汇编指令转换接口为内联汇编接口。可选的,所述处理器202,还用于:将所述预设芯片所支持的汇编指令中包含相同个操作数的汇编指令划分至同一类别,得到所述预设类别。可选的,所述处理器202,具体用于:根据所述目标汇编指令的内容及所述目标通用指令接口,生成所述专用指令接口的接口名称、接口参数列表及汇编嵌入代码;根据所述接口名称、所述接口参数列表及所述汇编嵌入代码,生成所述专用指令接口。可选的,所述处理器202,具体用于:根据所述目标汇编指令中的助记符、操作数类型及标志寄存器信息,生成所述专用指令接口的接口名称;调用所述目标通用指令接口,以根据所述目标汇编指令中的操作数端口信息和/或立即数,生成所述专用指令接口的接口参数列表,以及将所述目标汇编 指令转换为汇编嵌入代码。可选的,所述处理器202,具体用于:获取各个所述操作数类型对应的缩写字符;将所述缩写字符组合为缩写字符串;根据预设的分割符,对所述助记符、所述缩写字符串及所述标志寄存器信息进行组合,得到所述接口名称。可选的,所述处理器202,具体用于:通过宏调用方式或接口函数调用方式,调用所述目标通用指令接口。可选的,所述目标通用指令接口中定义有内联汇编接口;所述处理器202,具体用于:基于所述目标通用指令接口中定义的内联汇编接口,将所述目标汇编指令转换为内联汇编代码。可选的,所述处理器202,具体用于:对于任一所述预设通用指令接口,获取所述预设通用指令接口中定义的芯片标识及端口信息的数量,作为对比芯片标识及对比数量;将所述对比数量及所述对比芯片标识分别与所述目标汇编指令包含的操作数的数量及所述所属芯片的芯片标识进行比对;若所述对比数量与所述目标汇编指令包含的操作数的数量相同,且所述对比芯片标识与所述所属芯片的芯片标识相同,则将所述预设通用指令接口确定为所述目标通用指令接口。可选的,所述处理器202,具体用于:根据各个预设芯片所支持的汇编指令,生成混合指令池;将所述混合指令池中包含的汇编指令作为目标汇编指令,从所述混合指令池中获取所述目标汇编指令。可选的,所述处理器202,还用于:对于任一所述预设芯片,在所述预设芯片的原生代码的指定位置,定义所述预设芯片对应的专用指令接口,得到所述预设芯片的接口模型;所述预设芯片对应的专用指令接口是根据属于所述预设芯片的目标汇编指令生成的;在接收到指令调用请求时,从目标预设芯片的接口模型中获取与所述指令调用请求相匹配的专用指令接口;所述目标预设芯片的芯片标识与所述指令调用请求中包含的芯片标识相匹配。可选的,所述处理器202,还用于:根据所述专用指令接口,获取指定信息;所述指定信息至少包括所述专用指令接口中的端口信息及输出参数的类型;根据预设的注释生成工具,对所述指定信息进行组合,得到所述专用指令接口的接口注释。可选的,所述处理器202,还用于:获取预设的并行生成配置信息;若所述并行生成配置信息为指定值,则为所述专用指令接口封装预设等待指令;所述预设等待指令用于指示在所述专用指令接口被调用的情况下,等待所述专用指令接口执行完毕之后,执行其他被调用的专用指令接口。The preset general instruction interface is generated according to the port information of the m ports, the assembly instruction conversion interface, and the chip identifier of the preset chip. Optionally, the assembly instruction conversion interface is an inline assembly interface. Optionally, the processor 202 is further configured to: classify the assembly instructions that include the same operand among the assembly instructions supported by the preset chip into the same category to obtain the preset category. Optionally, the processor 202 is specifically configured to: generate an interface name, an interface parameter list, and an assembly embedded code of the dedicated instruction interface according to the content of the target assembly instruction and the target general instruction interface; The interface name, the interface parameter list and the assembler embedded code are used to generate the dedicated instruction interface. Optionally, the processor 202 is specifically configured to: generate the interface name of the dedicated instruction interface according to the mnemonic, operand type and flag register information in the target assembly instruction; call the target general instruction an interface to generate an interface parameter list of the dedicated instruction interface according to the operand port information and/or immediate data in the target assembly instruction, and convert the target assembly instruction into an assembly embedded code. Optionally, the processor 202 is specifically configured to: obtain the abbreviated characters corresponding to each of the operand types; combine the abbreviated characters into an abbreviated character string; , the abbreviated character string and the flag register information are combined to obtain the interface name. Optionally, the processor 202 is specifically configured to: call the target general instruction interface in a macro calling manner or an interface function calling manner. Optionally, an inline assembly interface is defined in the target general instruction interface; the processor 202 is specifically configured to: convert the target assembly instruction based on the inline assembly interface defined in the target general instruction interface for inline assembly code. Optionally, the processor 202 is specifically configured to: for any of the preset general-purpose command interfaces, obtain the number of chip identifiers and port information defined in the preset general-purpose command interface, as the comparison chip identifiers and comparisons. Quantity; compare the comparison quantity and the comparison chip identifier with the number of operands included in the target assembly instruction and the chip identifier of the chip to which the target assembly instruction contains; if the comparison quantity and the target assembly instruction include The number of operands is the same, and the comparison chip identification is the same as the chip identification of the belonging chip, then the preset general command interface is determined as the target general command interface. Optionally, the processor 202 is specifically configured to: generate a mixed instruction pool according to the assembly instructions supported by each preset chip; The target assembly instruction is obtained from the instruction pool. Optionally, the processor 202 is further configured to: for any of the preset chips, define a dedicated instruction interface corresponding to the preset chip at a designated position of the native code of the preset chip, and obtain the preset chip. The interface model of the preset chip; the dedicated instruction interface corresponding to the preset chip is generated according to the target assembly instruction belonging to the preset chip; when receiving an instruction call request, the interface model of the target preset chip is obtained. A dedicated instruction interface matching the instruction invocation request is obtained; the chip identification of the target preset chip matches the chip identification contained in the instruction invocation request. Optionally, the processor 202 is further configured to: acquire specified information according to the dedicated instruction interface; the specified information at least includes port information and the type of output parameters in the dedicated instruction interface; The annotation generation tool combines the specified information to obtain the interface annotation of the dedicated instruction interface. Optionally, the processor 202 is further configured to: obtain preset parallel generation configuration information; if the parallel generation configuration information is a specified value, encapsulate a preset waiting instruction for the dedicated instruction interface; It is assumed that the waiting instruction is used to indicate that when the dedicated instruction interface is called, after the execution of the dedicated instruction interface is completed, other called dedicated instruction interfaces are executed.
可选的,所述处理器202,还用于:获取预设输出路径;根据所述预设输出路径,输出所述专用指令接口。上述装置执行操作与上述方法中的各个对应步骤类似,且能达到相同的技术效果,为避免重复,这里不再赘述。进一步地,本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现上述接口生成方法中的各个步骤,且能达到相同的技术效果,为避免重复,这里不再赘述。Optionally, the processor 202 is further configured to: acquire a preset output path; and output the dedicated instruction interface according to the preset output path. The operations performed by the above-mentioned apparatus are similar to the corresponding steps in the above-mentioned method, and can achieve the same technical effect. To avoid repetition, details are not repeated here. Further, the embodiments of the present application also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, each step in the above-mentioned interface generation method is implemented, and can To achieve the same technical effect, in order to avoid repetition, details are not repeated here.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可 以理解并实施。本申请的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器来实现根据本申请实施例的计算处理设备中的一些或者全部部件的一些或者全部功能。本申请还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本申请的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。例如,图8为本申请实施例提供的一种计算处理设备的框图,如图8所示,图8示出了可以实现根据本申请的方法的计算处理设备。该计算处理设备传统上包括处理器310和以存储器320形式的计算机程序产品或者计算机可读介质。存储器320可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器320具有用于执行上述方法中的任何方法步骤的程序代码的存储空间330。例如,用于程序代码的存储空间330可以包括分别用于实现上面的方法中的各种步骤的各个程序代码。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为如参考图9所述的便携式或者固定存储单元。该存储单元可以具有与图8的计算处理设备中的存储器320类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括计算机可读代码,即可以由例如诸如310之类的处理器读取的代码,这些代码当由计算处理设备运行时,导致该计算处理设备执行上面所描述的方法中的各个步骤。The device embodiments described above are only illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed over multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment. Those of ordinary skill in the art can understand and implement it without creative effort. Various component embodiments of the present application may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor may be used in practice to implement some or all of the functions of some or all of the components in the computing processing device according to the embodiments of the present application. The present application can also be implemented as an apparatus or apparatus program (eg, computer programs and computer program products) for performing part or all of the methods described herein. Such a program implementing the present application may be stored on a computer-readable medium, or may be in the form of one or more signals. Such signals may be downloaded from Internet sites, or provided on carrier signals, or in any other form. For example, FIG. 8 is a block diagram of a computing processing device provided by an embodiment of the present application. As shown in FIG. 8 , FIG. 8 shows a computing processing device that can implement the method according to the present application. The computing processing device traditionally includes a processor 310 and a computer program product or computer readable medium in the form of a memory 320 . The memory 320 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. The memory 320 has storage space 330 for program code for performing any of the method steps in the above-described methods. For example, the storage space 330 for program codes may include various program codes for implementing various steps in the above methods, respectively. These program codes can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such computer program products are typically portable or fixed storage units as described with reference to FIG. 9 . The storage unit may have storage segments, storage spaces, etc. arranged similarly to the memory 320 in the computing processing device of FIG. 8 . The program code may, for example, be compressed in a suitable form. Typically, the storage unit includes computer readable code, ie code readable by a processor such as 310 for example, which when executed by a computing processing device, causes the computing processing device to perform each of the methods described above. step.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。本文中所称的“一个实施例”、“实施例”或者“一个或者多个实施例”意味着,结合实施例描述的特定特征、结构或者特性包括在本申请的至少一个实施例中。此外,请注意,这里“在一个实施例中”的词语例子不一定全指同一个实施例。在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本申请的实施例可以在没有这些具体细节的情况下被实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本申请可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征 进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments may be referred to each other. Reference herein to "one embodiment," "an embodiment," or "one or more embodiments" means that a particular feature, structure, or characteristic described in connection with an embodiment is included in at least one embodiment of the present application. Also, please note that instances of the phrase "in one embodiment" herein are not necessarily all referring to the same embodiment. In the description provided herein, numerous specific details are set forth. It will be understood, however, that the embodiments of the present application may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. do not denote any order. These words can be interpreted as names. Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still be The technical solutions described in the foregoing embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions in the embodiments of the present application.

Claims (33)

  1. 一种接口生成方法,其特征在于,所述方法包括:An interface generation method, characterized in that the method comprises:
    获取目标汇编指令;Get the target assembly instructions;
    根据所述目标汇编指令的类别指示信息,确定与所述类别指示信息相匹配的预设通用指令接口,得到目标通用指令接口;其中,不同类别指示信息对应不同的预设通用指令接口;According to the category indication information of the target assembly instruction, determine a preset general instruction interface that matches the category indication information, and obtain a target general instruction interface; wherein, different types of instruction information correspond to different preset general instruction interfaces;
    根据所述目标汇编指令的内容及所述目标通用指令接口,生成用于描述所述目标汇编指令的专用指令接口。According to the content of the target assembly instruction and the target general instruction interface, a dedicated instruction interface for describing the target assembly instruction is generated.
  2. 根据权利要求1所述方法,其特征在于,所述类别指示信息包括所述目标汇编指令包含的操作数的数量及所属芯片的芯片标识。The method according to claim 1, wherein the category indication information includes the number of operands included in the target assembly instruction and the chip identifier of the chip to which it belongs.
  3. 根据权利要求2所述方法,其特征在于,所述预设通用指令接口通过下述步骤生成:The method according to claim 2, wherein the preset general command interface is generated by the following steps:
    为预设芯片所支持的各个预设类别的汇编指令配置m个端口;同一预设类别的汇编指令包含的操作数个数相同,所述m不小于所述预设类别的汇编指令包含的操作数个数;Configure m ports for the assembly instructions of each preset category supported by the preset chip; the assembly instructions of the same preset category contain the same number of operands, and the m is not less than the operations contained in the assembly instructions of the preset category number;
    配置汇编指令转换接口;所述汇编指令转换接口用于根据所述汇编指令生成汇编嵌入代码;所述汇编嵌入代码用于将所述汇编指令嵌入所述预设芯片的原生代码中;configuring an assembly instruction conversion interface; the assembly instruction conversion interface is used to generate an assembly embedded code according to the assembly instruction; the assembly embedded code is used to embed the assembly instruction into the native code of the preset chip;
    根据所述m个端口的端口信息、所述汇编指令转换接口及所述预设芯片的芯片标识,生成所述预设通用指令接口。The preset general instruction interface is generated according to the port information of the m ports, the assembly instruction conversion interface, and the chip identifier of the preset chip.
  4. 根据权利要求3所述方法,其特征在于,所述汇编指令转换接口为内联汇编接口。The method according to claim 3, wherein the assembly instruction conversion interface is an inline assembly interface.
  5. 根据权利要求3所述方法,其特征在于,所述为预设芯片所支持的各个预设类别的汇编指令配置m个端口之前,所述方法还包括:The method according to claim 3, wherein before configuring m ports for the assembly instructions of each preset category supported by the preset chip, the method further comprises:
    将所述预设芯片所支持的汇编指令中包含相同个操作数的汇编指令划分至同一类别,得到所述预设类别。Divide the assembly instructions that include the same operand among the assembly instructions supported by the preset chip into the same category to obtain the preset category.
  6. 根据权利要求1至5任一所述方法,其特征在于,所述根据所述目标汇编指令的内容及所述目标通用指令接口,生成用于描述所述目标汇编指令的专用指令接口,包括:The method according to any one of claims 1 to 5, wherein the generating a dedicated instruction interface for describing the target assembly instruction according to the content of the target assembly instruction and the target general instruction interface, comprising:
    根据所述目标汇编指令的内容及所述目标通用指令接口,生成所述专用指令接口的接口名称、接口参数列表及汇编嵌入代码;According to the content of the target assembly instruction and the target general instruction interface, generate the interface name, the interface parameter list and the assembly embedded code of the special instruction interface;
    根据所述接口名称、所述接口参数列表及所述汇编嵌入代码,生成所述专用指令接口。The dedicated instruction interface is generated according to the interface name, the interface parameter list and the assembly embedded code.
  7. 根据权利要求6所述方法,其特征在于,所述根据所述目标汇编指令的内容及所述目标通用指令接口,生成所述专用指令接口的接口名称、接口参数列表及汇编嵌入代码,包括:The method according to claim 6, wherein generating the interface name, interface parameter list and assembler embedded code of the dedicated instruction interface according to the content of the target assembly instruction and the target general instruction interface, comprising:
    根据所述目标汇编指令中的助记符、操作数类型及标志寄存器信息,生成所述专用指令接口的接口名称;generating the interface name of the dedicated instruction interface according to the mnemonic, operand type and flag register information in the target assembly instruction;
    调用所述目标通用指令接口,以根据所述目标汇编指令中的操作数端口信息和/或立即数,生成所述专用指令接口的接口参数列表,以及将所述目标汇编指令转换为汇编嵌入代码。Invoke the target general-purpose instruction interface to generate an interface parameter list of the special-purpose instruction interface according to the operand port information and/or immediate data in the target assembly instruction, and convert the target assembly instruction into an assembly embedded code .
  8. 根据权利要求6或7所述方法,其特征在于,所述根据所述目标汇编指令中的助记符、 操作数类型及标志寄存器信息,生成所述专用指令接口的接口名称,包括:The method according to claim 6 or 7, wherein generating the interface name of the dedicated instruction interface according to the mnemonic, operand type and flag register information in the target assembly instruction, comprising:
    获取各个所述操作数类型对应的缩写字符;Obtain the abbreviated characters corresponding to each of the operand types;
    将所述缩写字符组合为缩写字符串;combining the abbreviated characters into an abbreviated string;
    根据预设的分割符,对所述助记符、所述缩写字符串及所述标志寄存器信息进行组合,得到所述接口名称。The interface name is obtained by combining the mnemonic, the abbreviated character string and the flag register information according to a preset separator.
  9. 根据权利要求7所述方法,其特征在于,所述调用所述目标通用指令接口,包括:The method according to claim 7, wherein the invoking the target general instruction interface comprises:
    通过宏调用方式或接口函数调用方式,调用所述目标通用指令接口。The target general instruction interface is called through a macro calling method or an interface function calling method.
  10. 根据权利要求7所述方法,其特征在于,所述目标通用指令接口中定义有内联汇编接口;The method according to claim 7, wherein an inline assembly interface is defined in the target general instruction interface;
    所述将所述目标汇编指令转换为汇编嵌入代码,包括:The converting the target assembly instruction into the assembly embedded code includes:
    基于所述目标通用指令接口中定义的内联汇编接口,将所述目标汇编指令转换为内联汇编代码。The target assembly instruction is converted into inline assembly code based on the inline assembly interface defined in the target general instruction interface.
  11. 根据权利要求2至5任一所述方法,其特征在于,所述根据所述目标汇编指令的类别指示信息,确定与所述类别指示信息相匹配的预设通用指令接口,得到目标通用指令接口,包括:The method according to any one of claims 2 to 5, wherein, according to the category indication information of the target assembly instruction, determining a preset general instruction interface that matches the category indication information to obtain the target general instruction interface ,include:
    对于任一所述预设通用指令接口,获取所述预设通用指令接口中定义的芯片标识及端口信息的数量,作为对比芯片标识及对比数量;For any one of the preset general-purpose command interfaces, obtain the number of chip identifiers and port information defined in the preset general-purpose command interface, as the comparison chip identifiers and the number of comparisons;
    将所述对比数量及所述对比芯片标识分别与所述目标汇编指令包含的操作数的数量及所述所属芯片的芯片标识进行比对;Comparing the number of comparisons and the identification of the comparison chip with the number of operands included in the target assembly instruction and the identification of the chip of the chip to which it belongs;
    若所述对比数量与所述目标汇编指令包含的操作数的数量相同,且所述对比芯片标识与所述所属芯片的芯片标识相同,则将所述预设通用指令接口确定为所述目标通用指令接口。If the number of comparisons is the same as the number of operands included in the target assembly instruction, and the comparison chip identifier is the same as the chip identifier of the chip to which it belongs, the preset general-purpose instruction interface is determined as the target general-purpose instruction interface. Command interface.
  12. 根据权利要求1所述方法,其特征在于,所述获取目标汇编指令,包括:The method according to claim 1, wherein the obtaining the target assembly instruction comprises:
    根据各个预设芯片所支持的汇编指令,生成混合指令池;Generate a mixed instruction pool according to the assembly instructions supported by each preset chip;
    将所述混合指令池中包含的汇编指令作为目标汇编指令,从所述混合指令池中获取所述目标汇编指令。The assembly instructions contained in the mixed instruction pool are used as target assembly instructions, and the target assembly instructions are acquired from the mixed instruction pool.
  13. 根据权利要求12所述方法,其特征在于,所述根据所述目标汇编指令的内容及所述目标通用指令接口,生成用于描述所述目标汇编指令的专用指令接口之后,所述方法还包括:The method according to claim 12, wherein after generating a dedicated instruction interface for describing the target assembly instruction according to the content of the target assembly instruction and the target general instruction interface, the method further comprises: :
    对于任一所述预设芯片,在所述预设芯片的原生代码的指定位置,定义所述预设芯片对应的专用指令接口,得到所述预设芯片的接口模型;所述预设芯片对应的专用指令接口是根据属于所述预设芯片的目标汇编指令生成的;For any of the preset chips, a dedicated command interface corresponding to the preset chip is defined at the designated position of the native code of the preset chip, and an interface model of the preset chip is obtained; the preset chip corresponds to The dedicated instruction interface is generated according to the target assembly instruction belonging to the preset chip;
    在接收到指令调用请求时,从目标预设芯片的接口模型中获取与所述指令调用请求相匹配的专用指令接口;所述目标预设芯片的芯片标识与所述指令调用请求中包含的芯片标识相匹配。When receiving an instruction invocation request, obtain a dedicated instruction interface matching the instruction invocation request from the interface model of the target preset chip; the chip identifier of the target preset chip and the chip included in the instruction invocation request ID matches.
  14. 根据权利要求1所述方法,其特征在于,所述根据所述目标汇编指令的内容及所述目 标通用指令接口,生成用于描述所述目标汇编指令的专用指令接口之后,所述方法还包括:The method according to claim 1, wherein after generating a dedicated instruction interface for describing the target assembly instruction according to the content of the target assembly instruction and the target general instruction interface, the method further comprises: :
    根据所述专用指令接口,获取指定信息;所述指定信息至少包括所述专用指令接口中的端口信息及输出参数的类型;Acquire specified information according to the dedicated command interface; the specified information at least includes port information and the type of output parameters in the dedicated command interface;
    根据预设的注释生成工具,对所述指定信息进行组合,得到所述专用指令接口的接口注释。According to a preset annotation generation tool, the specified information is combined to obtain the interface annotation of the dedicated instruction interface.
  15. 根据权利要求1所述方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    获取预设的并行生成配置信息;Obtain the preset parallel generation configuration information;
    若所述并行生成配置信息为指定值,则为所述专用指令接口封装预设等待指令;If the parallel generation configuration information is a specified value, encapsulating a preset waiting command for the dedicated command interface;
    所述预设等待指令用于指示在所述专用指令接口被调用的情况下,等待所述专用指令接口执行完毕之后,执行其他被调用的专用指令接口。The preset waiting instruction is used to instruct, in the case that the dedicated instruction interface is called, to execute other called dedicated instruction interfaces after the execution of the dedicated instruction interface is completed.
  16. 根据权利要求1所述方法,其特征在于,所述根据所述目标汇编指令的内容及所述目标通用指令接口,生成用于描述所述目标汇编指令的专用指令接口之后,所述方法还包括:The method according to claim 1, wherein after generating a dedicated instruction interface for describing the target assembly instruction according to the content of the target assembly instruction and the target general instruction interface, the method further comprises: :
    获取预设输出路径;Get the default output path;
    根据所述预设输出路径,输出所述专用指令接口。According to the preset output path, the dedicated command interface is output.
  17. 一种接口生成装置,其特征在于,所述装置包括:存储器和处理器;An interface generation device, characterized in that the device comprises: a memory and a processor;
    所述存储器,用于存储程序代码;the memory for storing program codes;
    所述处理器,调用所述程序代码,当所述程序代码被执行时,用于执行以下操作:The processor calls the program code, and when the program code is executed, is configured to perform the following operations:
    获取目标汇编指令;Get the target assembly instructions;
    根据所述目标汇编指令的类别指示信息,确定与所述类别指示信息相匹配的预设通用指令接口,得到目标通用指令接口;其中,不同类别指示信息对应不同的预设通用指令接口;According to the category indication information of the target assembly instruction, determine a preset general instruction interface that matches the category indication information, and obtain a target general instruction interface; wherein, different types of instruction information correspond to different preset general instruction interfaces;
    根据所述目标汇编指令的内容及所述目标通用指令接口,生成用于描述所述目标汇编指令的专用指令接口。According to the content of the target assembly instruction and the target general instruction interface, a dedicated instruction interface for describing the target assembly instruction is generated.
  18. 根据权利要求17所述装置,其特征在于,所述类别指示信息包括所述目标汇编指令包含的操作数的数量及所属芯片的芯片标识。18. The apparatus according to claim 17, wherein the category indication information includes the number of operands included in the target assembly instruction and the chip identifier of the chip to which it belongs.
  19. 根据权利要求18所述装置,其特征在于,所述处理器,还用于:The apparatus of claim 18, wherein the processor is further configured to:
    为预设芯片所支持的各个预设类别的汇编指令配置m个端口;同一预设类别的汇编指令包含的操作数个数相同,所述m不小于所述预设类别的汇编指令包含的操作数个数;Configure m ports for the assembly instructions of each preset category supported by the preset chip; the assembly instructions of the same preset category contain the same number of operands, and the m is not less than the operations contained in the assembly instructions of the preset category number;
    配置汇编指令转换接口;所述汇编指令转换接口用于根据所述汇编指令生成汇编嵌入代码;所述汇编嵌入代码用于将所述汇编指令嵌入所述预设芯片的原生代码中;configuring an assembly instruction conversion interface; the assembly instruction conversion interface is used to generate an assembly embedded code according to the assembly instruction; the assembly embedded code is used to embed the assembly instruction into the native code of the preset chip;
    根据所述m个端口的端口信息、所述汇编指令转换接口及所述预设芯片的芯片标识,生成所述预设通用指令接口。The preset general instruction interface is generated according to the port information of the m ports, the assembly instruction conversion interface, and the chip identifier of the preset chip.
  20. 根据权利要求19所述装置,其特征在于,所述汇编指令转换接口为内联汇编接口。The apparatus according to claim 19, wherein the assembly instruction conversion interface is an inline assembly interface.
  21. 根据权利要求19所述装置,其特征在于,所述处理器,还用于:The apparatus of claim 19, wherein the processor is further configured to:
    将所述预设芯片所支持的汇编指令中包含相同个操作数的汇编指令划分至同一类别,得到 所述预设类别。Divide the assembly instructions that include the same operand among the assembly instructions supported by the preset chip into the same category to obtain the preset category.
  22. 根据权利要求17至21任一所述装置,其特征在于,所述处理器,具体用于:The apparatus according to any one of claims 17 to 21, wherein the processor is specifically configured to:
    根据所述目标汇编指令的内容及所述目标通用指令接口,生成所述专用指令接口的接口名称、接口参数列表及汇编嵌入代码;According to the content of the target assembly instruction and the target general instruction interface, generate the interface name, the interface parameter list and the assembly embedded code of the special instruction interface;
    根据所述接口名称、所述接口参数列表及所述汇编嵌入代码,生成所述专用指令接口。The dedicated instruction interface is generated according to the interface name, the interface parameter list and the assembly embedded code.
  23. 根据权利要求22所述装置,其特征在于,所述处理器,具体用于:The apparatus according to claim 22, wherein the processor is specifically configured to:
    根据所述目标汇编指令中的助记符、操作数类型及标志寄存器信息,生成所述专用指令接口的接口名称;generating the interface name of the dedicated instruction interface according to the mnemonic, operand type and flag register information in the target assembly instruction;
    调用所述目标通用指令接口,以根据所述目标汇编指令中的操作数端口信息和/或立即数,生成所述专用指令接口的接口参数列表,以及将所述目标汇编指令转换为汇编嵌入代码。Invoke the target general-purpose instruction interface to generate an interface parameter list of the special-purpose instruction interface according to the operand port information and/or immediate data in the target assembly instruction, and convert the target assembly instruction into an assembly embedded code .
  24. 根据权利要求22或23所述装置,其特征在于,所述处理器,具体用于:The apparatus according to claim 22 or 23, wherein the processor is specifically configured to:
    获取各个所述操作数类型对应的缩写字符;Obtain the abbreviated characters corresponding to each of the operand types;
    将所述缩写字符组合为缩写字符串;combining the abbreviated characters into an abbreviated string;
    根据预设的分割符,对所述助记符、所述缩写字符串及所述标志寄存器信息进行组合,得到所述接口名称。The interface name is obtained by combining the mnemonic, the abbreviated character string and the flag register information according to a preset separator.
  25. 根据权利要求23所述装置,其特征在于,所述处理器,具体用于:The apparatus according to claim 23, wherein the processor is specifically configured to:
    通过宏调用方式或接口函数调用方式,调用所述目标通用指令接口。The target general instruction interface is called through a macro calling method or an interface function calling method.
  26. 根据权利要求23所述装置,其特征在于,所述目标通用指令接口中定义有内联汇编接口;The device according to claim 23, wherein an inline assembly interface is defined in the target general instruction interface;
    所述处理器,具体用于:The processor is specifically used for:
    基于所述目标通用指令接口中定义的内联汇编接口,将所述目标汇编指令转换为内联汇编代码。The target assembly instruction is converted into inline assembly code based on the inline assembly interface defined in the target general instruction interface.
  27. 根据权利要求18至21任一所述装置,其特征在于,所述处理器,具体用于:The apparatus according to any one of claims 18 to 21, wherein the processor is specifically configured to:
    对于任一所述预设通用指令接口,获取所述预设通用指令接口中定义的芯片标识及端口信息的数量,作为对比芯片标识及对比数量;For any one of the preset general-purpose command interfaces, obtain the number of chip identifiers and port information defined in the preset general-purpose command interface, as the comparison chip identifiers and the number of comparisons;
    将所述对比数量及所述对比芯片标识分别与所述目标汇编指令包含的操作数的数量及所述所属芯片的芯片标识进行比对;Comparing the number of comparisons and the identification of the comparison chip with the number of operands included in the target assembly instruction and the identification of the chip of the chip to which it belongs;
    若所述对比数量与所述目标汇编指令包含的操作数的数量相同,且所述对比芯片标识与所述所属芯片的芯片标识相同,则将所述预设通用指令接口确定为所述目标通用指令接口。If the number of comparisons is the same as the number of operands included in the target assembly instruction, and the comparison chip identifier is the same as the chip identifier of the chip to which it belongs, the preset general-purpose instruction interface is determined as the target general-purpose instruction interface. Command interface.
  28. 根据权利要求17所述装置,其特征在于,所述处理器,具体用于:The apparatus according to claim 17, wherein the processor is specifically configured to:
    根据各个预设芯片所支持的汇编指令,生成混合指令池;Generate a mixed instruction pool according to the assembly instructions supported by each preset chip;
    将所述混合指令池中包含的汇编指令作为目标汇编指令,从所述混合指令池中获取所述目标汇编指令。The assembly instructions contained in the mixed instruction pool are used as target assembly instructions, and the target assembly instructions are acquired from the mixed instruction pool.
  29. 根据权利要求28所述装置,其特征在于,所述处理器,还用于:The apparatus of claim 28, wherein the processor is further configured to:
    对于任一所述预设芯片,在所述预设芯片的原生代码的指定位置,定义所述预设芯片对应的专用指令接口,得到所述预设芯片的接口模型;所述预设芯片对应的专用指令接口是根据属于所述预设芯片的目标汇编指令生成的;For any of the preset chips, a dedicated command interface corresponding to the preset chip is defined at the designated position of the native code of the preset chip, and an interface model of the preset chip is obtained; the preset chip corresponds to The dedicated instruction interface is generated according to the target assembly instruction belonging to the preset chip;
    在接收到指令调用请求时,从目标预设芯片的接口模型中获取与所述指令调用请求相匹配的专用指令接口;所述目标预设芯片的芯片标识与所述指令调用请求中包含的芯片标识相匹配。When receiving an instruction invocation request, obtain a dedicated instruction interface matching the instruction invocation request from the interface model of the target preset chip; the chip identifier of the target preset chip and the chip included in the instruction invocation request ID matches.
  30. 根据权利要求17所述装置,其特征在于,所述处理器,还用于:The apparatus of claim 17, wherein the processor is further configured to:
    根据所述专用指令接口,获取指定信息;所述指定信息至少包括所述专用指令接口中的端口信息及输出参数的类型;Acquire specified information according to the dedicated command interface; the specified information at least includes port information and the type of output parameters in the dedicated command interface;
    根据预设的注释生成工具,对所述指定信息进行组合,得到所述专用指令接口的接口注释。According to a preset annotation generation tool, the specified information is combined to obtain the interface annotation of the dedicated instruction interface.
  31. 根据权利要求17所述装置,其特征在于,所述处理器,还用于:The apparatus of claim 17, wherein the processor is further configured to:
    获取预设的并行生成配置信息;Obtain the preset parallel generation configuration information;
    若所述并行生成配置信息为指定值,则在获取所述目标汇编指令之后,获取下一目标汇编指令,并根据所述下一目标汇编指令,执行生成所述下一目标汇编指令的专用指令接口的操作。If the parallel generation configuration information is a specified value, after acquiring the target assembly instruction, acquire the next target assembly instruction, and execute the special instruction for generating the next target assembly instruction according to the next target assembly instruction operation of the interface.
  32. 根据权利要求17所述装置,其特征在于,所述处理器,还用于:The apparatus of claim 17, wherein the processor is further configured to:
    获取预设输出路径;Get the default output path;
    根据所述预设输出路径,输出所述专用指令接口。According to the preset output path, the dedicated command interface is output.
  33. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现如权利要求1-16任一所述的接口生成方法。A computer-readable storage medium, characterized in that, a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the interface generation method according to any one of claims 1-16 is implemented.
PCT/CN2020/099739 2020-07-01 2020-07-01 Interface generation method and device, and computer-readable storage medium WO2022000371A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/099739 WO2022000371A1 (en) 2020-07-01 2020-07-01 Interface generation method and device, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/099739 WO2022000371A1 (en) 2020-07-01 2020-07-01 Interface generation method and device, and computer-readable storage medium

Publications (1)

Publication Number Publication Date
WO2022000371A1 true WO2022000371A1 (en) 2022-01-06

Family

ID=79317720

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/099739 WO2022000371A1 (en) 2020-07-01 2020-07-01 Interface generation method and device, and computer-readable storage medium

Country Status (1)

Country Link
WO (1) WO2022000371A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010016940A1 (en) * 1998-10-29 2001-08-23 Texas Instruments Inc System and method for translating include files
CN101118498A (en) * 2007-09-13 2008-02-06 上海交通大学 Assembler based on user describing and realizing method thereof
US20140149969A1 (en) * 2012-11-12 2014-05-29 Signalogic Source code separation and generation for heterogeneous central processing unit (CPU) computational devices
CN109947432A (en) * 2019-03-28 2019-06-28 Oppo广东移动通信有限公司 Assembler processing method and relevant apparatus
CN111078290A (en) * 2019-12-17 2020-04-28 西安电子科技大学 Compiler and compiling method for extensible instruction set

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010016940A1 (en) * 1998-10-29 2001-08-23 Texas Instruments Inc System and method for translating include files
CN101118498A (en) * 2007-09-13 2008-02-06 上海交通大学 Assembler based on user describing and realizing method thereof
US20140149969A1 (en) * 2012-11-12 2014-05-29 Signalogic Source code separation and generation for heterogeneous central processing unit (CPU) computational devices
CN109947432A (en) * 2019-03-28 2019-06-28 Oppo广东移动通信有限公司 Assembler processing method and relevant apparatus
CN111078290A (en) * 2019-12-17 2020-04-28 西安电子科技大学 Compiler and compiling method for extensible instruction set

Similar Documents

Publication Publication Date Title
US9916145B2 (en) Utilizing special purpose elements to implement a FSM
US9134974B2 (en) Source code separation and generation for heterogeneous central processing unit (CPU) computational devices
US7861222B2 (en) Discoscript: a simplified distributed computing scripting language
EP3525119B1 (en) Fpga converter for deep learning models
US20120192163A1 (en) Method and apparatus for compiling regular expressions
CN1570870A (en) Extreme pipeline and optimized reordering technology
CN105793818A (en) Source code translation
WO2021258692A1 (en) Multi-chip compatible compiling method and device
CN104360865A (en) Serialization method, deserialization method and related equipment
CN114816417B (en) Cross compiling method, device, computing equipment and storage medium
CN112905472A (en) Kernel debugging system and method
CN105446725A (en) Method and system for model driven development
US20090144528A1 (en) Method for running native code across single or multi-core hybrid processor achitecture
JP2009169864A (en) Compile method and compile program
CN111930359B (en) System and method for developing algorithm on heterogeneous embedded system
WO2022000371A1 (en) Interface generation method and device, and computer-readable storage medium
CN117033249A (en) Test case generation method and device, computer equipment and storage medium
US20230113783A1 (en) Cross-platform code conversion method and device
US8661425B1 (en) Method, apparatus, and computer-readable medium for storing data associated with a firmware program
Van Eijk et al. Constraint analysis for code generation: basic techniques and applications in FACTS
CN113467828A (en) Method and system for converting programming language in heterogeneous many-core processor
US8135943B1 (en) Method, apparatus, and computer-readable medium for generating a dispatching function
WO2020027930A1 (en) Property filtering
CN114866451B (en) iOS end route communication improvement method, device, storage medium and equipment
CN117075902A (en) Tensor-based compiling method, tensor-based compiling device and computer-readable storage medium for tensor-based compiling device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20942809

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20942809

Country of ref document: EP

Kind code of ref document: A1