Deep learning framework adaptation method, apparatus, and storage medium

By processing the deep learning framework and plugins, the compatibility issue between the deep learning framework and the MUSA software stack was resolved, accelerating model training and inference, and improving compatibility and user experience.

CN120560742BActive Publication Date: 2026-04-28MOORE THREADS TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MOORE THREADS TECH CO LTD
Filing Date
2025-05-21
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Current deep learning frameworks such as PyTorch have a rapid version iteration and update speed, making them unable to be directly adapted to some software stacks, such as Moore's Threads' MUSA software stack. This results in models under deep learning frameworks being unable to utilize the software stack and underlying hardware devices to accelerate model training and inference.

Method used

By processing the target deep learning framework and the plugins associated with the initial deep learning framework, including adding, modifying, and deleting patches, modifying interface types, determining the library versions that meet the conditions, building a compatibility verification environment, compiling and running the code on the software stack, and resolving compilation and runtime errors, the adaptation of the deep learning framework is achieved.

Benefits of technology

It improves the compatibility between deep learning frameworks and software stacks, enabling models under the target deep learning framework to accelerate inference and training by utilizing the software stack and underlying hardware devices, thereby enhancing the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120560742B_ABST
    Figure CN120560742B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a deep learning framework adaptation method and device, and a storage medium. The method comprises: processing a target deep learning framework to obtain a processed target deep learning framework, the running environment of the target deep learning framework being determined in a software stack; processing an initial plug-in associated with an initial deep learning framework to obtain a target plug-in associated with the target deep learning framework; and based on the processed target deep learning framework and the target plug-in, compiling and running code corresponding to the target deep learning framework on the software stack to adapt the target deep learning framework to the software stack. According to the embodiments of the present disclosure, the obtained target deep learning framework can be better adapted to the software stack, the compatibility of the deep learning framework and the software stack is improved, and the model under the target deep learning framework can utilize the capabilities of the software stack and the underlying hardware devices to accelerate the inference and training processes, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a method, apparatus and storage medium for adapting to a deep learning framework. Background Technology

[0002] Deep learning frameworks (such as PyTorch) are currently the mainstream artificial intelligence (AI) frameworks in the industry, primarily used for developing AI models, while also enabling rapid model training and inference. Especially in recent years, large-scale models have sparked a trend in the field of artificial intelligence, and deep learning models have become the mainstream choice due to their powerful functionality, ease of use, high scalability, and ease of debugging.

