Task processing method and device, electronic equipment and storage medium

By intercepting target computation functions and generating intent instructions, hardware parameters are optimized to cope with high-density computing tasks, solving the problem of insufficient throughput of computing tasks in electronic devices and achieving efficient improvement in computing performance and reduction in latency.

CN121277795BActive Publication Date: 2026-03-03INSPUR (SHANDONG) COMPUTER TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511831662.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-03-03
Estimated Expiration
2045-12-08

AI Technical Summary

Technical Problem

In the prior art, electronic devices suffer from poor throughput and cannot achieve maximum performance during computing tasks due to heat dissipation lag.

Method used

By intercepting target computation functions and generating intent instructions, the hardware parameters of electronic devices can be determined, hardware resources can be controlled to enter a high-performance state in advance, and heat dissipation and power consumption parameters can be optimized to cope with high-density computing tasks.

Benefits of technology

It significantly improves the throughput of computing tasks and reduces processing latency, overcomes the problem of decision lag, and ensures that hardware resources can respond instantly during high-density computing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121277795B_ABST
    Figure CN121277795B_ABST
Patent Text Reader

Abstract

The application relates to the computer field and provides a task processing method and device, electronic equipment and a storage medium. The method comprises the following steps: obtaining a processing task for the electronic equipment; the processing task comprises at least one calculation function; determining a target calculation function in the at least one calculation function and an interception function for the target calculation function; performing interception processing on the target calculation function based on the interception function; in response to the target calculation function being intercepted, generating an intention instruction for the target calculation function based on the target calculation function; determining a first hardware parameter for the electronic equipment based on the intention instruction; and controlling the electronic equipment to run based on the first hardware parameter and to call the target calculation function to perform calculation processing, so as to obtain a task processing result. The hardware resource can be triggered to enter a high-performance state in advance when a high-density calculation task is executed, the decision lag problem of the related art is overcome, the throughput of the calculation task is significantly improved, and the processing delay is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more particularly to a task processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the rapid development of artificial intelligence technology, tasks such as large-scale model inference place extremely stringent demands on the computing performance of electronic devices. To ensure efficient processing of these tasks, related technologies typically rely on the "temperature" of the electronic device to adjust its hardware parameters and guarantee throughput. For example, when the temperature of an electronic device rises, improving heat dissipation prevents the processor from being forced to throttle due to rapidly reaching its temperature limit. However, in practical applications, there is an unavoidable lag between the start of task computation, heat generation, conduction to sensors, and control system actions. This results in the system being unable to provide timely heat dissipation support, leading to poor throughput and preventing the system from reaching its maximum performance. Summary of the Invention

[0003] This application provides a task processing method, apparatus, electronic device, and storage medium to at least solve the above-mentioned technical problems existing in the prior art.

[0004] According to a first aspect of this application, a task processing method is provided, the method being applied to an electronic device, the method comprising:

[0005] Obtain a processing task for an electronic device; the processing task includes at least one computation function;

[0006] Determine the target computation function and the interception function for the target computation function in the at least one computation function; both the interception function and the target computation function include function signatures, and the function signature of the interception function is the same as the function signature of the target computation function;

[0007] Based on the interception function, the target computation function is intercepted; in response to the target computation function being intercepted, an intent instruction for the target computation function is generated based on the target computation function.

[0008] Based on the intent instruction, determine the first hardware parameters for the electronic device;

[0009] The control electronic device operates based on the first hardware parameters and calls the target calculation function to perform calculations and obtain the task processing results.

[0010] In one possible implementation, determining the target computation function among the at least one computation function and the interception function for the target computation function includes:

[0011] Obtain the percentage of time each calculation function consumes on the electronic device's processor during operation;

[0012] The computation function with the highest time consumption is selected as the target computation function in at least one computation function;

[0013] Based on the target calculation function and the preset interception logic code, an interception function is determined for the target calculation function.

[0014] In one possible implementation, before intercepting the target computation function based on the interception function, the method further includes:

[0015] Deploy the interception function in the target directory of the electronic device's operating system;

[0016] In response to a call instruction to the target computation function, the call instruction is redirected to an interceptor function deployed in the target directory.

[0017] In one possible implementation, generating intent instructions for the target computation function based on the target computation function includes:

[0018] Obtain the function name of the target calculation function and the expected performance level of the electronic device corresponding to the target calculation function;

[0019] Based on the function name and the desired performance level, generate intent instructions for the target computation function.

[0020] In one possible implementation, determining the first hardware parameter for the electronic device based on the intent instruction includes:

[0021] The intent instruction is parsed, and the first target index field is determined from the parsed intent instruction;

[0022] Based on the first target index field and the preset mapping relationship, a first hardware parameter for the electronic device is determined; wherein, the preset mapping relationship is used to characterize the correspondence between the target index field and the hardware parameter of the electronic device.

[0023] In one possible implementation, after the target calculation function is invoked for calculation processing, the method further includes:

[0024] Create a background thread for the interception function; the current state of the background thread is a sleeping state.

[0025] When the task processing result characterizes the target calculation function to complete the calculation, the current state of the background thread is adjusted from the sleeping state to the awakened state;

[0026] In response to the background thread being in a woken state, a computation end instruction is generated for the target computation function; the computation end instruction is used to release the hardware resources of the electronic device.

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

[0028] In response to the calculation end instruction, the calculation end instruction is parsed, and the second target index field is determined from the parsed calculation end instruction;

[0029] Based on the second target index field and the preset mapping relationship, a second hardware parameter for the electronic device is determined; wherein the second hardware parameter is less than the first hardware parameter.

[0030] The control electronics operate based on the second hardware parameters.

[0031] In one possible implementation, the first hardware parameters include heat dissipation parameters and power consumption parameters.

