Interface access method and electronic device

CN122507518APending Publication Date: 2026-08-04INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INSPUR SUZHOU INTELLIGENT TECH CO LTD
Filing Date
2026-06-24
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

但是,对于优化库不同硬件厂商可能有自己的适配方式,导致对于同一个优化库不同厂商的适配版本互不兼容;此外使用多种板卡使用需求的用户需要等待各个硬件厂商更新并发版自身适配的优化库,导致用户等待时间长、体验感差,并且难以确保优化库更新的时效性

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122507518A_ABST
    Figure CN122507518A_ABST
Patent Text Reader

Abstract

The application provides an interface access method and electronic equipment, which can be applied to the field of artificial intelligence technology. The interface access method comprises the following steps: based on the instruction of accessing a target optimization library to a preset computing power execution framework, determining a target access mode from a plurality of preset access modes according to the implementation language and interface function of the target interface of the target optimization library and whether the computing power execution framework has a core function component matched with the target interface; and accessing the target optimization library to the computing power execution framework according to the target access mode, so that the computing power execution framework optimizes a target task by using the target optimization library, and distributes the optimized target task to a hardware device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and more specifically to an interface access method and an electronic device. Background Technology

[0002] When an optimization library demonstrates superior performance on a certain type of model, hardware manufacturers typically extend that library into their own software stack ecosystem. This allows for better performance and enhanced hardware competitiveness through the combination of hardware and the optimization library. However, different hardware manufacturers may have their own adaptation methods for optimization libraries, leading to incompatibility between different manufacturers' versions of the same library. Furthermore, users with various board usage requirements must wait for each hardware manufacturer to update and release its own adapted optimization library, resulting in long waiting times, a poor user experience, and difficulty in ensuring the timeliness of optimization library updates. Summary of the Invention

[0003] In view of the above problems, this application provides an interface access method and an electronic device.

[0004] According to a first aspect of this application, an interface access method is provided, comprising: based on an instruction to access a target optimization library to a preset computing power execution framework, determining a target access method from a set of preset access methods based on the implementation language and interface function of the target interface of the target optimization library, and whether the computing power execution framework has core functional components adapted to the target interface, wherein the computing power execution framework is used to allocate at least one target task of at least one preset deep learning framework in the computing power execution framework to at least one hardware device, the target optimization library is used to optimize the execution efficiency of at least one target task on at least one hardware device, the target optimization library includes at least one of the following: a hardware resource management module and an operator execution optimization module, the target task includes: a computational task and / or a resource scheduling task; accessing the target optimization library to the computing power execution framework according to the target access method, the computing power execution framework using the target optimization library to optimize the target task, and allocating the optimized target task to the hardware device.

[0005] A second aspect of this application provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.

[0006] A third aspect of this application also provides a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.

[0007] A fourth aspect of this application also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method. Attached Figure Description

[0008] The above-mentioned contents, other objects, features and advantages of this application will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:

[0009] Figure 1 The diagram illustrates an application scenario of an interface access method and an electronic device according to embodiments of this application.

[0010] Figure 2 A flowchart of an interface access method according to an embodiment of this application is shown;

[0011] Figure 3 A flowchart of an interface access method according to another embodiment of this application is shown;

[0012] Figure 4 A schematic diagram of an interface access method according to an embodiment of this application is shown;

[0013] Figure 5 A structural block diagram of an interface access device according to an embodiment of this application is shown;

[0014] Figure 6 A block diagram of an electronic device suitable for implementing an interface access method according to an embodiment of this application is shown. Detailed Implementation

[0015] The embodiments of this application will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of this application. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of this application for ease of explanation. However, it will be apparent that one or more embodiments may be implemented without these specific details. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.

[0016] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The terms “comprising,” “including,” etc., as used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0017] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0018] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0019] Optimization libraries can be collections of software specifically designed to improve the hardware performance of AI operator tasks. They can enable tasks like convolution and matrix multiplication to run faster and consume less GPU memory, RAM, and computing power. When an optimization library demonstrates superior performance on a particular type of model—for example, significantly improving inference speed and training efficiency—hardware manufacturers typically adapt the library to enhance their hardware performance. Furthermore, the optimization process of a model is not dependent on a single framework or mode; rather, it's the result of multiple deep learning frameworks, modes, and optimization libraries working together. As the number of models increases, the number of matching optimization libraries also grows, posing a challenge to quickly supporting diverse optimization libraries.

[0020] Different hardware manufacturers may use different adaptation methods, leading to incompatibility between different versions of the same optimization library. For example, manufacturer A might use one method while manufacturer B uses another. Users would have to download, install, and debug different versions of the optimization library separately, which is cumbersome. Furthermore, different versions of the optimization library may be incompatible with the user's business code. Additionally, users using products from multiple hardware manufacturers must wait for each manufacturer to update and release its own optimized library. For instance, users using products from both manufacturers A and B must wait until both manufacturers have completed their adaptations before they can use the library, making it difficult to guarantee the timeliness of optimization library updates and resulting in long waiting times for users.

[0021] In view of this, embodiments of this application provide an interface access method, comprising: based on an instruction to access a target optimization library to a preset computing power execution framework, determining a target access method from a preset variety of access methods according to the implementation language and interface function of the target interface of the target optimization library, and whether the computing power execution framework has core functional components adapted to the target interface, wherein the computing power execution framework is used to allocate at least one target task of at least one preset deep learning framework in the computing power execution framework to at least one hardware device, the target optimization library is used to optimize the execution efficiency of at least one target task on at least one hardware device, the target optimization library includes at least one of the following: a hardware resource management module and an operator execution optimization module, the target task includes: a computational task and / or a resource scheduling task; according to the target access method, accessing the target optimization library to the computing power execution framework, the computing power execution framework using the target optimization library to optimize the target task, and allocating the optimized target task to the hardware device.

[0022] Figure 1 The diagram illustrates an application scenario of an interface access method and an electronic device according to embodiments of this application.

