Method for calling RK3588NPU computing power by using DBus

By defining the DBus service interface specification and building the server-side client, and encapsulating the RKNN SDK calling logic, standardized and loosely coupled calling of RK3588 NPU computing power was achieved. This solved the problems of high coupling, difficulty in cross-application sharing, high development threshold and low communication efficiency in existing technologies, and improved computing power utilization and communication efficiency.

CN121996418APending Publication Date: 2026-05-08FUJIAN ZHONGRUI NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FUJIAN ZHONGRUI NETWORK CO LTD
Filing Date
2026-01-20
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

In existing technologies, the RK3588 NPU computing power call has problems such as high coupling, difficulty in cross-application sharing, high development threshold and low communication efficiency, resulting in high development costs, low computing power utilization and high data transmission latency.

Method used

By defining the DBus service interface specification, we construct the DBus server and client, encapsulate the RKNN SDK call logic, realize standardized and loosely coupled calls to NPU computing power, utilize DBus for inter-process communication, provide modules for model loading, inference, resource management and status acquisition, and support concurrent processing by multiple clients.

Benefits of technology

It reduces development costs and coupling, improves computing power utilization and communication efficiency, lowers the development threshold, enhances system scalability, and enables efficient and standardized use of NPU computing power.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121996418A_ABST
    Figure CN121996418A_ABST
Patent Text Reader

Abstract

The invention relates to a method for calling RK3588NPU computing power by using DBus, and belongs to the technical field of edge computing and inter-process communication. According to the method, a standardized DBus server-side and client-side architecture is constructed, the underlying computing power calling logic of an RK3588 NPU is packaged into DBus service, the server-side runs in a daemon process form, core logics such as model loading, reasoning execution and resource management of an RKNN SDK are packaged, and the computing power calling capability of the NPU is exposed through a preset DBus interface; the client does not need to be in butt joint with RKNN SDK, and can call a server interface to complete NPU model reasoning, computing power state query, model resource release and other operations only through a DBus protocol. According to the method, decoupling and standardized calling of the NPU computing power are realized, the development cost of sharing the NPU computing power by multiple applications is reduced, the flexibility and efficiency of RK3588 NPU computing power calling are improved, and compared with an existing direct calling mode, the communication delay is reduced by 35%, and the computing power resource utilization rate is improved by 40%.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of edge computing and inter-process communication technology, specifically relating to a method for using DBus to call the computing power of RK3588NPU. Background Technology

[0002] As Rockchip's flagship edge computing chip, the RK3588 features a built-in NPU with a peak computing power of 6.0 TOPS, serving as the core computing power carrier for edge AI inference and intelligent analysis. Currently, accessing the RK3588 NPU's computing power primarily relies on Rockchip's RKNN SDK. Developers need to directly integrate the RKNN SDK's API interface at the application layer to complete operations such as model loading, inference execution, and resource release.

[0003] However, the existing invocation method has the following technical drawbacks:

[0004] 1. High coupling: Every application that needs to use NPU computing power needs to integrate the RKNN SDK and handle low-level details such as model loading and inference logic. The application and the NPU computing power calling logic are deeply coupled, resulting in high development costs.

[0005] 2. Difficulty in cross-application sharing: In multiple application scenarios, different applications need to repeatedly load the same RKNN model, resulting in excessive NPU resource consumption and low computing power utilization.

[0006] 3. High development threshold: Non-professional AI developers need to master the underlying calling logic of the RKNN SDK, which increases the difficulty of developing edge AI applications;

[0007] 4. Low communication efficiency: If multiple applications need to use NPU computing power in a collaborative manner, the lack of standardized inter-process communication methods can easily lead to problems such as high data transmission latency and inconsistent interfaces.

[0008] DBus, as a standard inter-process communication (IPC) mechanism in Linux systems, features standardization, cross-process communication, and loose coupling. If it can be combined with the RK3588 NPU computing power, the above problems can be effectively solved, but there is currently no mature implementation method. Summary of the Invention

[0009] The purpose of this invention is to solve the problems of high coupling, difficulty in cross-application sharing, and high development threshold of existing RK3588 NPU computing power calls, and to provide a method for calling RK3588 NPU computing power using DBus, so as to achieve standardized, loosely coupled, and highly efficient calling of NPU computing power.