[0032] In one possible implementation, the interception function includes the function address of the target computation function, and the function address includes computation parameters for the target computation function; the step of calling the target computation function to perform computation processing includes:

[0033] The interception function calls the function address of the target calculation function, and passes the calculation parameters to the target calculation function.

[0034] Based on the calculation parameters, the target calculation function is invoked for calculation processing.

[0035] According to a second aspect of this application, a task processing apparatus is provided, the apparatus being applied to an electronic device, the apparatus comprising:

[0036] The first acquisition unit is used to acquire a processing task for an electronic device; the processing task includes at least one calculation function.

[0037] The first determining unit is configured to determine the target computation function and the intercepting function for the target computation function among the at least one computation function; both the intercepting function and the target computation function include function signatures, and the function signature of the intercepting function is the same as the function signature of the target computation function;

[0038] The first generation unit is configured to intercept the target computation function based on the interception function, and in response to the target computation function being intercepted, generate an intent instruction for the target computation function based on the target computation function.

[0039] The second determining unit is used to determine the first hardware parameters for the electronic device based on the intent instruction;

[0040] The first processing unit is used to control the electronic device to operate based on the first hardware parameters, and to call the target calculation function to perform calculation processing to obtain the task processing result.

[0041] In one possible implementation, the first determining unit is configured to obtain the time consumption percentage of each calculation function on the electronic device processor during the operation of the electronic device; select the calculation function with the largest time consumption percentage as the target calculation function among at least one calculation function; and determine an interception function for the target calculation function based on the target calculation function and a preset interception logic code.

[0042] In one possible embodiment, the device further includes:

[0043] The redirection unit is used to deploy the interception function in the target directory of the electronic device's operating system; in response to a call instruction for a target computation function, the unit redirects the call instruction to the interception function deployed in the target directory.

[0044] In one possible implementation, the first generation unit is configured to obtain the function name of the target calculation function and the expected performance level of the electronic device corresponding to the target calculation function; and generate an intent instruction for the target calculation function based on the function name and the expected performance level.

[0045] In one possible implementation, the second determining unit is configured to parse the intent instruction, determine a first target index field from the parsed intent instruction, and determine a first hardware parameter for the electronic device based on the first target index field and a preset mapping relationship; wherein the preset mapping relationship is used to characterize the correspondence between the target index field and the hardware parameter of the electronic device.

[0046] In one possible embodiment, the device further includes:

[0047] The second generation unit is used to create a background thread for the interception function; the current state of the background thread is a sleeping state; when the task processing result represents the completion of the target calculation function, the current state of the background thread is adjusted from the sleeping state to the awakened state; in response to the current state of the background thread being awakened, a calculation end instruction for the target calculation function is generated; the calculation end instruction is used to release the hardware resources of the electronic device.

[0048] In one possible embodiment, the device further includes:

[0049] The running unit is configured to respond to the calculation end instruction by parsing the calculation end instruction, determining a second target index field from the parsed calculation end instruction, determining a second hardware parameter for the electronic device based on the second target index field and a preset mapping relationship, wherein the second hardware parameter is less than the first hardware parameter, and controlling the electronic device to run based on the second hardware parameter.

[0050] In one possible implementation, the first hardware parameters include heat dissipation parameters and power consumption parameters.

[0051] In one embodiment, the interception function includes the function address of the target computation function, and the function address includes computation parameters for the target computation function; the first processing unit is configured to call the function address of the target computation function through the interception function, pass the computation parameters to the target computation function; and call the target computation function to perform computation processing based on the computation parameters.

[0052] According to a third aspect of this application, an electronic device is provided, comprising:

[0053] At least one processor; and a memory communicatively connected to said at least one processor; wherein,

[0054] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in this application.

[0055] According to a fourth aspect of this application, a non-transitory computer-readable storage medium is provided storing computer instructions for causing the computer to perform the methods described in this application.

[0056] In this application, a processing task for an electronic device is obtained; the processing task includes at least one computation function; a target computation function and an interception function for the target computation function are determined among the at least one computation function; both the interception function and the target computation function include function signatures, and the function signature of the interception function is the same as the function signature of the target computation function; the target computation function is intercepted based on the interception function; in response to the interception of the target computation function, an intent instruction for the target computation function is generated based on the target computation function; a first hardware parameter for the electronic device is determined based on the intent instruction; the electronic device is controlled to run based on the first hardware parameter and call the target computation function to perform computation processing to obtain a task processing result.

[0057] The proposed solution achieves the following beneficial effects: by intercepting the target computation function and determining its computational intent, the corresponding hardware parameters are determined based on its computational intent, and the target computation function is called to perform computation in the environment where the hardware parameters are deployed. This can trigger hardware resources to enter a high-performance state in advance when executing high-density computing tasks, overcome the decision lag problem of related technologies, significantly improve the throughput of computing tasks, and reduce processing latency.

[0058] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0059] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. Several embodiments of this application are illustrated in the drawings by way of example and not limitation, in which:

[0060] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts.

[0061] Figure 1 A schematic diagram illustrating the implementation flow of the task processing method according to an embodiment of this application is shown;

[0062] Figure 2 A schematic diagram of the composition structure of the task processing device according to an embodiment of this application is shown;

[0063] Figure 3 A schematic diagram of the composition structure of an electronic device according to an embodiment of this application is shown. Detailed Implementation

[0064] To make the objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0065] This application provides a task processing method, which is applied to an electronic device, such as... Figure 1 As shown, the method includes:

[0066] S101: Obtain a processing task for the electronic device; the processing task includes at least one computation function.

[0067] In this step, electronic devices include, but are not limited to, laptops, desktop computers, etc. The processing task is a computational task submitted by the user at the application layer based on actual needs. The completion of a processing task may utilize multiple (or different types of) computation functions, such as function A serving subtask 1 of the processing task, and function B serving subtask 2 of the processing task.