[0023] like Figure 1 As shown, the application scenarios of the interface access method and electronic device in this application embodiment may include: a computing power execution framework, used to assign at least one target task of at least one preset deep learning framework pre-accessed to the computing power execution framework to at least one hardware device pre-accessed to the computing power execution framework; the preset deep learning framework may include at least one preset deep learning framework, such as framework 1, framework 2, etc., and the preset deep learning framework may include commonly used deep learning frameworks, which are not limited here; the preset deep learning framework can provide a running environment for the model, and the model may include, for example, a visual model, a language model, a multimodal model, etc.; the hardware device may include at least one hardware device, such as device 1, device 2, etc., device 1 is, for example, a central processing unit (CPU), device 2 is, for example, a graphics processing unit (GPU), but is not limited thereto, the hardware device may also include a machine learning unit (MLU), an expanded processing unit (XPU), a tensor processing unit (TPU), etc.

[0024] The target optimization library is used to optimize the execution efficiency of at least one target task on at least one hardware device. The target optimization library includes at least one of the following: a hardware resource management module and an operator execution optimization module. The core functional components include at least one of the following: an operator library for executing the target task, a runtime interface library for managing hardware resources, and a collection communication library for performing cross-hardware device communication. The target task includes: computational tasks and / or resource scheduling tasks. For example, based on instructions to connect the target optimization library to a preset computing power execution framework, the target access method can be determined from a variety of preset access methods, according to the implementation language and interface function of the target interface of the target optimization library, and whether the computing power execution framework has core functional components adapted to the target interface. The target optimization library is then connected to the computing power execution framework according to the target access method, and the computing power execution framework allocates the target task optimized using the target optimization library to the hardware device.

[0025] The following will be based on Figure 1 The described scene, through Figures 2-4 The interface access method of the embodiments of this application will be described in detail.

[0026] Figure 2 A flowchart of an interface access method according to an embodiment of this application is shown.

[0027] like Figure 2 As shown, the interface access method of this embodiment includes operations S210 to S220.

[0028] In operation S210, based on the instruction to connect the target optimization library to the preset computing power execution framework, the target access method is determined from a variety of preset access methods according to the implementation language and interface function of the target interface of the target optimization library, and whether the computing power execution framework has core functional components that are compatible with the target interface.

[0029] According to embodiments of this application, the target optimization library may include various types of libraries that need to be adapted, such as computing libraries, third-party libraries, and third-party frameworks. The target optimization library includes at least one of the following: a hardware resource management module and an operator execution optimization module.

[0030] For example, the hardware resource management module can be used to identify hardware devices and allocate hardware resources for operator computation; the operator execution optimization module can be used to improve the execution efficiency of operator tasks, such as merging multiple small operators into one large operator to reduce computational overhead, prioritizing the execution of high-priority operators, and can also be used to perform low-level numerical computations of operator tasks, such as convolution, matrix multiplication, attention computation, etc.

[0031] According to an embodiment of this application, a computing power execution framework is used to assign at least one target task of at least one preset deep learning framework in the computing power execution framework to at least one hardware device that has been pre-connected to the computing power execution framework. The target optimization library is used to optimize the execution efficiency of at least one target task on at least one hardware device. The target task includes computing tasks and / or resource scheduling tasks.

[0032] For example, at least one pre-defined deep learning framework can be pre-connected to the computing power execution framework.

[0033] For example, a computing power execution framework includes a unified architecture for various hardware and multiple deep learning frameworks. It can serve as an intermediate architecture, connecting upwards to multiple pre-defined deep learning frameworks and handling the operator execution sequences decomposed and organized by different deep learning frameworks. Compared to deep learning frameworks, the computing power execution framework is equivalent to the hardware device that executes operators and allocates computing power. Downwards, the computing power execution framework can connect to multiple hardware devices. It can provide multiple unified interfaces, allowing different hardware manufacturers to access the operator library, runtime interface library, and collection communication library of the computing power execution framework through interface cards, based on the characteristics of their own software stacks. Compared to hardware devices, the computing power execution framework is equivalent to a deep learning framework, capable of allocating operator execution, data transmission, and other tasks to its own hardware.

[0034] The target task can include various types of tasks, such as computational tasks and resource scheduling tasks. Based on this, the interface access method between the target optimization library and the computing power execution framework can be applied to various application scenarios, such as computational scenarios and resource scheduling scenarios.

[0035] For example, the instruction to connect the target optimization library to the preset computing power execution framework can be manually issued by the user, such as through console input, or automatically triggered by the system, such as when a new optimization library is detected online. Alternatively, the preset deep learning framework can act as the instruction initiator, sending the aforementioned instruction to the computing power execution framework. By connecting the target optimization library to the computing power execution framework, the target optimization library can leverage the framework's operator library, runtime library, and other components to adapt to all hardware devices connected to the computing power execution framework, without requiring hardware manufacturers to separately adapt the optimization library. For example, the implementation language can include C++, Python, etc., and the interface functions can include specific business operations that the target interface can perform, such as performing optimization operations like operator fusion, precision adaptation, and execution flow reordering; hardware management operations such as identifying hardware device types and allocating video memory or RAM; and cross-device collaborative operations such as data transfer between multiple hardware devices and operator task sharding parallelism. Core functional components include, for example, operator libraries and runtime interface libraries.

[0036] For example, the core functional components of the computing power execution framework that are adapted to the target interface may include: the core functional components of the computing power execution framework being able to interface with or replace the interface functions of the target interface of the target optimization library. For example, if the computing power execution framework has an operator library, its operator library can support interface functions such as execution operator fusion of the target interface, thus determining that the computing power execution framework has core functional components adapted to the target interface.

[0037] For example, multiple access methods can be pre-defined, such as accessing through the interface reserved in the target optimization library or accessing through recompilation. Based on the implementation language and interface function of the target interface, as well as whether the computing power execution framework has core functional components that are compatible with the target interface, it can be determined which of the multiple access methods the target interface and computing power execution framework are compatible with, so as to determine the target access method.

[0038] When operating the S220, the target optimization library is connected to the computing power execution framework according to the target access method. The computing power execution framework uses the target optimization library to optimize the target task and then allocates the optimized target task to the hardware device.

