Memory allocation method and device for target computing system and autonomous vehicle

By pre-allocating memory for external devices and resetting the state when the connection is interrupted, the problem of resource waste in the dynamic allocation of GPU memory is solved, and automatic memory reclamation and improved resource utilization are achieved.

CN119806812BActive Publication Date: 2026-06-02BEIJING BAIDU NETCOM SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2024-12-13
Publication Date
2026-06-02

Smart Images

  • Figure CN119806812B_ABST
    Figure CN119806812B_ABST
Patent Text Reader

Abstract

The disclosure provides a memory allocation method and device for a target computing system and an autonomous vehicle, and relates to the technical field of computers, in particular to the technical field of autonomous driving and resource scheduling. The implementation scheme is as follows: memory pre-application is performed for an external device connected to the target computing system, a memory block corresponding to the external device is obtained, the memory block includes a plurality of sub-memory blocks; in response to receiving a memory request of the external device, a first sub-memory block in an idle state in the memory block is allocated to the external device; and in response to receiving a signal indicating that the connection between the external device and the target computing system is interrupted, the state of the sub-memory block allocated to the external device is reset to the idle state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more particularly to the fields of autonomous driving and resource scheduling technology, specifically to a memory allocation method, apparatus, electronic device, computer-readable storage medium, computer program product, autonomous vehicle, and edge computing device for a target computing system. Background Technology

[0002] Graphics Processing Units (GPUs) have a wide range of applications, covering graphics and image processing, scientific computing, artificial intelligence, big data analytics, cloud computing, and many other fields. Their powerful parallel processing capabilities support various complex computational tasks, driving technological progress. Currently, the GPU market is developing rapidly, and with continuous technological innovation, GPUs will play an increasingly important role in more fields, becoming a core force driving the continued progress of the computing era.

[0003] The methods described in this section are not necessarily methods that had been previously conceived or adopted. Unless otherwise specified, no method described in this section should be assumed to be prior art simply because it is included in this section. Similarly, unless otherwise specified, the issues mentioned in this section should not be considered to be accepted in any prior art. Summary of the Invention

[0004] This disclosure provides a memory allocation method, apparatus, electronic device, computer-readable storage medium, computer program product, autonomous vehicle, and edge computing device for a target computing system.

[0005] According to one aspect of this disclosure, a memory allocation method for a target computing system is provided, comprising: obtaining a memory block corresponding to an external device connected to the target computing system by pre-allocating memory for the external device, the memory block including a plurality of sub-memory blocks; allocating a first sub-memory block in an idle state in the memory block to the external device in response to receiving a memory request from the external device; and resetting the state of the sub-memory block allocated to the external device to an idle state in response to receiving a signal that the connection between the external device and the target computing system is interrupted.

[0006] According to another aspect of this disclosure, a memory allocation apparatus for a target computing system is provided, comprising: an acquisition unit configured to acquire a memory block corresponding to an external device by pre-requesting memory for an external device connected to the target computing system, the memory block including a plurality of sub-memory blocks; an allocation unit configured to allocate a first sub-memory block in an idle state in the memory block to the external device in response to receiving a memory request from the external device; and a reset unit configured to reset the state of the sub-memory block allocated to the external device to an idle state in response to receiving a signal that the connection between the external device and the target computing system is interrupted.

[0007] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the memory allocation method for a target computing system disclosed herein.

[0008] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to execute the memory allocation method for a target computing system disclosed herein.

[0009] According to another aspect of this disclosure, a computer program product is provided, including a computer program, wherein the computer program, when executed by a processor, implements the memory allocation method for a target computing system disclosed herein.

[0010] According to another aspect of this disclosure, an autonomous vehicle is provided, comprising: at least one camera device; and electronic equipment of this disclosure.

[0011] According to another aspect of this disclosure, an edge computing device is provided, comprising: at least one camera device; and an electronic device of this disclosure.

[0012] According to one or more embodiments of this disclosure, the automatic reclamation of allocated memory can be achieved, improving resource utilization and avoiding resource waste caused by the inability to use the allocated memory after the external device is restored.

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

[0014] The accompanying drawings exemplify embodiments and form part of the specification, serving together with the textual description to explain exemplary implementations of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0015] Figure 1 A schematic diagram of an exemplary system in which the various methods described herein may be implemented according to embodiments of the present disclosure is shown;

[0016] Figure 2 A flowchart of a memory allocation method for a target computing system according to an embodiment of the present disclosure is shown;

[0017] Figure 3 A flowchart illustrating the allocation of sub-memory blocks to an external device according to an embodiment of the present disclosure is shown;