[0068] S102: Determine the target computation function and the interception function for the target computation function in the at least one computation function; both the interception function and the target computation function include function signatures, and the function signature of the interception function is the same as the function signature of the target computation function.

[0069] In this step, the target computation function is the one with the highest resource requirements of the electronic device among multiple computation functions. The interception function is used to intercept the target computation function, so that it is temporarily not called. The target computation function can be determined by using performance analysis tools, such as Nsight Systems, to hook the driver layer API (Application Programming Interface) and read hardware performance counters, thereby performing performance profiling on each computation function. The interception function can be compiled from the source code containing the interception logic and the function signature of the intercepted object—the target computation function. In a specific embodiment, a standard Linux platform compilation toolchain (such as GCC / G++) can be used to compile the source code containing the interception logic and the function signature of the target computation function into a dynamic link library file by adding the -fPIC (generate position-independent code) and -shared (generate shared library) compilation parameters. The interception function is included in this dynamic link library file.

[0070] S103: Based on the interception function, the target calculation function is intercepted; in response to the target calculation function being intercepted, an intent instruction for the target calculation function is generated based on the target calculation function.

[0071] In this step, the target computation function is intercepted using interception logic (which can be pre-written by the user), preventing it from being executed immediately. After successfully intercepting the target computation function, processing is performed based on it, transforming the impending high-density computation into a structured, machine-parseable intent signal. This intent signal is then transmitted to the lower system layer, where it pre-adjusts the hardware parameters (resources) of the electronic device according to the computation intent, maximizing the throughput and optimizing the performance of the target computation function.