[0039] For example, the target optimization library can be connected to the computing power execution framework according to the target access method. The target optimization library can optimize at least one target task, and the computing power execution framework can allocate the target task optimized by the target optimization library to hardware devices to improve the execution efficiency of the target task on the hardware devices.

[0040] According to embodiments of this application, based on the implementation language and interface functions of the target interface of the target optimization library, and whether the computing power execution framework possesses core functional components adapted to the target interface, the target access method adapted to the target optimization library and the computing power execution framework can be accurately determined from a variety of preset access methods. By connecting the target optimization library to the computing power execution framework according to the target access method, the feature of the computing power execution framework being able to interface with multiple deep learning frameworks can be utilized. For general optimization libraries that support multiple deep learning frameworks, only one interface is needed in the computing power execution framework to adapt to multiple hardware devices. This breaks down technical barriers between various hardware manufacturers, saves significant adaptation time, meets the timeliness requirements for optimization library updates, and reduces adaptation difficulty. Furthermore, for optimization libraries targeting only a single deep learning framework, connecting the optimization library to the computing power execution framework also saves adaptation time and improves the adaptation efficiency of the optimization library.

[0041] According to embodiments of this application, the target interface includes at least one of the following: an interface in the target optimization library for target task optimization, an interface for hardware resource identification and allocation, and a cross-device collaboration interface for data transmission and task synchronization between multiple devices. The core functional components include at least one of the following: an operator library for performing computational tasks, a runtime interface library for managing hardware resources, and a collection communication library for performing cross-hardware device communication.

[0042] For example, computational tasks may include convolution, matrix multiplication, attention computation, etc. The interface for optimizing operator tasks can perform strategies such as operator fusion, execution order adjustment, and precision adaptation on operator tasks to obtain optimized operator tasks.

[0043] For example, the interface used for hardware resource identification and allocation can identify hardware device types, query video memory usage, computing core load and other hardware resource statuses, and allocate corresponding hardware resources to operator tasks.

[0044] For example, cross-device collaboration interfaces can enable data transmission, task sharding, and result synchronization and merging between multiple hardware devices. Task sharding, for example, includes splitting a large model inference task into multiple subtasks and distributing them to different devices.

[0045] For example, the operator library can perform various types of operator tasks; managing hardware resources can include allocating and releasing video memory or storage, managing hardware device initialization, etc.; the collection communication library can be used for multi-hardware collaboration, such as providing standardized cross-device communication interfaces, etc.

[0046] According to embodiments of this application, the target access method is determined from a set of preset access methods based on the implementation language and interface functions of the target interface of the target optimization library, and whether the computing power execution framework has core functional components adapted to the target interface. This includes: when the implementation language is a compiled language, determining the degree of dependency of the interface function on the target optimization library architecture based on at least one of the following: the complexity of the call path for implementing the interface function, and the difficulty of modifying the interface function to adapt to the computing power execution framework; when the degree of dependency is greater than the preset degree, determining the target access method as the first access method, wherein the first access method is used to achieve the docking between the computing power execution framework and the target optimization library without modifying the source code of the target optimization library.

[0047] For example, the implementing languages ​​include compiled languages ​​and interpreted languages.

[0048] For example, compiled languages ​​can include languages ​​that require all source code to be translated into binary instructions that the machine can directly recognize before the code is executed, such as C++.

[0049] Interpreted languages ​​can include programming languages ​​that do not require pre-compiling source code into machine code, but are read, translated, and executed line by line at runtime, such as Python.

[0050] For example, the more complex the call path of the interface function, the more difficult it is to modify the interface function to adapt to the computing power execution framework, and the higher the dependence of the interface function on the target optimization library architecture. For instance, an interface function that needs to call multiple nested modules of the target optimization library has a higher degree of dependence than an interface function that only needs to call 1-2 independent modules of the target optimization library. Furthermore, the higher the amount of code and the larger the scope of modification to the interface function, the higher the degree of dependence.

[0051] For example, when the implementation language includes a compiled language, such as C++, if the interface functionality has a high dependency on the target optimization library architecture, and / or the target optimization library itself has a complex architecture, connecting it to the computing power execution framework by recompiling the target optimization library would result in a huge workload and lead to instability in the target optimization library's operation. Therefore, when the dependency level is greater than a preset level, the target access method can be determined as the first access method, where the preset level can be set according to actual needs and is not limited here.

[0052] For example, the first access method can be used to determine the appropriate call node by analyzing the call implementation of the target interface, and intercept part of the target interface call according to the call node. Then, the execution logic of the call is replaced with an implementation that can be connected to the computing power execution framework by using some core functional components in the computing power execution framework. In this way, the target optimization library can be connected to the computing power execution framework. Thus, the connection between the computing power execution framework and the target optimization library can be achieved with minimal modification to the source code of the target optimization library, or without modification to the source code of the target optimization library.

[0053] According to the embodiments of this application, when the interface function is highly dependent on the target optimization library architecture and the target optimization library itself has a complex architecture, the first access method can connect the target optimization library to the computing power execution framework without modifying the source code. This greatly expands the possibility of interfaces implemented in compiled languages ​​connecting to the computing power execution framework, enhances the accessibility of the target optimization library, and can be applied to the adaptation of multiple third-party libraries, inference frameworks, training frameworks, and computing libraries in computing power execution framework projects, ensuring that the functions of each optimization library are fully implemented. The performance of the implementation can be comparable to the environment provided by a heterogeneous device alone, and for large language model inference tasks, it may even be better than the environment provided by a heterogeneous device.

[0054] According to an embodiment of this application, the first access method includes: determining a key call node from the call path of the target interface, wherein the call path includes at least one call node, and the key call node includes: a necessary node that can call the external interface of the target optimization library and is used to implement the core function of the target interface, wherein the external interface includes at least one of the following: a runtime interface and a hardware resource allocation interface; if the computing power execution framework has an available interface that matches the function of the external interface, interrupting the call of the target interface to the external interface in the key call node, and using the available interface to execute the call, and feeding back the call result to the call path.