[0018] Figure 4 An architecture diagram of a first driver and a second driver according to exemplary embodiments of the present disclosure is shown;

[0019] Figure 5 A flowchart illustrating a memory pre-allocation according to an exemplary embodiment of the present disclosure is shown;

[0020] Figure 6 A flowchart illustrating the allocation of sub-memory blocks to a camera device according to an exemplary embodiment of the present disclosure is shown;

[0021] Figure 7 A flowchart illustrating the release of a sub-memory block according to an exemplary embodiment of the present disclosure is shown;

[0022] Figure 8 A flowchart illustrating memory block release according to an exemplary embodiment of the present disclosure is shown;

[0023] Figure 9 A structural block diagram of a memory allocation apparatus for a target computing system according to an embodiment of the present disclosure is shown;

[0024] Figure 10 A structural block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation

[0025] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0026] In this disclosure, unless otherwise stated, the use of terms such as "first," "second," etc., to describe various elements is not intended to limit the positional, temporal, or importance relationships of these elements; such terms are merely used to distinguish one element from another. In some examples, the first element and the second element may refer to the same instance of that element, while in other cases, based on the context, they may refer to different instances.

[0027] The terminology used in the description of the various examples described in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context explicitly indicates otherwise, an element may be one or more unless the number of elements is specifically limited. Furthermore, the term "and / or" as used in this disclosure covers any one of the listed items and all possible combinations thereof.

[0028] In related technologies, in application scenarios involving dynamic allocation and release of video memory, some versions of graphics card drivers (such as CUDA 535) fail to automatically reclaim allocated memory after a process is forcibly terminated, resulting in a waste of memory resources.

[0029] The embodiments of this disclosure provide a memory allocation method for a target computing system. Memory pre-allocation is performed for each external device to obtain an available memory block corresponding to that external device. When an external device requests memory, a free sub-memory block is allocated to that external device. When the process of an external device is forcibly terminated due to an interruption in the connection between the external device and the target computing system, all allocated sub-memory blocks corresponding to that external device are reset to a free state. This achieves automatic reclamation of allocated memory, improves resource utilization, and avoids resource waste caused by the external device being unable to use the allocated memory after it recovers.

[0030] The embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.

[0031] Figure 1 A schematic diagram of an exemplary system 100 in which the various methods and apparatus described herein can be implemented according to embodiments of this disclosure is shown. Reference Figure 1 The system 100 includes a motor vehicle 110, a server 120, and one or more communication networks 130 that couple the motor vehicle 110 to the server 120.

[0032] In embodiments of this disclosure, the motor vehicle 110 may include a computing device according to embodiments of this disclosure and / or be configured to perform a method according to embodiments of this disclosure.

[0033] Server 120 may run one or more services or software applications that enable methods for allocating memory. In some embodiments, server 120 may also provide other services or software applications, which may include non-virtual environments and virtual environments. Figure 1 In the configuration shown, server 120 may include one or more components that implement the functions performed by server 120. These components may include software components, hardware components, or combinations thereof that can be executed by one or more processors. A user of motor vehicle 110 may sequentially interact with server 120 using one or more client applications to utilize the services provided by these components. It should be understood that various different system configurations are possible and may differ from system 100. Therefore, Figure 1 This is an example of a system used to implement the various methods described herein, and is not intended to be limiting.

[0034] Server 120 may include one or more general-purpose computers, special-purpose server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running a virtual operating system, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that can be virtualized to maintain virtual storage devices for servers). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.

[0035] The computing unit in server 120 can run one or more operating systems, including any of the aforementioned operating systems and any commercially available server operating system. Server 120 can also run any of a variety of additional server applications and / or middleware applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.

[0036] In some implementations, server 120 may include one or more applications to analyze and merge data feeds and / or event updates received from vehicle 110. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of vehicle 110.

[0037] Network 130 can be any type of network well known to those skilled in the art, and can support data communication using any of a variety of available protocols (including, but not limited to, TCP / IP, SNA, IPX, etc.). By way of example only, one or more networks can be satellite communication networks, local area networks (LANs), Ethernet-based networks, token ring networks, wide area networks (WANs), the Internet, virtual networks, virtual private networks (VPNs), intranets, extranets, blockchain networks, public switched telephone networks (PSTNs), infrared networks, wireless networks (including, for example, Bluetooth, WiFi), and / or any combination of these with other networks.

