Dynamic shared memory multiplexing method and device applicable to GPGPU (General Purpose Graphics Processing Unit)

Through the dynamic shared memory multiplexing method, using the read-write lock index table and memory demand analysis, the problem of inefficient shared memory management in GPGPU is solved, more efficient memory resource utilization and computing throughput are achieved, and the GPGPU is improved. Overall performance.

CN118535356AActive Publication Date: 2024-08-23YUANQIXIN (SHANDONG) SEMICONDUCTOR TECHNOLOGY CO LTD

Patent Information

Application Number
CN202411000879.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-08-23
Estimated Expiration
2044-07-25

AI Technical Summary

Technical Problem

The shared memory management in the GPGPU architecture adopts a static allocation strategy, which results in inefficiency during concurrent access by multiple threads, limits performance, and is difficult to support the simultaneous execution of more thread blocks, affecting computing throughput.

Method used

Adopting a dynamic shared memory multiplexing method, through memory requirement analysis of thread blocks and read-write lock index table management, thread blocks with the same data access requirements are allowed to share reusable shared memory partitions, and thread blocks with different requirements are Allocate read and write locks to achieve flexible scheduling and rapid release of memory resources.

Benefits of technology

It significantly improves the utilization efficiency of shared memory and the computing throughput of GPGPU, reduces the delay of thread blocks waiting for memory resources, improves thread scheduling response speed and concurrent memory access capabilities, and achieves more efficient resource utilization and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535356A
    Figure CN118535356A
Patent Text Reader

Abstract

The invention discloses a dynamic shared memory multiplexing method and device applicable to a GPGPU (General Purpose Graphics Processing Unit), and relates to the technical field of memory resource allocation. Comprising the following steps: step 1, based on a GPGPU (General Purpose Graphics Processing Unit) framework, according to a memory task request sent by each thread block, performing memory demand analysis on the thread blocks: step 11, allowing the thread blocks with the same data access demand to share a reusable shared memory partition in a shared memory pool, and step 12, aiming at the thread blocks without the same data access demand, storing the thread blocks in the shared memory pool; the distributed read-write lock is used for locking and accessing a non-multiplexing shared memory partition in the shared memory pool at a given moment, and 2, when the thread block completes a memory task request, releasing the shared memory and providing the shared memory to other thread blocks for use; according to the method, the computing efficiency of the GPGPU and the utilization rate of memory resources are effectively improved, the throughput of the system is remarkably increased, meanwhile, the waiting time of the thread block is shortened, and the concurrent access capability of the memory is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention discloses a dynamic shared memory multiplexing method and device suitable for GPGPU, and relates to the technical field of memory resource allocation. Background Art

[0002] As an efficient parallel computing platform, general-purpose graphics processing units (GPGPUs) are widely used in scientific computing, graphics processing, big data analysis and other fields. However, the shared memory management method in the GPGPU architecture often adopts a static allocation strategy, which is inefficient when accessed by multiple threads concurrently, limiting the performance of GPGPU. In existing GPGPU designs, the allocation of shared memory is bound to the life cycle of thread blocks. Even if the actual usage time is much less than the allocation time, once allocated, it will occupy the entire execution period. This leads to low utilization of shared memory resources and makes it difficult to support the simultaneous execution of more thread blocks, affecting the thread-level parallelism and overall computing throughput of GPGPU. Summary of the invention

[0003] The present invention aims at solving the problems of the prior art and provides a method and device for dynamic shared memory multiplexing suitable for GPGPU, which can significantly improve the utilization efficiency of shared memory and the computing throughput of GPGPU without increasing hardware resources. Through the present invention, shared memory resources can be managed and scheduled more flexibly, allowing multiple thread blocks to efficiently share and reuse limited shared memory space, thereby breaking through performance bottlenecks.

[0004] The specific scheme proposed by the present invention is: The present invention provides a dynamic shared memory multiplexing method applicable to GPGPU, comprising: Step 1: Based on the GPGPU framework, perform memory requirement analysis on thread blocks according to the memory task requests issued by each thread block: Step 11: Allow thread blocks with the same data access requirements to share reusable shared memory partitions in the shared memory pool. Step 12: for thread blocks that do not have the same data access requirements, a read-write lock is allocated to lock access to a non-reused shared memory partition in the shared memory pool at a given time, wherein the thread block read-write lock is allocated using a read-write lock index table. When the corresponding shared memory segment signal in the read-write lock index table is pulled high, it indicates that a thread block in the shared memory partition has been allocated a read-write lock and needs to wait for the read-write lock to be released. When the corresponding shared memory partition signal in the read-write lock index table is pulled low, it indicates that the read-write lock corresponding to the shared memory partition has been released. Step 2: When the thread block completes the memory task request, the shared memory is released and provided to other thread blocks.