[0055] For example, the call path of the target interface may include the interface stack of the target interface, such as analyzing the interface stack of the C++ interface. The call path of the C++ interface of the target optimization library may include a top-down path that sequentially calls the upper-layer business interface, the middle-layer functional interface, and the lower-layer hardware interface.

[0056] For example, a call node may include a single interface call link in the call path. For instance, in the call path from triggering to completion of the target interface, each instance of one interface calling another interface can be considered a call node.

[0057] For example, key calling nodes are used to implement the core functions of the target interface, such as operator computation and hardware resource management. Without key calling nodes, the core functions of the target interface are difficult to implement. For instance, key calling nodes can directly call the external interfaces of the target optimization library. These external interfaces may include interfaces related to hardware devices, such as runtime interfaces and hardware resource allocation interfaces.

[0058] According to embodiments of this application, the external interface can also include multiple interfaces for various application scenarios. For example, it can include computational interfaces, resource scheduling interfaces, etc., wherein the computational interfaces are used, for example, to provide services for executing numerical computation tasks, and the resource scheduling interfaces are used, for example, for task distribution, resource allocation, etc. Accordingly, the first access method can be applied to various scenarios, such as operator computation scenarios, resource scheduling scenarios, etc.

[0059] For example, by using the external interface of the target optimization library that can call the necessary node for implementing the core function of the target interface as the key calling node, if the computing power execution framework can provide a functionally matching available interface, the integrity of the entire calling path can be maintained after replacing the calling logic of the key calling node.

[0060] For example, the available interfaces may include all the core functions of the computing power execution framework that can implement the external interface, and whose input parameters, output results, and calling logic are fully compatible with the external interface.

[0061] For example, interrupting the target interface's call to an external interface in a critical call node can include blocking or terminating the target interface's call to the target optimization library's external interface while the critical call node is executing; for example, if the critical call node requires calling external interface A, the call to external interface A can be blocked, for example, by intercepting the call request.

[0062] By interrupting the call from the target interface to the external interface only in the critical call node, rather than terminating the entire call path, the normal execution of other nodes in the call path can be ensured.

[0063] For example, the call can be executed using the available interface, such as using the available interface to complete the function to be performed by the above call, obtain the call result, and return the call result to the call path to ensure that other call nodes in the call path are executed normally.

[0064] For example, the call result can be fed back to the node above the critical call node to ensure the integrity of the entire call path.

[0065] According to the embodiments of this application, when the computing power execution framework has an available interface that matches the external interface function, the call of the target interface to the external interface in the key call node is interrupted, and the call is executed using the available interface, and the call result is fed back to the call path. There is no need to modify the source code of the target optimization library, which avoids the workload and stability risks caused by recompiling the complex architecture. Even when the interface function is highly dependent on the architecture of the target optimization library and the architecture of the target optimization library itself is complex, the docking between the target optimization library and the computing power execution framework can still be achieved.

[0066] According to embodiments of this application, the instructions for the first access method can be controlled via environment variables. Environment variables may include configuration parameters read during program runtime. When environment variables are set, the first access method can be executed; conversely, if they are not set during program runtime, the first access method may not be executed. Thus, by simply setting or canceling environment variables, the program's execution logic can be altered, improving the flexibility of the first access method's execution.

[0067] According to an embodiment of this application, the first access method further includes: determining the input parameter rules and output result rules based on the target interface's call to the external interface in the key calling node, and feeding back the call result to the calling path according to the input parameter rules and output result rules. The input parameter rules may include the parameter type, quantity, and value range of the input parameters; the output result rules may include the result data type and data structure.

[0068] By determining the input parameter rules and output result rules for the target interface's call to the external interface in the key call node, and feeding back the call result to the call path according to the input parameter rules and output result rules, it can be ensured that the process of feeding back the call result to the call path is seamless, thereby ensuring the integrity of the entire call path execution flow and avoiding path interruption.

[0069] According to an embodiment of this application, the interface access method further includes, when the external interface includes a hardware resource allocation interface, calling the hardware resource with the computing power execution framework as the first allocation priority.

[0070] For example, after interrupting the target interface's call to an external interface in a critical call node, the available resources of all hardware devices corresponding to the computing power execution framework are obtained. If the computing power execution framework has hardware resources that can meet the resource request requirements of the target optimization library, its hardware resources can be allocated first. For instance, if the target optimization library needs 1GB of free video memory, and the computing power execution framework happens to provide 1GB of free video memory, then the computing power execution framework's hardware resources can be allocated first. By prioritizing the computing power execution framework as the first allocation priority hardware resource, the target optimization library can preferentially select hardware resources managed by the computing power execution framework. Only when the computing power execution framework has no available hardware resources will the target optimization library select its default hardware resources. This ensures maximum utilization of the computing power execution framework's diverse and heterogeneous hardware management capabilities.

[0071] According to an embodiment of this application, the interface access method further includes: when the degree of dependency is less than or equal to a preset degree, and the computing power execution framework has an operator library and a runtime interface library, determining the target access method as a second access method, wherein the second access method includes: using the operator library and runtime interface library of the computing power execution framework to replace the operator execution optimization module and hardware resource management module of the target optimization library, and recompiling the replaced target optimization library.

[0072] For example, when the dependency level is less than or equal to the preset level, the workload of connecting the target optimization library to the computing power execution framework by recompiling the target optimization library will not be too high. Therefore, the recompiling method can be used to connect the target optimization library and the computing power execution framework. For example, when the dependency level is less than or equal to the preset level and the computing power execution framework has an operator library and a runtime interface library, a second access method can be used.

[0073] For example, if the C++ interface of the target optimization library is mainly used for operator computation, existing operators in the operator library of the computing power execution framework (such as the convolution operator that comes with the computing power execution framework) can be used, or a combination of multiple basic operators in the operator library (such as the convolution operator formed by combining the split matrix operator and the matrix multiplication operator) can be used to replace the operator computation module of the target optimization library and recompile it so that when the deep learning framework calls the C++ operator interface of the target optimization library, it actually calls the computation logic of the computing power execution framework.