[0072] In this embodiment, the intent instruction can be understood as a "computation preparation instruction," which includes the following fields: signal_type, timestamp_ns, source_pid, intercepted_function, and performance_target, all in JSON format. The signal_type field is a string field used to explicitly identify the purpose of the instruction. For example, a value of "PREPARE" indicates that the instruction is used for computation preparation. The timestamp_ns field is an integer field used to record the nanosecond-level high-precision timestamp when the instruction was generated, facilitating performance analysis and timeout judgment. The source_pid field is an integer field used to record the process ID of the application sending the instruction within the container (currently, applications are often deployed using container technology; in this article, the container can be understood as the application's runtime environment). The intercepted_function field is a string field used to record the name of the intercepted target computation function. The performance_target field is a string field used to convey the desired performance tuning level, such as the highest level, the second highest level, etc., to the daemon process (a background service process that runs continuously with high privileges on the host operating system of the electronic device, responsible for overall hardware resource control and instruction sending and receiving in this embodiment). This field allows the daemon to load different hardware allocation strategies based on different expected requirements.

[0073] The dynamically linked library file generated during compilation, as mentioned in the previous explanation of step S102, is deployed to a specific path (directory) on the host operating system. This directory is then mapped into the container's internal space via the application container's volume mounting mechanism, allowing access by applications within the container. The dynamically linked library file includes at least one pseudo-function. After the intent instruction is constructed, the pseudo-function in the dynamically linked library file sends the intent instruction to the daemon process by performing the following operations:

[0074] 1. Establish a communication connection: Call the standard Socket API (Socket Application Programming Interface) to connect to the UNIX domain socket file visible within the container. UNIX domain sockets, as a kernel-level inter-process communication mechanism, do not transmit data through the network protocol stack, and have the characteristics of low latency and high throughput, making them suitable for the high-performance instruction transmission scenario required in this embodiment.

[0075] 2. Serialization and Sending: Serialize the JSON-formatted intent command constructed above into a UTF-8 encoded string, and send the string out from the container through the established Socket connection by calling the send() function.

[0076] 3. Closing the connection: In this embodiment, command transmission adopts a short connection mode. After the command is sent, the close() function is called immediately to close the socket connection in order to quickly release system resources.

[0077] It is understandable that a strict isolation layer exists between applications and the host operating system and hardware. Related technologies operate entirely at the host level, unable to perceive the computational phase of a specific application within the application container. Any traditional method attempting to establish communication between the two, such as modifying application source code or the operating system kernel, is impractical due to its high invasiveness, high maintenance costs, and disruption of standard container images. This embodiment, however, intercepts and establishes cross-isolation environment communication mechanisms through dynamic link libraries, enabling the interception of computational intent across container isolation without modifying application source code, container images, or the operating system kernel. This addresses the core pain points of traditional solutions in containerized environments: high deployment costs and strong invasiveness.

[0078] S104: Based on the intent instruction, determine the first hardware parameters for the electronic device.

[0079] In this step, the daemon process, within its main loop, asynchronously and non-blockingly listens to the UNIX domain socket established in step S103 using standard I / O multiplexing mechanisms. When a new connection request arrives, the daemon process accepts the connection and reads the data stream, i.e., the intent instruction, from the socket. Since short-connection mode is used for instruction transmission, the connection is immediately closed after the data is read. The daemon process parses the intent instruction and determines a set of explicit, executable low-level hardware control actions based on the parsed instruction content. These hardware control actions consist of multiple sets of (first) hardware parameters.

[0080] In one specific embodiment, the (first) hardware parameters for the electronic device can be determined from the instruction-action mapping policy library based on the parsed instruction content. The instruction-action mapping policy library defines the mapping relationship between different intent instructions and specific hardware action policies. Under each policy, a list of actions to be executed in response to intent signaling is defined. Each action in the list clearly indicates the target hardware, the action execution command, and the specific hardware parameters. In this embodiment, the policy library is implemented as a YAML format configuration file located in the host file system. The YAML format is used because of its high human readability and structured expression capabilities, making it easy for system administrators to view and customize according to actual needs. When the daemon process starts, it fully reads the YAML configuration file, parses it, and loads it into a high-efficiency query data structure in memory. After successfully parsing the intent instruction, the daemon process quickly finds the corresponding hardware parameters of the electronic device in the policy data structure in memory based on the parsed instruction content.

[0081] S105: Control the electronic device to operate based on the first hardware parameters, and call the target calculation function to perform calculation processing to obtain the task processing result.

[0082] In this step, after obtaining the action list, the daemon process iterates through the list and assigns it to the corresponding hardware control interface based on the target hardware, execution command, and hardware parameters defined in each action. To ensure real-time control, control commands for different hardware are issued in parallel.

[0083] Taking power consumption and heat dissipation as examples of hardware parameters, the steps for an electronic device to operate based on the first hardware parameter are explained:

[0084] Regarding power consumption parameters, this is specifically handled through an interface implemented within the daemon process that interacts with the operating system kernel's virtual file system. The daemon process, based on the relevant definitions in the policy, calls its internal functions to open the power control node file specified in the action list and writes the instantaneous power consumption limit value defined in the power consumption parameters to that file. This file write operation is immediately captured and activated by the kernel power management module, with a latency on the order of microseconds. This ensures that the power limit is lifted before the high-density computing task (target computation function) begins. This achieves a temporary, brief increase in the instantaneous power consumption limit of the electronic device's processor, providing sufficient power budget for the upcoming high-density computing task.

[0085] For heat dissipation parameters, this is specifically accomplished through out-of-band communication with the server's BMC (Baseboard Management Controller). The preferred communication protocol is the industry-standard IPMI (Intelligent Platform Management Interface). The daemon process calls its internal functions according to the relevant definitions in the policy. This function constructs an IPMI raw command, whose network function code, command code, and data field values ​​are all provided by the action list. This command is sent to the BMC. Upon receiving the command, the BMC immediately switches the fan control logic from "automatic temperature control mode" to "manual mode" and drives the fan according to the heat dissipation parameters specified in the command, such as the PWM (Pulse Width Modulation) duty cycle. This operation latency is typically in the millisecond range, ensuring that the cooling system is already in a high-intensity working state before a significant accumulation of computational heat. This forces the cooling fan to instantly increase its speed to a high level, creating sufficient heat dissipation margin in advance.

[0086] By executing these parallel steps with precise targeting of different hardware parameters, this step enables proactive optimization of the electronic device's hardware environment before the core phase of high-density computing tasks arrives. This allows the device to instantly switch from its normal operating state to a high-performance state ready to handle extreme performance. Calling the target computation function at this point maximizes its throughput and yields the best possible task processing results.

[0087] The scheme shown in steps S101-S105 involves obtaining a processing task for an electronic device; the processing task includes at least one computation function; determining a target computation function and an interception function for the target computation function; both the interception function and the target computation function include function signatures, and the function signature of the interception function is the same as that of the target computation function; intercepting the target computation function based on the interception function; generating an intent instruction for the target computation function based on the target computation function in response to the interception; determining first hardware parameters for the electronic device based on the intent instruction; controlling the electronic device to run based on the first hardware parameters and calling the target computation function for computation processing to obtain the task processing result. This embodiment of the application, by intercepting the target computation function and determining its computation intent, thereby determining the corresponding hardware parameters based on its computation intent, and calling the target computation function for computation in the environment of hardware parameter deployment, can trigger hardware resources to enter a high-performance state in advance when executing high-density computation tasks, overcoming the decision lag problem of related technologies, significantly improving the throughput of computation tasks and reducing processing latency.

[0088] In some alternative solutions, determining the target computation function among the at least one computation function and the interception function for the target computation function includes:

[0089] Obtain the percentage of time each calculation function consumes on the electronic device's processor during operation;

[0090] The computation function with the highest time consumption is selected as the target computation function in at least one computation function;

[0091] Based on the target calculation function and the preset interception logic code, an interception function is determined for the target calculation function.

[0092] In this application, among at least one computation function, there are computation functions with low resource consumption and those with high resource consumption. For most high-density computing tasks, their computational load typically follows the Pareto principle, meaning that the vast majority of computation time is consumed by a few core computation functions. Therefore, to ensure the maximum throughput of the processing task, it is necessary to ensure the maximum performance of the core computation functions in the processing task when they are called. This avoids blind optimization and allows optimization work to be focused on the key functions that have the greatest impact on performance, thereby achieving optimal resource allocation. The core computation function is the target computation function in the embodiments of this application. In a specific embodiment, the target computation function can be obtained by performing a one-time offline performance profiling of each computation function using the official performance analysis tool provided by the vendor. Specifically, the performance analysis tool analyzes the CPU (Central Processing Unit) and GPU (Graphics Processing Unit) time consumption ratio of each computation function during the operation of the electronic device's application, and the computation function with the largest time consumption ratio is selected as the target computation function. For example, analyzing a large language model inference task based on the Transformer architecture reveals that over 90% of GPU computation time is concentrated on a few computation functions that perform general matrix multiplication. Therefore, these general matrix multiplication functions are designated as the target computation functions. The number of target computation functions can be one or more.

[0093] As mentioned above, the function signature of the interception function is the same as the function signature of the target computation function. The interception logic can be obtained by programmers writing and uploading it. By compiling the preset interception logic and the function signature of the target computation function to be intercepted, an interception function for the target computation function can be obtained. This interception function can be used to effectively intercept the target computation function.

[0094] In some alternative solutions, before intercepting the target computation function based on the interception function, the method further includes:

[0095] Deploy the interception function in the target directory of the electronic device's operating system;

[0096] In response to a call instruction to the target computation function, the call instruction is redirected to an interceptor function deployed in the target directory.

[0097] As described above, the interceptor function is deployed in the target directory of the operating system. When the container for the target computation function is started, i.e., when the target computation function is about to be called, it is declared through an environment variable parameter. This environment variable instructs the dynamic linker inside the container to prioritize loading the dynamic link library file containing the interceptor function in the target directory of this embodiment before loading any other libraries. Since the dynamic link library file is loaded first, the interceptor function defined in it with the same function signature as the target computation function will be preferentially registered in the process symbol table. When the upper-layer application calls the target computation function, the dynamic linker transparently redirects the call to this interceptor function, thereby achieving interception. This achieves the successful setting of a reliable, non-intrusive awareness probe (interceptor function) in the application runtime context to capture high-density target computation functions without modifying the application source code or rebuilding the container image.

[0098] In some alternative solutions, generating intent instructions for the target computation function based on the target computation function includes:

[0099] Obtain the function name of the target calculation function and the expected performance level of the electronic device corresponding to the target calculation function;

[0100] Based on the function name and the desired performance level, generate intent instructions for the target computation function.

[0101] In this application, as described above, the intent instruction includes the function name of the target computation function and the expected performance level required to process the target computation function. The expected performance level can be pre-defined by the customer according to actual needs, or it can be based on the CPU and GPU resource usage of the target computation function, using its corresponding empirical performance level as the expected performance level. The function name of the target computation function can be obtained when the target computation function is determined. Taking the function name of the target computation function as A and the expected performance level as EXTREME_TURBO (a more aggressive level than the normal level) as an example, the intent instruction can be in the following form:

[0102] {

[0103] "intercepted_function": "A",

[0104] "performance_target": "EXTREME_TURBO"

[0105] }

[0106] It can translate function-level performance requirements into machine-readable intent instructions, providing data support for determining hardware parameters based on these intent instructions.

[0107] In some alternative solutions, determining the first hardware parameters for the electronic device based on the intent instruction includes:

[0108] The intent instruction is parsed, and the first target index field is determined from the parsed intent instruction;

[0109] Based on the first target index field and the preset mapping relationship, a first hardware parameter for the electronic device is determined; wherein, the preset mapping relationship is used to characterize the correspondence between the target index field and the hardware parameter of the electronic device.

[0110] In this application, the daemon process reads the intent instruction as a UTF-8 encoded JSON string. It calls an embedded high-performance JSON parsing library to deserialize the string into a data structure in memory and verifies the integrity of the data structure to obtain the parsed intent instruction. Then, it extracts core fields from the intent instruction, such as signal_type (e.g., "PREPARE") and performance_target (e.g., "EXTREME_TURBO"). These core fields are used as the (first) target index, and the first hardware parameter is determined from a preset mapping relationship (such as the aforementioned instruction-action mapping strategy library). This mapping relationship includes different indices and their corresponding hardware parameters. For example, when signal_type is "PREPARE" and performance_target is "EXTREME_TURBO", the corresponding hardware parameter is A. A can be a set of parameters, including parameters related to different hardware, such as fan parameters (wind speed, airflow), voltage parameters, current parameters, etc. This embodiment maps abstract intent instructions to a set of specific, parallel-executable hardware parameters through a set of externally configurable mapping relationships. This decoupled design separates hardware control strategies from business application logic, giving the system high flexibility, scalability, and cross-hardware platform adaptability.

[0111] In some alternative implementations, after the target computation function is invoked for computation, the method further includes:

[0112] Create a background thread for the interception function; the current state of the background thread is a sleeping state.

[0113] When the task processing result characterizes the target calculation function to complete the calculation, the current state of the background thread is adjusted from the sleeping state to the awakened state;

[0114] In response to the background thread being in a woken state, a computation end instruction is generated for the target computation function; the computation end instruction is used to release the hardware resources of the electronic device.

[0115] In this application, considering that some target computation functions may be executed on the GPU, and given the asynchronous execution characteristics of modern GPU computing, the return of a function call on the CPU side does not necessarily indicate that the computation task on the GPU side has been completed. Therefore, a reliable mechanism is needed to synchronize the GPU's execution status to ensure subsequent resource reclamation. To accurately monitor the completion of GPU computation tasks, this embodiment inserts event markers into the GPU execution flow via API and obtains the GPU's execution progress by querying the event status. Specifically, before calling the target computation function, the intercepting function creates two event objects, such as start_event and end_event. The event markers and target computation function call instructions are submitted sequentially to the same data stream in the order of start_event - call to target computation function - end_event, and the GPU will strictly execute the command queue in this order. Therefore, when end_event is marked as "completed" by the GPU, it can be definitively stated that all target computation functions preceding it have been executed.

[0116] Meanwhile, to avoid blocking the main computing thread of the upper-layer application while waiting for the GPU to complete, the monitoring and waiting logic in this embodiment is executed in an independent background thread created and separated from the interception function. Specifically, after submitting all GPU instructions and returning from the target computing function call, the interception function immediately creates a new CPU background thread and separates it. The core purpose of this background thread is to execute blocking calls, which cause the background thread to enter an efficient sleep state until the GPU hardware actually completes the task marked by end_event, at which point it will be awakened by the operating system kernel. In other words, the moment when end_event is marked as "completed" by the GPU is the moment when the background thread is awakened, which is the precise moment when the target computing function completes. At the same time, after the background thread is created, the aforementioned main computing thread immediately returns from the interception function and continues to execute subsequent CPU tasks, completely unaffected by the GPU's time-consuming calculations and background monitoring logic. This implements an accurate and reliable GPU computing completion status monitor, providing crucial status input for triggering the computing completion signal and driving resource reclamation at the appropriate time, ensuring the timing accuracy and integrity of the entire control loop.

[0117] In response to the background thread being in an awakened state, a computation end command is generated for the target computation function. All operations in this step are executed by the background thread, ensuring that the generation and sending of the command do not cause any blocking or performance interference to the main computation thread of the upper-layer application. The computation end command is used to notify the daemon process that the active pre-provisioning phase has ended and that hardware resources should be restored to normal management mode. Specifically, this command is triggered by the return of the `end_event` related function call running within the background thread, with the triggering time precisely corresponding to the time point when the GPU completes all relevant computation functions. Echoing the aforementioned intent commands, this embodiment also uses JSON format to construct the computation end command to ensure system consistency. The computation end command includes the following fields: `signal_type`, `timestamp_ns`, `source_pid` (the value of this field is consistent with the value of this field in the aforementioned intent commands), and `intercepted_function`, all of which are in JSON format. For the data types and meanings of each field, please refer to the aforementioned description of intent commands. Furthermore, the sending of the computation end command is also described in the aforementioned description of the intent command sending process, and will not be repeated here.

[0118] In some alternative solutions, the method further includes:

[0119] In response to the calculation end instruction, the calculation end instruction is parsed, and the second target index field is determined from the parsed calculation end instruction;

[0120] Based on the second target index field and the preset mapping relationship, a second hardware parameter for the electronic device is determined; wherein the second hardware parameter is less than the first hardware parameter.

[0121] The control electronics operate based on the second hardware parameters.

[0122] In this application, similar to the aforementioned description of intent instructions, after the computation end instruction is issued, the daemon process receives and parses the computation end instruction through the listening socket, extracts core fields such as signal_type from the parsed computation end instruction, uses the core fields as the (second) target index, and uses this target index to determine the second hardware parameters from a preset mapping relationship (such as the aforementioned instruction-action mapping strategy library). This mapping relationship includes different indices and their corresponding hardware parameters. It should be noted that the second hardware parameter is smaller than the first hardware parameter. It can be understood that the first hardware parameter is the hardware parameter when the electronic device provides maximum performance for the processing of the target computation function, and the second hardware parameter is the hardware parameter of the electronic device by default. Under normal circumstances, in order to save the power consumption of the electronic device and improve its battery life, the default hardware parameters of the electronic device are small and insufficient to maximize the potential of each hardware component. Here, we still take the heat dissipation parameter and power consumption parameter as examples for explanation. After determining the second hardware parameter, the steps for the electronic device to run based on the second hardware parameter are explained:

[0123] Regarding power consumption parameters, the daemon process, based on the relevant definitions in the policy, calls its internal functions to write the default power consumption value defined in the second hardware parameter back to the same power control node file. This operation takes effect immediately, returning processor power management to the default logic of the operating system and firmware. This restores the processor's instantaneous power consumption limit from the temporarily increased peak value to the default safe value that conforms to the thermal design power specification.

[0124] Regarding heat dissipation parameters, the daemon calls its internal functions according to the relevant definitions in the policy, constructs and sends an IPMI raw command (whose network function code, command code, and data fields are used to indicate exiting manual mode and resuming automatic control). Upon receiving this command, the BMC immediately takes over fan control according to its preset heat dissipation control strategy and smoothly adjusts the fan speed to a level that matches economy and safety based on the second hardware parameters or the system's real-time thermal status. This achieves the restoration of the cooling fan from a forced manual high-speed mode to an automatic temperature control mode led by the BMC and based on the second hardware parameters or real-time temperature sensor feedback.

[0125] This ensures that after each high-density processing task is completed, all temporarily allocated hardware resources can be instantly and reliably restored to their standard operating state. This not only completes the performance improvement loop of the entire computing process but also guarantees that the proactive performance enhancement mechanism in this embodiment always operates within the inherent security framework of the electronic device server, thereby achieving a balance between high performance and high reliability.

[0126] In some alternative solutions, the first hardware parameters include heat dissipation parameters and power consumption parameters.

[0127] In this application, the hardware parameters (first hardware parameters and second hardware parameters) include heat dissipation parameters and power consumption parameters. Among them, heat dissipation parameters include fan speed, air outlet size, fan blade opening angle, etc.; power consumption parameters include voltage, current, capacitor size, clock speed, etc.

[0128] In some alternative solutions, the interception function includes the function address of the target computation function, and the function address includes computation parameters for the target computation function; the step of calling the target computation function to perform computation processing includes:

[0129] The interception function calls the function address of the target calculation function, and passes the calculation parameters to the target calculation function.

[0130] Based on the calculation parameters, the target calculation function is invoked for calculation processing.

[0131] In this application, the interception function includes the function address of the target computation function, and the function address includes the computation parameters for the target computation function. When the target computation function is called for computation processing, the interception function immediately executes its core transfer operation. It passes all computation parameters (such as handles, matrix dimensions, pointers, etc.) passed by the upper-layer application to the original, real target computation function intact by calling the original function address (the function address of the target computation function) obtained and saved during the interception phase. This process ensures the correct execution of the computation task while remaining completely transparent to the application. When calling some target computation functions executed by the GPU, the CPU submits the computation instructions and computation parameters to the GPU's command queue. This submission process is extremely short (usually in the microsecond range), and the CPU call then returns quickly. The actual computation processing of the target computation function, which takes hundreds of milliseconds, is executed independently and asynchronously on the GPU hardware. There is a time window of hundreds of milliseconds between the CPU issuing the computation instruction and the GPU finally completing the computation. During this window, the aforementioned hardware parameter pre-tuning actions (such as increasing the power consumption limit and fan speed) are performed in complete parallel time with the actual computing tasks of the GPU, which can maximize computing efficiency.

[0132] Since the first hardware parameters have been pre-delivered and are in effect, when the GPU begins executing high-density target computation functions, it is already in a proactively optimized hardware environment, including:

[0133] Ample power budget: The temporarily increased upper limit of processor power consumption allows the GPU to run at its highest boost frequency continuously throughout the entire computing cycle without having to throttle due to hitting the default power limit.

[0134] Ample heat dissipation margin: The high-speed cooling mode, which is activated in advance, effectively suppresses the accumulation of chip temperature caused by computational heat generation, and avoids the GPU from triggering thermal throttling due to excessive temperature.

[0135] By employing the above methods, this application ensures that the core processing tasks of the application can be executed in a hardware environment where peak performance can be fully unleashed, thereby directly and effectively shortening the overall time of a single inference or computation task and achieving a significant performance improvement.

[0136] This application also provides a task processing device, which is applied to an electronic device, such as... Figure 2 As shown, the device includes:

[0137] The first acquisition unit 201 is used to acquire a processing task for an electronic device; the processing task includes at least one calculation function.

[0138] The first determining unit 202 is used to determine the target computation function and the intercepting function for the target computation function among the at least one computation function; both the intercepting function and the target computation function include function signatures, and the function signature of the intercepting function is the same as the function signature of the target computation function;

[0139] The first generation unit 203 is configured to intercept the target calculation function based on the interception function, and in response to the target calculation function being intercepted, generate an intent instruction for the target calculation function based on the target calculation function.

[0140] The second determining unit 204 is used to determine the first hardware parameters for the electronic device based on the intent instruction;

[0141] The first processing unit 205 is used to control the electronic device to run based on the first hardware parameters, and to call the target calculation function to perform calculation processing to obtain the task processing result.

[0142] In some optional solutions, the first determining unit 202 is used to obtain the proportion of time consumed by each calculation function on the electronic device processor during the operation of the electronic device; to take the calculation function with the largest proportion of time consumption as the target calculation function among at least one calculation function; and to determine the interception function for the target calculation function based on the target calculation function and the preset interception logic code.

[0143] In some alternative solutions, the device also includes:

[0144] The redirection unit is used to deploy the interception function in the target directory of the electronic device's operating system; in response to a call instruction for a target computation function, the unit redirects the call instruction to the interception function deployed in the target directory.

[0145] In some alternative solutions, the first generation unit 203 is used to obtain the function name of the target calculation function and the expected performance level of the electronic device corresponding to the target calculation function; and generate an intent instruction for the target calculation function based on the function name and the expected performance level.

[0146] In some alternative solutions, the second determining unit 204 is used to parse the intent instruction, determine a first target index field from the parsed intent instruction, and determine a first hardware parameter for the electronic device based on the first target index field and a preset mapping relationship; wherein the preset mapping relationship is used to characterize the correspondence between the target index field and the hardware parameter of the electronic device.

[0147] In some alternative embodiments, the device further includes:

[0148] The second generation unit is used to create a background thread for the interception function; the current state of the background thread is a sleeping state; when the task processing result represents the completion of the target calculation function, the current state of the background thread is adjusted from the sleeping state to the awakened state; in response to the current state of the background thread being awakened, a calculation end instruction for the target calculation function is generated; the calculation end instruction is used to release the hardware resources of the electronic device.

[0149] In some alternative embodiments, the device further includes:

[0150] The running unit is configured to respond to the calculation end instruction by parsing the calculation end instruction, determining a second target index field from the parsed calculation end instruction, determining a second hardware parameter for the electronic device based on the second target index field and a preset mapping relationship, wherein the second hardware parameter is less than the first hardware parameter, and controlling the electronic device to run based on the second hardware parameter.

[0151] In some alternative solutions, the first hardware parameters include heat dissipation parameters and power consumption parameters.

[0152] In some alternative solutions, the interception function includes the function address of the target computation function, and the function address includes computation parameters for the target computation function; the first processing unit 205 is used to call the function address of the target computation function through the interception function, pass the computation parameters to the target computation function; and call the target computation function to perform computation processing based on the computation parameters.

[0153] It should be noted that the task processing device in this application embodiment is similar in principle to the aforementioned task processing method in solving the problem. Therefore, the implementation process, implementation principle, and beneficial effects of the task processing device can be found in the description of the implementation process, implementation principle, and beneficial effects of the aforementioned method. Repeated descriptions will not be repeated.

[0154] According to embodiments of this application, this application also provides an electronic device and a readable storage medium.

[0155] Figure 3 A schematic block diagram of an example electronic device 300 that can be used to implement embodiments of this application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.

[0156] like Figure 3 As shown, the electronic device 300 includes a computing unit 301, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 302 or a computer program loaded from a storage unit 308 into a random access memory (RAM) 303. The RAM 303 may also store various programs and data required for the operation of the electronic device 300. The computing unit 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0157] Multiple components in electronic device 300 are connected to I / O interface 305, including: input unit 306, such as keyboard, mouse, etc.; output unit 307, such as various types of displays, speakers, etc.; storage unit 308, such as disk, optical disk, etc.; and communication unit 309, such as network card, modem, wireless transceiver, etc. Communication unit 309 allows electronic device 300 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0158] The computing unit 301 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 301 performs the various methods and processes described above, such as task processing methods. For example, in some embodiments, the task processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 308. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 300 via ROM 302 and / or communication unit 309. When the computer program is loaded into RAM 303 and executed by the computing unit 301, one or more steps of the task processing method described above may be performed. Alternatively, in other embodiments, the computing unit 301 may be configured to perform task processing methods by any other suitable means (e.g., by means of firmware).