[0005] Furthermore, step 1 of the dynamic shared memory multiplexing method applicable to GPGPU also includes step 10: judging whether there is valid data in the address space corresponding to the memory task request and whether there is sufficient allocation space in the shared memory pool according to the memory requirements of the thread block, and if so, proceeding to steps 11 and 12.

[0006] Furthermore, in step 10 of the dynamic shared memory multiplexing method applicable to GPGPU, a shared memory scoreboard is used to record a valid signal of the address space in the shared memory. When data is written into the address space, the valid signal is pulled high, and it is regarded that there is valid data in the address space. Otherwise, it is regarded that there is no valid data in the address space. At the same time, the register is used to record the size of the remaining space of the shared memory to determine whether the remaining space of the shared memory is sufficient for allocation.

[0007] Furthermore, in step 11 of the dynamic shared memory multiplexing method applicable to GPGPU, it is determined whether the thread blocks have the same data access requirements based on the addresses of the thread blocks accessing the shared memory in the memory task request. If the addresses of the thread blocks accessing the shared memory are the same, they have the same data access requirements; otherwise, the thread blocks do not have the same data access requirements.

[0008] Furthermore, in step 2 of the dynamic shared memory multiplexing method applicable to GPGPU, the released scattered address space of the shared memory is remapped so that the address space is concentrated in a continuous shared memory partition, so that the shared memory pool can subsequently allocate a continuous address space and read the continuous address space.

[0009] The present invention also provides a dynamic shared memory multiplexing device suitable for GPGPU, including a demand allocation module and a resource adjustment module. The demand allocation module is based on the GPGPU framework and performs memory demand analysis of thread blocks according to the memory task requests issued by each thread block: Step 11: Allow thread blocks with the same data access requirements to share reusable shared memory partitions in the shared memory pool. Step 12: for thread blocks that do not have the same data access requirements, a read-write lock is allocated to lock access to a non-reused shared memory partition in the shared memory pool at a given time, wherein the thread block read-write lock is allocated using a read-write lock index table. When the corresponding shared memory segment signal in the read-write lock index table is pulled high, it indicates that a thread block in the shared memory partition has been allocated a read-write lock and needs to wait for the read-write lock to be released. When the corresponding shared memory partition signal in the read-write lock index table is pulled low, it indicates that the read-write lock corresponding to the shared memory partition has been released. When a thread block completes a memory task request, the resource adjustment module releases the shared memory and provides it to other thread blocks.

[0010] Furthermore, the demand allocation module of the dynamic shared memory multiplexing device suitable for GPGPU also executes step 10: according to the memory demand of the thread block, it is determined whether there is valid data in the address space corresponding to the memory task request and whether the shared memory pool has sufficient allocation space, and if so, steps 11 and 12 are executed.

[0011] Furthermore, when the demand allocation module of the dynamic shared memory multiplexing device suitable for GPGPU executes step 10, the shared memory scoreboard is used to record the valid signal of the address space in the shared memory. When data is written into the address space, the valid signal is pulled high, and it is regarded that there is valid data in the address space. Otherwise, it is regarded that there is no valid data in the address space. At the same time, the register is used to record the size of the remaining space of the shared memory to determine whether the remaining space of the shared memory is sufficient for allocation.

[0012] Furthermore, when the demand allocation module of the dynamic shared memory multiplexing device suitable for GPGPU executes step 11, it determines whether the thread blocks have the same data access requirements based on the addresses of the thread blocks accessing the shared memory in the memory task request. If the addresses of the thread blocks accessing the shared memory are the same, they have the same data access requirements; otherwise, the thread blocks do not have the same data access requirements.

[0013] Furthermore, the resource adjustment module of the dynamic shared memory multiplexing device suitable for GPGPU remaps the released scattered address space of the shared memory so that the address space is concentrated in a continuous shared memory partition, so that the shared memory pool can subsequently allocate continuous address space and read the continuous address space.