[0074] For example, when the C++ interface of the target optimization library is used for operator computation and hardware resource management, the hardware resource management module of the target optimization library can be replaced by a combination of one or more runtime interfaces in the runtime interface library of the computing power execution framework.

[0075] For example, replacing the operator execution optimization module and hardware resource management module of the target optimization library may include source code-level replacement, which can be done by directly modifying the code of the operator calculation module and hardware resource management module of the target optimization library source code when the target optimization library source code is available; it may also include adaptation layer replacement, which can be done by writing adaptation layer code to adapt to the computing power execution framework and overwrite the original module logic when the target optimization library source code is unavailable.

[0076] For example, recompilation may include: compiling the entire target optimization library after replacing the operator execution optimization module and hardware resource management module of the target optimization library. Recompilation allows the replaced logic to take effect, overriding the original implementation of the target optimization library.

[0077] According to embodiments of this application, by utilizing the operator library and runtime interface library of the computing power execution framework to replace the operator execution optimization module and hardware resource management module of the target optimization library, and then recompiling, the target optimization library can be made to have multi-hardware device adaptation capabilities.

[0078] According to embodiments of this application, when the implementation language is an interpreted language and the computing power execution framework has a runtime interface library and a collection communication library, it can be determined whether the target optimization library includes a reserved interface for hardware device access; if it is determined that no reserved interface is included, the target access method is determined to be a third access method, wherein the third access method includes: configuring the computing power execution framework as a hardware device type that the target optimization library can recognize, so that the target optimization library accesses the computing power execution framework in a hardware device call mode, and the computing power execution framework allocates the target task optimized by the target optimization library to the hardware device through the runtime interface and the collection communication library.

[0079] For example, the hardware device invocation pattern of the target optimization library may include recognizing hardware device types in a preset format (such as GPUs from specific manufacturers). However, the target optimization library typically cannot directly recognize and invoke software layer components such as computing power execution frameworks. Through standardized adaptation, the computing power execution framework can be configured as a hardware device type recognizable by the target optimization library, enabling the target optimization library to recognize the computing power execution framework, which was originally a software middleware layer, as a hardware device. Therefore, the target optimization library can interface with the computing power execution framework using its original hardware device invocation pattern without modifying its code, avoiding the high adaptation costs caused by significant source code modifications required for interface integration, and maximizing the preservation of the target optimization library's native invocation habits and stability.

[0080] For example, standardization adaptation may include hardware identifier adaptation. For instance, if the target optimization library's hardware identification depends on a hardware identifier, hardware identifier adaptation may include the computing power execution framework registering a custom hardware identifier and configuring the target optimization library to recognize this custom hardware identifier.

[0081] For example, standardization adaptation can also include API call format adaptation. For instance, the target optimization library has a fixed interface specification for calling hardware devices. API call format adaptation can include the computing power execution framework encapsulating its own core functional interfaces (such as interfaces for core functions like resource allocation and data copying) so that its parameters, return values, and calling process are fully adapted to the target optimization library's native hardware interface.

[0082] For example, a third access method can be indirect access via the underlying Python interface. The computing power execution framework can be added as a hardware device to the calling process of the optimization library, allowing the target optimization library to recognize the computing power execution framework as a hardware device. Through the runtime interface provided by the computing power execution framework, it can perform resource scheduling, collection communication, and other functions as a hardware device.

[0083] For example, the computing power execution framework can accurately allocate the operator tasks optimized by the target optimization library to the hardware devices most suitable for executing the optimized operator tasks through the runtime interface and collection communication library.

[0084] For example, the runtime interface can identify the hardware type, computing load, memory usage, and other hardware status of all connected computing power execution framework hardware devices to determine the most suitable hardware device for executing the optimized target task. The collection communication library can be used for task coordination and allocation among multiple hardware devices, such as enabling cross-device data transfer between multiple hardware devices. After the optimized target task is sent to the hardware device, the hardware device can execute calculations according to the instructions of the computing power execution framework and return the results to the optimization library.

[0085] According to embodiments of this application, through a third access method, the target optimization library can interface with the computing power execution framework without modifying its code, reducing adaptation costs. Furthermore, most optimization libraries can support configuring the computing power execution framework to a hardware device type recognizable by the target optimization library, improving the universality of the interface access method.

[0086] By reserving a hardware registration interface, the computing power execution framework can be packaged as a backend hardware and registered into the target optimization library. Through the unified scheduling in the target optimization library, it can execute the functions provided by multiple computing power execution frameworks and ultimately provide computing power support.

[0087] According to an embodiment of this application, the interface access method further includes: when it is determined that a reserved interface is included, determining the target access method as a fourth access method, wherein the fourth access method includes a preset hardware access method corresponding to the reserved interface.

[0088] For example, during the development and design of the optimization library, interfaces for connecting to other hardware devices may be reserved in advance for the target optimization library. That is, the target optimization library includes reserved interfaces and the access methods corresponding to the reserved interfaces are pre-configured. In this case, a fourth access method is adopted, such as a preset hardware access method corresponding to the reserved interfaces.

[0089] For example, the computing power execution framework can be directly used as a type of hardware device, and the computing power execution framework can be connected using a preset hardware access method. The reserved interface and the preset hardware access method can be set according to actual needs and are not limited here.

[0090] According to the embodiments of this application, since the fourth access method does not require modification of the target optimization library source code or interception of key calling nodes, it can directly complete the connection between the computing power execution framework and the target optimization library. Therefore, the fourth access method has a lower adaptation cost and technical complexity in connecting the target optimization library to the computing power execution framework.

[0091] Figure 3 A flowchart of an interface access method according to another embodiment of this application is shown. Figure 3 As shown, the interface access method of this embodiment includes operations S310 to S340.

[0092] In operation S310, the target optimization library is determined. For example, the target optimization library may include the latest upgraded or updated optimization library.

[0093] When operating the S320, analyze the target interfaces of the target optimization library. For example, you can analyze the interfaces in the target optimization library used for target task optimization, and the interfaces used for hardware resource identification and allocation.