[0159] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.

[0160] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0161] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0162] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0163] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0164] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0165] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.

[0166] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.

[0167] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A task processing method characterized by, The method is applied to an electronic device, and the method comprises: obtaining a processing task for the electronic device; the processing task comprises at least one computing function; determining a target computing function in the at least one computing function and an interception function for the target computing function; the interception function and the target computing function each comprise a function signature, and the function signature of the interception function is the same as the function signature of the target computing function; intercepting the target computing function based on the interception function, and in response to the target computing function being intercepted, generating an intent instruction for the target computing function based on the target computing function; determining a first hardware parameter for the electronic device based on the intent instruction; controlling the electronic device to run based on the first hardware parameter and to perform computing processing by calling the target computing function to obtain a task processing result; wherein the generating of the intent instruction for the target computing function based on the target computing function comprises: obtaining a function name of the target computing function and an expected performance level of the electronic device corresponding to the target computing function; generating the intent instruction for the target computing function based on the function name and the expected performance level; the determining of the first hardware parameter for the electronic device based on the intent instruction comprises: parsing the intent instruction to determine a first target index field from the parsed intent instruction; determining the first hardware parameter for the electronic device based on the first target index field and a preset mapping relationship; the preset mapping relationship is used to represent a corresponding relationship between a target index field and a hardware parameter of the electronic device.