[0003] Currently, deep learning frameworks such as PyTorch are updated very quickly and cannot be directly adapted to some software stacks (such as Moore Threads' MUSA software stack). This results in models under deep learning frameworks being unable to utilize the software stack and underlying hardware devices for accelerated model training and inference. Therefore, a new deep learning framework adaptation solution is urgently needed to enable deep learning frameworks to adapt to software stacks. Summary of the Invention

[0004] In view of this, this disclosure proposes a method, apparatus and storage medium for adapting deep learning frameworks.

[0005] According to one aspect of this disclosure, a method for adapting to deep learning frameworks is provided. The method includes:

[0006] The target deep learning framework is processed to obtain the processed target deep learning framework. The runtime environment of the target deep learning framework is determined in the software stack.

[0007] The initial plugin associated with the initial deep learning framework is processed to obtain the target plugin associated with the target deep learning framework.

[0008] Based on the processed target deep learning framework and target plugins, the code corresponding to the target deep learning framework is compiled and run on the software stack, making the target deep learning framework compatible with the software stack.

[0009] In one possible implementation, the initial deep learning framework is a deep learning framework in an initial version, the target deep learning framework is a deep learning framework in a target version, and the initial plugin associated with the initial deep learning framework is processed to obtain the target plugin associated with the target deep learning framework, including:

[0010] The initial plugin is processed based on different types of patches to obtain the target plugin. These different types of patches include any one or more of the following: patches for implementing functions already supported in the target version of the deep learning framework, patches for adapting the software stack, and patches for handling incompatibility issues between the target version and the initial version of the deep learning framework.

[0011] In one possible implementation, the initial plugin is processed based on different types of patches to obtain the target plugin, including:

[0012] Remove the first object from the initial plugin. The first object represents a patch used to implement the functionality already supported in the target version of the deep learning framework.

[0013] A second object is added to the initial plugin; the second object represents a patch used to adapt to the software stack.

[0014] Modify the third object in the initial plugin. The third object represents a patch used to address incompatibility issues between the target version and the initial version of the deep learning framework.

[0015] In one possible implementation, the target deep learning framework is processed to obtain a processed target deep learning framework, including:

[0016] The interface of the preset type in the target deep learning framework is modified to be compatible with the target type of the software stack, resulting in the processed target deep learning framework.

[0017] In one possible implementation, the method further includes:

[0018] Identify the libraries and their versions that meet the preset conditions within the software stack;

[0019] For each library and its version, determine the text file used to configure the runtime environment;

[0020] The runtime environment is built based on text files to verify the compatibility between different versions of the library.

[0021] To ensure compatibility between different versions of the library, determine the runtime environment that supports the target deep learning framework.

[0022] In one possible implementation, the preset conditions include:

[0023] The version corresponding to each library is the version before the preset time point;

[0024] The version corresponding to each library is the version closest to the preset time point;

[0025] Each version of the library undergoes continuous integration testing.

[0026] In one possible implementation, the code corresponding to the target deep learning framework is compiled and run on the software stack, adapting the target deep learning framework to the software stack, including:

[0027] In cases where errors occur during compilation and / or runtime of code on the software stack, resolve compilation and / or runtime errors to adapt the target deep learning framework to the software stack.

[0028] One possible implementation involves resolving compile-time errors, including:

[0029] Determine the cause of the compilation error;

[0030] Based on the cause of the error, determine the solution to the compilation error;

[0031] The reasons for compilation errors include one or more of the following:

[0032] Changes to the compilation environment of the deep learning framework under the target version, incorrect header file imports, code generation errors related to operators of preset types, and function interfaces in the code corresponding to the deep learning framework of the target version not being compatible with the software stack.

[0033] In one possible implementation, the solution to the compile-time error is determined based on the cause of the error, including:

[0034] If the compilation environment of the deep learning framework changes under the target version, specify the compilation options and import the corresponding header files;

[0035] If the header file is imported incorrectly, import the correct header file path in the corresponding header file location in the code of the deep learning framework under the target version;

[0036] In the event of a code generation error related to an operator of a preset type, modify the registration method of the relevant operator;

[0037] If the function interfaces in the code corresponding to the target version of the deep learning framework are not compatible with the software stack, the code that calls the corresponding functions should be adjusted or a new function implementation should be added to the code.

[0038] In one possible implementation, runtime issues include runtime logic errors, and resolving runtime errors includes:

[0039] Identify runtime logic errors and their locations in the code;

[0040] Add logs to the call chain of the module where the location is located to check the runtime state and variable values;

[0041] Solutions for determining runtime logic errors based on runtime state and variable values.

[0042] In one possible implementation, runtime issues also include issues in unit tests, which include any one or more of the following: unimplemented interface, abnormal operator precision, and abnormal operator execution.

[0043] According to another aspect of this disclosure, a deep learning framework adaptation device is provided. The device includes:

[0044] The first processing module is used to process the target deep learning framework to obtain the processed target deep learning framework. The running environment of the target deep learning framework is determined in the software stack.

[0045] The second processing module is used to process the initial plugin associated with the initial deep learning framework to obtain the target plugin associated with the target deep learning framework.

[0046] The compilation and execution module is used to compile and run the code corresponding to the target deep learning framework on the software stack based on the processed target deep learning framework and target plugins, so that the target deep learning framework is adapted to the software stack.

[0047] In one possible implementation, the initial deep learning framework is a deep learning framework under an initial version, the target deep learning framework is a deep learning framework under a target version, and the second processing module is used for:

[0048] The initial plugin is processed based on different types of patches to obtain the target plugin. These different types of patches include any one or more of the following: patches for implementing functions already supported in the target version of the deep learning framework, patches for adapting the software stack, and patches for handling incompatibility issues between the target version and the initial version of the deep learning framework.

[0049] In one possible implementation, the initial plugin is processed based on different types of patches to obtain the target plugin, including:

[0050] Remove the first object from the initial plugin. The first object represents a patch used to implement the functionality already supported in the target version of the deep learning framework.

[0051] A second object is added to the initial plugin; the second object represents a patch used to adapt to the software stack.

[0052] Modify the third object in the initial plugin. The third object represents a patch used to address incompatibility issues between the target version and the initial version of the deep learning framework.

[0053] In one possible implementation, the first processing module is used for:

[0054] The interface of the preset type in the target deep learning framework is modified to be compatible with the target type of the software stack, resulting in the processed target deep learning framework.

[0055] In one possible implementation, the device further includes:

[0056] The first determination module is used to determine the libraries and their versions that meet preset conditions in the software stack.

[0057] The second determination module is used to determine the text file used to configure the runtime environment for the library and its version.

[0058] The verification module is used to build a runtime environment based on text files and verify the compatibility between different versions of the library.

[0059] The third determination module is used to determine the runtime environment that supports the target deep learning framework in response to compatibility issues between different versions of the library.

[0060] In one possible implementation, the preset conditions include:

[0061] The version corresponding to each library is the version before the preset time point;

[0062] The version corresponding to each library is the version closest to the preset time point;

[0063] Each version of the library undergoes continuous integration testing.

[0064] In one possible implementation, the code corresponding to the target deep learning framework is compiled and run on the software stack, adapting the target deep learning framework to the software stack, including:

[0065] In cases where errors occur during compilation and / or runtime of code on the software stack, resolve compilation and / or runtime errors to adapt the target deep learning framework to the software stack.

[0066] One possible implementation involves resolving compile-time errors, including:

[0067] Determine the cause of the compilation error;

[0068] Based on the cause of the error, determine the solution to the compilation error;

[0069] The reasons for compilation errors include one or more of the following:

[0070] Changes to the compilation environment of the deep learning framework under the target version, incorrect header file imports, code generation errors related to operators of preset types, and function interfaces in the code corresponding to the deep learning framework of the target version not being compatible with the software stack.

[0071] In one possible implementation, the solution to the compile-time error is determined based on the cause of the error, including:

[0072] If the compilation environment of the deep learning framework changes under the target version, specify the compilation options and import the corresponding header files;

[0073] If the header file is imported incorrectly, import the correct header file path in the corresponding header file location in the code of the deep learning framework under the target version;

[0074] In the event of a code generation error related to an operator of a preset type, modify the registration method of the relevant operator;

[0075] If the function interfaces in the code corresponding to the target version of the deep learning framework are not compatible with the software stack, the code that calls the corresponding functions should be adjusted or a new function implementation should be added to the code.

[0076] In one possible implementation, runtime issues include runtime logic errors, and resolving runtime errors includes:

[0077] Identify runtime logic errors and their locations in the code;

[0078] Add logs to the call chain of the module where the location is located to check the runtime state and variable values;

[0079] Solutions for determining runtime logic errors based on runtime state and variable values.

[0080] In one possible implementation, runtime issues also include issues in unit tests, which include any one or more of the following: unimplemented interface, abnormal operator precision, and abnormal operator execution.

[0081] According to another aspect of this disclosure, a deep learning framework adaptation apparatus is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the above method when executing instructions stored in the memory.

[0082] According to another aspect of this disclosure, a non-volatile computer-readable storage medium is provided that stores computer program instructions thereon, wherein the computer program instructions, when executed by a processor, implement the above-described method.

[0083] According to another aspect of this disclosure, a computer program product is provided, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device performs the above-described method.

[0084] According to the embodiments of this application, by processing the target deep learning framework and the initial plugin associated with the initial deep learning framework, wherein the runtime environment of the target deep learning framework is determined in the software stack, the plugin can be updated to adapt to the target deep learning framework, and the resulting target deep learning framework can be better adapted to the software stack. By compiling and running the code corresponding to the target deep learning framework on the software stack based on the processed target deep learning framework and target plugin, the target deep learning framework can be adapted to the software stack, which can improve the compatibility between the deep learning framework and the software stack, and enable the model under the target deep learning framework to accelerate the inference and training process by utilizing the capabilities of the software stack and the underlying hardware devices, thereby improving the user experience.

[0085] Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0086] The accompanying drawings, which are included in and form part of this specification, illustrate exemplary embodiments, features, and aspects of this disclosure together with the specification and serve to explain the principles of this disclosure.

