Deep learning framework adaptation method, device and equipment for device backend
By generating the initial framework and integration templates and performing adaptive code configuration, the problem of adaptive complexity of deep learning frameworks in the existing technology is solved, and fast and efficient adaptation and maintenance are achieved.
Patent Information
- Application Number
- CN202411605822.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-11-12
AI Technical Summary
When the existing deep learning framework is adapted to new hardware devices, it requires a lot of customized development, resulting in high development and maintenance complexity and hindering the rapid integration and promotion of new hardware technologies.
By obtaining the preconfiguration information of the device backend, generating the initial framework and integration template, building the adaptive code template, and performing adaptive code configuration, we obtain the deep learning framework adapted to the device backend.
It reduces the workload of users in framework adaptation development, optimizes the adaptation code structure, simplifies the adaptation process between the deep learning framework and the device backend, and achieves fast and efficient adaptation and maintenance.
Smart Images

Figure CN119127149B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of artificial intelligence basic software framework, and in particular to a method, apparatus and device for adapting a deep learning framework at the back end of a device. Background Art
[0002] With the rapid development of artificial intelligence technology, deep learning frameworks, especially open source frameworks led by PyTorch and TensorFlow, have been widely used in multiple industries and have dominated practical applications. However, adapting new hardware devices to these frameworks usually involves a lot of custom development work, including writing and maintaining Python front-end, device management, operator adaptation, and vendor-specific code, which is not only time-consuming but also technically demanding. Currently, device manufacturers encounter many challenges in the adaptation process, such as inconsistent device access methods, poor usability of abstract solutions, tight coupling with framework native code, and frequent framework version updates. These problems significantly increase the complexity of development and maintenance, thereby hindering the rapid integration and widespread promotion of new hardware technologies. Summary of the invention
[0003] Based on this, it is necessary to provide a deep learning framework adaptation method, device and equipment for the device backend that can reduce the user's workload in framework adaptation development and optimize the adaptation code structure in response to the above technical problems.
[0004] In a first aspect, the present application provides a method for adapting a deep learning framework of a device backend, the method comprising:
[0005] Get the pre-configuration information of the device backend;
[0006] Generate an initial framework and an integrated template of the device backend according to the pre-configuration information;
[0007] Based on the initial framework and the integration template, construct an adaptation code template for the device backend;
[0008] The adaptation code template is adaptively configured to obtain a deep learning framework adapted to the back end of the device.
[0009] In one embodiment, the pre-configuration information includes device parameters of the device backend and a target framework version type of a deep learning framework to be generated. Generating an initial framework of the device backend according to the pre-configuration information includes:
[0010] Determine at least one hardware management component of the device backend according to the device parameters, and generate at least one hardware code subframework adapted to the target framework version type based on the hardware management component;
[0011] According to the hardware code sub-framework, register and / or construct a device support operator; the device support operator is used to calculate and call the at least one hardware code sub-framework;
[0012] The device support operator and the hardware code subframework are assembled into a code framework to generate an initial framework of the device backend.
[0013] In one embodiment, the hardware management component includes a conventional component and a specific component, the conventional component includes a device management component, a stream component, an event management component, and a memory management component, and the specific component includes a tensor management component; the hardware code subframework includes a conventional code subframework and a tensor processing code subframework; and the generating at least one hardware code subframework adapted to the target framework version type based on the hardware management component includes:
[0014] Abstracting the device management component, stream component, event management component, and memory management component into a conventional code subframework adapted to the target framework version type;
[0015] The tensor management component is abstracted into a tensor processing code subframework adapted to the target framework version type.
[0016] In one embodiment, the integration template includes a compiler code template, and generating the integration template of the device backend according to the preconfiguration information includes:
[0017] Determine at least one compiler of the device backend according to the device parameters, and obtain a compiler type and a compiler integration method of the compiler;
[0018] A compiler code template adapted to the target framework version type is generated according to the compiler type and the compiler integration mode.
[0019] In one embodiment, the integration template further includes an expansion tool code template, and the generating of the integration template of the device backend according to the pre-configuration information further includes:
[0020] Determine at least one expansion tool of the backend of the device according to the device parameters;
[0021] The access integration mode of the expansion tool is obtained, and an expansion tool code template adapted to the target framework version type is generated.
[0022] In one embodiment, the adaptive code configuration of the adaptation code template includes:
[0023] According to the initial framework and the integrated template, interface operator code, target framework native code, compiler code and expansion tool code are adaptively generated to obtain a deep learning framework adapted to the device backend.
[0024] In one of the embodiments, the method further includes: determining whether the deep learning framework adapted by the device backend meets preset expectations; if not, regenerating the initial framework and integration template of the device backend according to the pre-configuration information.
[0025] In a second aspect, the present application also provides a deep learning framework adaptation device for a device backend, including:
[0026] The pre-configuration module is used to obtain the pre-configuration information of the device backend;
[0027] A configuration management module, used to generate an initial framework and an integrated template of the device backend according to the pre-configuration information;
[0028] A template generation module is used to construct an adaptation code template for the device backend based on the initial framework and the integrated template; and to perform adaptive code configuration on the adaptation code template to obtain a deep learning framework adapted to the device backend.
[0029] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps corresponding to the method described in the first aspect when executing the computer program.
[0030] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps corresponding to the method described in the first aspect above.
[0031] The deep learning framework adaptation method, apparatus and device for the above-mentioned device backend obtains pre-configuration information of the device backend; generates an initial framework and an integration template of the device backend according to the pre-configuration information; constructs an adaptation code template of the device backend based on the initial framework and the integration template; and performs adaptive code configuration on the adaptation code template to obtain a deep learning framework adapted to the device backend, shielding the differences between different frameworks, versions and device types, so that the device can quickly and efficiently complete the deep learning framework adaptation and maintenance, simplifying and standardizing the adaptation process of the deep learning framework and the device backend. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 It is a structural block diagram of a deep learning framework adaptation device at the back end of a device in one embodiment;
[0034] Figure 2 It is a flowchart of a deep learning framework adaptation method of a device backend in one embodiment;
[0035] Figure 3 A schematic diagram of a process for generating an initial framework of the device backend in one embodiment;
[0036] Figure 4 A schematic diagram of a process for generating an integrated template of the device backend in an embodiment;
[0037] Figure 5 A schematic diagram of a process for generating an integrated template of the device backend in another embodiment;
[0038] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0041] Conventional deep learning frameworks mainly include four sub-framework contents: tensor implementation and device access, operator library and implementation, graph computing mode and compiler, and expansion tools. Therefore, when building a deep learning framework adapted to the device backend, it is necessary to build and adapt the framework from the above four aspects.
[0042] In one embodiment, Figure 1 As shown, a deep learning framework adaptation device for a device backend is provided, the device comprising a command line framework 10, a pre-configuration module 11, a configuration management module 12, a template generation module 13 and an installation and maintenance module 14.
[0043] The command line framework 10 serves as a user operation UI interface and uniformly manages the functions of all modules.
[0044] The pre-configuration module 11 is used to obtain pre-configuration information of the device backend.
[0045] The configuration management module 12 is used to generate the initial framework and integration template of the device backend according to the pre-configuration information.
[0046] The template generation module 13 is used to construct an adaptation code template for the device backend based on the initial framework and the integrated template; and to perform adaptive code configuration on the adaptation code template to obtain a deep learning framework adapted to the device backend.
[0047] The installation and maintenance module 14 is used to install and uninstall the content in the deep learning framework, perform code maintenance and debugging, log management, etc. according to user needs or the training results of the deep learning framework. For example, the access / removal of custom operators or operation interfaces, the access / removal of Python modules, and the access / removal of plug-ins or registrations in the deep learning framework.
[0048] Each module in the deep learning framework adapter device at the back end of the above-mentioned device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, for example, in the form of a Python toolkit and stored in the memory of the computer device, so that the processor can call and execute the operations corresponding to each of the above modules.
[0049] In an exemplary embodiment, Figure 2 As shown, a method for adapting a deep learning framework to a device backend is provided, and the method is applied to Figure 1 The deep learning framework adapter device of the device backend in the example is used to illustrate, including the following steps 201 to 204. Among them:
[0050] Step 201, obtaining pre-configuration information of the device backend.
[0051] Specifically, the pre-configuration information includes device parameters of the device backend and a target framework version type of the deep learning framework to be generated.
[0052] The device parameters include device type, device name, device identification enumeration value, device management options, operator list, compilation integration options, extended tool options, etc. Among them, the device type may include GPU devices, accelerator cards, etc. The operator list is all operations / operators supported by the device, including linear algebra, activation functions, convolution, fusion operators, etc. The compilation integration options involve options such as compiler configuration, source code conversion, binary generation, etc. The extended tool options include the selection and configuration of debugging tools, performance analysis and other development auxiliary tools.
[0053] Step 202: Generate an initial framework and an integrated template of the device backend according to the pre-configuration information.
[0054] The initial framework of the device backend includes a hardware code subframe of device-related hardware and a device support operator. The device support operator is used to calculate and call the at least one hardware code subframe. The integrated template of the device backend includes a compiler code template and an expansion tool template.
[0055] Specifically, the configuration management module 12 includes a series of unified device interfaces, through which the device parameters and target framework version type of the device backend are obtained to generate a hardware code sub-framework of the device backend, shielding the differences between different hardware devices so that the upper-level framework does not need to directly process the complex logic related to specific hardware.
[0056] The configuration management module 12 also includes a series of operation operator interfaces, through which the device support operators of the device backend are generated according to the device parameters and target framework version type of the device backend, so that users can call operators by specifying devices, thereby building and training deep learning models without perceiving device differences.
[0057] The configuration management module 12 also includes a graph optimization and compilation integration interface, through which a compiler code template adapted to the device backend is accessed according to device parameters and target framework version type.
[0058] The configuration management module 12 also includes an expansion tool interface, which is aligned with the tool interface of the target framework, encapsulates, converts or replaces the tool interface of the target framework, and generates an expansion tool code template adapted to the device backend to complete the support for the specified device. The tool interface includes performance analysis, test suite, optimizer, framework collaboration, model fine-tuning and security fault recovery.
[0059] Step 203: construct an adaptation code template for the device backend based on the initial framework and the integration template.
[0060] Step 204, adaptively configure the adaptation code template to obtain a deep learning framework adapted to the device backend.
[0061] Specifically, the template generation module 13 constructs the adaptation code template of the device backend according to the initial framework and the integrated template, and determines the compilation environment and compilation execution method of the adaptation code template. The adaptation code template is adaptively configured to generate interface operator code, target framework native code, compiler code and expansion tool code to obtain a deep learning framework adapted to the device backend.
[0062] In the deep learning framework adaptation method of the above-mentioned device backend, the pre-configuration information of the device backend is obtained; according to the pre-configuration information, the initial framework and integration template of the device backend are generated; based on the initial framework and integration template, the adaptation code template of the device backend is constructed; the adaptation code template is adaptively configured to obtain the deep learning framework adapted to the device backend, which shields the differences between different frameworks, versions and device types, enables the device to quickly and efficiently complete the deep learning framework adaptation and maintenance, and simplifies and standardizes the adaptation process of the deep learning framework and the device backend.
[0063] In an exemplary embodiment, Figure 3 As shown, step 202 generates the initial framework of the device backend according to the pre-configuration information, specifically including the following steps 301 to 303. Among them:
[0064] Step 301: Determine at least one hardware management component of the device backend according to the device parameters, and generate at least one hardware code sub-framework adapted to the target framework version type based on the hardware management component.
[0065] The hardware management component includes conventional components and specific components, wherein the conventional components include device management components, stream components, event management components, and memory management components, and the specific components include tensor management components, device software stacks, etc. The hardware code subframework includes a conventional code subframework and a tensor processing code subframework.
[0066] The device interface of the configuration management module 12 includes a general device management interface and a specific device management interface. The device management component, stream component, event management component, and memory management component are abstracted into a general code subframe that is compatible with the target framework version type through the general device management interface. The tensor management component is abstracted into a tensor processing code subframe that is compatible with the target framework version type through the specific device management interface. Among them, the abstraction process of the tensor management component includes but is not limited to the adaptation of functions such as tensor slicing, tensor storage, tensor type, and tensor precision. The tensor type includes but is not limited to the adaptation of standard tensors, sparse tensors, quantized tensors, and nested tensors. The tensor precision includes the adaptation of half-precision, single-precision, double-precision, integer precision, and mixed precision.
[0067] Step 302: register and / or construct a device support operator according to the hardware code sub-framework; the device support operator is used to calculate and call the at least one hardware code sub-framework.
[0068] Specifically, the functions of the operator interface of the configuration management module 12 include the adaptation of the distributed framework and operators, the integration of the native operator library, the custom operator library and the device acceleration library operator library. According to the generated hardware code subframework, register and / or build the device support operator.
[0069] If the hardware code subframework involves distributed computing of the framework, it is necessary to register or build device support operators for adaptation and adjustment of the device backend and integration of the collective communication library. If the required device support operator belongs to the native operator library and is compatible with any device backend, it is registered or stubbed according to the native access method of the native operator in the deep learning framework. If the required device support operator belongs to a custom operator and is incompatible with the device backend, the registration and construction of the custom operator is achieved by adding a new operator, or by building a Python extension module to access the custom operator, or by using an integrated compiler to develop a custom operator. The access method of the device acceleration library operator follows the access method of the native operator library and the custom operator library.
[0070] Among them, adding new operators includes two ways: configuration addition and code addition. Configuration addition is to complete the registration of custom operators by building configuration information and operator implementation process, and code addition is to directly connect custom operators in the operator management subframework in the target framework source code. The way to build a Python extension module to access custom operators is to register the implementation process of the custom operator to the built Python extension module, and associate the Python extension module with the code subframework of the deep learning framework to complete the construction and registration of the custom operator. The way to develop operators using an integrated compiler is to connect custom operators by using graph compilation, such as using PyTorch's JIT compilation mode and Triton operator compilation. The above operator access processes all include the automatic differentiation or explicit differentiation mechanism of the adaptation framework.
[0071] Step 303: assemble the device support operator and the hardware code subframework into a code framework to generate an initial framework of the device backend.
[0072] In this embodiment, the hardware management components of the device are abstracted through the device interface of the configuration management module 12 to shield the differences between different hardware devices. The registration call of the device support operator is implemented through the operation operator interface of the configuration management module 12, so that users can build and train deep learning models without perceiving device differences.
[0073] In one embodiment, if Figure 4 As shown, the integration template includes a compiler code template. Step 202 generates an integration template of the device backend according to the pre-configuration information, which specifically includes the following steps 401 to 402.
[0074] Step 401: determine at least one compiler of the device backend according to the device parameters, and obtain the compiler type and compiler integration method of the compiler.
[0075] Step 402: Generate a compiler code template adapted to the target framework version type according to the compiler type and the compiler integration mode.
[0076] Specifically, according to the device parameters, at least one compiler of the device backend is determined, wherein the compiler types include graph optimization compiler, device operation optimizer, device compiler, etc. Among them, the graph optimization compiler is mainly used in the static graph and operator optimization scenarios of the deep learning framework. The device operation optimizer is used for the operation driving process of a specific device. The main function of the device compiler is to integrate device-specific compilation technology and control the compilation process of the device, thereby supporting device integrated compilation or just-in-time compilation.
[0077] Compiler integration methods include native compiler integration, supported compiler integration, and new compiler integration. For example, the target framework version type of the deep learning framework to be generated is the PyTorch framework. In the PyTorch framework, if the device backend is a CPU device, the native compiler of the PyTorch framework includes the GCC compiler or the Clang compiler; if the device backend is a CUDA device, the native compiler of the PyTorch framework includes the NVIDIA compiler, the torch.compile graph optimization compiler, and the torch.jit just-in-time compiler. According to the compiler type and the compiler integration method, a compiler code template adapted to the target framework version type is generated.
[0078] In this embodiment, a compiler code template adapted to the device backend is generated through device parameters, supporting different types of device backends, which is conducive to the construction and training of artificial intelligence models for different types of device backends.
[0079] In one embodiment, if Figure 5 As shown, the integration template also includes an expansion tool code template. Step 202 generates an integration template for the device backend according to the pre-configuration information, which specifically includes the following steps 501 to 502.
[0080] Step 501: Determine at least one expansion tool of the device backend according to the device parameters.
[0081] Step 502: Acquire the access integration mode of the expansion tool, and generate an expansion tool code template adapted to the target framework version type.
[0082] Specifically, according to the device parameters, at least one expansion tool required for the device backend is determined. The access integration mode of the expansion tool includes native development tool integration, supported development tool integration and new development tool integration. For example, if the target framework version type of the deep learning framework to be generated is the PyTorch framework, if the device is a CambriconPyTorch ProfilerPyTorch device, the native development tool torch.profiler of the PyTorch framework can be used to perform performance analysis on the Cambricon PyTorchProfilerPyTorch device, and the native development tool torch.profiler is encapsulated, converted or replaced to generate a corresponding adapted expansion tool code template. Or the external supported development tool NVIDIA Nsight Systems of the PyTorch framework can also be used to perform performance analysis on the CambriconPyTorch ProfilerPyTorch device, and the supported development tool NVIDIA NsightSystems is encapsulated, converted or replaced to generate a corresponding adapted expansion tool code template.
[0083] In this embodiment, an extension tool code template that matches the target framework version type is generated through device parameters. The extension tool code template is adapted to the device backend, which is conducive to the construction and training of artificial intelligence models on different types of device backends.
[0084] In one of the embodiments, the method further includes: determining whether the deep learning framework adapted by the device backend meets preset expectations; if not, regenerating the initial framework and integration template of the device backend according to the pre-configuration information.
[0085] Specifically, the installation and maintenance module 14 determines whether the deep learning framework adapted to the device backend meets preset expectations based on user needs or code debugging results of the deep learning framework. If not, the configuration management module 12 is controlled to regenerate the initial framework and integration template of the device backend according to the pre-configuration information, or to install and uninstall the sub-framework content in the deep learning framework in real time.
[0086] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0087] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store device backend data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a deep learning framework adaptation method for the back end of the device is implemented.
[0088] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0089] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0090] Get the pre-configuration information of the device backend;
[0091] Generate an initial framework and an integrated template of the device backend according to the pre-configuration information;
[0092] Based on the initial framework and the integration template, construct an adaptation code template for the device backend;
[0093] The adaptation code template is adaptively configured to obtain a deep learning framework adapted to the back end of the device.
[0094] In one embodiment, when the processor executes the computer program, the following steps are also implemented: according to the device parameters, at least one hardware management component of the device backend is determined, and based on the hardware management component, at least one hardware code sub-framework adapted to the target framework version type is generated; according to the hardware code sub-framework, a device support operator is registered and / or constructed; the device support operator is used to calculate and call the at least one hardware code sub-framework; the device support operator and the hardware code sub-framework are assembled into a code framework to generate an initial framework of the device backend.
[0095] In one embodiment, when the processor executes the computer program, the following steps are also implemented: abstracting the device management component, stream component, event management component, and memory management component into a regular code sub-framework adapted to the target framework version type; abstracting the tensor management component into a tensor processing code sub-framework adapted to the target framework version type.
[0096] In one embodiment, when the processor executes the computer program, the following steps are also implemented: according to the device parameters, at least one compiler of the device backend is determined, and the compiler type and compiler integration method of the compiler are obtained; according to the compiler type and the compiler integration method, a compiler code template adapted to the target framework version type is generated.
[0097] In one embodiment, when the processor executes the computer program, the following steps are also implemented: determining at least one expansion tool of the device backend according to the device parameters; obtaining the access integration method of the expansion tool, and generating an expansion tool code template adapted to the target framework version type.
[0098] In one embodiment, when the processor executes the computer program, the following steps are also implemented: according to the initial framework and the integrated template, the interface operator code, the target framework native code, the compiler code and the expansion tool code are adaptively generated to obtain a deep learning framework adapted to the back end of the device.
[0099] In one embodiment, when the processor executes the computer program, the following steps are also implemented: determining whether the deep learning framework adapted by the device backend meets preset expectations; if not, regenerating the initial framework and integration template of the device backend according to the pre-configuration information.
[0100] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps corresponding to the deep learning framework adaptation method of the device backend described in the above embodiments are implemented.
[0101] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps corresponding to the deep learning framework adaptation method of the device backend described in the above embodiments.
[0102] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0103] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0104] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for adapting a deep learning framework of a device backend, characterized in that: The method comprises: Get the pre-configuration information of the device backend; Generate an initial framework and an integration template of the device backend according to the pre-configuration information; wherein the pre-configuration information includes device parameters of the device backend and the target framework version type of the deep learning framework to be generated, including: determining at least one hardware management component of the device backend according to the device parameters, and generating at least one hardware code sub-framework adapted to the target framework version type based on the hardware management component; registering and / or building a device support operator according to the hardware code sub-framework; the device support operator is used to calculate and call the at least one hardware code sub-framework; assembling the device support operator and the hardware code sub-framework into a code framework to generate an initial framework of the device backend; Based on the initial framework and the integration template, construct an adaptation code template for the device backend; The adaptation code template is adaptively configured to obtain a deep learning framework adapted to the back end of the device.
2. The deep learning framework adaptation method of the device backend according to claim 1, characterized in that: The hardware management component includes a conventional component and a specific component, wherein the conventional component includes a device management component, a stream component, an event management component, and a memory management component, and the specific component includes a tensor management component; the hardware code subframework includes a conventional code subframework and a tensor processing code subframework; and the generating of at least one hardware code subframework adapted to the target framework version type based on the hardware management component includes: Abstracting the device management component, stream component, event management component, and memory management component into a conventional code subframework adapted to the target framework version type; The tensor management component is abstracted into a tensor processing code subframework adapted to the target framework version type.
3. The deep learning framework adaptation method of the device backend according to claim 1, characterized in that: The integration template includes a compiler code template, and generating the integration template of the device backend according to the pre-configuration information includes: Determine at least one compiler of the device backend according to the device parameters, and obtain a compiler type and a compiler integration method of the compiler; A compiler code template adapted to the target framework version type is generated according to the compiler type and the compiler integration mode.
4. The deep learning framework adaptation method of the device backend according to claim 3, characterized in that: The integration template also includes an expansion tool code template, and the generation of the integration template of the device backend according to the pre-configuration information also includes: Determine at least one expansion tool of the backend of the device according to the device parameters; The access integration mode of the expansion tool is obtained, and an expansion tool code template adapted to the target framework version type is generated.
5. The deep learning framework adaptation method of the device backend according to claim 4, characterized in that: The adaptive code configuration of the adaptation code template comprises: According to the initial framework and the integrated template, interface operator code, target framework native code, compiler code and expansion tool code are adaptively generated to obtain a deep learning framework adapted to the device backend.
6. The deep learning framework adaptation method of the device backend according to claim 1, characterized in that: The method further comprises: Determine whether the deep learning framework adapted by the device backend meets the preset expectations. If not, regenerate the initial framework and integration template of the device backend according to the pre-configuration information.
7. A deep learning framework adapter device for a device backend, characterized in that: The device comprises: The pre-configuration module is used to obtain the pre-configuration information of the device backend; A configuration management module, used to generate an initial framework and an integrated template of the device backend according to the pre-configuration information; wherein the pre-configuration information includes device parameters of the device backend and a target framework version type of a deep learning framework to be generated, including: determining at least one hardware management component of the device backend according to the device parameters, and generating at least one hardware code sub-framework adapted to the target framework version type based on the hardware management component; registering and / or constructing a device support operator according to the hardware code sub-framework; the device support operator is used to calculate and call the at least one hardware code sub-framework; assembling the device support operator and the hardware code sub-framework into a code framework to generate an initial framework of the device backend; The template generation module is used to construct an adaptation code template for the device backend based on the initial framework and the integrated template; and to perform adaptive code configuration on the adaptation code template to obtain a deep learning framework adapted to the device backend.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method, device, and computer program product for generating program code
US11106434B1
Operator development method and apparatus, operator processing method and apparatus, and electronic device, system and storage medium
WO2024001594A1