2. The method of claim 1, wherein, The determining of the target computing function in the at least one computing function and the interception function for the target computing function comprises: obtaining a time consumption proportion of each computing function to a processor of the electronic device in an operation process of the electronic device; taking a computing function with the largest time consumption proportion as the target computing function in the at least one computing function; determining the interception function for the target computing function based on the target computing function and a preset interception logic code.

3. The method according to claim 1 or 2, characterized in that, Before the intercepting of the target computing function based on the interception function, the method further comprises: deploying the interception function under a target directory of an operating system of the electronic device; in response to a calling instruction of the target computing function, redirecting the calling instruction to the interception function deployed under the target directory.

4. The method of claim 1, wherein, After the calling of the target computing function for computing processing, the method further comprises: creating a background thread for the interception function; a current state of the background thread is a dormant state; when the task processing result indicates that the target computing function is calculated, adjusting the current state of the background thread from the dormant state to a wake-up state; in response to the current state of the background thread being the wake-up state, generating a calculation end instruction for the target computing function; the calculation end instruction is used to release a hardware resource of the electronic device.

5. The method of claim 4, wherein, The method further comprises: In response to the calculation end instruction, the calculation end instruction is parsed, and a second target index field is determined from the parsed calculation end instruction; Based on the second target index field and a preset mapping relationship, a second hardware parameter for the electronic device is determined; wherein the second hardware parameter is less than the first hardware parameter; The electronic device is controlled to run based on the second hardware parameter.