[0087] Figure 1 A schematic diagram illustrating an application scenario according to an embodiment of this application is shown.

[0088] Figure 2 A flowchart illustrating a deep learning framework adaptation method according to an embodiment of this application is shown.

[0089] Figure 3 A flowchart illustrating a deep learning framework adaptation method according to an embodiment of this application is shown.

[0090] Figure 4 This diagram illustrates the effect of an end-to-end test according to an embodiment of the present application.

[0091] Figure 5 A structural diagram of a deep learning framework adapter according to an embodiment of this application is shown.

[0092] Figure 6 This is a block diagram illustrating an apparatus 1900 for adapting a deep learning framework according to an exemplary embodiment. Detailed Implementation

[0093] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.

[0094] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0095] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.

[0096] Deep learning frameworks (such as PyTorch) are currently the mainstream artificial intelligence (AI) frameworks in the industry, primarily used for AI model development, and also enabling rapid model training and inference. Especially in recent years, large-scale models have sparked a trend in the AI ​​field, and deep learning models have become the mainstream choice due to their powerful functionality, ease of use, high scalability, and ease of debugging. However, the rapid version iteration and updates of deep learning frameworks like PyTorch make them incompatible with some software stacks (such as Moore's Threads' MUSA software stack). This prevents models under deep learning frameworks from leveraging the software stack and underlying hardware for accelerated model training and inference. Therefore, a new deep learning framework adaptation solution is urgently needed to achieve compatibility between deep learning frameworks and software stacks.

[0097] In view of this, this application provides a method, apparatus, and storage medium for adapting a deep learning framework. The method of this application processes a target deep learning framework and an initial plugin associated with it. The runtime environment of the target deep learning framework is determined within the software stack. This allows for updating the plugins to adapt to the target deep learning framework, resulting in a better fit between the target deep learning framework and the software stack. By compiling and running the code corresponding to the target deep learning framework on the software stack based on the processed target deep learning framework and target plugins, the target deep learning framework is adapted to the software stack. This improves the compatibility between the deep learning framework and the software stack, enabling models under the target deep learning framework to leverage the capabilities of the software stack and underlying hardware to accelerate inference and training processes, thereby enhancing the user experience.

[0098] Figure 1This illustration shows an application scenario according to an embodiment of this application. This application can be used in scenarios where a deep learning framework (such as the PyTorch framework) is adapted to Moore Threads' MUSA software stack. The MUSA software stack can provide various software tools and application development frameworks, supporting full-process acceleration of AI model training and inference. The underlying hardware device of the MUSA software stack can be a graphics processing unit (GPU), etc. To enable the PyTorch framework to adapt to the MUSA software stack, this application provides a plugin (torch_musa). The plugin can be developed based on a specific version of the PyTorch framework (i.e., the initial deep learning framework, such as version v2.0.0 of the PyTorch framework), and is used as an application to run in the software stack through the software stack's interface API, enabling version v2.0.0 of the PyTorch framework to run in the MUSA software stack.

[0099] like Figure 1 As shown, in the application scenario of this application embodiment, since the PyTorch framework is constantly iterating and updating, many new features are added, performance is improved, and problems are fixed with each iteration. Since torch_musa is usually developed based on a fixed version of the PyTorch framework, it is necessary to periodically upgrade the PyTorch framework version and make torch_musa re-adapt to the new version of the PyTorch framework. When the PyTorch framework version is updated, the method of this application embodiment can be used to process the plugin and the updated PyTorch framework (i.e., the target deep learning framework, such as PyTorch version v2.2.0), so that PyTorch version v2.2.0 can continue to be used with the MUSA software stack.

[0100] After adapting the MUSA software stack to the PyTorch framework version 2.2.0, training or inference tasks can be performed on deep learning models under the PyTorch framework version 2.2.0 within the MUSA software stack to accelerate task execution.

[0101] The methods described in this application can be used in terminal devices or servers. The terminal device can be any one or more of the following: mobile phone, foldable electronic device, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cellular phone, personal digital assistant (PDA), and in-vehicle device. This disclosure does not impose any special limitations on the specific type of terminal device; it can have wired or wireless communication capabilities.

[0102] Servers can be located locally or in the cloud, and can be physical devices or virtual devices such as virtual machines and containers. They possess wireless communication capabilities, which can be configured within the server's chip (system) or other components. Wireless communication capabilities can be implemented through mobile communication technologies such as 2G / 3G / 4G / 5G, as well as Wi-Fi, Bluetooth, frequency modulation (FM), data radio, and satellite communication. Wired connections can also be used to communicate and interact with other devices.