[0038] System 100 may also include one or more databases 150. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 150 may be used to store information such as audio files and video files. The data repository 150 may reside in various locations. For example, a data repository used by server 120 may be local to server 120, or it may be located away from server 120 and may communicate with server 120 via a network-based or dedicated connection. The data repository 150 may be of different types. In some embodiments, the data repository used by server 120 may be a database, such as a relational database. One or more of these databases may store, update, and retrieve data from and from the database in response to commands.

[0039] In some embodiments, one or more of the databases 150 may also be used by an application to store application data. The databases used by the application may be of different types, such as key-value stores, object stores, or regular stores supported by a file system.

[0040] Motor vehicle 110 may include sensors 111 for sensing the surrounding environment. Sensors 111 may include one or more of the following sensors: a visual camera, an infrared camera, an ultrasonic sensor, a millimeter-wave radar, and a lidar (LiDAR). Different sensors can provide different detection accuracy and range. Cameras may be mounted in front of, behind, or at other locations on the vehicle. Visual cameras can capture the situation inside and outside the vehicle in real time and present it to the driver and / or passengers. In addition, by analyzing the images captured by the visual cameras, information such as traffic light indications, intersection conditions, and the operating status of other vehicles can be obtained. Infrared cameras can capture objects in night vision conditions. Ultrasonic sensors may be mounted around the vehicle to measure the distance of objects outside the vehicle using the strong directionality of ultrasound. Millimeter-wave radar may be mounted in front of, behind, or at other locations on the vehicle to measure the distance of objects outside the vehicle using the characteristics of electromagnetic waves. LiDAR may be mounted in front of, behind, or at other locations on the vehicle to detect the edges and shape information of objects, thereby performing object recognition and tracking. Due to the Doppler effect, the radar device can also measure the speed changes of the vehicle and moving objects.

[0041] The motor vehicle 110 may also include a communication device 112. The communication device 112 may include a satellite positioning module capable of receiving satellite positioning signals (e.g., BeiDou, GPS, GLONASS, and GALILEO) from satellite 141 and generating coordinates based on these signals. The communication device 112 may also include a module for communicating with a mobile communication base station 142. The mobile communication network can implement any suitable communication technology, such as current or emerging wireless communication technologies (e.g., 5G technology) like GSM / GPRS, CDMA, and LTE. The communication device 112 may also have a vehicle-to-everything (V2X) module, configured to enable vehicle-to-the-world communication, for example, vehicle-to-vehicle (V2V) communication with other vehicles 143 and vehicle-to-infrastructure (V2I) communication with infrastructure 144. Furthermore, the communication device 112 may also have a module configured to communicate with a user terminal 145 (including but not limited to smartphones, tablets, or wearable devices such as watches) via, for example, a wireless local area network conforming to the IEEE 802.11 standard or Bluetooth. Using the communication device 112, the motor vehicle 110 can also access the server 120 via the network 130.

[0042] The motor vehicle 110 may also include a control unit 113. The control unit 113 may include a processor, such as a central processing unit (CPU) or a graphics processing unit (GPU), or other dedicated processors, that communicates with various types of computer-readable storage devices or media. The control unit 113 may include an autonomous driving system for automatically controlling various actuators in the vehicle. The autonomous driving system is configured to control the powertrain, steering system, and braking system of the motor vehicle 110 (not shown) via multiple actuators in response to inputs from multiple sensors 111 or other input devices to control acceleration, steering, and braking respectively, without human intervention or with limited human intervention. Some processing functions of the control unit 113 can be implemented via cloud computing. For example, some processing can be performed using an onboard processor while other processing can be performed using cloud computing resources. The control unit 113 may be configured to perform methods according to this disclosure. Furthermore, the control unit 113 may be implemented as an example of a computing device on the motor vehicle side (client) according to this disclosure.

[0043] Figure 1 The system 100 can be configured and operated in various ways to enable the application of the various methods and apparatus described in this disclosure.

[0044] According to embodiments of this disclosure, such as Figure 2 As shown, a memory allocation method for a target computing system is provided, including: step S201, obtaining a memory block corresponding to an external device connected to the target computing system by pre-allocating memory for the external device, the memory block including multiple sub-memory blocks; step S202, in response to receiving a memory request from the external device, allocating a first sub-memory block in an idle state in the memory block to the external device; and step S203, in response to receiving a signal that the connection between the external device and the target computing system is interrupted, resetting the state of the sub-memory block allocated to the external device to an idle state.