[0014] The benefits of the present invention are: The present invention reuses and dynamically allocates memory resources, ensuring that memory is allocated only when actually needed, effectively avoiding unnecessary memory occupation and waste, and achieving efficient circulation of memory resources. In addition, the fast release mechanism ensures that the memory resources occupied by the thread block are immediately recovered after the computing task is completed, significantly reducing the delay caused by the thread block waiting for memory resources and improving the response speed of thread scheduling; The multiplexing strategy allows multiple thread blocks to share the same memory resource, reducing the idle time caused by waiting for memory allocation, thereby speeding up the execution of thread blocks. This overlapping use of time reduces the idleness of memory resources, allowing more computing tasks to be performed simultaneously, and improving the overall computing throughput; With adaptive memory adjustment capability, the system can adaptively adjust memory allocation strategies according to the specific characteristics and runtime behavior of applications to achieve optimal resource utilization and performance. This flexibility and scalability enables the system to adapt to GPGPU applications of different sizes and characteristics. Overall, the present invention effectively improves the computing efficiency of GPGPU and the utilization of memory resources, significantly increases the throughput of the system, reduces the waiting time of thread blocks, improves the concurrent access capability of memory, and provides users with a more efficient, stable and reliable computing environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 Schematic diagram of the process of the present invention.

[0016] Figure 2 The present invention relates to a flow chart of a reusable shared memory partition shared by thread blocks with the same data access requirements.

[0017] Figure 3 The present invention relates to a flow chart of dynamically allocating memory. DETAILED DESCRIPTION

[0018] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0019] Embodiment 1: The present invention provides a dynamic shared memory multiplexing method applicable to GPGPU, comprising: Step 1: Based on the GPGPU framework, perform memory requirement analysis on thread blocks according to the memory task requests issued by each thread block: Step 11: Allow thread blocks with the same data access requirements to share reusable shared memory partitions in the shared memory pool.

[0020] Whether the thread blocks have the same data access requirements is determined based on the addresses of the thread blocks accessing the shared memory in the memory task request. If the addresses of the thread blocks accessing the shared memory are the same, they have the same data access requirements. Otherwise, the thread blocks do not have the same data access requirements.

[0021] When one of the thread blocks with the same data access requirement reads the data in the address space of the reusable shared memory partition, the data can be directly returned to other thread blocks with the same data access requirement, thereby achieving a multiplexing effect.

[0022] Step 12: For thread blocks that do not have the same data access requirements, a read-write lock is allocated to lock access to a non-reused shared memory partition in the shared memory pool at a given time, wherein the thread block read-write lock is allocated using a read-write lock index table. When the corresponding shared memory segmentation signal in the read-write lock index table is pulled high, it indicates that a thread block in the shared memory partition has been allocated a read-write lock and needs to wait for the read-write lock to be released. When the corresponding shared memory partition signal in the read-write lock index table is pulled low, it indicates that the read-write lock corresponding to the shared memory partition has been released.

[0023] Step 2: When the thread block completes the memory task request, the shared memory is released and provided to other thread blocks.

[0024] For example, combined with Figure 2 , thread blocks 1 to n request memory, and perform demand analysis on thread blocks 1 to n. For example, thread blocks 1 and n have the same data access requirements, and share a reusable shared memory partition in the shared memory pool. When thread blocks 1 and n complete the memory request task, release the corresponding shared memory partition. At the same time, it can be determined whether there are other thread blocks that need this shared memory partition. If there is thread block 2 that needs this shared memory partition, it is assigned to thread block 2 to perform the memory task. After completing the memory task of thread block 2, release this shared memory partition and return it to the shared memory pool.

[0025] Embodiment 2: Based on embodiment 1, step 1 of the method of the present invention also includes step 10: according to the memory requirements of the thread block, determine whether there is valid data in the address space corresponding to the memory task request and whether the shared memory pool has sufficient allocation space, and if so, proceed to steps 11 and 12.

[0026] The shared memory scoreboard can be further used to record the valid signal of the address space in the shared memory. When data is written to the address space, the valid signal is pulled high, which is regarded as valid data in the address space, otherwise it is regarded as no valid data in the address space. If the valid bit of the corresponding address is not set to 1, it is regarded as the address does not have data, the allocation fails, an error is reported, and the memory task request is returned, waiting for the next request to be sent.

[0027] At the same time, the register is used to record the remaining space of the shared memory to determine whether the remaining space of the shared memory is sufficient for allocation. If the remaining size is less than the requested space size, it is considered that there is insufficient space and the allocation fails. The memory task request is temporarily suspended until there is enough memory in the shared memory pool to meet the request. At this time, the request is responded to and memory is allocated to the thread block that issued the request.