[0103] Figure 2 A flowchart illustrating a deep learning framework adaptation method according to an embodiment of this application is provided. This method can be used in the aforementioned terminal device or server, such as... Figure 2 As shown, the method may include:

[0104] Step S201: Process the target deep learning framework to obtain the processed target deep learning framework.

[0105] The runtime environment of the target deep learning framework can be determined within the software stack, which in this application's scenario is, for example, the MUSA software stack mentioned above. The deep learning framework can be, for example, PyTorch, TensorFlow, or Keras, and the target deep learning framework is the deep learning framework of the target version, which in this application's scenario is, for example, PyTorch version 2.2.0.

[0106] The runtime environment can be the software and hardware environment required to support the normal compilation of the deep learning framework in the software stack.

[0107] The method may include:

[0108] Identify the libraries and their versions that meet the preset conditions within the software stack;

[0109] For each library and its version, determine the text file used to configure the runtime environment;

[0110] The runtime environment is built based on text files to verify the compatibility between different versions of the library.

[0111] To ensure compatibility between different versions of the library, determine the runtime environment that supports the target deep learning framework.

[0112] In a software stack, a library is a pre-written collection of code that provides a specific set of functions or services that can be reused by multiple programs or applications. Libraries may include DDK (Device Driver Development Kit, including packaged kernel-mode drivers KMD and user-mode drivers UMD), musa_toolkit (a toolkit for supporting the MUSA software stack), muDNN (a deep learning library in the MUSA software stack), torch_musa (a plugin associated with deep learning frameworks such as PyTorch), mccl (a collection communication library in the MUSA software stack), muSparse (a library in the MUSA software stack for optimizing sparse matrix operations), and muRand (a random number generation library in the MUSA software stack), among others.

[0113] Since different versions of libraries may be incompatible, the first step is to determine the version of each library and verify the compatibility between the versions to determine the runtime environment.

[0114] The preset conditions may include:

[0115] The version corresponding to each library is the version before the preset time point;

[0116] The version corresponding to each library is the version closest to the preset time point;

[0117] Each version of the library undergoes continuous integration testing.

[0118] Continuous integration testing, or CI testing, involves automating the execution of tests during the software development process to ensure code quality and stability.

[0119] After obtaining libraries of various versions (commit IDs) that meet the aforementioned preset conditions, a text file (Dockerfile) can be written based on each version of the library. This text file can include configuration content related to the runtime environment, referencing the aforementioned versions of the library as the configuration environment. To verify the compatibility between the different library versions, a runtime environment can be built based on the Dockerfile. The code corresponding to the commit ID of each library (i.e., the code corresponding to each version of the library) and the code of the initial deep learning framework (i.e., the initial version of the deep learning framework, such as PyTorch version 2.0.0) are compiled in this runtime environment. Unit test code in `torch_musa` is then run for unit testing. If the unit tests pass, preset deep learning models (which can be typical models) can be run for end-to-end testing. If the end-to-end tests pass, the different library versions can be considered compatible. Therefore, the built runtime environment can be considered to meet the subsequent upgrade conditions. Subsequent steps can ensure that updated versions of the PyTorch framework (PyTorch versions higher than v2.0.0) can continue to be used with the MUSA software stack.

[0120] The initial deep learning framework can be an initial version of the deep learning framework, such as PyTorch version 2.0.0.

[0121] Because the target deep learning framework contains a large amount of CUDA-related code, this code cannot be run directly on the MUSA software stack and the underlying GPU of MUSA. However, since the MUSA software stack is compatible with the CUDA software stack, the CUDA-related code can be ported, and the relevant CUDA interfaces can be modified to the MUSA interface to achieve compatibility and operation.

[0122] During the processing of the target deep learning framework, the interfaces of the preset types in the target deep learning framework can be modified to adapt to the target type of the software stack, thus obtaining the processed target deep learning framework.

[0123] The default type of interface can be a CUDA interface, and the target type of interface can be a MUSA interface.

[0124] For example, the names of CUDA interfaces in the corresponding code (such as C / C++) of the target deep learning framework can be replaced with text using preset plugins in the MUSA software stack (such as the musify tool) to map them to the names of MUSA interfaces, thereby achieving code portability.

[0125] For CUDA interfaces contained in the Python code of the target deep learning framework, other text matching patterns can be used to replace their names with the names of MUSA interfaces.

[0126] For modules unique to the MUSA software stack, or modules in the MUSA software stack whose implementation differs significantly from CUDA due to differences in hardware and software, the code for these modules can be written separately to achieve the corresponding functions. The interface name, except for the CUDA prefix, should be consistent with the name of the corresponding MUSA interface, and these newly implemented modules should be imported into the corresponding position in the target deep learning framework.

[0127] Step S202: Process the initial plugin associated with the initial deep learning framework to obtain the target plugin associated with the target deep learning framework.

[0128] The initial plugin associated with the initial deep learning framework can be a torch_musa plugin that includes patches adapted to the initial deep learning framework.

[0129] Since the PyTorch framework can undergo numerous changes between different versions, the patches originally generated in the torch_musa plugin to adapt to the initial v2.0.0 version of the PyTorch framework may generate a large number of errors if directly applied to the target v2.2.0 version of the PyTorch framework using `git apply`. To make the patches compatible with the target v2.2.0 version of the PyTorch framework, the patches in the initial torch_musa plugin can be modified to obtain the target torch_musa plugin.

[0130] In S202, it is possible to:

[0131] The initial plugin is processed based on different types of patches to obtain the target plugin.

[0132] The different types of patches include any one or more of the following: patches for implementing functions already supported in the target version of the deep learning framework, patches for adapting the software stack, and patches for handling incompatibility issues between the target version and the initial version of the deep learning framework.

[0133] The processing of patches in the initial plugin can include adding, modifying, or deleting them, and different processing methods can be used based on different types of patches.