[0045] Therefore, memory is first pre-allocated for each external device to obtain an available memory block for that external device. When the external device makes a memory request, the free sub-memory blocks are allocated to that external device. When the process of the external device is forcibly terminated due to the interruption of the connection between the external device and the target computing system, all the allocated sub-memory blocks corresponding to that external device are reset to a free state to realize the automatic reclamation of allocated memory, improve resource utilization, and avoid resource waste caused by the external device being unable to use the allocated memory after it recovers.

[0046] In some embodiments, the target computing system may be a computing system built on one or more of a computer, a mobile phone, or an in-vehicle computer. External devices may be at least one of a voice device, a camera device, or a sensing device that is communicatively connected to the target computing system.

[0047] In some embodiments, pre-allocating memory for an external device connected to the target computing system may be pre-allocating memory for a computing unit in the target computing system, wherein the computing unit may be, for example, a graphics processor.

[0048] In some embodiments, there may be one or more external devices. When pre-allocating memory, an independent memory region may be allocated for each external device as a memory block corresponding to that external device. Each memory block may include multiple sub-memory blocks. Understandably, the memory size of each sub-memory block and the number of sub-memory blocks can be determined according to actual needs and are not limited here.

[0049] In some embodiments, the operation of pre-allocating memory for external devices connected to the target computing system can be performed in response to the startup of the target computing system. This can further improve the efficiency of memory allocation.

[0050] After acquiring the corresponding memory block for each external device, in response to a memory request sent by the external device, a sub-memory block in an idle state can be acquired from the corresponding memory block and allocated to the external device; in response to receiving a signal that the connection between the external device and the target computing system is interrupted, the state of each allocated sub-memory block in the memory block corresponding to the external device is reset to an idle state, so that memory can be reallocated for the external device after it recovers.

[0051] The reasons for the interruption of the connection between the external device and the target computing system may include, but are not limited to, the interruption caused by the external device crashing or shutting down due to hardware failure or power problems, or the interruption caused by communication link failure. These failures will cause the process being executed by the external device to be forcibly terminated.

[0052] In some embodiments, the external device may include a camera device. Pre-allocating memory for the external device connected to the target computing system to obtain a memory block corresponding to the external device may include: obtaining the pixels of the camera device; and obtaining the memory block corresponding to the camera device based on the pixels of the camera device, wherein the memory size of each sub-memory block in the memory block is determined based on the pixels of the camera device.

[0053] In some embodiments, the external device may be a camera device, and the target computing system may be an onboard computer or an edge computing device in a roadside device.

[0054] In some embodiments, the target computing system can be connected to multiple external camera devices (e.g., 12), each with potentially different pixel counts. By determining the memory size of the corresponding sub-memory blocks based on the pixel count of the camera devices, resource waste caused by excessively large sub-memory blocks can be avoided, thereby improving resource utilization.

[0055] In some embodiments, the memory size of each sub-memory block in the memory block can be the memory size required for a frame of image captured by the camera device.

[0056] In some exemplary embodiments, the vehicle-mounted computer can connect to 12 camera devices, including eight 8MP cameras and four 3MP cameras. The memory required for one frame of an image captured by an 8MP camera is approximately 7.8125MB, and the memory required for one frame of an image captured by a 3MP camera is approximately 2.93MB. When pre-allocating memory for each camera device, the memory size of the sub-memory block corresponding to the 8MP camera can be determined as 7.8125MB, and the memory size of the sub-memory block corresponding to the 3MP camera can be determined as 2.93MB. This improves resource utilization and further enhances the efficiency of image data processing.

[0057] In some embodiments, a preset memory size can be added to the memory size required for a single frame of image to determine the memory size of the sub-memory block and prevent possible memory overflow.

[0058] In some embodiments, the target computing system may include a first driver and a second driver.

[0059] like Figure 3 As shown, in response to receiving a memory request from an external device, allocating a first sub-memory block in a free state within a memory block to the external device may include: Step S301, in response to receiving a memory request, a second driver sends a memory block allocation request to a first driver, the memory block allocation request including a first identifier of the external device; Step S302, in response to receiving a memory block allocation request, the first driver performs the following operations: Step S3021, based on the first identifier, obtains the first sub-memory block from the memory block corresponding to the external device; Step S3022, sends a second identifier of the first sub-memory block to the second driver; and Step S3023, updates the state of the first sub-memory block to an allocated state; and Step S303, in response to receiving a second identifier, the second driver sends the second identifier to the external device to allocate the first sub-memory block to the external device.

[0060] Therefore, by modifying existing drivers to implement the memory allocation method of the present disclosure, it is possible to reduce development costs, improve development efficiency, and enhance the stability of the memory allocation scheme.