[0028] For example, combined with Figure 3When a thread block initiates a memory access request, it first determines whether there is valid data in the address space corresponding to the shared memory to be accessed. If so, it determines the size of the space that can be allocated in the shared memory pool. If the space is insufficient, it waits. If the space meets the allocation requirements, it allocates memory for the thread block to execute the task. If the task is completed, the memory is quickly released to achieve resource recovery. At the same time, it detects whether there are other memory access requests. If not, the task is terminated. If so, the memory is adaptively adjusted. For example, in step 2, the scattered address space of the released shared memory is remapped so that the address space is concentrated in a continuous shared memory partition, so that the shared memory pool can allocate continuous address space and read the continuous address space in the future.

[0029] Embodiment 3: The present invention also provides a dynamic shared memory multiplexing device suitable for GPGPU, including a demand allocation module and a resource adjustment module. The demand allocation module is based on the GPGPU framework and performs memory demand analysis of thread blocks according to the memory task requests issued by each thread block: Step 11: Allow thread blocks with the same data access requirements to share reusable shared memory partitions in the shared memory pool. Step 12: for thread blocks that do not have the same data access requirements, a read-write lock is allocated to lock access to a non-reused shared memory partition in the shared memory pool at a given time, wherein the thread block read-write lock is allocated using a read-write lock index table. When the corresponding shared memory segment signal in the read-write lock index table is pulled high, it indicates that a thread block in the shared memory partition has been allocated a read-write lock and needs to wait for the read-write lock to be released. When the corresponding shared memory partition signal in the read-write lock index table is pulled low, it indicates that the read-write lock corresponding to the shared memory partition has been released. When a thread block completes a memory task request, the resource adjustment module releases the shared memory and provides it to other thread blocks.

[0030] As the information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.

[0031] Similarly, the device of the present invention reuses and dynamically allocates memory resources, ensuring that memory allocation is performed only when actually needed, effectively avoiding unnecessary memory occupation and waste, and achieving efficient circulation of memory resources. In addition, the fast release mechanism ensures that the memory resources occupied by the thread block are immediately recovered after the computing task is completed, significantly reducing the delay caused by the thread block waiting for memory resources and improving the response speed of thread scheduling; The multiplexing strategy allows multiple thread blocks to share the same memory resource, reducing the idle time caused by waiting for memory allocation, thereby speeding up the execution of thread blocks. This overlapping use of time reduces the idleness of memory resources, allowing more computing tasks to be performed simultaneously, and improving the overall computing throughput; With adaptive memory adjustment capability, the system can adaptively adjust memory allocation strategies according to the specific characteristics and runtime behavior of applications to achieve optimal resource utilization and performance. This flexibility and scalability enables the system to adapt to GPGPU applications of different sizes and characteristics. In general, the device of the present invention effectively improves the computing efficiency of GPGPU and the utilization rate of memory resources, significantly increases the throughput of the system, reduces the waiting time of thread blocks, improves the concurrent access capability of memory, and provides users with a more efficient, stable and reliable computing environment.

[0032] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.

[0033] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.

Claims

1. A dynamic shared memory multiplexing method suitable for GPGPU, characterized by include: Step 1: Based on the GPGPU framework, perform memory requirement analysis on thread blocks according to the memory task requests issued by each thread block: Step 11: Allow thread blocks with the same data access requirements to share reusable shared memory partitions in the shared memory pool. Step 12: for thread blocks that do not have the same data access requirements, a read-write lock is allocated to lock access to a non-reused shared memory partition in the shared memory pool at a given time, wherein the thread block read-write lock is allocated using a read-write lock index table. When the corresponding shared memory segment signal in the read-write lock index table is pulled high, it indicates that a thread block in the shared memory partition has been allocated a read-write lock and needs to wait for the read-write lock to be released. When the corresponding shared memory partition signal in the read-write lock index table is pulled low, it indicates that the read-write lock corresponding to the shared memory partition has been released. Step 2: When the thread block completes the memory task request, the shared memory is released and provided to other thread blocks.

2. A dynamic shared memory multiplexing method suitable for GPGPU according to claim 1, characterized in that Step 1 also includes step 10: according to the memory requirements of the thread block, determine whether there is valid data in the address space corresponding to the memory task request and whether the shared memory pool has sufficient allocation space, and if so, proceed to steps 11 and 12.