[0134] See Figure 3 The diagram illustrates a flowchart of a deep learning framework adaptation method according to an embodiment of this application. Figure 3As shown, the initial plugin is processed based on different types of patches to obtain the target plugin, which may include:

[0135] Step S301: Remove the first object from the initial plugin.

[0136] The first object can represent a patch corresponding to the functionality already supported in the deep learning framework used to implement the target version.

[0137] Due to development needs, the initial plugin may introduce features that are not yet supported by the initial version of the deep learning framework (such as new operators, bug fixes, and support for third-party acceleration backends). These features are generally implemented through patches in the initial plugin, while the target version of the deep learning framework may already support these features. For example, the target version of the deep learning framework may introduce operators, fix bugs, and support third-party acceleration backends through PrivateUse1 as a keyword.

[0138] Therefore, when adapting to the target version of a deep learning framework, the patches corresponding to these functions can be directly deprecated, and the corresponding functions provided in the target version of the deep learning framework can be used directly.

[0139] Step S302: Add a second object to the initial plugin.

[0140] The second object can represent a patch used to adapt the software stack. This patch can be used to adapt the software stack backend (such as the operating system, drivers, etc.). Since the CUDA (Compute Unified Device Architecture) backend supported by the PyTorch framework may have interfaces that are not supported by the MUSA backend or whose logic is inconsistent with the MUSA backend, adding a patch to adapt the software stack can modify the CUDA backend supported by the PyTorch framework to an interface compatible with the MUSA backend.

[0141] Step S303: Modify the third object in the initial plugin.

[0142] The third object can represent a patch used to address incompatibility issues between the target and initial versions of the deep learning framework.

[0143] Because the target version of the deep learning framework may have new dependencies compared to the initial version, the build environment may also change. For example, PyTorch version 2.2.0 requires compilation using C++17, and backpropagation or gradients for complex numbers are no longer supported compared to version 2.0.0. The incompatibility issues between the target and initial versions of the deep learning framework can be addressed by modifying the relevant parts of the patch in the initial plugin that handles these incompatibilities. This ensures that when the target plugin is applied to the software stack, the software stack supports the target version of the deep learning framework.

[0144] After processing the plugins and modifying the code of the target deep learning framework, the code corresponding to the target deep learning framework can be compiled and run on the software stack.

[0145] Step S203: Based on the processed target deep learning framework and target plugin, compile and run the code corresponding to the target deep learning framework on the software stack to adapt the target deep learning framework to the software stack.

[0146] The code corresponding to the target deep learning framework can be the code of PyTorch framework version 2.2.0.

[0147] According to the embodiments of this application, by processing the target deep learning framework and the initial plugin associated with the initial deep learning framework, wherein the runtime environment of the target deep learning framework is determined in the software stack, the plugin can be updated to adapt to the target deep learning framework, and the resulting target deep learning framework can be better adapted to the software stack. By compiling and running the code corresponding to the target deep learning framework on the software stack based on the processed target deep learning framework and target plugin, the target deep learning framework can be adapted to the software stack, which can improve the compatibility between the deep learning framework and the software stack, and enable the model under the target deep learning framework to accelerate the inference and training process by utilizing the capabilities of the software stack and the underlying hardware devices, thereby improving the user experience.

[0148] When compiling and running the code corresponding to the target deep learning framework on the software stack, compilation errors and / or runtime errors may occur. If compilation errors and / or runtime errors occur, the code of the target deep learning framework can be adjusted so that the target deep learning framework can be successfully compiled and run on the software stack and the GPU at the bottom of the software stack, that is, adapted to the software stack.

[0149] In the process of compiling and running the code corresponding to the target deep learning framework on the software stack, making the target deep learning framework compatible with the software stack, the following can be achieved:

[0150] In cases where errors occur during compilation and / or runtime of code on the software stack, resolve compilation and / or runtime errors to adapt the target deep learning framework to the software stack.

[0151] Resolving compile-time errors can include:

[0152] Determine the cause of the compilation error;

[0153] Based on the cause of the error, determine the solution to the compilation error;

[0154] The reasons for compilation errors can include one or more of the following:

[0155] Changes to the compilation environment of the deep learning framework under the target version, incorrect header file imports, code generation errors related to operators of preset types, and function interfaces in the code corresponding to the deep learning framework of the target version not being compatible with the software stack.

[0156] Different error messages can correspond to different solutions. In determining the solution to a compilation error based on its cause, you can:

[0157] If the compilation environment of the deep learning framework changes under the target version, specify the compilation options and import the corresponding header files;

[0158] Changes to the compilation environment of the target deep learning framework, such as PyTorch version 2.2.0 requiring compilation with C++17, can be addressed by specifying C++17 as a compilation option in CMakeLists during the compilation process. Additionally, the file c10 / util / C++17.h can be imported into the PyTorch code; this file provides some custom interfaces to adapt to C++17. This should resolve compilation errors in such cases.

[0159] If the header file is imported incorrectly, import the correct header file path in the corresponding header file location in the code of the deep learning framework under the target version;

[0160] Compilation errors due to incorrect header file imports may occur because the target version of the deep learning framework has refactored some code, potentially leading to incorrect header file import paths in earlier versions of the framework. To resolve this, you can import the correct header file paths in the appropriate header file locations within the target version's code. For example, in PyTorch version 2.2.0, the path to `torchgen / utils.py` has been changed to `torchgen / yaml_utils.py`. To import this file, you can import `torchgen.yaml_utils` in the PyTorch code of version 2.2.0.

[0161] For some code in PyTorch version 2.2.0 that has undergone logic changes, the compilation problem caused by incorrect header file imports can be resolved by importing new header files.