[0061] In some embodiments, the first driver may be a driver for hardware initialization and resource allocation. The second driver may be a driver for managing and controlling external devices. It is understood that those skilled in the art can determine the first and second drivers according to actual needs, and no restrictions are imposed herein.

[0062] In some embodiments, the acquisition and management of memory blocks can be performed by a first driver.

[0063] In some embodiments, pre-allocating graphics card memory for external devices connected to the target computing system to obtain memory blocks corresponding to the external devices may include: in response to the startup of the target computing system, registering each camera device through a first driver to obtain device identification information and pixels of each camera device; and, through the first driver, allocating corresponding memory blocks in video memory for each camera device based on the pixels of each camera device.

[0064] The memory allocation method disclosed herein will be further described in detail below using in-vehicle computers and in-vehicle camera equipment as examples.

[0065] In some exemplary embodiments, the first driver may be a PCIE (Peripheral Component Interconnect Express) driver for implementing hardware initialization and resource allocation. The second driver may be a V4L2 (Video for Linux 2, a kernel driver for video devices in the Linux kernel) driver for implementing video or image data processing and the management and control of the camera device.

[0066] Figure 4 An architecture diagram of a first driver and a second driver according to exemplary embodiments of the present disclosure is shown.

[0067] In some exemplary embodiments, such as Figure 4 As shown, an external device (such as an in-vehicle camera) can interact with the second driver through an external device driver (such as a camera driver). The second driver and the first driver can interact through a preset interface.

[0068] In some exemplary embodiments, see continue to see Figure 4The first driver is used to manage the memory blocks V0 to V11 pre-allocated during system startup. The flowchart for memory pre-allocation can be found in [link to flowchart]. Figure 5 In response to the start of the memory pre-allocation process, the first driver pre-allocates corresponding memory blocks for each camera device based on information such as the pixel count of each camera device.

[0069] In some exemplary embodiments, the first driver can pre-allocate memory for each camera device using the dma_alloc_attrs function.

[0070] See also Figure 4 Memory blocks V0 to V11 correspond to 12 camera devices (camera device v0 to camera device v11), and each memory block includes n memory blocks, which can be identified as buffer 1, buffer2, ..., buffer n.

[0071] In response to the second driver receiving a memory request from a camera device, the second driver obtains a free sub-memory block (the first sub-memory block mentioned above) from the memory block managed by the first driver corresponding to the camera device, and allocates the sub-memory block to the camera device.

[0072] In response to the second driver receiving a signal that a camera device is powered off (for example, in response to a camera device being powered off, the second driver closes the file descriptor corresponding to the camera device), a first release instruction can be sent to the first driver to reset the state of each allocated sub-memory block corresponding to the camera device to an idle state.

[0073] Figure 6 A flowchart illustrating the allocation of sub-memory blocks to a camera device according to an exemplary embodiment of the present disclosure is shown.

[0074] In some exemplary embodiments, such as Figure 6 As shown, in response to a memory request received by the second driver from a camera device, a memory allocation process is triggered. The second driver sends a memory block allocation request to the first driver by calling a memory allocation function (e.g., get_dma_attrs). This memory block allocation request includes a first identifier of the camera device (e.g., device identifier v1 mentioned above). Upon receiving the request, the first driver can determine the memory block corresponding to the camera device based on the first identifier. It then sequentially checks the status of multiple sub-memory blocks within that memory block. In response to detecting a sub-memory block in an idle state, the first driver returns the address of that sub-memory block to the second driver, which then allocates it to the camera device. Simultaneously, the first driver can set the status of the sub-memory block to an allocated state.

[0075] In some embodiments, the memory allocation method for the target computing system described above may further include: in response to receiving a memory release signal for a first sub-memory block sent by an external device, a second driver sends a second release request to a first driver, the second release request including a first identifier of the external device and a second identifier of the first sub-memory block; and in response to receiving the second release request, the first driver updates the state of the first sub-memory block to an idle state based on the first identifier and the second identifier.

[0076] In some embodiments, in response to the completion of execution of a process of a camera device, the sub-memory block occupied by that process can be released. In some embodiments, the camera device can send a memory release signal for the corresponding sub-memory block to a second driver. After receiving the signal, the second driver can send a second release request to the first driver (e.g., through the put_dma_attrs function). The request carries a first identifier of the camera device (device identifier v1) and a second identifier of the sub-memory block (e.g., the identifier buffer 2 of the sub-memory block).

[0077] Upon receiving the request, the first driver can locate the corresponding sub-memory block in the corresponding memory block based on the aforementioned identifier (e.g., locate the sub-memory block buffer 2 in memory block V1) and reset the state of the sub-memory block to the idle state.