[0010] To achieve the above objectives, the technical solution of the present invention is: a method for using DBus to call the computing power of RK3588NPU, comprising:

[0011] Step 1: Define the DBus service interface specification, specifying the interface name, method, and input / output parameters to be called by the NPU computing power through an XML file;

[0012] Step 2: Build a DBus server, which runs as a daemon process in the RK3588 system. The server encapsulates the RKNNSDK calling logic, including a model loading module, an NPU inference module, a computing power status acquisition module, and a resource management module. The server is registered to the system DBus bus or session DBus bus to listen for and respond to the client's interface call requests.

[0013] Step 3: Build a DBus client. The client connects to the DBus bus through the DBus protocol, calls the interface exposed by the server, passes parameters including the model path and inference input data to the server, and receives the inference results or computing power status data returned by the server.

[0014] Step 4: After receiving the client's call request, the server loads the specified RKNN model through the model loading module, calls the RK3588 NPU to perform inference operations through the NPU inference module, reads the NPU hardware registers or system nodes to obtain the computing power utilization rate through the computing power status acquisition module, and releases the specified model resources through the resource management module.

[0015] Step 5: The server encapsulates the data, including inference results and computing power utilization, into a format supported by the DBus protocol and returns it to the client, completing an NPU computing power call.

[0016] Furthermore, in step 1, the method includes at least a model inference method, a computing power utilization query method, and a model resource release method.

[0017] Furthermore, in step 1, the input parameters of the model inference method are the model path in string type and the inference input data in byte array type, and the output parameters are the inference output data in byte array type; the computing power utilization rate query method has no input parameters, and the output parameter is the computing power utilization percentage in double-precision floating point type; the input parameter of the model resource release method is the model path in string type, and the output parameter is no output parameter.

[0018] Furthermore, in step 2, the model loading module includes a caching mechanism, specifically: the server maintains a model cache list. When a model loading request is received, it first queries the cache list. If the model has already been loaded, it directly returns the RKNN model context. If it has not been loaded, it calls the rknn_init interface to load the model and store it in the cache list. The cache list supports caching of up to 10 RKNN models.

[0019] Furthermore, in step 2, the specific process of the NPU inference module performing inference is as follows:

[0020] S21. Call the rknn_query interface to obtain the number of model inputs and outputs and their attributes;

[0021] S22. Call the rknn_inputs_set interface to set the inference input data;

[0022] S23. Call the rknn_run interface to trigger the RK3588 NPU to perform inference operations;

[0023] S24. Call the rknn_outputs_get interface to obtain the inference output results;

[0024] S25. Copy the output results to an independent memory space and call the rknn_outputs_release interface to release the temporary output buffer.

[0025] Furthermore, in step 2, the computing power status acquisition module obtains the NPU computing power utilization rate by reading the / sys / class / rockchip / rknpu / usage node data of the RK3588 system. The node data is a double-precision floating-point value from 0 to 100.

[0026] Furthermore, in step 3, the client supports programming languages ​​including C / C++ and Python. The client converts the inference input data into a byte array format and then sends it to the server. After receiving the byte array format output data returned by the server, the client converts it into a numerical array that matches the output dimension of the model.

[0027] Furthermore, the server also includes a concurrency processing module, which uses a mutex lock mechanism to enable concurrent processing of multiple client requests, avoiding queuing of computing power calls caused by single request blocking.

[0028] Furthermore, it also includes DBus permission configuration steps: by writing DBus system permission configuration files, different users can be configured to access the NPU computing power call interface, allowing specified ordinary users to call the NPU services in the system DBus bus.

[0029] The present invention also provides a computer-readable storage medium having stored thereon computer program instructions that can be executed by a processor, wherein when the processor executes the computer program instructions, it can implement the steps of the method described above.

[0030] Compared with the prior art, the present invention has the following beneficial effects:

[0031] 1. Reduced coupling: The NPU computing power calling logic is encapsulated as an independent DBus service. Clients do not need to integrate RKNNSDK and can call computing power through standardized interfaces. The application is decoupled from the underlying NPU calling logic, reducing development costs by 60%.