[0162] In PyTorch version 2.0.0, the header file for all operators might be included via Function.h. This meant that Function.h was simply imported when the operator header file was needed. However, this file was removed in PyTorch version 2.2.0. Therefore, if compilation issues arise due to incorrect header file imports, such as missing functions for operators, the header file corresponding to the specific operator should be imported separately to resolve the problem.

[0163] In the event of a code generation error related to an operator of a preset type, modify the registration method of the relevant operator;

[0164] Code generation errors related to operators of preset types may mean that the PyTorch framework can automatically generate C++ code for operators based on configuration files, but due to version updates of the PyTorch framework, operators adapted to the MUSA software stack in the initial version of PyTorch may generate abnormally in the target version of PyTorch.

[0165] For example, the third-party GPUs at the bottom layer of the MUSA software stack generally use the keyword PrivateUse1 as the acceleration backend. However, in the PyTorch code of version 2.2.0, the torchgen.model module checks the acceleration backends supported by dispatch_keys when generating operators through the native_functions.yaml configuration file. But dispatch_keys does not contain the keyword PrivateUse1, which may cause a compilation error. So this problem can be solved by adding the keyword PrivateUse1 to dispatch_keys.

[0166] For example, during compilation, you might encounter an issue where the code for the function `_scaled_dot_product_attention_math_musa` cannot be generated. This function is used on the MUSA software stack to implement the self-attention mechanism (FlashAttention). This problem arises because it includes a dropout operator, which contains a randomization module. When the random seeds are inconsistent, the generated operators will produce inconsistent outputs under the same input, thus being considered as having an operator implementation error. To resolve this issue, a predefined label (such as `nondeterministic_seeded`) can be added to the registered dropout operator.

[0167] If the function interfaces in the code corresponding to the target version of the deep learning framework are not compatible with the software stack, the code that calls the corresponding functions should be adjusted or a new function implementation should be added to the code.

[0168] Although the CUDA interface in the target deep learning framework has been modified in step S201 above, there may still be incompatible function interfaces in the code. This may lead to compile-time issues where the function interfaces in the code corresponding to the target version of the deep learning framework are not compatible with the software stack.