[0078] This allows for the timely reclamation of sub-memory blocks from terminated processes, thereby further improving the utilization rate of memory resources.

[0079] In some embodiments, in response to receiving a signal indicating that the connection between the external device and the target computing system is interrupted, resetting the state of a sub-memory block allocated to the external device to an idle state may include: in response to receiving the signal, a second driver sends a first release request to a first driver, the first release request including a first identifier of the external device; and in response to receiving the first release request, the first driver resets the state of each sub-memory block in the memory block corresponding to the external device to an idle state according to the first identifier.

[0080] Therefore, by modifying existing drivers to implement the memory allocation method of the present disclosure, it is possible to reduce development costs, improve development efficiency, and enhance the stability of the memory allocation scheme.

[0081] Figure 7 A flowchart illustrating the release of a sub-memory block according to an exemplary embodiment of the present disclosure is shown.

[0082] In some exemplary embodiments, in response to a camera device being powered off during operation, after the second driver receives a signal indicating that the camera device is powered off (e.g., in response to the camera device being powered off, the second driver closes the file descriptor corresponding to the camera device), it can trigger a memory release process and reset the state of all sub-memory blocks allocated to the camera device to an idle state by calling a memory release function (e.g., put_dma_attrs). After the camera device is powered on again, these memory blocks can be re-allocated to the camera device according to memory requests.

[0083] In some embodiments, the memory allocation method for the target computing system described above may further include: releasing a memory block by a first driver in response to the target computing system being shut down.

[0084] Figure 8 A flowchart illustrating memory block release according to an exemplary embodiment of the present disclosure is shown.

[0085] In some exemplary embodiments, such as Figure 8 As shown, in response to the shutdown of the onboard computer, the first driver can release the memory blocks corresponding to each requested camera device by calling a memory release function (e.g., dma_free_attrs). Therefore, when the target computing system is shut down, all requested memory blocks are released promptly, thus avoiding resource waste caused by memory resources still being occupied after the system is shut down.

[0086] In some embodiments, such as Figure 9 As shown, a memory allocation apparatus 900 for a target computing system is provided, comprising: an acquisition unit 910 configured to acquire a memory block corresponding to an external device by pre-requesting memory for an external device connected to the target computing system, the memory block including a plurality of sub-memory blocks; an allocation unit 920 configured to allocate a first sub-memory block in an idle state in the memory block to the external device in response to receiving a memory request from the external device; and a reset unit 930 configured to reset the state of the sub-memory block allocated to the external device to an idle state in response to receiving a signal that the connection between the external device and the target computing system is interrupted.

[0087] The operations performed by units 910 to 930 in the memory allocation device 900 for the target computing system and the effects they can achieve are similar to steps S201 to S203 in the memory allocation method for the target computing system, and will not be described again.

[0088] In some embodiments, the target computing system may include a first driver and a second driver, and the allocation unit may include: a first sending subunit configured to, in response to receiving a memory request, send a memory block allocation request from the second driver to the first driver, the memory block allocation request including a first identifier of an external device; a first execution subunit configured to, in response to receiving the memory block allocation request, perform the following operations by the first driver: obtaining a first sub-memory block from the memory block corresponding to the external device according to the first identifier; sending a second identifier of the first sub-memory block to the second driver; and updating the status of the first sub-memory block to an allocated status; and a second sending subunit configured to, in response to receiving a second identifier, send the second identifier to the external device to allocate the first sub-memory block to the external device.

[0089] In some embodiments, the reset unit may include: a third sending subunit configured to send a first release request from the second driver to the first driver in response to receiving a signal, the first release request including a first identifier of the external device; and a first reset subunit configured to reset the state of each sub-memory block in the memory block corresponding to the external device to an idle state in response to receiving the first release request, based on the first identifier.

[0090] In some embodiments, the memory allocation apparatus for the target computing system described above may further include: a sending unit configured to, in response to receiving a memory release signal for a first sub-memory block sent by an external device, send a second release request from a second driver to a first driver, the second release request including a first identifier of the external device and a second identifier of the first sub-memory block; and an updating unit configured to, in response to receiving the second release request, update the state of the first sub-memory block to an idle state by the first driver based on the first identifier and the second identifier.

[0091] In some embodiments, the memory allocation device for the target computing system described above may further include: a release unit configured to release a memory block by a first driver in response to the shutdown of the target computing system.