[0094] For example, when analyzing interfaces, the computing power execution framework can be treated as a single hardware device for adaptation design. Based on the technical characteristics of the computing power execution framework, once it is connected to the target optimization library, it is equivalent to the target optimization library connecting to multiple heterogeneous hardware devices managed by the computing power execution framework at once. This eliminates the need for each heterogeneous hardware device to be adapted to the target optimization library individually, thus significantly shortening the adaptation cycle and greatly improving access efficiency.

[0095] For example, it can be analyzed whether the access of the target optimization library only requires the access of the Python interface to complete the connection between the target optimization library and the computing power execution framework, or whether both the Python interface and the C++ interface need to be adapted to achieve the connection. Furthermore, the Python interface can be used as the top-level application, and the C++ interface can be used as the underlying logic implementation.

[0096] When operating S330, determine the target access method.

[0097] For example, when the target interface is implemented in an interpreted language, a third and fourth access method can be used. When the implementation language is a compiled language, a first and second access method can be used.

[0098] For example, when the implementation language is a compiled language, the interface type of the target interface can be further analyzed. The interface type may include computational interfaces used to implement the computational logic of a certain segment or a certain kernel. For example, a computational interface can calculate the computation result of a certain large fusion operator. The interface type may also include functional interfaces, which can be used to implement a certain function, such as obtaining the maximum memory of the hardware device or obtaining the maximum number of threads of the hardware device.

[0099] For example, for computational interfaces, the computational logic of the computational interface can be analyzed to parse out the specific operators used in the computational logic and the order of operator execution, and the computational logic can be implemented using the operator library provided by the computational execution framework to obtain the correct computational results.

[0100] For example, for functional interfaces, we can analyze the interfaces in the runtime library or collection communication library that the computing power execution framework can provide to implement the functional interface, so as to realize the functions to be implemented by the preset functional interface.

[0101] For example, a second access method can be used for computing interfaces, while functional interfaces can choose between a first access method and / or a second access method depending on the actual situation. For instance, the second access method can be the primary method and the first access method can be the secondary method.

[0102] According to an embodiment of this application, determining the target access method from a plurality of preset access methods includes: determining the target access method from a plurality of access methods based on the adaptation cost and technical complexity of using the access method to access the target optimization library into the computing power execution framework.

[0103] For example, in order of adaptation cost and technical complexity from low to high, the various access methods can be ranked as follows: fourth access method, third access method, second access method, and first access method. First, it can be determined whether the fourth access method can be used to connect the target optimization library to the computing power execution framework. If it is determined that the fourth access method cannot be used, then it can be determined whether the third access method can be used. Similarly, if it is determined that the third access method cannot be used, then it can be determined whether the second access method can be used, and if it is determined that the second access method cannot be used, then it can be determined whether the first access method can be used.

[0104] According to the embodiments of this application, based on the adaptation cost and technical complexity of using the access method to access the target optimization library into the computing power execution framework, the target access method is determined hierarchically from multiple access methods, which can improve the determination efficiency and reduce the time and resource costs of the determination process.

[0105] For example, when the target optimization library cannot be accessed using only one access method, at least two access methods can be combined. For instance, if the computing power execution framework needs to use the interfaces reserved by the target optimization library, and the operator library in the computing power execution framework can implement the computational logic of its corresponding compiled interface, and also needs to use the runtime interface library provided by the computing power execution framework to obtain hardware board information on the C++ side to execute different branch calculations, etc., then multiple access methods from the first to the fourth can be combined.

[0106] According to embodiments of this application, by providing multiple access methods, each of which can be used individually or in combination, most optimization library interface access methods can be covered. The multiple access methods provided in this application can cover various interface scenarios, including top-level Python, bottom-level Python, and bottom-level C++ interfaces. The logic for determining the access method is clear, accurately identifying the interface access method and accelerating the access of optimization libraries. Furthermore, relying on the characteristics of the computing power execution framework, the above access methods can quickly connect optimization libraries to multiple hardware devices, breaking down technical barriers between different manufacturers and improving timeliness.

[0107] In operation S340, the computing power execution framework is accessed. For example, the target optimization library can be accessed to the computing power execution framework according to the target access method. One or more of the first to fourth access methods can be used to access the target optimization library to the computing power execution framework. According to the embodiments of this application, by hierarchically determining the target access method from multiple access methods and using the target access method to access the optimization library to the computing power execution framework, for users with multiple hardware usage needs, users only need to maintain the architecture of the target optimization library and the computing power execution framework, without having to maintain the hardware equipment of each hardware manufacturer separately, thereby saving operation and maintenance costs. In addition, each time the optimization library is upgraded or updated, only the architecture of the target optimization library and the computing power execution framework needs to be upgraded and maintained, improving the optimization timeliness.

[0108] Figure 4 A schematic diagram of an interface access method according to an embodiment of this application is shown.

[0109] Among them, such as Figure 4 The first end shown can include a C++ interface. The second end can include a Python interface.

[0110] For example, interface category analysis can be used to determine whether the target interface is a Python interface or a C++ interface.

[0111] Since Python interfaces typically do not require operator library access, the distinction between C++ and Python interfaces can be made by determining whether operator library access is required.

[0112] For cases where operator library access is not required: determine whether a second-end access from the runtime interface library or collection communication library is needed, such as whether a Python interface is required. If so, further interface analysis and unification can be performed. For example, analyze whether the computing power execution framework can provide a unified Python interface for both the runtime interface library and the collection communication library, and then access the interface. For instance, access the interfaces from the computing power execution framework, such as through a third access method, thus completing the access. If a second-end access from the runtime interface library or collection communication library is not required, a fourth access method can be used, completing the access. By recursively summarizing multiple types of interface hijacking, when integrating new optimization libraries, only interfaces not intercepted by the computing power execution framework need to be considered, improving interface access efficiency.

[0113] For cases requiring operator library access: the target interface can be computationally abstracted to determine its computational logic, and the computational function can be implemented based on the operator library provided by the computing power execution framework; furthermore, operator access can be performed, for example, through a second access method.