[0169] For example, this could include changes to the interface signatures (and the names and parameter names of the interface functions) of some function interfaces due to PyTorch framework version updates. For instance, the interface signature of the `_fused_sdp_choice_stub` function in PyTorch framework code version 2.0.0 is "using fused_sdp_choice_fn=int64_t(*)(constTensor&query_,const Tensor&key_,const Tensor&value_,const c10::optional <tensor>&attn_mask_, double dropout_p, bool is_causal);”, while in the PyTorch framework code of version 2.2.0, the interface signature is changed to "using fused_sdp_choice_fn=int64_t(*)(const Tensor&query_,const Tensor&key_,const Tensor&value_,const c10::optional <tensor>&attn_mask_,doubledropout_p,bool is_causal,c10::optional <double>The function `scale` has been updated to include a parameter in version 2.0.0. To resolve compile-time errors caused by changes in the interface signature, users can pass the `scale` parameter when calling the function in the PyTorch framework code in version 2.2.0.

[0170] For example, the PyTorch framework code in version 2.2.0 might call a newly introduced function, but the software stack doesn't have an implementation of that function or the function is deprecated. To solve the compile-time problem caused by this, you can add the implementation of the newly introduced function to the corresponding module in the code.

[0171] The above process can successfully compile the target version of the deep learning framework code and the target plugin on the software stack, but errors may still occur during runtime.

[0172] Runtime issues can include runtime logic errors. In resolving runtime errors, one can:

[0173] Identify runtime logic errors and their locations in the code;

[0174] Add logs to the call chain of the module where the location is located to check the runtime state and variable values;

[0175] Solutions for determining runtime logic errors based on runtime state and variable values.

[0176] Runtime logic errors, such as incorrect variable values, algorithms not executing as expected, or incorrect conditional statements, can be located in the code by analyzing error messages and using a debugger. For example, analyzing the error message might reveal that a function interface in the corresponding module is not implemented; implementing that function interface in that module will resolve the runtime logic error. Similarly, after identifying the module containing the runtime logic error through error message analysis, log analysis might indicate that the error stems from an incorrectly configured custom collection communication backend; configuring the custom collection communication backend in the code of that module (e.g., adding "musa") will resolve the runtime logic error.

[0177] The aforementioned runtime issues may also include issues in unit tests, which may include any one or more of the following: unimplemented interfaces, abnormal operator precision, and abnormal operator operation.

[0178] For example, unit tests can be performed on the PyTorch framework code and the target plugin torch_musa to test for issues under boundary conditions. Addressing these issues in the unit tests will ensure that the PyTorch framework code and the target plugin torch_musa run successfully on the MUSA software stack.

[0179] We can also use typical models from different AI fields to perform end-to-end testing on the software stack. For example, a typical model in the AI ​​field is a deep learning model under the target deep learning framework. By running the deep learning model on the software stack, we can verify whether running it on a software stack adapted to the target version of the deep learning framework will cause a loss of functionality and performance.

[0180] See Figure 4 This diagram illustrates the effect of an end-to-end test according to an embodiment of this application. Figure 4 As shown, this application performed distributed pre-training of the LLAMA2 model under the Megatron-DeepSpeed ​​framework on a software stack adapted to the target deep learning framework to test the effect of the adapted software stack. The data for TFLOPs, representing floating-point operation speed, and other metrics all performed normally. Figure 4 The `ad` section shows the loss function curves for different step lengths (1554, 54600, 223,641,600 and 6,873,040,044 respectively). It can be seen that the model can converge normally when performing distributed pre-training in the software stack. This verifies that the functionality and performance of the software stack adapted to the target version of the deep learning framework are not compromised. Furthermore, the model training and inference acceleration brought by the target version of the deep learning framework can be used on the software stack, improving the user experience.

[0181] Figure 5 A structural diagram of a deep learning framework adapter according to an embodiment of this application is shown. Figure 5 As shown, the device may include:

[0182] The first processing module 501 is used to process the target deep learning framework to obtain the processed target deep learning framework. The running environment of the target deep learning framework is determined in the software stack.

[0183] The second processing module 502 is used to process the initial plugin associated with the initial deep learning framework to obtain the target plugin associated with the target deep learning framework.

[0184] The compilation and execution module 503 is used to compile and run the code corresponding to the target deep learning framework on the software stack based on the processed target deep learning framework and target plugin, so that the target deep learning framework is adapted to the software stack.

[0185] In one possible implementation, the initial deep learning framework is a deep learning framework under an initial version, the target deep learning framework is a deep learning framework under a target version, and the second processing module 502 is used for:

[0186] The initial plugin is processed based on different types of patches to obtain the target plugin. These different types of patches include any one or more of the following: patches for implementing functions already supported in the target version of the deep learning framework, patches for adapting the software stack, and patches for handling incompatibility issues between the target version and the initial version of the deep learning framework.

[0187] In one possible implementation, the initial plugin is processed based on different types of patches to obtain the target plugin, including:

[0188] Remove the first object from the initial plugin. The first object represents a patch used to implement the functionality already supported in the target version of the deep learning framework.

[0189] A second object is added to the initial plugin; the second object represents a patch used to adapt to the software stack.

[0190] Modify the third object in the initial plugin. The third object represents a patch used to address incompatibility issues between the target version and the initial version of the deep learning framework.

[0191] In one possible implementation, the first processing module 501 is used for:

[0192] The interface of the preset type in the target deep learning framework is modified to be compatible with the target type of the software stack, resulting in the processed target deep learning framework.

[0193] In one possible implementation, the device further includes:

[0194] The first determination module is used to determine the libraries and their versions that meet preset conditions in the software stack.

[0195] The second determination module is used to determine the text file used to configure the runtime environment for the library and its version.

[0196] The verification module is used to build a runtime environment based on text files and verify the compatibility between different versions of the library.

[0197] The third determination module is used to determine the runtime environment that supports the target deep learning framework in response to compatibility issues between different versions of the library.

[0198] In one possible implementation, the preset conditions include:

[0199] The version corresponding to each library is the version before the preset time point;

[0200] The version corresponding to each library is the version closest to the preset time point;

[0201] Each version of the library undergoes continuous integration testing.

[0202] In one possible implementation, the code corresponding to the target deep learning framework is compiled and run on the software stack, adapting the target deep learning framework to the software stack, including:

[0203] In cases where errors occur during compilation and / or runtime of code on the software stack, resolve compilation and / or runtime errors to adapt the target deep learning framework to the software stack.

[0204] One possible implementation involves resolving compile-time errors, including:

[0205] Determine the cause of the compilation error;

[0206] Based on the cause of the error, determine the solution to the compilation error;

[0207] The reasons for compilation errors include one or more of the following:

[0208] Changes to the compilation environment of the deep learning framework under the target version, incorrect header file imports, code generation errors related to operators of preset types, and function interfaces in the code corresponding to the deep learning framework of the target version not being compatible with the software stack.

[0209] In one possible implementation, the solution to the compile-time error is determined based on the cause of the error, including:

[0210] If the compilation environment of the deep learning framework changes under the target version, specify the compilation options and import the corresponding header files;

[0211] If the header file is imported incorrectly, import the correct header file path in the corresponding header file location in the code of the deep learning framework under the target version;

[0212] In the event of a code generation error related to an operator of a preset type, modify the registration method of the relevant operator;

[0213] If the function interfaces in the code corresponding to the target version of the deep learning framework are not compatible with the software stack, the code that calls the corresponding functions should be adjusted or a new function implementation should be added to the code.

[0214] In one possible implementation, runtime issues include runtime logic errors, and resolving runtime errors includes:

[0215] Identify runtime logic errors and their locations in the code;

[0216] Add logs to the call chain of the module where the location is located to check the runtime state and variable values;

[0217] Solutions for determining runtime logic errors based on runtime state and variable values.

[0218] In one possible implementation, runtime issues also include issues in unit tests, which include any one or more of the following: unimplemented interface, abnormal operator precision, and abnormal operator execution.

[0219] According to the embodiments of this application, by processing the target deep learning framework and the initial plugin associated with the initial deep learning framework, wherein the runtime environment of the target deep learning framework is determined in the software stack, the plugin can be updated to adapt to the target deep learning framework, and the resulting target deep learning framework can be better adapted to the software stack. By compiling and running the code corresponding to the target deep learning framework on the software stack based on the processed target deep learning framework and target plugin, the target deep learning framework can be adapted to the software stack, which can improve the compatibility between the deep learning framework and the software stack, and enable the model under the target deep learning framework to accelerate the inference and training process by utilizing the capabilities of the software stack and the underlying hardware devices, thereby improving the user experience.

[0220] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0221] This disclosure also proposes a computer-readable storage medium storing computer program instructions that, when executed by a processor, implement the above-described method. The computer-readable storage medium can be volatile or non-volatile.

[0222] This disclosure also proposes a deep learning framework adaptation device, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.

[0223] This disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device performs the above-described method.

[0224] Figure 6 This is a block diagram illustrating an apparatus 1900 for deep learning framework adaptation according to an exemplary embodiment. For example, apparatus 1900 may be provided as a server or terminal device. (Refer to...) Figure 6 The apparatus 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the methods described above.

[0225] Device 1900 may also include a power supply component 1926 configured to perform power management of device 1900, a wired or wireless network interface 1950 configured to connect device 1900 to a network, and an input / output interface 1958 (I / O interface). Device 1900 can operate on an operating system, such as Windows Server, stored in memory 1932. TM macOS X TM Unix TM Linux TM FreeBSD TM Or similar.