[0092] In some embodiments, the external device may include a camera device, and the acquisition unit may include: a first acquisition subunit configured to acquire pixels of the camera device; and a second acquisition subunit configured to acquire a memory block corresponding to the camera device based on the pixels of the camera device, wherein the memory size of each sub-memory block in the memory block is determined based on the pixels of the camera device.

[0093] In some embodiments, the memory size of each sub-memory block in the memory block can be the memory size required for a frame of image captured by the camera device.

[0094] According to embodiments of this disclosure, an electronic device, a readable storage medium, and a computer program product are also provided.

[0095] According to another aspect of this disclosure, an edge computing device is also provided. Optionally, in addition to electronic devices, the edge computing device may also include communication components, etc. The electronic devices and communication components can be integrated or separately configured. The electronic devices can acquire data from roadside sensing devices (such as roadside cameras), such as images and videos, thereby performing image and video processing and data calculations, and then transmitting the processing and calculation results to the cloud control platform via the communication components.

[0096] Optionally, the edge computing device can also be a Road Side Computing Unit (RSCU). Alternatively, the electronic device itself can also have the functions of acquiring and communicating sensing data, such as an AI camera. The electronic device can directly perform image and video processing and data calculation based on the acquired sensing data, and then transmit the processing and calculation results to the cloud control platform.

[0097] Optionally, the cloud control platform performs processing in the cloud, including image and video processing and data calculation. The cloud control platform can also be called a vehicle-road cooperative management platform, V2X platform, cloud computing platform, central system, cloud server, etc.

[0098] refer to Figure 10 The present invention describes a structural block diagram of an electronic device 1000 that can serve as a server or client of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0099] like Figure 10As shown, the electronic device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. The RAM 1003 may also store various programs and data required for the operation of the electronic device 1000. The computing unit 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0100] Multiple components in electronic device 1000 are connected to I / O interface 1005, including: input unit 1006, output unit 1007, storage unit 1008, and communication unit 1009. Input unit 1006 can be any type of device capable of inputting information to electronic device 1000. Input unit 1006 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device, and may include, but is not limited to, a mouse, keyboard, touchscreen, trackpad, trackball, joystick, microphone, and / or remote control. Output unit 1007 can be any type of device capable of presenting information, and may include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 1008 may include, but is not limited to, a hard disk and an optical disk. The communication unit 1009 allows the electronic device 1000 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and / or chipsets, such as Bluetooth devices, 802.11 devices, WiFi devices, WiMax devices, cellular communication devices and / or the like.

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

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

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

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

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

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

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

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

[0109] While embodiments or examples of this disclosure have been described with reference to the accompanying drawings, it should be understood that the methods, systems, and devices described above are merely exemplary embodiments or examples, and the scope of the invention is not limited by these embodiments or examples, but only by the granted claims and their equivalents. Various elements in the embodiments or examples may be omitted or replaced by their equivalents. Furthermore, the steps may be performed in a different order than that described in this disclosure. Further, various elements in the embodiments or examples may be combined in various ways. Importantly, as the technology evolves, many elements described herein can be replaced by equivalents that appear after this disclosure.

Claims

1. A memory allocation method for a target computing system, the target computing system including a first driver and a second driver, the method comprising: By pre-allocating memory for an external device connected to the target computing system, a memory block corresponding to the external device is obtained. The memory block includes multiple sub-memory blocks. The external device includes a camera device. The process of pre-allocating memory for the external device connected to the target computing system and obtaining the memory block corresponding to the external device includes: In response to the startup of the target computing system, the pixels of the camera device are acquired through the first driver; and The first driver program pre-allocates memory based on the pixels of the camera device to request a corresponding memory block for the camera device in the video memory. The memory size of each sub-memory block in the memory block is determined based on the pixels of the camera device, and the memory block is held and managed by the first driver program. In response to the second driver receiving a memory request from the external device, the second driver retrieves a first free sub-memory block from the memory block managed by the first driver and allocates it to the external device; and In response to receiving a signal indicating that the connection between the external device and the target computing system has been interrupted, the first driver resets the state of the sub-memory block that has been allocated to the external device to an idle state, so that after the external device and the target computing system resume connection, the sub-memory block can be reallocated according to the memory request of the external device.

2. The method of claim 1, wherein, The step of responding to the second driver receiving a memory request from the external device by retrieving a first sub-memory block that is in a free state from the memory block managed by the first driver and allocating it to the external device includes: In response to receiving the memory request, the second driver sends a memory block allocation request to the first driver, the memory block allocation request including a first identifier of the external device; In response to receiving the memory block allocation request, the first driver performs the following operations: Based on the first identifier, the first sub-memory block is obtained from the memory block corresponding to the external device; Send the second identifier of the first sub-memory block to the second driver; and Update the state of the first sub-memory block to the allocated state; and In response to receiving the second identifier, the second driver sends the second identifier to the external device to allocate the first sub-memory block to the external device.