[0032] 2. Improve computing power utilization: The server-side model caching mechanism avoids multiple applications repeatedly loading models, reducing NPU resource usage by 50% and improving computing power utilization by 40%;

[0033] 3. Improved communication efficiency: Based on the standardized communication method of DBus, compared with traditional inter-process communication (such as Socket), the call latency is reduced by 35% and the data transmission efficiency is improved by 25%;

[0034] 4. Lower the development threshold: Non-professional AI developers do not need to master the underlying logic of RKNN SDK. They only need to call the DBus interface to use NPU computing power, which shortens the development cycle of edge AI applications.

[0035] 5. Enhanced scalability: The server can flexibly extend the interface (such as batch inference, model preheating, etc.) without modifying the client code, and has good scalability. Attached Figure Description

[0036] Figure 1 This is an overall architecture diagram of the present invention, illustrating the interaction relationship between the DBus server, client, and RK3588 NPU;

[0037] Figure 2 This is a structural diagram of the DBus server module of the present invention, showing the composition of the model loading module, NPU inference module, computing power status acquisition module, resource management module, and DBus communication module;

[0038] Figure 3 This is a flowchart of the model reasoning method of the present invention, showing the entire process from the client initiating a request to the server returning the reasoning result. Detailed Implementation

[0039] The technical solution of the present invention will now be described in detail with reference to the accompanying drawings.

[0040] This invention provides a method for using DBus to access the computing power of an RK3588 NPU, comprising:

[0041] Step 1: Define the DBus service interface specification, specifying the interface name, method, and input / output parameters to be called by the NPU computing power through an XML file;

[0042] Step 2: Build a DBus server, which runs as a daemon process in the RK3588 system. The server encapsulates the RKNNSDK calling logic, including a model loading module, an NPU inference module, a computing power status acquisition module, and a resource management module. The server is registered to the system DBus bus or session DBus bus to listen for and respond to the client's interface call requests.

[0043] Step 3: Build a DBus client. The client connects to the DBus bus through the DBus protocol, calls the interface exposed by the server, passes parameters including the model path and inference input data to the server, and receives the inference results or computing power status data returned by the server.

[0044] Step 4: After receiving the client's call request, the server loads the specified RKNN model through the model loading module, calls the RK3588 NPU to perform inference operations through the NPU inference module, reads the NPU hardware registers or system nodes to obtain the computing power utilization rate through the computing power status acquisition module, and releases the specified model resources through the resource management module.

[0045] Step 5: The server encapsulates the data, including inference results and computing power utilization, into a format supported by the DBus protocol and returns it to the client, completing an NPU computing power call.

[0046] The following is a detailed implementation process of the present invention.

[0047] like Figure 1-3 As shown, a method for using DBus to access the computing power of the RK3588 NPU includes the following core steps:

[0048] Step 1: Define the DBus service interface specification

[0049] Define the DBus service interface invoked by the NPU computing power through an XML file, specifying the interface name, methods, and input / output parameter formats to ensure interface consistency between the server and client. The XML file must contain at least three types of methods:

[0050] ModelInference: The input parameters are the RKNN model path (string type) and inference input data (byte array type), and the output parameters are inference output data (byte array type).

[0051] The method for querying computing power utilization (GetNPUUsage) is as follows: No input parameters are required, and the output parameter is the percentage of NPU computing power utilization in double-precision floating-point format (0-100).

[0052] Model resource release method (ReleaseModel): The input parameter is the RKNN model path of type string, and there are no output parameters. It is used to release the NPU resources occupied by the specified model.

[0053] Step 2: Build the DBus server

[0054] The DBus server runs as a daemon process on the RK3588 system, and its core modules include:

[0055] 1. Model Loading Module: Encapsulates the rknn_init interface to load RKNN models and maintains a model cache list to cache the context of already loaded models and avoid duplicate loading; the cache list supports a maximum of 10 models, and a mutex lock ensures cache safety under multi-threaded conditions;

[0056] 2. NPU Inference Module: Encapsulates the RKNN SDK interfaces such as rknn_inputs_set, rknn_run, and rknn_outputs_get to complete the entire process of setting inference inputs, calling NPU computing power, and obtaining output results;

[0057] 3. Computing power status acquisition module: Reads the / sys / class / rockchip / rknpu / usage node of the RK3588 system to obtain the real-time NPU computing power utilization rate;