[0226] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by a processing component 1922 of the device 1900 to perform the above-described method.

[0227] This disclosure can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this disclosure.

[0228] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0229] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0230] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as "C" or similar languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions to implement various aspects of this disclosure.

[0231] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0232] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0233] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0234] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0235] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.< / double> < / tensor> < / tensor>

Claims

1. A method for adapting to deep learning frameworks, characterized in that, The method includes: The target deep learning framework is processed to obtain the processed target deep learning framework, and the running environment of the target deep learning framework is determined in the software stack. The initial plugin associated with the initial deep learning framework is processed to obtain the target plugin associated with the target deep learning framework. The initial deep learning framework is a deep learning framework under an initial version, and the target deep learning framework is a deep learning framework under a target version, wherein the target version is higher than the initial version. Based on the processed target deep learning framework and the target plugin, the code corresponding to the target deep learning framework is compiled and run on the software stack, so that the target deep learning framework is adapted to the software stack. The process of processing the target deep learning framework to obtain the processed target deep learning framework includes: The interface of the preset type in the target deep learning framework is modified to be compatible with the target type of the software stack, and the processed target deep learning framework is obtained. The process of processing the initial plugin associated with the initial deep learning framework to obtain the target plugin associated with the target deep learning framework includes: The initial plugin is processed based on different types of patches to obtain the target plugin.

2. The method according to claim 1, characterized in that, The different types of patches include any one or more of the following: patches for implementing functions already supported in the target version of the deep learning framework, patches for adapting the software stack, and patches for handling incompatibility issues between the target version and the initial version of the deep learning framework.

3. The method according to claim 2, characterized in that, The process of processing the initial plugin based on different types of patches to obtain the target plugin includes: Remove the first object from the initial plugin, which represents a patch used to implement the functionality already supported in the target version of the deep learning framework. A second object is added to the initial plugin, which represents a patch used to adapt the software stack; Modify the third object in the initial plugin, which represents a patch for handling incompatibility issues between the target version and the initial version of the deep learning framework.

4. The method according to claim 1, characterized in that, The method further includes: Identify the libraries and their versions that meet the preset conditions within the software stack; For the library and its version, determine the text file used to configure the runtime environment; A runtime environment is built based on the text file to verify the compatibility between different versions of the library; To ensure compatibility between different versions of the library, determine the runtime environment that supports the target deep learning framework.

5. The method according to claim 4, characterized in that, The preset conditions include: The version corresponding to each library is the version before the preset time point; The version corresponding to each library is the version closest to the preset time point; Each version of the library undergoes continuous integration testing.

6. The method according to claim 1, characterized in that, The step of compiling and running the code corresponding to the target deep learning framework on the software stack, so that the target deep learning framework is adapted to the software stack, includes: In the event of errors during compilation and / or runtime of the code on the software stack, resolve the compilation and / or runtime errors to adapt the target deep learning framework to the software stack.

7. The method according to claim 6, characterized in that, Troubleshooting compilation errors includes: Determine the cause of the compilation error; Based on the cause of the error, determine the solution to the compilation error; The reasons for the compilation error include one or more of the following: Changes to the compilation environment of the deep learning framework under the target version, incorrect header file imports, code generation errors related to operators of preset types, and function interfaces in the code corresponding to the deep learning framework of the target version not being compatible with the software stack.

8. The method according to claim 7, characterized in that, The step of determining a solution to the compilation error based on the cause of the error includes: If the compilation environment of the deep learning framework changes under the target version, specify the compilation options and import the corresponding header files; If the header file is imported incorrectly, import the correct header file path in the corresponding header file location in the code of the deep learning framework under the target version; In the event of a code generation error related to an operator of a preset type, modify the registration method of the relevant operator; If the function interfaces in the code corresponding to the target version of the deep learning framework are not compatible with the software stack, the code that calls the corresponding functions should be adjusted or a new function implementation should be added to the code.

9. The method according to claim 6, characterized in that, Runtime issues include runtime logic errors. Resolving runtime errors includes: Identify runtime logic errors and their locations in the code; Add logs to the call chain of the module where the location is located to check the runtime state and variable values; The solution to the runtime logic error is determined based on the runtime state and the values ​​of the variables.

10. The method according to claim 6, characterized in that, Runtime issues also include issues in unit tests, which include one or more of the following: unimplemented interface, abnormal operator precision, and abnormal operator operation.

11. A deep learning framework adaptation device, characterized in that, The device includes: The first processing module is used to process the target deep learning framework to obtain the processed target deep learning framework. The running environment of the target deep learning framework is determined in the software stack. The second processing module is used to process the initial plugin associated with the initial deep learning framework to obtain the target plugin associated with the target deep learning framework. The initial deep learning framework is a deep learning framework under an initial version, and the target deep learning framework is a deep learning framework under a target version, wherein the target version is higher than the initial version. The compilation and execution module is used to compile and run the code corresponding to the target deep learning framework on the software stack based on the processed target deep learning framework and the target plugin, so that the target deep learning framework is adapted to the software stack. The first processing module is used for: The interface of the preset type in the target deep learning framework is modified to be compatible with the target type of the software stack, and the processed target deep learning framework is obtained. The second processing module is used for: The initial plugin is processed based on different types of patches to obtain the target plugin.

12. A deep learning framework adaptation device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to implement the method of any one of claims 1 to 10 when executing instructions stored in the memory.

13. A non-volatile computer-readable storage medium storing computer program instructions thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 10.

Citation Information

Patent Citations

  • Artificial intelligence accelerator card heterogeneous cluster adaptation method and system and storage medium

    CN119294454A