Resource scheduling method, electronic device, storage medium, and computer program product
By storing resource data in the GPU's on-chip memory and accessing it directly, the problem of GPUs being unable to perform efficient rendering is solved, thus improving the GPU's processing performance and efficiency.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2025-12-02
- Publication Date
- 2026-07-16
AI Technical Summary
As the application scenarios for graphics processing units (GPUs) become increasingly diverse and data processing demands increase, existing technologies are unable to meet the needs of efficient rendering, resulting in limited rendering speed and reduced GPU processing power and efficiency.
By storing resource data in the GPU's on-chip memory and retrieving it directly when needed, the information storage and retrieval mechanism is optimized, avoiding the latency of obtaining resource data from external storage media.
It improves GPU processing performance and resource data utilization, reduces waiting time during rendering, and enhances data processing speed and efficiency.
Smart Images

Figure CN2025139375_16072026_PF_FP_ABST
Abstract
Description
Resource scheduling methods, electronic devices, storage media, and computer program products
[0001] This application claims priority to Chinese patent application filed on January 13, 2025 with the State Intellectual Property Office of China, application number 202510061287.7, entitled "Resource Scheduling Method, Electronic Device, Storage Medium and Computer Program Product", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of terminal technology, and more specifically, to a resource scheduling method, electronic device, storage medium, and computer program product. Background Technology
[0003] With the development of terminal technology, the application scenarios of graphics processing units (GPUs) are becoming increasingly diverse. For example, GPUs are used in fields such as image rendering, machine learning, communications, virtual reality, and augmented reality.
[0004] However, with the increasing demand for data processing, such as image processing, the GPU's resource allocation and data processing capabilities have gradually become unable to meet the needs of efficient rendering, resulting in limited rendering speed and reduced GPU's data processing capabilities and efficiency. Summary of the Invention
[0005] This application provides a resource scheduling method, electronic device, storage medium, and computer program product, which can be used to improve the data processing capabilities and efficiency of a GPU. The technical solution is as follows:
[0006] Firstly, a resource scheduling method is provided for use in electronic devices, the method comprising:
[0007] In response to a scenario-triggered operation, determine the type of application scenario to be processed;
[0008] When the type of the application scenario to be processed is the target scenario type, the target resource data required for scenario processing is read from the on-chip memory. The on-chip memory is the memory set in the graphics processing unit (GPU). The target resource data is resource data that is persistently stored in the on-chip memory. The application scenario of the target scenario type requires the GPU's data processing capability to meet the preset performance conditions.
[0009] If the type of the application scenario to be processed is not the same as the type of the target scenario, the target resource data will not be invoked.
[0010] It should be noted that the preset performance conditions can be conditions that place high demands on the data processing capabilities of the GPU, and these preset performance conditions can be set in advance according to requirements. For example, the preset performance conditions can be GPU-related conditions, and / or, the preset performance conditions can be rendering-related conditions, etc.
[0011] Thus, because the GPU stores some resource data in its on-chip memory, the information storage and retrieval mechanism is optimized. When the application scenario to be processed has high requirements for the GPU's data processing capabilities, that is, when facing complex processing tasks, electronic devices can directly and quickly retrieve this resource data from their own storage through the GPU, without waiting for external data transmission. This improves the latency caused by obtaining resource data from other storage media (spaces), thereby improving the GPU's processing performance, as well as increasing the rate at which the GPU processes data and the utilization rate of resource data.
[0012] As an example of this application, when the type of the application scenario to be processed is the target scenario type, the electronic device can also persistently store the target resource data before reading the target resource data required for scenario processing from the on-chip memory.
[0013] For example, the electronic device can acquire first resource data, which is resource data to be used when performing scene processing;
[0014] If the usage frequency of the first resource data is greater than or equal to the first frequency threshold, and / or if the data type of the first resource data is a preset type, and / or if the usage scenario type of the first resource data is a target scenario type, the first resource data will be determined as the target resource data.
[0015] The target resource data is stored in on-chip memory.
[0016] In this way, by setting different filtering conditions to determine the target resource data, the accuracy of determining the target resource data is improved, and the diversity of the target resource data is guaranteed.
[0017] As an example of this application, the operation of an electronic device storing target resource data in on-chip memory includes:
[0018] Set a persistence flag for the target resource data. The persistence flag is used to indicate that the target resource data should be persistently stored in on-chip memory.
[0019] Based on the persistent identifier, the target resource data is mapped to on-chip memory.
[0020] In some embodiments, the electronic device can set a resource descriptor for the target resource data. The resource descriptor is a structure used to describe the attributes of the resource data. The scene recognition module can add persistent attributes to the resource descriptor, such as adding a persistent identifier to the resource descriptor.
[0021] In this way, by setting a persistent identifier for the target resource data, the accurate storage of the target resource data is ensured.
[0022] As an example of this application, before the electronic device stores the target resource data in the on-chip memory, it can also set up a persistent storage area in the on-chip memory. The persistent storage area is used to store the resource data to be persisted.
[0023] Based on this, the operation of mapping target resource data to on-chip memory by the electronic device according to the persistent identifier includes:
[0024] Based on the persistent identifier, the target resource data is mapped to the persistent storage area.
[0025] As an example, after setting up a persistent storage area, an electronic device can further divide the persistent storage area into multiple sub-areas, each used to store resource data of a specific data type. In other words, when persistently storing target resource data, the electronic device can determine the data type of the target resource data and store it in the corresponding sub-area based on the data type. Specifically, if the target resource data includes multiple data types, the electronic device can store each data type separately in its corresponding sub-area.
[0026] In this way, by allocating a dedicated persistent storage area in the on-chip memory, and using this persistent storage area specifically for storing resource data to be persisted, when storing target resource data, it can be mapped to this persistent storage area according to the persistent identifier, ensuring the orderly storage and efficient reading of resource data, while realizing the storage and management operations of target resource data.
[0027] As an example of this application, the electronic device includes a scene recognition module, a GPU, and a memory allocation interface;
[0028] Based on this, the scene recognition module can set persistent identifiers for target resource data;
[0029] The scene recognition module can send target resource data to the GPU through the memory allocation interface;
[0030] The GPU can map target resource data to on-chip memory based on persistent identifiers.
[0031] In this way, during the storage of target resource data, multiple modules in the electronic device cooperate with each other to realize the complete process from data determination, transmission to storage. The close cooperation between the modules ensures the efficient implementation of the resource scheduling method.
[0032] As an example of this application, the operation of an electronic device mapping target resource data to a persistent storage area based on a persistent identifier includes:
[0033] Based on the persistent identifier, determine the size of the contiguous free space within the persistent storage area to obtain the first value;
[0034] If the first value is greater than or equal to the target value, the target resource data is stored in the persistent storage area. The target value is used to indicate the size of the target resource data.
[0035] In this way, by determining the size of the contiguous free space within the persistent storage space, it is possible to accurately determine whether the size of the persistent storage space is sufficient to store the target resource data, thereby improving the reliability of storing the target resource data.
[0036] As an example of this application, the electronic device determines the size of the continuous free space in the persistent storage area based on the persistent identifier, obtains a first value, and if the first value is less than a target value, determines the second resource data in the persistent storage area whose storage time is greater than or equal to a preset duration, whose scheduling frequency is less than or equal to a second frequency threshold, and which is currently not in use; releases the second resource data, and determines a second value, which is used to indicate the size of the continuous free space in the persistent storage area after releasing the second resource data; if the second value is greater than or equal to the target value, stores the target resource data in the persistent storage area.
[0037] Thus, if the first value is less than the target value, the size of the contiguous free space in the persistent storage area is maximized by releasing the resource data that is not frequently used within the persistent storage area.
[0038] As an example of this application, the operation of the electronic device releasing the second resource data includes:
[0039] Change the state of the second resource data in the persistent storage area from persistent to non-persistent;
[0040] Release resource data that is in a non-persistent state within the persistent storage area.
[0041] In this way, by modifying the state to release the second resource data, it can be ensured that the second resource data cannot be easily swapped out of the on-chip memory.
[0042] As an example of this application, after the electronic device stores the target resource data in on-chip memory, it can also receive resource update data, which is the resource data after the target resource data has been updated; and update the target resource data stored in on-chip memory with the resource update data.
[0043] In this way, by updating the target resource data stored in the on-chip memory to the resource update data, the resource data in the GPU's on-chip memory can be directly modified, reducing the overhead of data transfer.
[0044] As an example of this application, after the electronic device stores the target resource data in on-chip memory, it can also manage the state of the target resource data. For example, the electronic device can perform operations such as setting and modifying the state of the target resource data.
[0045] In some embodiments, the GPU can record the state of each type of resource data and its transition rules during the process of managing the state of resource data, thereby ensuring the correctness and efficiency of state transitions.
[0046] As an example of this application, when the type of the application scenario to be processed is the target scenario type, the electronic device can read the target resource data required for scenario processing from the on-chip memory and then perform scenario processing on the application scenario to be processed based on the target resource data.
[0047] It should be noted that the scene processing operations performed by electronic devices vary depending on the target resource data and the application scenario to be processed. For example, electronic devices can perform scene building and rendering, data encryption and / or decryption, model training, data calculation, and other operations.
[0048] Thus, because this on-chip memory is dedicated to the GPU and boasts high-speed data read and write capabilities, and the target resource data is pre-persistently stored in this on-chip memory, the GPU does not need to retrieve resource data from slower external storage media (such as system memory or hard drives) during scene rendering. Instead, it directly and quickly reads the required resource data from the on-chip memory, significantly improving the speed of resource data retrieval and thereby enhancing the overall performance of the GPU. For example, in the rendering of complex scenes in 3D games, texture data, lighting data, and other data pre-stored in on-chip memory can be quickly accessed by the GPU, reducing waiting time during rendering and allowing the game visuals to be presented to the player more smoothly.
[0049] Secondly, a resource scheduling apparatus is provided, which has the function of implementing the resource scheduling method behavior described in the first aspect. The resource scheduling apparatus includes at least one module, which is used to implement the resource scheduling method provided in the first aspect. The nuclear resource scheduling apparatus includes:
[0050] The determination module is used to determine the type of application scenario to be processed in response to scenario triggering operations;
[0051] The first calling module is used to read the target resource data required for scene processing from the on-chip memory when the type of the application scenario to be processed is the target scenario type. The on-chip memory is the memory set in the graphics processing unit (GPU), and the target resource data is the resource data that is persistently stored in the on-chip memory. The application scenario of the target scenario type requires the data processing capability of the GPU to meet the preset performance conditions.
[0052] The second calling module is used to prevent the target resource data from being called when the type of the application scenario to be processed is not the same as the target scenario type.
[0053] Thirdly, an electronic device is provided, comprising a processor and a memory. The memory stores a program supporting the electronic device in executing the resource scheduling method provided in the first aspect, and stores data related to implementing the resource scheduling method described in the first aspect. The processor is configured to execute the program stored in the memory. The electronic device may further include a communication bus for establishing a connection between the processor and the memory.
[0054] Fourthly, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the resource scheduling method described in the first aspect.
[0055] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, causes the computer to execute the resource scheduling method described in the first aspect.
[0056] The technical effects achieved by the second, third, fourth, and fifth aspects mentioned above are similar to those achieved by the corresponding technical means in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0057] Figure 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0058] Figure 2 is a block diagram of a software system for an electronic device provided in an embodiment of this application;
[0059] Figure 3 is a schematic diagram of an application scenario provided by an embodiment of this application;
[0060] Figure 4 is a schematic diagram of another application scenario provided by an embodiment of this application;
[0061] Figure 5 is a schematic diagram of another application scenario provided by an embodiment of this application;
[0062] Figure 6 is a flowchart of a resource scheduling method provided in an embodiment of this application;
[0063] Figure 7 is a flowchart of a method for persistently storing resource data according to an embodiment of this application;
[0064] Figure 8 is a schematic diagram of determining target resource data according to an embodiment of this application;
[0065] Figure 9 is a flowchart of another resource scheduling method provided in an embodiment of this application. Detailed Implementation
[0066] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0067] It should be understood that "multiple" as mentioned in this application refers to two or more. In the description of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.
[0068] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0069] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0070] With the increasing demands for complex scene processing in fields such as gaming, video, and machine learning, GPU performance has become a key factor. In current GPU technology, the amount of on-chip memory limits the efficiency of GPUs when processing large-scale data.
[0071] In addition, with the increasing demand for image processing (usually image rendering), such as high-resolution textures and complex depth and color calculations, GPUs sometimes cannot meet the requirements for efficient processing of data that needs to be accessed and processed quickly, thus reducing the GPU's image processing capabilities and efficiency.
[0072] To improve the image processing capabilities and efficiency of GPUs, this application provides a resource scheduling method. In this method, in response to a scene triggering operation, the type of the application scenario to be processed can be determined. If the type of the application scenario is the target scene type, the electronic device can directly read the target resource data from the GPU's on-chip memory. If the type of the application scenario is not the target scene type, the target resource data will not be read from the GPU's on-chip memory. That is, in this application embodiment, some resource data can be specifically stored in the GPU, thereby optimizing the information storage and retrieval mechanism. When the application scenario to be processed has high requirements for the GPU's data processing capabilities, i.e., when facing complex scene processing tasks, the electronic device can directly and quickly retrieve this resource data from its own storage through the GPU, without waiting for external data transmission. This improves the latency caused by obtaining resource data from other storage media, thereby improving the GPU's processing performance, the rate at which the GPU processes data, and the utilization rate of resource data.
[0073] Before providing a detailed explanation of the resource scheduling method provided in the embodiments of this application, the electronic equipment involved in the embodiments of this application will be described first.
[0074] As an example, this method can be applied to electronic devices that include GPUs. As an example and not a limitation, the electronic device can be, but is not limited to, tablet computers, desktop computers, laptop computers, handheld computers, laptops, in-vehicle devices, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), mobile phones, smartwatches, etc., and this application embodiment does not limit this.
[0075] Figure 1 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Referring to Figure 1, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0076] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0077] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0078] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0079] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from this memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0080] In some embodiments, the processor 110 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0081] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0082] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0083] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.
[0084] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
[0085] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0086] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0087] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0088] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is an integer greater than 1.
[0089] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0090] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's image sensor. The light signal is converted into an electrical signal, and the image sensor transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimizations on image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be integrated into the camera 193.
[0091] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is an integer greater than 1.
[0092] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP performs Fourier transforms on the frequency energy.
[0093] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG 2, MPEG 3, MPEG 4, etc.
[0094] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0095] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions, such as saving music, video, and other files on the external memory card.
[0096] Internal memory 121 can be used to store computer-executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created by electronic device 100 during use (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0097] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D and application processor.
[0098] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch operation intensity based on pressure sensor 180A. Electronic device 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than the pressure threshold is applied to the SMS application icon, a command to view an SMS message is executed. When a touch operation with an intensity greater than or equal to the pressure threshold is applied to the SMS application icon, a command to create a new SMS message is executed.
[0099] The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the electronic device 100 about three axes (i.e., the x, y, and z axes). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the shake of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 100 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 180B can also be used in navigation and motion-sensing game scenarios.
[0100] The barometric pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates altitude using the air pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.
[0101] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip cover. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover based on the magnetic sensor 180D. Based on the detected opening and closing state of the cover or the flip cover, the electronic device 100 can set features such as automatic flip unlocking.
[0102] The accelerometer 180E can detect the magnitude of acceleration of electronic device 100 in various directions (generally three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. The accelerometer 180E can also be used to identify the attitude of electronic device 100, and can be applied to applications such as screen orientation switching and pedometers.
[0103] A distance sensor 180F is used to measure distance. Electronic device 100 can measure distance via infrared or laser. In some embodiments, during a shooting scenario, electronic device 100 can utilize the distance sensor 180F for distance measurement to achieve fast focusing.
[0104] The proximity sensor 180G may include a light-emitting diode (LED) and a light detector, such as a photodiode. The LED may be an infrared LED. The electronic device 100 emits infrared light outward through the LED. The electronic device 100 uses the photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, the electronic device 100 can determine that an object is nearby. When insufficient reflected light is detected, it can determine that no object is nearby. The electronic device 100 can use the proximity sensor 180G to detect when a user holds the electronic device 100 close to their ear for a phone call, so as to automatically turn off the screen to save power. The proximity sensor 180G can also be used in holster mode and pocket mode for automatic unlocking and locking of the screen.
[0105] The ambient light sensor 180L is used to sense the brightness of ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 based on the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also work with the proximity sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0106] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can utilize the characteristics of the collected fingerprints to achieve fingerprint unlocking, accessing application locks, taking photos with fingerprints, answering calls with fingerprints, etc.
[0107] Temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 uses the temperature detected by temperature sensor 180J to execute a temperature handling strategy. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 reduces the performance of a processor located near temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is below another threshold, electronic device 100 heats battery 142 to prevent abnormal shutdown of electronic device 100 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, electronic device 100 boosts the output voltage of battery 142 to prevent abnormal shutdown due to low temperature.
[0108] Touch sensor 180K, also known as a "touch panel," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touch display." Touch sensor 180K detects touch operations applied to or near it. Touch sensor 180K can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of electronic device 100, in a different position than display screen 194.
[0109] The software system of electronic device 100 will be described next.
[0110] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses a layered Android system as an example to illustrate the software system of electronic device 100.
[0111] Figure 2 is a block diagram of a software system of an electronic device 100 provided in an embodiment of this application. Referring to Figure 2, the layered architecture divides the software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the HAL layer, and the kernel layer.
[0112] The application layer can include a series of application packages. As shown in Figure 2, application packages can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0113] As an example, the application layer can also include a scene recognition module. This module can determine whether resource data required for the current application scenario needs to be persisted. Specifically, the scene recognition module can identify key characteristics of the resource data and, based on these characteristics, determine whether the resource data needs persistence. For example, the scene recognition module can determine the resource data's usage frequency, resource type (including whether the resource is an intermediate texture), scene complexity, and other characteristics. If it is determined that the resource data needs to be persisted, the scene recognition module can set a persistence flag for the resource data and set other attributes for it.
[0114] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications within the application layer. The application framework layer includes predefined functions. As shown in Figure 2, the application framework layer may include a window manager, content providers, a view system, a phone manager, a resource manager, and a notification manager. The window manager manages window programs. It can obtain the screen size, determine the presence of a status bar, lock the screen, and capture the screen. The content provider stores and retrieves data, making this data accessible to applications. This data may include video, images, audio, incoming and outgoing phone calls, browsing history and bookmarks, and a phone book. The view system includes visual controls, such as controls for displaying text and controls for displaying images. The view system can be used to build the application's display interface, which can consist of one or more views, such as a view displaying SMS notification icons, a view displaying text, and a view displaying images. The phone manager provides communication functions for the electronic device 100, such as managing call status (including connection and disconnection). The resource manager provides various resources for the application, such as localized strings, icons, images, layout files, and video files. The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify of download completion or message alerts. The notification manager can also display notifications as icons or scrolling text in the system's top status bar, such as notifications from background applications. Furthermore, the notification manager can appear as dialog boxes on the screen, such as displaying text messages in the status bar, emitting sounds, vibrating electronic devices, or flashing indicator lights.
[0115] The HAL layer may include a memory allocation interface that queries the memory type in the GPU in the hardware layer and passes resource data, including persistent identifiers, to the GPU's on-chip memory.
[0116] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.
[0117] Referring to Figure 2, the electronic device may also include a hardware layer. This hardware layer may include a CPU. In some implementations, the GPU may be used to perform corresponding processing based on APIs in graphics libraries (such as OpenGL ES) invoked by instructions processed by various modules in the framework layer.
[0118] Next, the application scenarios involved in the embodiments of this application will be described, and the application scenarios of the embodiments of this application will be described using mobile phones as an example.
[0119] Please refer to Figure 3, which is a schematic diagram of an application scenario provided by an embodiment of this application. In one application scenario, in various large-scale 3D games, such as role-playing games and first-person shooter games, electronic devices can display complex scenes and rich visuals to users. For the smoothness and clarity of game rendering, electronic devices place extremely high demands on the GPU's data processing capabilities. During game operation, when performing scene rendering operations, the electronic device can determine the type of the current game scene through the CPU. For example, referring to Figure 3(a) or (b), in the intense battle scenes of large-scale multiplayer online role-playing games, these scenes contain a large number of character models, detailed textures, and complex lighting effects, placing high demands on real-time rendering performance. Therefore, the electronic device can identify the type of the 3D game scene as the target scene type through the CPU. Subsequently, the CPU can identify frequently used resource data (usage frequency greater than or equal to a first frequency threshold) in these game scenes, such as common character textures, weapon model data, scene terrain textures, and specific data types (such as high-precision texture data, key lighting data, shadow data, and other preset types), as target resource data, and persistently store them in the on-chip memory of the GPU. When rendering these complex game scenes again, the electronic device reads the required target resource data directly from the on-chip memory through the GPU, avoiding the latency of obtaining resource data from external memory or other storage media, greatly improving the GPU's rendering speed, thereby ensuring the smoothness and real-time performance of the game screen, allowing players to enjoy an immersive gaming experience, reducing stuttering and frame drops, and improving the overall quality and playability of the game.
[0120] In another application scenario, during the editing or playback of high-definition videos, especially those containing complex special effects, multi-layered image compositing, and high-resolution materials, the GPU is required to process large amounts of video frame data quickly. Therefore, the electronic device can identify the video scene type as the target scene type through the CPU. In this case, the electronic device can store frequently used video clips (usage frequency greater than or equal to a first frequency threshold), specific video effect template data, and data commonly used in the final video output scene (resource data related to the target scene type) as target resource data in the GPU's on-chip memory. Thus, during the playback of ultra-high-definition videos as shown in Figure 4, especially for ultra-high-definition videos (such as 4K and 8K videos), particularly movies and documentaries with complex visual content, the GPU can directly read target resource data such as texture and color correction data from the on-chip memory, accelerating video decoding and rendering speed for each frame, ensuring smooth playback and image clarity, while also improving real-time preview effects and rendering output efficiency during video editing, saving time and costs.
[0121] In another application scenario, in VR and AR applications, users have very high requirements for real-time interactivity and visual effects. For example, as shown in Figure 5, in VR car games, the user's head movements and body movements frequently trigger the rendering of new scenes, while AR applications also need to quickly process large amounts of image data when rendering virtual environments. Immersive virtual scenes in VR, such as virtual concerts, virtual museum tours, and virtual driving tours, all fall into the category of target scene types. Electronic devices can identify resource data such as panoramic image data, texture and model data of virtual objects, and environmental depth information as target resource data, and persistently store the target resource data in the GPU's on-chip memory. When rendering these scenes, the GPU can quickly read the target resource data from the on-chip memory, enabling the GPU to quickly process and present realistic images, reducing latency, improving the user's interactive experience in virtual or augmented reality environments, avoiding discomfort symptoms such as dizziness caused by screen lag, and enhancing the practicality and attractiveness of the application.
[0122] In another application scenario, within the field of artificial intelligence, specifically machine learning and deep learning, deep learning models typically involve massive data processing. For example, in image recognition tasks (often requiring visualization), electronic devices need to extract features from tens of thousands of images, train models, and optimize them. In natural language processing, electronic devices, when faced with large-scale text corpora, need to perform operations such as word vector learning and semantic understanding model construction. Therefore, electronic devices can identify the type of machine learning and deep learning scenario as the target scenario type. During machine learning and deep learning, electronic devices can identify frequently used, specific types of resource data (such as model weights and intermediate feature data) as target resource data and persistently store this target resource data in the GPU's on-chip memory. Subsequently, during training or inference, the electronic device can quickly access frequently used or critical data through the GPU, avoiding the latency of reading data from external storage devices, greatly improving data access speed, ensuring the smoothness and efficiency of the entire machine learning and deep learning task, accelerating the model's training convergence speed and inference response speed, thereby improving the overall performance and capabilities of the artificial intelligence system. In other words, in machine learning and deep learning scenarios, when processing large amounts of data with GPUs, resource scheduling mechanisms such as setting up persistent storage and reading target resource data from the GPU's on-chip memory provide strong support for GPUs to perform machine learning and deep learning related tasks. This ensures that GPUs can more smoothly acquire and store the required data, thereby improving the efficiency of processing large amounts of data and better completing the training and inference work of deep learning models.
[0123] In another application scenario, within the fields of scientific computing and simulation technology, such as in professional graphic design and modeling applications, during the creation of complex 3D models, detailed material texture rendering, and high-quality rendering, electronic devices can determine the target scene type for these operations. Subsequently, the electronic device can identify commonly used material library data, basic 3D model component data, and the data required for the final high-quality rendering scene as target resource data, and persistently store this target resource data in the GPU's on-chip memory. When the electronic device performs operations such as model rotation, scaling, material adjustment, and final rendering output, the GPU can quickly read the target resource data from on-chip memory, accelerating graphics processing and display, improving design efficiency, reducing waiting time caused by GPU performance issues, and enhancing the overall efficiency and quality of the design process.
[0124] In another application scenario, within the field of wired communication, when processing high-speed data streams—such as large-scale data exchange between data centers in a backbone network or real-time wired transmission of high-definition video—common signal processing parameters and encryption algorithm-related data can be set as target resource data and persistently stored in the GPU's on-chip memory. This allows electronic devices to read the target resource data from the GPU's on-chip memory, quickly acquiring data related to signal processing algorithms and encryption / decryption keys. This ensures the timeliness and accuracy of signal processing, improves the speed of data encryption and decryption, and enhances the overall performance and security of the wired communication system.
[0125] In another application scenario, when an electronic device is running simple applications, such as the system's built-in calculator application, since the calculator's application scenario does not belong to the target scenario type, the electronic device will not call the target resource data in the on-chip memory. Instead, it will use conventional resource management methods, thereby ensuring the reasonable utilization of resources and performance optimization of the entire electronic device in different application scenarios.
[0126] It should be noted that the embodiments of this application are only illustrated using the above-mentioned multiple application scenarios as examples, and do not constitute a limitation on the embodiments of this application.
[0127] Based on the execution entity provided in the above embodiments, the resource scheduling method provided in this application will be described next. Please refer to Figure 6, which is a schematic flowchart of a resource scheduling method according to an example. It is an example and not a limitation. The method is illustrated using the interaction of multiple modules in an electronic device as an example, and the method may include some or all of the following:
[0128] Step 601: The first application runs according to the scenario-triggered operation.
[0129] It should be noted that the first application can be any application of the electronic device, such as a desktop application, a 3D game application, a 2D game application, a video playback application, a video editing application, a model building application, a computer application, a music application, a clock application, etc.
[0130] As an example, a scene triggering operation can be an operation that triggers any scene. For example, a scene triggering operation can be a startup operation of the first application, or a scene triggering operation can refer to a triggering operation of any function of the first application. This application embodiment does not impose specific limitations on scene triggering operations.
[0131] Step 602: When the first application runs according to the scenario-triggered operation, the scenario recognition module determines the type of the current application scenario to be processed.
[0132] It should be noted that the application scenario to be processed refers to the application scenario triggered by the first application according to the scenario triggering operation. The GPU's operations for calling corresponding resource data differ depending on the type of application scenario to be processed. Therefore, in order to perform resource calls quickly and accurately, the scenario recognition module can determine the type of the current application scenario to be processed.
[0133] As an example, the application scenario type can include target scenario type and non-target scenario type (type not being a target scenario type). Target scenario type refers to application scenarios that have high requirements for GPU data processing capabilities and meet preset performance conditions. For example, application scenarios belonging to the target scenario type can include complex battle scenes in large-scale 3D games, high-definition virtual reality scenes, etc.
[0134] It should be noted that preset performance conditions can be set in advance according to requirements. For example, preset performance conditions can be GPU-related conditions. For instance, preset performance conditions may include GPU computing performance metrics. For example, preset performance conditions may include a GPU's floating-point operations per second reaching a third value, such as 10 TFLOPS. And / or, preset performance conditions may include a minimum GPU data transfer bandwidth, such as a GPU memory bandwidth of at least 300 GB / s. And / or, preset performance conditions may include the size of the GPU's on-chip memory, such as a GPU on-chip memory capacity greater than or equal to 16 GB.
[0135] It is worth noting that, given the preset performance conditions, including the GPU's floating-point operations per second, the lower limit of the GPU's data transfer bandwidth, and the size of the GPU's on-chip memory, electronic devices can still perform scene rendering efficiently in complex application scenarios.
[0136] For example, for a complex 3D game scene, if the number of floating-point operations per second of the GPU in that scene reaches the third value, then the scene recognition module can determine that the type of the 3D game scene is the target scene type.
[0137] For example, in a high-definition video editing scenario, if the GPU's memory bandwidth reaches 300GB / s in that scenario, the scene recognition module can determine that the type of the high-definition video editing scenario is the target scene type.
[0138] For example, in a machine learning scenario, when an electronic device is training and visualizing a large-scale image dataset, if the GPU's video memory capacity in that scenario is greater than or equal to 16GB, then the scene recognition module device can determine that the current machine learning scenario type is the target scenario type.
[0139] In some embodiments, the preset performance conditions may include not only the conditions described above, but also other conditions, such as rendering-related conditions. For example, the preset performance conditions may also include requiring a rendering frame rate greater than or equal to a first frame rate, which can be set according to scene requirements, such as 60 frames per second, 70 frames per second, etc. And / or, the preset performance conditions may also include requiring support for rendering resolutions greater than or equal to 4K, and in the case of high resolution, the color depth of each pixel reaches a fourth value, which can be 10 bits, 15 bits, etc. And / or, the preset performance conditions may also include rendering complexity, for example, requiring the amount of data processed per unit time to be greater than a fifth value, which can vary depending on the type of data being processed.
[0140] It is worth noting that, given the preset performance conditions including rendering frame rate requirements, rendering resolution requirements, and / or rendering complexity requirements, if the electronic device is in a complex application scenario, it may still be able to perform scene rendering efficiently.
[0141] For example, in a real-time battle game scenario, where the GPU is required to guarantee a rendering frame rate of 60 frames per second or higher, the scene recognition module can determine the type of the battle game scenario as the target scene type.
[0142] For example, in some professional video production or high-definition video playback scenarios, where the GPU is required to support rendering at 4K (3840×2160) and above resolutions, and at this resolution, the quality indicators such as color accuracy and detail richness of the image can be guaranteed to meet certain standards, such as the color depth of each pixel reaching 10 bits or higher, then the scene recognition module can determine the type of video production or high-definition video playback scenario as the target scene type.
[0143] For example, for game or video scenes with numerous special effects, such as scenes containing real-time ray tracing, complex particle systems, etc., the scene requires the GPU to process a certain number of special effects calculations per unit time. For instance, if the GPU is required to process 1 million ray tracing sampling points per second or to simultaneously support the physical simulation and rendering of 100,000 particles, then the scene recognition module can determine that the game or video scene is the target scene type.
[0144] In other words, the application scenario corresponding to the target scene type usually requires the GPU to process large amounts of graphics data quickly and stably to ensure the smoothness and realism of the image. If the application scenario to be processed does not require GPU performance, then the application scenario type to be processed is not the target scene type.
[0145] Step 603: If the type of the application scenario to be processed is the target scenario type, the scene recognition module sends the first resource acquisition message to the GPU.
[0146] Since the type of the application scenario to be processed is the target scenario type, it means that the GPU may use some resource data that is used frequently and has high requirements for GPU performance. Therefore, the scene recognition module can send a first resource acquisition message to the GPU, which is used to instruct the GPU to acquire the target resource data from its on-chip memory.
[0147] It should be noted that on-chip memory refers to the memory set in the GPU, while target resource data refers to resource data that is persistently stored in on-chip memory.
[0148] As an example, the GPU can persist the target resource data to on-chip memory before executing step 603. The operation of persisting the target resource data to on-chip memory can be referred to the flowchart shown in Figure 7 below, and will not be described in detail here.
[0149] Step 604: Upon receiving the first resource acquisition message, the GPU reads the target resource data required for scene processing from the on-chip memory.
[0150] As an example, in the case of a complex 3D game scene, the GPU can obtain target resource data from on-chip memory, such as common textures of characters, weapon model data, scene terrain textures, and specific data types, such as high-precision texture data, key lighting data, shadow data, and other resource data. This ensures that the GPU can quickly process complex calculations such as lighting calculations and physical simulations in the game scene, thereby achieving efficient rendering of the image.
[0151] As an example, in the case of a high-definition video editing scenario, the GPU can quickly read target resource data such as texture and depth from on-chip memory when rendering the video, thus ensuring smooth editing and playback of subsequent video frames.
[0152] As an example, in the case of a machine learning scenario, when an electronic device is training and visualizing a large-scale image dataset, the GPU can obtain sufficient target resource data from on-chip memory, such as neural network model parameters, intermediate calculation results, and image textures, so as to perform efficient scene rendering and related data processing tasks.
[0153] As an example, in the case of VR and AR application scenarios, the GPU can obtain target resource data such as panoramic image data, texture and model data of virtual objects, and environmental depth information from on-chip memory. In this way, the GPU can quickly process and present realistic images, reduce latency, and improve the user's interactive experience in virtual or augmented reality environments.
[0154] As an example, in the case of a 3D model building scenario, the electronic device can obtain target resource data such as commonly used material library data and basic 3D model component data from on-chip memory, thereby enabling rapid 3D model building.
[0155] Step 605: The GPU performs scene processing on the application scenario to be processed based on the target resource data.
[0156] It should be noted that the operations performed by the GPU for scene processing vary depending on the target resource data and the application scenario to be processed. For example, the GPU can perform operations such as scene building and rendering, data encryption and / or decryption, model training, and data computation.
[0157] Step 606: If the type of the application scenario to be processed is not the target scenario type, the scene recognition module sends a second resource acquisition message to the GPU.
[0158] It should be noted that if the type of the application scenario to be processed is not the target scenario type, the GPU does not need to obtain the target resource data from the on-chip memory. In this case, the scene recognition module can send a second resource acquisition message to the GPU. This second resource acquisition message is used to indicate that the GPU does not need to obtain the target resource data from its on-chip memory, but can obtain the relevant resource data from other storage spaces.
[0159] Step 607: Upon receiving the second resource acquisition message, the GPU does not retrieve the target resource data, but instead acquires the third resource data from other storage spaces.
[0160] It should be noted that third-party resource data is usually resource data that is used infrequently and / or has little impact on GPU performance.
[0161] For example, in the case of launching a calculator application, the third resource data can be a schematic diagram of the calculator application interface; in the case of launching a clock application, the third resource data can be a schematic diagram of the clock application interface and time information.
[0162] Step 608: The GPU performs scene processing on the application scenario to be processed based on the third resource data.
[0163] For example, when the application scenario to be processed is the launch scenario of a calculator application or the launch operation of a clock application, the corresponding scenario triggering operation is the interface display operation.
[0164] In this embodiment, since the GPU's on-chip memory stores some resource data, the information storage and retrieval mechanism is optimized. When the application scenario to be processed has high requirements for the GPU's data processing capabilities, i.e., when facing complex processing tasks, the electronic device can directly and quickly retrieve this resource data from its own storage through the GPU, without waiting for external data transmission. This improves the latency caused by obtaining resource data from other storage media (spaces), thereby enhancing the GPU's processing performance, as well as increasing the GPU's data processing rate and the utilization rate of resource data.
[0165] Next, the operation of persistently storing target resource data in the GPU's on-chip memory will be explained. Please refer to Figure 7. This method is an example and not a limitation. The method is illustrated using the interaction of multiple modules in an electronic device as an example. The method may include some or all of the following:
[0166] Step 701: The scene recognition module obtains the first resource data.
[0167] It should be noted that the first resource data is the resource data used when processing any scenario, and the first resource data obtained by the scene recognition module is different depending on the application scenario.
[0168] In some embodiments, the scene recognition module may acquire the first resource data if it recognizes that the type of the current scene to be processed is the target scene type. Of course, the scene recognition module may also acquire the first resource data before recognizing the type of the current scene to be processed, and this application embodiment does not impose specific limitations on this.
[0169] Step 702: If the usage frequency of the first resource data is greater than or equal to the first frequency threshold, and / or if the data type of the first resource data is a preset type, and / or if the usage scenario type of the first resource data is the target scenario type, the scenario recognition module determines the first resource data as the target resource data.
[0170] It should be noted that the first frequency threshold can be preset according to requirements, for example, it can be 10 times / second, 20 times / second, etc. Preset types include texture-related types (which can include intermediate textures generated during rendering), depth-related types, etc.
[0171] Since the usage frequency of the first resource data is greater than or equal to a first frequency threshold, it indicates that the first resource data is frequently accessed by the GPU. Therefore, in order to avoid reloading the first resource data during each rendering or to avoid reallocating memory for the first resource data during each rendering, the scene recognition module can determine the first resource data as the target resource data when its usage frequency is greater than or equal to the first frequency threshold.
[0172] Because different types of resource data have varying impacts on GPU performance—for example, texture-related and depth-related resource data typically require fast GPU access, while temporary resources, such as dynamically generated geometry, usually do not require fast access—the scene recognition module can still identify the first resource data as the target resource data even if the data type of the first resource data is a preset type, and the preset types include texture-related and depth-related types.
[0173] Because some rendering effects, such as blur, shadows, and post-processing rendering effects, may generate intermediate textures, these intermediate textures are likely to be frequently used during the rendering process. Therefore, if the preset type includes intermediate texture types, and the data type of the first resource data is an intermediate texture type, the scene recognition module can determine that the first resource data is the target resource data.
[0174] Since the target scene type refers to an application scenario that places high demands on the GPU's data processing capabilities and meets preset performance conditions—for example, when the complexity of the scenario in which the first resource data is used is high, such as when the number of objects (greater than or equal to the sixth value), the number of light sources (greater than or equal to the seventh value), and the complexity of the shaders in the scenario in which the first resource data is used is high—the GPU typically needs to be able to access the data quickly. In this case, the scene recognition module can determine that the first resource data is the target resource data.
[0175] In other words, the scene recognition module can determine whether the first resource data needs to be persisted based on several key features. For example, referring to Figure 8, the scene recognition module can determine whether to persist the first resource data based on at least one of four key features. These four key features may include the type of resource data, the frequency of resource data usage, the complexity of the resource data usage scenario, and the usage of intermediate textures, etc.
[0176] It should be noted that the embodiments of this application only use the above four key features as examples for illustration, and do not constitute a limitation on the embodiments of this application.
[0177] Step 703: The scene recognition module sets a persistent identifier for the target resource data.
[0178] It should be noted that the persistence flag is used to indicate that the target resource data is persistently stored in on-chip memory.
[0179] In some embodiments, the scene recognition module can set a resource descriptor for the target resource data. The resource descriptor is a structure used to describe the attributes of the resource data. The scene recognition module can add persistent attributes to the resource descriptor, such as adding a persistent identifier to the resource descriptor.
[0180] Step 704: The scene recognition module sends target resource data to the GPU through the memory allocation interface.
[0181] It should be noted that in order to accurately store the target resource data, electronic devices provide a memory allocation interface, through which the target resource data can be sent to the GPU.
[0182] Step 705: Upon receiving the target resource data, the GPU maps the target resource data to on-chip memory.
[0183] Since the scene recognition module may send resource data other than the target resource data through the memory allocation interface (meaning the memory allocation interface is not solely for transmitting target resource data), in order to accurately persist the target resource data, the GPU can determine whether the received target resource data carries a persistence identifier. If the target resource data has a persistence identifier, it is mapped to on-chip memory. If the target resource data does not carry or does not have a persistence identifier, it will not be persistently stored in on-chip memory.
[0184] In some embodiments, the operation of the GPU mapping target resource data to on-chip memory includes: if the target resource data has a persistent identifier, determining the storage address of a persistent storage region, wherein the persistent storage region is a storage region pre-allocated in on-chip memory for storing resource data to be persisted; and storing the target resource data in the persistent storage region.
[0185] In some embodiments, the GPU may pre-allocate persistent storage space in on-chip memory, and the size of the persistent storage space may be determined based on historical storage records.
[0186] Furthermore, since the memory allocation interface may be a dedicated interface for transmitting persistent resource data, the resource data received by the GPU through the memory allocation interface is all persistent resource data. In this case, when the GPU receives the target resource data, it can directly store the target resource data in the persistent storage area.
[0187] In some embodiments, the operation of storing GPU target resource data in a persistent storage area may include: determining the size of a contiguous free space in the persistent storage area to obtain a first value; and storing the target resource data in the persistent storage area if the first value is greater than or equal to a target value, wherein the target value is used to indicate the size of the target resource data.
[0188] Since the GPU's persistent storage region may already contain a large amount of persistent resource data, when the GPU receives target resource data, the size of a contiguous free area in the persistent storage region may be greater than or equal to the size of the target resource data. In this case, the GPU can directly store the target resource data in the contiguous free area. However, the size of a contiguous free area in the persistent storage region may be smaller than the size of the target resource data. In this case, the GPU cannot store the target resource data in the persistent storage region.
[0189] In some embodiments, if the first value is less than the target value, the GPU may abandon the storage of the target resource data in this instance.
[0190] In some embodiments, if the first value is less than the target value, the GPU may temporarily stop storing the target resource data and monitor the size of the continuous free space in the persistent storage area. If the size of the continuous free space is detected to be greater than or equal to the size of the target resource data, the target resource data is stored in the persistent storage area.
[0191] As an example, if the first value is less than the target value, the GPU can also proactively reorganize the persistent storage area to obtain more contiguous free space.
[0192] For example, if the first value is less than the target value, the GPU can determine that the second resource data in the persistent storage area has a storage time greater than or equal to a preset duration, a scheduling frequency less than or equal to a second frequency threshold, and is currently not in use; release the second resource data, and determine a second value, which indicates the size of the free space in the persistent storage area after releasing the second resource data; if the second value is greater than or equal to the target value, store the target resource data in the persistent storage area. If the second value is less than the target value, abandon the persistent storage of the target resource data.
[0193] It should be noted that the second frequency threshold can be set in advance according to needs, and the second frequency threshold is much smaller than the first frequency threshold. For example, the second frequency threshold can be 1 time / 3 days, 1 time / 7 days, etc.
[0194] In some embodiments, the operation of the GPU to release the second resource data includes: changing the state of the second resource data in the persistent storage area from a persistent state to a non-persistent state; and releasing the resource data in the non-persistent state in the persistent storage area.
[0195] In some embodiments, an electronic device may be provided with a resource release interface, which the GPU can call to release resource data in a non-persistent state.
[0196] It should be noted that when the second resource data is stored in the persistent storage area, the GPU can set the state of the second resource data to persistent state. This ensures that the second resource data cannot be easily swapped out of on-chip memory. When the GPU changes the state of the second resource data from persistent to non-persistent state, the second resource data can be swapped out of on-chip memory; that is, when the state of the second resource data becomes non-persistent, the GPU can release the second resource data.
[0197] In some embodiments, after modifying the state of the second resource data to a non-persistent state, the GPU can release all non-persistent resource data within the persistent storage area, thereby maximizing the size of the contiguous free space within the persistent storage area.
[0198] It should be noted that when the first value is less than the target value, the GPU may perform other operations besides releasing the second resource data. For example, the GPU may defragment the persistent storage area. Furthermore, the defragmentation operation can be performed before, after, or simultaneously with the release of the second resource data; this embodiment does not impose specific limitations on this.
[0199] In some embodiments, the size of the free space within the persistent storage region may be greater than or equal to a target value. In this case, instead of releasing the second resource data, the persistent storage region may be fragmented to consolidate discontinuous free spaces into a single contiguous free space. If a contiguous free space exists within the fragmented persistent storage region, and the size of this contiguous free space is greater than or equal to the target value, the GPU may store the target resource data in this contiguous free space. If the size of this contiguous free space is less than the target value, the GPU may continue to release the second resource data. Alternatively, after releasing the second resource data, if the second value is less than the target value, the GPU may continue to fragment the persistent storage space.
[0200] As an example, since the resource data in the persistent storage space is persistent storage resource data, the GPU's fragmentation and reorganization of the persistent storage space refers to reorganizing the discontinuous storage space into a contiguous storage space. In other words, it is to adjust the position of the resource data stored in the persistent storage space.
[0201] In some embodiments, the operation of the GPU storing target resource data in persistent storage may also include other operations. For example, the GPU may divide the persistent storage into multiple sub-regions according to different data types. Thus, when storing target resource data, the GPU can determine the type of the target resource data and then store the target resource data in the sub-region corresponding to its type.
[0202] It should be noted that the data types corresponding to each of the multiple sub-regions are different. The data types can be distinguished according to the application scenario or according to the type of data itself (such as image type, numerical type, symbol type, texture type, etc.). This application embodiment does not impose specific restrictions on the distinction according to data types.
[0203] In some embodiments, after the GPU stores the target resource data in persistent storage, it can also set the state of the target resource data. For example, setting the state of the target resource data to persistent state can prevent the target resource data from being swapped out.
[0204] As an example, the GPU can also set the target resource data to a readable or unreadable state. When the target resource data is in a readable state, external devices can read and use the target resource data. When the target resource data is in an unreadable state, external devices cannot read the target resource data.
[0205] In some embodiments, the state of the target resource data may include not only the states described above, but also other states, such as a used state, an unused state, etc., and the state of the target resource data may change according to various scenarios. For example, during the rendering process, the state of the used resource data may change from an unused state to a used state and a readable state, etc.
[0206] In other words, the GPU can manage the state of resource data stored in persistent storage space. This management operation includes setting and modifying the state of resource data.
[0207] In some embodiments, the GPU can record the state of each type of resource data and its transition rules during the process of managing the state of resource data, thereby ensuring the correctness and efficiency of state transitions.
[0208] Step 706: When the scene recognition module detects that the target resource data has been updated, it sends the resource update data to the GPU through the memory allocation interface.
[0209] In some embodiments, after the GPU stores the target resource data in on-chip memory, the target resource data may be updated. In order to ensure rendering accuracy and GPU rendering efficiency, the scene recognition module can send resource update data to the GPU through the memory allocation interface when it detects that the target resource data has been updated.
[0210] It should be noted that the updated resource data is the resource data after the target resource data has been updated, and the update of the target resource data includes partial or complete updates of the target resource data. This application embodiment does not impose specific limitations on this.
[0211] Step 707: The GPU receives resource update data.
[0212] Step 708: The GPU updates the target resource data stored in on-chip memory with the resource update data.
[0213] In some embodiments, the operation of updating the target resource data stored in on-chip memory with updated resource data by the GPU includes: after releasing the target resource data, the GPU persistently storing the updated resource data; or, the GPU overwriting the target resource data with the updated resource data; or, the GPU replacing the target resource data with the updated resource data. This application does not specifically limit this approach.
[0214] It should be noted that the operation of the GPU releasing the target resource data can refer to the operation of the GPU releasing the second resource data described above, and the operation of the GPU persistently storing the resource update data can refer to the operation of the GPU persistently storing the target resource data described above. This application embodiment will not elaborate on these points one by one.
[0215] It is worth noting that by updating the target resource data stored in the on-chip memory to the resource update data, the GPU can directly modify the resource data in the on-chip memory, thereby reducing the overhead of data transfer.
[0216] In some embodiments, after the GPU replaces the target resource data stored in on-chip memory with the updated resource data, it can also set the state of the updated resource data. This ensures that the resource data is in the correct state so that the updated resource data can adapt to real-time rendering requirements.
[0217] In some embodiments, the GPU can also periodically detect the usage of resource data in persistent storage. If fourth resource data that has been unused for a long period of time (unused duration greater than or equal to a duration threshold) is detected in persistent storage, and / or if the usage frequency of fourth resource data is less than or equal to a third frequency threshold (the third frequency threshold is less than or equal to a second frequency threshold) during the detection period, then the GPU can release the fourth resource data from persistent storage.
[0218] As an example, after releasing the fourth resource data, it can also be destroyed. This ensures the security and efficiency of the resource data release process.
[0219] It should be noted that the operation of the GPU releasing the fourth resource data can refer to the operation of the GPU releasing the second resource data described above, and this application embodiment will not elaborate on this point.
[0220] It is worth noting that by periodically monitoring the usage of resource data in the persistent storage space and releasing infrequently used resource data, the on-chip memory of the GPU can be effectively managed, ensuring the efficient use of resource data.
[0221] In this embodiment, multiple modules within the electronic device collaborate during the storage of target resource data. The scene recognition module sets persistent identifiers for the target resource data, accurately determining which resource data requires persistent storage through real-time monitoring and analysis of the application scenario. Then, the scene recognition module sends the target resource data with persistent identifiers to the GPU via the memory allocation interface. Upon receiving this data, the GPU maps the target resource data to the corresponding location in on-chip memory based on the persistent identifiers, thus realizing a complete process from data identification and transmission to storage. The close cooperation between the modules ensures the efficient implementation of the resource scheduling method.
[0222] It should be noted that the above description uses an electronic device to implement resource scheduling through the interaction of multiple modules as an example. Next, to further understand the embodiments of this application, the description will focus on the method being executed by an electronic device. Please refer to Figure 9, which is a flowchart illustrating a resource scheduling method according to another exemplary embodiment. As an example and not a limitation, the method may include some or all of the following:
[0223] Step 901: In response to the scene trigger operation, determine the type of application scene to be processed.
[0224] As an example, a scene-triggered operation can refer to the application's startup operation, the triggering operation of a certain function within the application, etc., and this application embodiment does not impose specific limitations on it.
[0225] As an example, the application scenario to be processed refers to the application scenario triggered by the scenario triggering operation. For example, the application scenario to be processed can be a video playback scenario, a game launch scenario, an application startup scenario, etc.
[0226] As an example, the application scenario type can include target scenario type and non-target scenario type (type not being the target scenario type). The target scenario type refers to application scenarios that have high requirements for GPU data processing capabilities and meet preset performance conditions. Examples include complex battle scenes in large-scale 3D games and high-definition virtual reality scenes.
[0227] It should be noted that the operation of the electronic device in response to the scene trigger operation and in determining the application scene to be processed can refer to the operation of step 602 above, and this embodiment of the application will not be described in detail.
[0228] Step 902: If the type of the application scenario to be processed is the target scenario type, read the target resource data required for scenario processing from the on-chip memory.
[0229] It should be noted that on-chip memory refers to memory set within the GPU, and the target resource data refers to resource data persistently stored in on-chip memory. The application scenario of this target scenario type requires the GPU's data processing capabilities to meet preset performance conditions.
[0230] When the application scenario to be processed is of the target type, this application scenario might be a complex battle scene in a 3D game, a high-definition virtual reality scene, or similar. These application scenarios typically require the GPU to process large amounts of graphics data quickly and stably to ensure the smoothness and realism of the visuals. Therefore, when the application scenario to be processed is of the target scene type, the electronic device can read the target resource data required for scene processing from on-chip memory.
[0231] It should be noted that the preset performance conditions can be conditions that place high demands on the GPU's data processing capabilities, and these preset performance conditions can be set in advance according to requirements. For example, the preset performance conditions can be GPU-related conditions, and / or rendering-related conditions, etc. For a description of the preset performance conditions, please refer to the description of the preset performance conditions in step 602 above; this application will not repeat it further.
[0232] In some embodiments, when the type of the application scenario to be processed is the target scenario type, after reading the target resource data required for scenario processing from the on-chip memory, the electronic device can also perform scenario processing on the application scenario to be processed based on the target resource data.
[0233] It should be noted that the scene processing operations performed by electronic devices vary depending on the target resource data and the application scenario to be processed. For example, electronic devices can perform scene building and rendering, data encryption and / or decryption, model training, data calculation, and other operations.
[0234] It's worth noting that because this on-chip memory is dedicated to the GPU, it boasts high-speed data read and write capabilities. Furthermore, since the target resource data is pre-persistently stored in this on-chip memory, during scene rendering, the GPU doesn't need to retrieve resource data from slower external storage media (such as system memory or hard drives). Instead, it directly and quickly reads the required resource data from the on-chip memory, significantly improving the speed of resource data retrieval and thus enhancing the overall performance of the GPU. For example, in rendering complex scenes in 3D games, texture data and lighting data pre-stored in on-chip memory can be quickly accessed by the GPU, reducing waiting time during rendering and allowing for a smoother presentation of the game to the player.
[0235] It should be noted that the target resource data is pre-stored in on-chip memory. The following section will explain the operation of pre-storing the target resource source data.
[0236] As an example, the electronic device can acquire first resource data, which is resource data to be used when performing scene processing; if the usage frequency of the first resource data is greater than or equal to a first frequency threshold, and / or if the data type of the first resource data is a preset type, and / or if the usage scenario type of the first resource data is a target scenario type, the first resource data is determined as target resource data; and the target resource data is stored in on-chip memory.
[0237] It should be noted that the first frequency threshold can be preset according to requirements, for example, it can be 10 times / second, 20 times / second, etc. Preset types include texture-related types (including intermediate textures generated during rendering), depth-related types, etc.
[0238] It is worth noting that by setting different filtering conditions to determine the target resource data, the accuracy of determining the target resource data is improved, and the diversity of the target resource data is ensured.
[0239] In some embodiments, the operation of an electronic device storing target resource data in on-chip memory includes: setting a persistent identifier for the target resource data, the persistent identifier indicating that the target resource data is persistently stored in on-chip memory; and mapping the target resource data to on-chip memory according to the persistent identifier.
[0240] In some embodiments, the electronic device can set a resource descriptor for the target resource data. The resource descriptor is a structure used to describe the attributes of the resource data. The scene recognition module can add persistent attributes to the resource descriptor, such as adding a persistent identifier to the resource descriptor.
[0241] It is worth noting that by setting a persistent identifier for the target resource data, the accurate storage of the target resource data is ensured.
[0242] In some embodiments, before storing the target resource data in on-chip memory, the electronic device may pre-define a persistent storage area in the on-chip memory. This persistent storage area is used to store the resource data to be persisted. Thus, the electronic device can map the target resource data to the persistent storage area based on a persistence identifier.
[0243] It is worth noting that by allocating a dedicated persistent storage area in the on-chip memory, and using this persistent storage area specifically for storing resource data to be persisted, when storing target resource data, it can be mapped to this persistent storage area according to the persistent identifier, ensuring the orderly storage and efficient retrieval of resource data, while also realizing the storage and management operations of the target resource data.
[0244] As an example, after setting up a persistent storage area, an electronic device can further divide the persistent storage area into multiple sub-areas, each used to store resource data of a specific data type. In other words, when persistently storing target resource data, the electronic device can determine the data type of the target resource data and store it in the corresponding sub-area based on the data type. Specifically, if the target resource data includes multiple data types, the electronic device can store each data type separately in its corresponding sub-area.
[0245] It should be noted that this data type can be classified according to the application scenario of the resource data or according to the attributes of the resource data. This application embodiment does not impose specific restrictions on this.
[0246] As can be seen from the above, electronic devices can include a scene recognition module, a GPU, and a memory allocation interface. In this way, electronic devices can achieve persistent storage of target resource data through the scene recognition module, GPU, and memory allocation module.
[0247] For example, the scene recognition module sets a persistent identifier for the target resource data; the scene recognition module can send the target resource data to the GPU through the memory allocation interface; the GPU can map the target resource data to on-chip memory according to the persistent identifier. This process can refer to the operations of steps 703-705 above, and will not be described in detail in this embodiment.
[0248] It is worth noting that during the storage of target resource data, multiple modules in the electronic device cooperate with each other to realize the complete process from data determination, transmission to storage. The close cooperation between the modules ensures the efficient implementation of the resource scheduling method.
[0249] Because the size of contiguous free space within the persistent storage area may or may not meet the size of the target resource data when mapping target resource data to a persistent storage area, the electronic device can determine the size of contiguous free space within the persistent storage area based on a persistent identifier to obtain a first value. If the first value is greater than or equal to a target value, the target resource data is mapped to the persistent storage area, where the target value indicates the size of the target resource data.
[0250] It is worth noting that by determining the size of the contiguous free space within the persistent storage space, it is possible to accurately determine whether the size of the persistent storage space is sufficient to store the target resource data, thereby improving the reliability of storing the target resource data.
[0251] Of course, the first value may be less than the target value. In this case, the electronic device can determine that the storage time in the persistent storage area is greater than or equal to the preset duration, the scheduling frequency is less than or equal to the second frequency threshold, and the second resource data is not currently in use; release the second resource data and determine the second value, which is used to indicate the size of the continuous free space in the persistent storage area after the second resource data is released; if the second value is greater than or equal to the target value, store the target resource data in the persistent storage area.
[0252] It is worth noting that when the first value is less than the target value, the size of the contiguous free space in the persistent storage area is maximized by releasing the resource data that is not frequently used in the persistent storage area.
[0253] In some embodiments, the operation of the electronic device to release the second resource data includes: changing the state of the second resource data in the persistent storage area from a persistent state to a non-persistent state; and releasing the resource data in the non-persistent state in the persistent storage area.
[0254] It is worth noting that by modifying the state to release the second resource data, it can be ensured that the second resource data cannot be easily swapped out of the on-chip memory.
[0255] Since the size of the contiguous free space within the persistent storage region may still be insufficient to store the target resource data after releasing the second resource data, the electronic device may abandon the storage of the target resource data. Alternatively, the electronic device may continue to monitor the size of the contiguous free space within the persistent storage region, and store the target resource data if the size of the contiguous free space is greater than the target value. Alternatively, the electronic device may continue to defragment the persistent storage region to obtain a larger contiguous free space. This operation can be referred to the GPU operation in step 705 above, and will not be described in detail in this embodiment.
[0256] In some embodiments, after the electronic device stores the target resource data in on-chip memory, it can also receive resource update data, which is the resource data after the target resource data has been updated; and update the target resource data stored in on-chip memory with the resource update data.
[0257] Since target resource data is not static—for example, game applications may undergo version updates, and the game scene may change accordingly—electronic devices need to use the updated resource data for scene rendering. Therefore, target resource data also updates. To improve scene rendering efficiency and GPU performance, electronic devices can update the on-chip target resource data using updated resource data.
[0258] It is worth noting that by updating the target resource data stored in the on-chip memory to resource update data, the resource data in the GPU's on-chip memory can be directly modified, reducing the overhead of data transfer.
[0259] In some embodiments, after the electronic device stores the target resource data in on-chip memory, it can also manage the state of the target resource data. For example, the electronic device can perform operations such as setting and modifying the state of the target resource data.
[0260] In some embodiments, the GPU can record the state of each type of resource data and its transition rules during the process of managing the state of resource data, thereby ensuring the correctness and efficiency of state transitions.
[0261] Step 903: If the type of the application scenario to be processed is not the same as the target scenario type, do not call the target resource data.
[0262] If the type of the application scenario to be rendered is not the target scenario type, the electronic device will not access the target resource data. For these non-target scenario types, such as simple 2D graphics applications or general applications with low graphics processing requirements, the electronic device can process them using traditional resource scheduling methods. This avoids unnecessary resource waste and complex resource allocation operations, while also ensuring the overall efficiency and reasonable energy consumption of the electronic device when processing various applications.
[0263] In this embodiment, since the GPU's on-chip memory stores some resource data, the information storage and retrieval mechanism is optimized. When the application scenario to be processed has high requirements for the GPU's data processing capabilities, i.e., when facing complex processing tasks, the electronic device can directly and quickly retrieve this resource data from its own storage through the GPU, without waiting for external data transmission. This improves the latency caused by obtaining resource data from other storage media, thereby enhancing the GPU's processing performance, as well as increasing the GPU's data processing rate and the utilization rate of resource data.
[0264] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line, DSL) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer, or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0265] The above descriptions are optional embodiments provided by this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the technical scope disclosed in this application should be included within the protection scope of this application.
Claims
1. A resource scheduling method, characterized in that, When applied to electronic devices, the method includes: In response to a scenario-triggered operation, determine the type of application scenario to be processed; When the type of the application scenario to be processed is the target scenario type, the target resource data required for scenario processing is read from the on-chip memory. The on-chip memory is the memory set in the graphics processing unit (GPU). The target resource data is resource data that is persistently stored in the on-chip memory. The application scenario of the target scenario type requires the data processing capability of the GPU to meet preset performance conditions. If the type of the application scenario to be processed is not the type of the target scenario, the target resource data will not be invoked.
2. The method as described in claim 1, characterized in that, Before reading the target resource data required for scene processing from on-chip memory when the type of the application scenario to be processed is the target scenario type, the method further includes: Acquire first resource data, which is the resource data to be used during scene processing; If the usage frequency of the first resource data is greater than or equal to the first frequency threshold, and / or if the data type of the first resource data is a preset type, and / or if the usage scenario type of the first resource data is the target scenario type, the first resource data is determined as the target resource data. The target resource data is stored in the on-chip memory.
3. The method as described in claim 2, characterized in that, The step of storing the target resource data in the on-chip memory includes: A persistence flag is set for the target resource data, and the persistence flag is used to indicate that the target resource data is persistently stored in the on-chip memory; Based on the persistent identifier, the target resource data is mapped to the on-chip memory.
4. The method as described in claim 2 or 3, characterized in that, Before storing the target resource data in the on-chip memory, the method further includes: A persistent storage area is set in the on-chip memory, and the persistent storage area is used to store resource data to be persisted; The step of mapping the target resource data to the on-chip memory based on the persistent identifier includes: Based on the persistent identifier, the target resource data is mapped to the persistent storage area.
5. The method as described in claim 3, characterized in that, The electronic device includes a scene recognition module, a GPU, and a memory allocation interface; Setting a persistent identifier for the target resource data includes: The scene recognition module sets the persistent identifier for the target resource data; The step of mapping the target resource data to the on-chip memory based on the persistent identifier includes: The scene recognition module sends the target resource data to the GPU through the memory allocation interface; The GPU maps the target resource data to the on-chip memory based on the persistent identifier.
6. The method as described in claim 4, characterized in that, The step of mapping the target resource data to the persistent storage area based on the persistent identifier includes: Based on the persistent identifier, the size of the contiguous free space within the persistent storage area is determined to obtain a first value; If the first value is greater than or equal to the target value, the target resource data is stored in the persistent storage area, and the target value is used to indicate the size of the target resource data.
7. The method as described in claim 6, characterized in that, After determining the size of the contiguous free space within the persistent storage area based on the persistent identifier and obtaining the first value, the method further includes: If the first value is less than the target value, it is determined that the storage time in the persistent storage area is greater than or equal to the preset duration, the scheduling frequency is less than or equal to the second frequency threshold, and the second resource data is not currently in use. The second resource data is released, and a second value is determined, which indicates the size of the continuous free space in the persistent storage area after the second resource data is released. If the second value is greater than or equal to the target value, the target resource data is stored in the persistent storage area.
8. The method as described in claim 7, characterized in that, The release of the second resource data includes: The state of the second resource data in the persistent storage area is changed from persistent to non-persistent; Release the resource data that is in the non-persistent state within the persistent storage area.
9. The method according to any one of claims 2-8, characterized in that, After storing the target resource data in the on-chip memory, the method further includes: Receive resource update data, wherein the resource update data is the resource data after the target resource data has been updated; The target resource data stored in the on-chip memory is updated with the resource update data.
10. The method as described in claim 1, characterized in that, When the type of the application scenario to be processed is the target scenario type, after reading the target resource data required for scenario processing from on-chip memory, the method further includes: Based on the target resource data, the application scenario to be processed is processed.
11. An electronic device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, the electronic device performs the method as described in any one of claims 1-10.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-10.
13. A computer program product, characterized in that, Includes a computer program, which, when run, causes the method as described in any one of claims 1-10 to be performed.