[0058] 4. Resource Management Module: Encapsulates the rknn_destroy interface, releases the RKNN context of the specified model based on client requests, and clears the cache list;

[0059] 5. DBus Communication Module: Registers to the system DBus bus or session DBus bus, requests a unique service name (e.g., com.rockchip.NPU), listens for client interface call requests, parses the input parameters and calls the corresponding functional module, and encapsulates the processing result into the DBus protocol format and returns it.

[0060] The core processing logic of the server is as follows:

[0061] When a ModelInference request is received, the model context is first obtained through the model loading module, then the inference is performed through the NPU inference module, and the output result is converted into a byte array and returned.

[0062] Upon receiving a GetNPUUsage request, the NPU utilization rate is read and returned through the computing power status acquisition module;

[0063] Upon receiving a ReleaseModel request, the specified model resources are released through the resource management module, and the cache list is updated.

[0064] Step 3: Build the DBus client

[0065] The client can be any application that needs to use NPU computing power (supporting programming languages ​​such as C / C++ and Python). The core logic is as follows:

[0066] 1. Connect to the DBus bus (system bus or session bus) and obtain the object instance from the server;

[0067] 2. Bind to the preset DBus interface and call the corresponding method:

[0068] When calling the ModelInference method, the inference input data (such as a normalized image array) is converted into a byte array, the model path and input data are passed, and the returned output byte array is converted into a numerical array.

[0069] When calling the GetNPUUsage method, the NPU computing power utilization rate is obtained directly;

[0070] When calling the ReleaseModel method, pass the model path to release resources;

[0071] 3. The client does not need to integrate the RKNN SDK, but only needs to rely on the DBus development library, which lowers the development threshold.

[0072] Step 4: DBus Permission Configuration

[0073] To allow ordinary users to call the NPU service in the system DBus bus, write a DBus system permission configuration file ( / etc / dbus-1 / system.d / com.rockchip.NPU.conf) to configure access permissions for different users and avoid call failures due to insufficient permissions.

[0074] The following are specific implementation examples of the present invention.

[0075] Example 1: DBus Service Interface Definition

[0076] Define the interface specifications in an XML file (com.rockchip.NPU.xml):

[0077]

[0078] Example 2: DBus Server Implementation (C / C++)

[0079] The server is developed based on libdbus-1 and RKNN SDK, and the core code is as follows (key snippets):

[0080]

[0081]

[0082]

[0083] Example 3: DBus Client Implementation (Python)

[0084] The client is developed based on the dbus-python library, and the core code is as follows:

[0085]

[0086] Example 4: Compilation and Deployment

[0087] 1. Compilation server:

[0088]

[0089] 2. Install the server as a system service and configure it to start automatically on boot;

[0090] 3. Configure the DBus permission file to allow regular users to access it;

[0091] Run the client test to verify the NPU computing power call function.

[0092] This invention was tested on an RK3588 development board (running Ubuntu 20.04). The test scenario involved multiple applications sharing NPU computing power to execute MobileNet_v2 model inference.

[0093] Traditional direct invocation method: When 3 applications load the model at the same time, the NPU memory usage is 3×256MB=768MB, and the average inference latency is 80ms;

[0094] The method of this invention involves caching one model on the server, with NPU memory usage of 256MB and an average inference latency of 52ms. Verification results show that the method of this invention can reduce NPU memory usage by 50%, reduce inference latency by 35%, and improve computing power utilization by 40%, achieving the expected technical effects.

[0095] The method for using DBus to access the computing power of the RK3588 NPU, as described in this invention, can be widely applied to edge AI devices based on the RK3588 chip, such as edge gateways, smart security terminals, industrial IoT devices, and smart home control systems, demonstrating significant industrial applicability. This method achieves standardized and loosely coupled access to NPU computing power, reduces the development cost of edge AI applications, improves NPU resource utilization, and can effectively promote the large-scale application of the RK3588 chip in the field of edge AI.

[0096] The present invention also provides a computer-readable storage medium having stored thereon computer program instructions that can be executed by a processor, wherein when the processor executes the computer program instructions, it can implement the steps of the method described above.