3. The method of claim 2, wherein, The step of resetting the state of the sub-memory block allocated to the external device to an idle state by the first driver in response to receiving a signal indicating that the connection between the external device and the target computing system is interrupted includes: In response to receiving the signal, the second driver sends a first release request to the first driver, the first release request including a first identifier of the external device; and In response to receiving the first release request, the first driver resets the state of each sub-memory block in the memory block corresponding to the external device to an idle state according to the first identifier.

4. The method according to claim 2 or 3, further comprising: In response to receiving a memory release signal for the first sub-memory block sent by the external device, the second driver sends a second release request to the first driver. The second release request includes a first identifier of the external device and a second identifier of the first sub-memory block. as well as In response to receiving the second release request, the first driver updates the state of the first sub-memory block to free state based on the first identifier and the second identifier.

5. The method according to claim 2 or 3, further comprising: In response to the shutdown of the target computing system, the memory block is released by the first driver.

6. The method of claim 1, wherein, The memory size of each sub-memory block in the memory block is the memory size required for one frame of image captured by the camera device.

7. A memory allocation device for a target computing system, the target computing system including a first driver and a second driver, the device comprising: The acquisition unit is configured to acquire a memory block corresponding to an external device connected to the target computing system by pre-allocating memory for the external device, the memory block comprising multiple sub-memory blocks, and the external device including a camera device. The acquisition unit is further configured to: In response to the startup of the target computing system, the pixels of the camera device are acquired through the first driver; and The first driver program pre-allocates memory based on the pixels of the camera device to request a corresponding memory block for the camera device in the video memory. The memory size of each sub-memory block in the memory block is determined based on the pixels of the camera device, and the memory block is held and managed by the first driver program. An allocation unit is configured to, in response to the second driver receiving a memory request from the external device, obtain a first sub-memory block that is in a free state from the memory block managed by the first driver and allocate it to the external device; and The reset unit is configured to, in response to receiving a signal indicating that the connection between the external device and the target computing system has been interrupted, have the first driver reset the state of the sub-memory block already allocated to the external device to an idle state, so that after the external device and the target computing system resume connection, the sub-memory block can be reallocated according to the memory request of the external device.

8. The apparatus of claim 7, wherein, The allocation unit includes: A first transmitting subunit is configured to, in response to receiving the memory request, send a memory block allocation request from the second driver to the first driver, the memory block allocation request including a first identifier of the external device; The first execution subunit is configured to, in response to receiving the memory block allocation request, perform the following operations by the first driver: Based on the first identifier, the first sub-memory block is obtained from the memory block corresponding to the external device; Send the second identifier of the first sub-memory block to the second driver; and Update the state of the first sub-memory block to the allocated state; and The second transmitting subunit is configured to, in response to receiving the second identifier, send the second identifier to the external device by the second driver to allocate the first sub-memory block to the external device.

9. The apparatus of claim 8, wherein, The reset unit includes: A third transmitting subunit is configured to, in response to receiving the signal, send a first release request from the second driver to the first driver, the first release request including a first identifier of the external device; and The first reset subunit is configured to, in response to receiving the first release request, have the first driver reset the state of each sub-memory block in the memory block corresponding to the external device to an idle state based on the first identifier.

10. The apparatus according to claim 8 or 9, further comprising: The sending unit is configured to, in response to receiving a memory release signal for the first sub-memory block sent by the external device, send a second release request from the second driver to the first driver, the second release request including a first identifier of the external device and a second identifier of the first sub-memory block; as well as The update unit is configured to, in response to receiving the second release request, update the state of the first sub-memory block to an idle state by the first driver based on the first identifier and the second identifier.

11. The apparatus according to claim 8 or 9, further comprising: The release unit is configured to release the memory block by the first driver in response to the shutdown of the target computing system.

12. The apparatus of claim 7, wherein, The memory size of each sub-memory block in the memory block is the memory size required for one frame of image captured by the camera device.

13. An electronic device, comprising: At least one processor; as well as A memory that is communicatively connected to the at least one processor; in The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.

14. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-6.

15. A computer program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the method of any one of claims 1-6.

16. An autonomous vehicle, comprising: At least one camera device; as well as The electronic device as claimed in claim 13.

17. An edge computing device, comprising: At least one camera device; as well as The electronic device as claimed in claim 13.