3. A dynamic shared memory multiplexing method suitable for GPGPU according to claim 2, characterized in that In step 10, the shared memory scoreboard is used to record the valid signal of the address space in the shared memory. When data is written into the address space, the valid signal is pulled high, which is regarded as the existence of valid data in the address space. Otherwise, it is regarded as the absence of valid data in the address space. At the same time, the register is used to record the size of the remaining space of the shared memory to determine whether the remaining space of the shared memory is sufficient for allocation.

4. The method for dynamic shared memory multiplexing suitable for GPGPU according to claim 1, characterized in that In step 11, it is determined whether the thread blocks have the same data access requirements based on the addresses of the thread blocks accessing the shared memory in the memory task request. If the addresses of the thread blocks accessing the shared memory are the same, they have the same data access requirements, otherwise the thread blocks do not have the same data access requirements.

5. The method for dynamic shared memory multiplexing suitable for GPGPU according to claim 1, characterized in that In step 2, the scattered address space of the released shared memory is remapped so that the address space is concentrated in a continuous shared memory partition, so that the shared memory pool can subsequently allocate a continuous address space and read the continuous address space.

6. A dynamic shared memory multiplexing device suitable for GPGPU, characterized in that Including demand allocation module and resource adjustment module, The demand allocation module is based on the GPGPU framework and performs memory demand analysis of thread blocks according to the memory task requests issued by each thread block: Step 11: Allow thread blocks with the same data access requirements to share reusable shared memory partitions in the shared memory pool. Step 12: for thread blocks that do not have the same data access requirements, a read-write lock is allocated to lock access to a non-reused shared memory partition in the shared memory pool at a given time, wherein the thread block read-write lock is allocated using a read-write lock index table. When the corresponding shared memory segment signal in the read-write lock index table is pulled high, it indicates that a thread block in the shared memory partition has been allocated a read-write lock and needs to wait for the read-write lock to be released. When the corresponding shared memory partition signal in the read-write lock index table is pulled low, it indicates that the read-write lock corresponding to the shared memory partition has been released. When a thread block completes a memory task request, the resource adjustment module releases the shared memory and provides it to other thread blocks.

7. A dynamic shared memory multiplexing device suitable for GPGPU according to claim 6, characterized in that: The allocation module also executes step 10: according to the memory requirements of the thread block, it determines whether there is valid data in the address space corresponding to the memory task request and whether there is enough allocation space in the shared memory pool. If so, it executes steps 11 and 12.

8. The dynamic shared memory multiplexing device suitable for GPGPU according to claim 7, characterized in that: When the allocation module executes step 10, the shared memory scoreboard is used to record the valid signal of the address space in the shared memory. When data is written into the address space, the valid signal is pulled high, and it is regarded that there is valid data in the address space. Otherwise, it is regarded that there is no valid data in the address space. At the same time, the register is used to record the size of the remaining space of the shared memory to determine whether the remaining space of the shared memory is sufficient for allocation.

9. A dynamic shared memory multiplexing device suitable for GPGPU according to claim 6, characterized in that: When the allocation module executes step 11, it determines whether the thread blocks have the same data access requirements based on the addresses of the thread blocks accessing the shared memory in the memory task request. If the addresses of the thread blocks accessing the shared memory are the same, they have the same data access requirements; otherwise, the thread blocks do not have the same data access requirements.

10. The dynamic shared memory multiplexing device suitable for GPGPU according to claim 6, characterized in that the resource The adjustment module remaps the scattered address space of the released shared memory so that the address space is concentrated in a continuous shared memory partition, so that the subsequent shared memory pool allocates continuous address space and reads the continuous address space.

Citation Information

Patent Citations

  • Method for sharing stream memory of heterogeneous multi-processor

    CN101551761A

  • A method and an application of multi-process single-write multi-read lock-free shared memory

    CN109298935A

  • Multi-process coding method, system and device based on event and shared memory mechanism

    CN109413432A

  • Task scheduling method based on GPU space resource sharing

    CN111736987A

  • GPU page missing processing method and system based on page locking memory and medium

    CN112162855A

Cited By

  • GPGPU (General Purpose Graphics Processing Unit) thread block synchronization method and equipment based on thread lock and medium

    CN119557115A

  • GPGPU thread block synchronization method, device and medium based on thread lock

    CN119557115B