6. The method of claim 1, wherein, The first hardware parameter includes a heat dissipation parameter and a power consumption parameter.

7. The method of claim 1, wherein, The interception function includes a function address of the target calculation function, and the function address includes a calculation parameter for the target calculation function; the calculation processing of the target calculation function includes: The calculation parameter is passed to the target calculation function through the function address of the target calculation function called by the interception function; Based on the calculation parameter, the target calculation function is called for calculation processing.

8. A task processing apparatus characterized by comprising: The device is applied to an electronic device, and the device includes: A first acquisition unit is configured to acquire a processing task for an electronic device; the processing task includes at least one calculation function; A first determination unit is configured to determine a target calculation function in the at least one calculation function and an interception function for the target calculation function; the interception function and the target calculation function both include a function signature, and the function signature of the interception function is the same as the function signature of the target calculation function; A first generation unit is configured to intercept the target calculation function based on the interception function, and in response to the target calculation function being intercepted, generate an intent instruction for the target calculation function based on the target calculation function; A second determination unit is configured to determine a first hardware parameter for the electronic device based on the intent instruction; A first processing unit is configured to control the electronic device to run based on the first hardware parameter, and to call the target calculation function for calculation processing to obtain a task processing result; The first generation unit is configured to acquire a function name of the target calculation function and an expected performance level of the electronic device corresponding to the target calculation function; and generate an intent instruction for the target calculation function based on the function name and the expected performance level; The second determination unit is configured to parse the intent instruction, determine a first target index field from the parsed intent instruction, and determine a first hardware parameter for the electronic device based on the first target index field and a preset mapping relationship; wherein the preset mapping relationship represents a correspondence between the target index field and the hardware parameter of the electronic device.