[0114] Correspondingly, after the computing function is connected, it can be determined whether the first end of the runtime interface library or the collection communication library needs to be connected. If so, interface analysis and unification can be performed. For example, the first end (such as the C++ interface end) of the runtime interface library and the collection communication library in the computing power execution framework required by the target interface can be analyzed and the interface can be connected. For example, the interface in the computing power execution framework can be connected, and thus the connection is completed. If not, the interface connection can be completed.

[0115] For example, the complexity of the C++ interface can be analyzed. If the interface functionality can be achieved through a single interface call or a combination of interfaces, the second access method can be selected. If the interface scheduling complexity is high and the involved interface scheduling layers are too deep, the first access method should be selected. The above operation can be repeated for different target interfaces of the target optimization library to gradually complete the access of the entire target optimization library. This expands the possibilities for C++ interface access and implements the target interface functionality with minimal intrusion into the source code, thereby enhancing the accessibility of the optimization library.

[0116] According to embodiments of this application, by providing multiple interface access methods, all of which are based on a computing power execution framework, and treating the computing power execution framework as a "many-to-one-to-many" intermediate structure, the computing power execution framework can be regarded as a hardware device when accessing optimization libraries. The various interfaces provided by the computing power execution framework can be used to meet the access requirements of the optimization libraries. Compared to heterogeneous hardware devices, the computing power execution framework provides a unified interface for deep learning frameworks, and heterogeneous devices accessing the computing power execution framework can automatically support the optimization libraries supported by the computing power execution framework.

[0117] According to the embodiments of this application, the provided multiple interface access methods are a top-down, simple-to-complex, holistic solution adapted to the optimization library. Each access method can be used alone for simple interfaces or in combination. This allows for the analysis of the interfaces required by the optimization library, enabling layer-by-layer access to the computing power execution framework, calling the optimization functions of the optimization library, and obtaining computing power support from heterogeneous devices according to the scheduling mode of the optimization library.

[0118] Based on the above interface access method, this application also provides an interface access device. The following will be combined with... Figure 5 The device is described in detail.

[0119] Figure 5 A structural block diagram of an interface access device according to an embodiment of this application is shown.

[0120] like Figure 5 As shown, the interface access device 500 of this embodiment includes a first determining module 510 and an access module 520.

[0121] The first determining module 510 is used to determine a target access method from a set of preset access methods based on the instruction to connect the target optimization library to a preset computing power execution framework, according to the implementation language and interface function of the target interface of the target optimization library, and whether the computing power execution framework has core functional components adapted to the target interface. The computing power execution framework is used to allocate at least one target task of at least one preset deep learning framework within the computing power execution framework to at least one hardware device. The target optimization library is used to optimize the execution efficiency of at least one target task on at least one hardware device. The target optimization library includes at least one of the following: a hardware resource management module and an operator execution optimization module. The target task includes: computational tasks and / or resource scheduling tasks. In one embodiment, the first determining module 510 can be used to execute the operation S210 described above, which will not be repeated here.

[0122] The access module 520 is used to access the target optimization library into the computing power execution framework according to the target access method. The computing power execution framework uses the target optimization library to optimize the target task and allocates the optimized target task to the hardware device. In one embodiment, the access module 520 can be used to perform the operation S220 described above, which will not be repeated here.

[0123] According to an embodiment of this application, the first determining module 510 includes a first determining submodule, used to determine the degree of dependency of the interface function on the target optimization library architecture based on at least one of the following when the implementation language includes a compiled language: the complexity of the call path for implementing the interface function, and the difficulty of modifying the interface function to adapt to the computing power execution framework; the second determining submodule is used to determine the target access method as the first access method when the degree of dependency is greater than a preset degree, wherein the first access method is used to realize the docking between the computing power execution framework and the target optimization library without modifying the source code of the target optimization library.

[0124] The first access method includes: determining key call nodes from the call path of the target interface, wherein the call path includes at least one call node, and the key call node includes: a necessary node that can call the external interface of the target optimization library and is used to implement the core function of the target interface, wherein the external interface includes at least one of the following: runtime interface, hardware resource allocation interface; if the computing power execution framework has an available interface that matches the function of the external interface, interrupting the call of the target interface to the external interface in the key call node, and using the available interface to execute the call, and feeding back the call result to the call path.

[0125] According to an embodiment of this application, the first determining module 510 further includes a third determining submodule, which is used to determine the target access method from multiple access methods based on the adaptation cost and technical complexity of using the access method to access the target optimization library into the computing power execution framework.

[0126] According to an embodiment of this application, the first determining module 510 further includes a calling submodule, used to call hardware resources that include: setting the computing power execution framework as the first allocation priority when the external interface includes a hardware resource allocation interface.

[0127] According to an embodiment of this application, the first determining module 510 further includes a fourth determining submodule, used to determine the target access method as the second access method when the degree of dependency is less than or equal to a preset degree and the computing power execution framework has an operator library and a runtime interface library. The second access method includes: using the operator library and runtime interface library of the computing power execution framework to replace the operator execution optimization module and hardware resource management module of the target optimization library, and recompiling the replaced target optimization library.

[0128] According to an embodiment of this application, the first determining module 510 further includes a fifth determining submodule, used to determine whether the target optimization library includes a reserved interface for hardware device access when the implementation language includes an interpreted language and the computing power execution framework has a runtime interface library and a collection communication library; and a sixth determining submodule, used to determine the target access method as a third access method when it is determined that the reserved interface is not included, wherein the third access method includes: configuring the computing power execution framework as a hardware device type that the target optimization library can recognize, so that the target optimization library accesses the computing power execution framework in a hardware device calling mode, and the computing power execution framework allocates the target task optimized by the target optimization library to the hardware device through the runtime interface and the collection communication library.

[0129] According to an embodiment of this application, the first determining module 510 further includes a seventh determining submodule, which is used to determine the target access method as a fourth access method when a reserved interface is determined, wherein the fourth access method includes a preset hardware access method corresponding to the reserved interface.