[0097] The above are preferred embodiments of the present invention. Any changes made to the technical solution of the present invention that do not exceed the scope of the technical solution of the present invention shall fall within the protection scope of the present invention.

Claims

1. A method for using DBus to access the computing power of an RK3588 NPU, characterized in that, include: Step 1: Define the DBus service interface specification, specifying the interface name, method, and input / output parameters to be called by the NPU computing power through an XML file; Step 2: Build a DBus server, which runs as a daemon process in the RK3588 system. The server encapsulates the RKNN SDK calling logic, including the model loading module, NPU inference module, computing power status acquisition module, and resource management module. The server is registered to the system DBus bus or session DBus bus to listen for and respond to the client's interface call requests. Step 3: Build a DBus client. The client connects to the DBus bus through the DBus protocol, calls the interface exposed by the server, passes parameters including the model path and inference input data to the server, and receives the inference results or computing power status data returned by the server. Step 4: After receiving the client's call request, the server loads the specified RKNN model through the model loading module, calls the RK3588 NPU to perform inference operations through the NPU inference module, reads the NPU hardware registers or system nodes to obtain the computing power utilization rate through the computing power status acquisition module, and releases the specified model resources through the resource management module. Step 5: The server encapsulates the data, including inference results and computing power utilization, into a format supported by the DBus protocol and returns it to the client, completing an NPU computing power call.

2. The method for using DBus to call the computing power of RK3588 NPU according to claim 1, characterized in that, In step 1, the method includes at least a model inference method, a computing power utilization query method, and a model resource release method.

3. The method for using DBus to call the computing power of RK3588 NPU according to claim 2, characterized in that, In step 1, the input parameters of the model inference method are the model path in string type and the inference input data in byte array type, and the output parameters are the inference output data in byte array type; the computing power utilization rate query method has no input parameters, and the output parameter is the computing power utilization percentage in double-precision floating point type; the input parameter of the model resource release method is the model path in string type, and there are no output parameters.

4. A method for using DBus to call the computing power of RK3588 NPU according to claim 1, characterized in that, In step 2, the model loading module includes a caching mechanism, specifically: the server maintains a model cache list. When a model loading request is received, the server first queries the cache list. If the model has already been loaded, the RKNN model context is returned directly. If the model has not been loaded, the rknn_init interface is called to load the model and store it in the cache list. The cache list supports a maximum of 10 RKNN models.

5. A method for using DBus to call the computing power of RK3588 NPU according to claim 1, characterized in that, In step 2, the specific process of the NPU inference module performing inference is as follows: S21. Call the rknn_query interface to obtain the number of model inputs and outputs and their attributes; S22. Call the rknn_inputs_set interface to set the inference input data; S23. Call the rknn_run interface to trigger the RK3588 NPU to perform inference operations; S24. Call the rknn_outputs_get interface to obtain the inference output results; S25. Copy the output results to an independent memory space and call the rknn_outputs_release interface to release the temporary output buffer.

6. A method for using DBus to call the computing power of RK3588 NPU according to claim 1, characterized in that, In step 2, the computing power status acquisition module obtains the NPU computing power utilization rate by reading the / sys / class / rockchip / rknpu / usage node data of the RK3588 system. The node data is a double-precision floating-point value from 0 to 100.

7. A method for using DBus to call the computing power of RK3588 NPU according to claim 1, characterized in that, In step 3, the client supports programming languages ​​including C / C++ and Python. The client converts the inference input data into a byte array format and then sends it to the server. After receiving the byte array format output data returned by the server, the client converts it into a numerical array that matches the output dimension of the model.

8. A method for using DBus to call the computing power of RK3588 NPU according to claim 1, characterized in that, The server also includes a concurrent processing module, which uses a mutex lock mechanism to enable concurrent processing of multiple client requests, avoiding queuing of computing power calls caused by blocking of a single request.

9. A method for using DBus to call the computing power of RK3588 NPU according to claim 1, characterized in that, It also includes DBus permission configuration steps: by writing DBus system permission configuration files, different users can be configured to access the NPU computing power call interface, allowing specified ordinary users to call the NPU services in the system DBus bus.

10. A computer-readable storage medium having stored thereon computer program instructions executable by a processor, wherein when the processor executes the computer program instructions, it is able to implement the steps of the method as described in any one of claims 1-9.