9. The apparatus of claim 8, wherein, The first determination unit is configured to acquire a time consumption proportion of each calculation function to a processor of the electronic device during running of the electronic device; and determine a calculation function with the largest time consumption proportion as the target calculation function in the at least one calculation function; Based on the target calculation function and a preset interception logic code, an interception function for the target calculation function is determined.

10. The apparatus of claim 8 or 9, wherein, The device further includes: The redirection unit is configured to deploy the intercept function under a target directory of an operating system of the electronic device, and to redirect a calling instruction of the target computing function to the intercept function deployed under the target directory in response to the calling instruction.

11. The apparatus of claim 8, wherein, The apparatus further includes: The second generation unit is configured to create a background thread for the intercept function, and the current state of the background thread is a sleep state. When the task processing result represents that the target computing function is calculated, the current state of the background thread is adjusted from the sleep state to a wake-up state. In response to the current state of the background thread being the wake-up state, a calculation end instruction for the target computing function is generated. The calculation end instruction is used to release a hardware resource of the electronic device.

12. The apparatus of claim 11, wherein, The apparatus further includes: The running unit is configured to parse the calculation end instruction in response to the calculation end instruction, to determine a second target index field from the parsed calculation end instruction, to determine a second hardware parameter for the electronic device based on the second target index field and a preset mapping relationship, and to control the electronic device to run based on the second hardware parameter. The second hardware parameter is smaller than the first hardware parameter.

13. The apparatus of claim 8, wherein, The first hardware parameter includes a heat dissipation parameter and a power consumption parameter.

14. The apparatus of claim 8, wherein, The intercept function includes a function address of the target computing function, and the function address includes a calculation parameter for the target computing function. The first processing unit is configured to call the function address of the target computing function through the intercept function, to pass the calculation parameter to the target computing function, and to call the target computing function for calculation processing based on the calculation parameter.

15. An electronic device, comprising: The apparatus includes: at least one processor; and a memory connected with the at least one processor in communication. Wherein The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of any one of claims 1-7.

16. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to execute the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Time migration method and device

    CN112416473A

  • Interception of a function call, selecting a function from available functions and rerouting the function call

    US20170277551A1