[0130] According to embodiments of this application, any plurality of modules in the first determining module 510 and the access module 520 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least a portion of the functionality of one or more of these modules can be combined with at least a portion of the functionality of other modules and implemented in one module. According to embodiments of this application, at least one of the first determining module 510 and the access module 520 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any appropriate combination of any of these three implementation methods. Alternatively, at least one of the first determining module 510 and the access module 520 can be at least partially implemented as a computer program module, which can perform corresponding functions when the computer program module is run.

[0131] Figure 6 A block diagram of an electronic device suitable for implementing an interface access method according to an embodiment of this application is shown.

[0132] like Figure 6 As shown, an electronic device 600 according to an embodiment of this application includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage portion 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this application.

[0133] RAM 603 stores various programs and data required for the operation of electronic device 600. Processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Processor 601 executes various operations of the method flow according to embodiments of this application by executing programs in ROM 602 and / or RAM 603. It should be noted that programs may also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 may also execute various operations of the method flow according to embodiments of this application by executing programs stored in one or more memories.

[0134] According to embodiments of this application, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to a bus 604. The electronic device 600 may also include one or more of the following components connected to the input / output (I / O) interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 610 as needed so that computer programs read from it can be installed into the storage section 608 as needed.

[0135] This application also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of this application.

[0136] According to embodiments of this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium, such as including but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this application, the computer-readable storage medium may include ROM 602 and / or RAM 603 and / or one or more memories other than ROM 602 and RAM 603 described above.

[0137] Embodiments of this application also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of this application.

[0138] When the computer program is executed by the processor 601, it performs the functions defined in the system / apparatus of this application embodiment. According to the embodiments of this application, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0139] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0140] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, it performs the functions defined in the system of this application embodiment. According to the embodiments of this application, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0141] According to embodiments of this application, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0142] 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 this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated 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 a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0143] Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, the features described in the various embodiments of this application can be combined and / or combined in various ways without departing from the spirit and teachings of this application. All such combinations and / or combinations fall within the scope of this application.

[0144] The embodiments of this application have been described above. However, these embodiments are merely illustrative and not intended to limit the scope of this application. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Without departing from the scope of this application, those skilled in the art can make various substitutions and modifications, all of which should fall within the scope of this application.

Claims

1. An interface access method, characterized in that, The method includes: Based on the instruction to connect the target optimization library to a preset computing power execution framework, according to the implementation language and interface function of the target interface of the target optimization library, and whether the computing power execution framework has core functional components adapted to the target interface, a target access method is determined from a preset number of access methods. The computing power execution framework is used to allocate at least one target task of at least one preset deep learning framework in the computing power execution framework to at least one hardware device. The target optimization library is used to optimize the execution efficiency of the at least one target task on the at least one hardware device. The target optimization library includes at least one of the following: a hardware resource management module and an operator execution optimization module. The target task includes: computational tasks and / or resource scheduling tasks. According to the target access method, the target optimization library is connected to the computing power execution framework. The computing power execution framework uses the target optimization library to optimize the target task and allocates the optimized target task to the hardware device.

2. The method according to claim 1, characterized in that, The step of determining the target access method from a variety of preset access methods based on the implementation language and interface functions of the target interface of the target optimization library, and whether the computing power execution framework has core functional components adapted to the target interface, includes: When the implementation language is a compiled language, the degree of dependency of the interface function on the target optimization library architecture is determined according to at least one of the following: the complexity of the call path for implementing the interface function, and the difficulty of modifying the interface function to adapt to the computing power execution framework; If the degree of dependence is greater than a preset degree, the target access method is determined to be the first access method, wherein the first access method is used to realize the docking between the computing power execution framework and the target optimization library without modifying the source code of the target optimization library.

3. The method according to claim 2, characterized in that, The first access method includes: Determine key call nodes from the call path of the target interface, wherein the call path includes at least one call node, and the key call node includes: a necessary node that can call the external interface of the target optimization library and is used to implement the core function of the target interface, wherein the external interface includes at least one of the following: runtime interface, hardware resource allocation interface; If the computing power execution framework has an available interface that matches the external interface function, the call of the target interface to the external interface in the key call node is interrupted, and the call is executed using the available interface, and the call result is fed back to the call path.

4. The method according to claim 1, characterized in that, The step of determining the target access method from a set of preset access methods includes: Based on the adaptation cost and technical complexity of using the access method to connect the target optimization library to the computing power execution framework, the target access method is determined from the multiple access methods.

5. The method according to claim 3, characterized in that, The method further includes: When the external interface includes the hardware resource allocation interface, the call includes: assigning the computing power execution framework as the hardware resource with the first allocation priority.

6. The method according to claim 2, characterized in that, The method further includes: If the dependency level is less than or equal to the preset level, and the computing power execution framework has an operator library and a runtime interface library, the target access method is determined to be the second access method, wherein the second access method includes: The operator execution optimization module and the hardware resource management module of the target optimization library are replaced by the operator library and the runtime interface library of the computing power execution framework, and the target optimization library is recompiled after replacement.

7. The method according to claim 2, characterized in that, The method further includes: If the implementation language is an interpreted language and the computing power execution framework has a runtime interface library and a collection communication library, determine whether the target optimization library includes a reserved interface for hardware device access. If it is determined that the reserved interface is not included, the target access method is determined to be a third access method, wherein the third access method includes: The computing power execution framework is configured to be a hardware device type that the target optimization library can recognize, so that the target optimization library can access the computing power execution framework in hardware device call mode, and the computing power execution framework can allocate the target tasks optimized by the target optimization library to the hardware device through the runtime interface and the collection communication library.

8. The method according to claim 7, characterized in that, The method further includes: If the reserved interface is included, the target access method is determined to be the fourth access method, wherein the fourth access method includes a preset hardware access method corresponding to the reserved interface.

9. The method according to claim 1, characterized in that, The target interface includes at least one of the following: an interface in the target optimization library for target task optimization, an interface for hardware resource identification and allocation, and a cross-device collaborative interface for data transmission and task synchronization between multiple devices; The core functional components include at least one of the following: an operator library for performing computational tasks, a runtime interface library for managing hardware resources, and a collection communication library for performing cross-hardware device communication.

10. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 9.