Shared memory access method, device, and computer equipment

By judging channel integration conditions and detecting channel address continuity in the graphics processor, channel address access is optimized, repository conflict problems when multi-channel work items access shared memory are solved, and access efficiency is improved.

CN117372236BActive Publication Date: 2024-09-06GLENFLY TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202210789015.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-06
Publication Date
2024-09-06
Estimated Expiration
2042-07-06

AI Technical Summary

Technical Problem

In graphics processors, access to shared memory by multi-channel work items can easily lead to memory bank conflicts and reduce access efficiency.

Method used

By obtaining the configuration information of the shared memory and the channel information of the work items to be processed, it is determined whether the repository meets the channel integration conditions, and the channel address continuity is detected to determine the channel processing mode, thereby optimizing the access method of the channel address and reducing the need for shared memory. number of visits.

Benefits of technology

It effectively reduces repository conflicts, improves the efficiency of shared memory access, and ensures accurate and efficient access to shared memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117372236B
    Figure CN117372236B
Patent Text Reader

Abstract

The present invention provides a method and device for accessing a shared memory. The method comprises: obtaining configuration information of the shared memory and channel information of a work item to be processed; determining, based on the configuration information and the channel information, that a storage library corresponding to the work item to be processed satisfies a channel integration condition, and then using the work item to be processed as a work item to be detected. Based on the channel information of the work item to be detected, a channel address continuity detection is performed on the channel address corresponding to the work item to be detected to determine a channel processing mode corresponding to the work item to be detected, the channel processing mode including a channel integration mode and a channel non-integration mode. Based on the channel processing mode, the channel address of the work item to be detected is processed, and the shared memory is accessed based on the processed channel address. In this way, the efficiency of accessing the shared memory is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an efficient shared memory access method, apparatus, computer equipment, storage medium and computer program product in a graphics processor. Background Art

[0002] With the rapid development of science and technology, graphics processors contain a large number of parallel processing units, which can be programmed to perform single instruction multiple data stream parallel computing. For example, general-purpose image processors are often used for parallel computing. In the process of parallel computing of general-purpose image processors, work items in the same work group can access the same shared memory.

[0003] In the traditional access method, each work item channel can independently access the bank in the shared memory. However, for multi-channel work items, the same bank may be accessed, resulting in bank conflicts (BankConflict) and low shared memory access efficiency. In view of this, the present invention provides a method and device for efficiently accessing shared memory based on work item channel address detection, which can effectively reduce the number of shared memory accesses, reduce bank conflicts, and improve access efficiency. Summary of the invention

[0004] Based on this, it is necessary to provide a shared memory access method and device to address the above technical issues.

[0005] In a first aspect, the present application provides a method for accessing a shared memory. The method comprises:

[0006] Get the configuration information of the shared memory and determine the channel information of the work items to be processed;

[0007] In the case where it is determined according to the configuration information and the channel information that the storage repository corresponding to the work item to be processed meets the channel integration condition, the work item to be processed is used as the work item to be detected;

[0008] Based on the channel information of the work item to be detected, performing a channel address continuity detection on the channel address corresponding to the work item to be detected to determine the channel processing mode corresponding to the work item to be detected, wherein the channel processing mode includes a channel integration mode and a channel non-integration mode;

[0009] The channel address of the work item to be detected is processed based on the channel processing mode, and the shared memory is accessed based on the processed channel address.

[0010] In a second aspect, the present application also provides a shared memory access device. The device comprises:

[0011] An acquisition module is used to obtain configuration information of the shared memory and determine channel information of the work item to be processed;

[0012] a determination module, configured to, if it is determined according to the configuration information and the channel information that the storage repository corresponding to the work item to be processed satisfies the channel integration condition, use the work item to be processed as the work item to be detected;

[0013] a detection module, configured to perform a channel address continuity detection on a channel address corresponding to the work item to be detected based on the channel information of the work item to be detected, so as to determine a channel processing mode corresponding to the work item to be detected, wherein the channel processing mode includes a channel integration mode and a channel non-integration mode;

[0014] A processing module is used to process the channel address of the work item to be detected based on the channel processing mode, and access the shared memory based on the processed channel address.

[0015] The above-mentioned shared memory access method and device obtain the configuration information of the shared memory and determine the channel information of the work item to be processed. When it is determined according to the configuration information and the channel information that the storage library corresponding to the work item to be processed meets the channel integration condition, the work item to be processed is used as the work item to be detected. In this way, by judging whether the storage library meets the channel integration condition, a preliminary detection of the storage library of the work item to be processed is achieved to ensure that the shared memory can be accessed effectively and accurately in the future. Based on the channel information of the work item to be detected, the channel address corresponding to the work item to be detected is tested for channel address continuity to determine the channel processing mode corresponding to the work item to be detected, and the channel processing mode includes a channel integration mode and a channel non-integration mode. In this way, based on the channel address continuity detection, the channel address of the work item to be detected can be accurately determined to obtain a channel processing mode that matches the channel of the work item to be detected. Based on the channel processing mode, the channel address of the work item to be detected is processed accordingly, and the shared memory is accessed based on the processed channel address. In this way, based on the channel processing mode matching the channel of the work item to be detected, the number of accesses to the shared memory is reduced, thereby reducing storage library conflicts, and further, greatly improving the efficiency of access to the shared memory. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 An application environment diagram of a shared memory access method in one embodiment;

[0017] Figure 2 is a schematic diagram of a shared memory in one embodiment;

[0018] Figure 3A A schematic diagram of multi-channel access to a shared memory by work items in one embodiment;

[0019] Figure 3B A schematic diagram of multi-channel access to a shared memory by work items in another embodiment;

[0020] Figure 3C A schematic diagram of multi-channel access to a shared memory by work items in another embodiment;

[0021] Figure 3D A schematic diagram of multi-channel access to a shared memory by work items in another embodiment;

[0022] Figure 4 A schematic diagram of a repository conflict in one embodiment;

[0023] Figure 5 A schematic diagram of a flow chart of a method for accessing a shared memory in one embodiment;

[0024] Figure 6 A schematic flow chart of the steps of determining a storage channel threshold in one embodiment;

[0025] Figure 7 A schematic diagram of a flow chart of a step of determining a channel processing mode in an embodiment;

[0026] Figure 8 A schematic diagram of a flow chart of determining a step of spanning a storage library in one embodiment;

[0027] Fig. 9 A schematic diagram of a flow chart of a step of determining a channel processing mode in an embodiment;

[0028] Fig.10 A topological diagram of a shared memory control unit in one embodiment;

[0029] Fig.11 A schematic flow chart of a step of determining a channel processing mode in another embodiment;

[0030] Fig.12 A schematic flow chart of a step of determining a channel processing mode in another embodiment;

[0031] Fig.13 A topological diagram of a shared memory control unit in another embodiment;

[0032] Fig.14 A schematic flow chart of a step of determining a channel processing mode in another embodiment;

[0033] Fig.15 is a structural block diagram of a shared memory access device in one embodiment;

[0034] Fig.16 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0036] The present invention provides an efficient shared memory access method and device. Before introducing the access method and device in detail, the following explanation is given for the computer terms used in the specification and claims of the present invention.

[0037] Arithmetic logic unit: sends a read and / or write request of a shared memory and channel information to the shared memory control unit, for example, sends the address and / or data of a work item to the shared memory control unit.

[0038] General register file: used to store source data required by the arithmetic logic unit, such as data returned by a read operation received from the shared memory control unit, for operation by the arithmetic logic unit.

[0039] Shared memory control unit: used to process the read and / or write requests and channel information sent by the arithmetic logic operation unit, which includes a channel address continuity detection unit and a request splitting unit, controls the read operation and / or write operation of the shared memory, and is responsible for bypassing the data returned by the read request to the general register file; wherein, the channel address continuity detection unit also includes a processing mode selection unit.

[0040] Shared memory: used to store channel data of work items. Shared memory can be configured according to the number of memory banks m, the byte index of the memory bank width n, and the number of cache lines k.

[0041] Figure 1 FIG. 1 is a schematic diagram of an application environment in an embodiment of the present invention. Figure 1 As shown, the terminal 102 communicates with the server 104 via a communication network. The data storage system can store data that the terminal 102 and the server 104 need to process. The data storage system can be integrated on the server 104, or placed on a cloud network or other network server.

[0042] The terminal 102 may be, but is not limited to, a personal computer, a laptop computer, a smart phone, a tablet computer, an IoT device, and a portable wearable device including a graphics processing unit. The IoT device may be a smart speaker, a smart TV, a smart air conditioner, a smart car device, etc. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, etc. Among them, the image processing unit includes an integrated graphics card, an independent graphics card, and an image processing unit on a mobile phone. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0043] Figure 2 FIG. 1 is a schematic diagram of a shared memory in an embodiment of the present invention. Figure 2 As shown, the shared memory includes m banks, namely, banks Bank0, Bank1, Bank2, ..., Bankm-3, Bankm-2, Bankm-1, where m is an integer greater than 1. Each bank includes k cache lines, namely, cache lines Line0, Line1, Line2, Line3, ..., Linek-1, where k is also an integer greater than 1. Specifically, the storage width of Line0 in Bank0 is 2 n Bytes, where n is the byte index (such as Figure 2 Therefore, the entire shared memory (such as Figure 2 The size of 0, 1, 2...m-3, m-2, m-1...km-1) can be expressed as m*2 n *k Bytes.

[0044] That is, the shared memory can be configured according to the number of memory banks m, the byte index of the memory bank width n, and the number of cache lines k. In the specification and claims of the present invention, the above parameters m, n, k are referred to as configuration information of the shared memory.

[0045] FIG. 3A to FIG. 3D All of them are schematic diagrams of multi-channel access to shared memory by work items in embodiments of the present invention. Figure 3A As shown, work item A has four channels, x, y, z, and w, and each channel accesses the repository independently and continuously. The x channel stores data between Byte0 and Byte1 of repository j, the y channel stores data between Byte2 and Byte3 of repository j, the z channel stores data between Byte0 and Byte1 of repository j+1, and the w channel stores data between Byte2 and Byte3 of repository j+1. Similarly, Figure 3B , 3C As shown in 3D, it is a schematic diagram of accessing the storage library when work item A has three channels of x, y, and z, two channels of x and y, and a single channel of x.

[0046] In image processors and general-purpose image processors, shared memory can provide fast read and write for the arithmetic logic unit, and its read and write latency should be as short as possible.

[0047] Figure 4 FIG. 1 is a schematic diagram of a storage library conflict in an embodiment of the present invention. Take work item A having four channels as an example. Figure 4 As shown, channel x is stored between Byte0 and Byte1 of repository j, and channel y is stored between Byte2 and Byte3 of repository j. At this time, channel x and channel y are accessing the same repository j, and there is a repository conflict between the two channels. Similarly, there is a repository conflict between channel z and channel w. That is, channel x and channel y cannot access repository j at the same time, and channel z and channel w cannot access repository j+1 at the same time. In this way, channel y and channel w need to wait for the next cycle to access repository j and repository j+1. When multiple channels of a work item access shared memory independently, multiple channels may access the same repository, which will cause a repository conflict, thereby greatly reducing the efficiency of shared memory access.

[0048] It should be noted that the channels in a work item may have different data formats, such as 8 / 16 / 32 / 64bpc (ie, the number of bits each channel has), etc., wherein the data format is smaller than the width of the storage library.

[0049] It is also necessary to add here that Figure 4 This section only briefly introduces the working principle of the storage library conflict. The storage library conflict of storage devices such as memory, hard disk, mobile hard disk, etc. should belong to the common technology of those skilled in the art, and the present invention will not be described in detail here.

[0050] It should be noted that the computer devices involved in the present invention are all computer devices equipped with general-purpose image processors.

[0051] Figure 5 FIG. 1 is a schematic diagram of a method for accessing a shared memory in an embodiment of the present invention. Figure 5 As shown, in step S502, configuration information of the shared memory is obtained, and channel information of the work item to be processed is determined.

[0052] Among them, the configuration information includes the number m of storage banks in the shared memory, the byte index n of the storage bank width, and the number k of cache lines, which are used to represent the size of the shared memory. The channel information includes the data format and number of channels of the channel, which are used to represent the channel information of the work items to be processed.

[0053] Next, in step S504, when it is determined according to the configuration information and the channel information that the storage library corresponding to the work item to be processed meets the channel integration condition, the work item to be processed is used as the work item to be detected.

[0054] It should be noted that for whether the channel integration conditions are met and how to determine whether the channel integration conditions are met, please refer to the content of formula (1), which will not be repeated here.

[0055] Next, in step S506, based on the channel information of the work item to be detected, a channel address continuity check is performed on the channel address of the work item to determine a channel processing mode corresponding to the work item to be detected, wherein the channel processing mode includes a channel integration mode and a channel non-integration mode.

[0056] The channel address continuity detection is used to determine the number of channels of a work item, determine whether the channels of a work item span multiple storage banks, and determine a channel processing mode. The channel integration mode represents a mode of integrating at least two channels, and the channel non-integration mode represents a mode of non-integration of channels.

[0057] For example, based on the channel information of the work item to be detected, the shared memory control unit in the computer device performs a channel address continuity test on the channel address corresponding to the work item to be detected, determines the storage status of the channel in the storage library, and determines the channel processing mode corresponding to the work item to be detected through the storage status. The storage status can characterize whether the channel of the work item to be detected is integrated and multiple cross-storage libraries.

[0058] Finally, in step S508, the channel address of the work item to be detected is processed based on the channel processing mode, and the shared memory is accessed based on the processed channel address.

[0059] It should be noted that the processing involved in step S508 is to integrate or not integrate the channel addresses.

[0060] Specifically, based on the channel processing mode, the computer device processes the channel address of the work item to be detected according to the channel processing mode to obtain a processed channel address, and accesses the shared memory based on the processed channel address.

[0061] For example, the shared memory control unit in the computer device sends the channel processing mode to the request splitting unit in the shared memory unit. The request splitting unit processes the channel address of the work item to be detected according to the channel processing mode, obtains the processed channel address, and accesses the shared memory based on the processed channel address.

[0062] In the above-mentioned shared memory access method, the configuration information of the shared memory is obtained, and the channel information of the work item to be processed is determined. When it is determined according to the configuration information and the channel information that the storage library corresponding to the work item to be processed meets the channel integration condition, the work item to be processed is used as the work item to be detected. In this way, by judging whether the storage library meets the channel integration condition, a preliminary detection of the storage library of the work item to be processed is achieved to ensure that the shared memory can be effectively and accurately accessed later. Based on the channel information of the work item to be detected, the channel address corresponding to the work item to be detected is detected for channel address continuity to determine the channel processing mode corresponding to the work item to be detected, and the channel processing mode includes a channel integration mode and a channel non-integration mode. In this way, based on the channel address continuity detection, the channel address of the work item to be detected can be accurately determined to obtain a channel processing mode that matches the channel of the work item to be detected. Based on the channel processing mode, the channel address of the work item to be detected is processed accordingly, and the shared memory is accessed based on the processed channel address. In this way, based on the channel processing mode matching the channel of the work item to be detected, the number of accesses to the shared memory is reduced, thereby reducing storage library conflicts, and further, greatly improving the efficiency of access to the shared memory.

[0063] In one embodiment, when it is determined according to the configuration information and the channel information that the storage library corresponding to the pending work item meets the channel integration condition, before using the pending work item as the work item to be detected, the method further includes: determining the storage channel value of the storage library corresponding to the pending work item according to the configuration information of the shared memory and the channel information of the pending work item. When the storage channel value is greater than the first threshold value, it is determined that the storage library corresponding to the pending work item meets the channel integration condition.

[0064] The channel value is the maximum number of channels that can be stored in a storage library.

[0065] Specifically, the computer device determines the channel capacity corresponding to the work item to be processed based on the byte index of the storage library, the number of channels of the work item to be processed, and the data format information of the channel. The computer device determines the minimum value of the channel capacity and the number of channels as the channel value. The computer device compares the storage channel value with the first threshold value. If the storage channel value is greater than the first threshold value, it is determined that the storage library corresponding to the work item to be processed meets the channel integration condition. The channel capacity is used to characterize the channel size.

[0066] For example, the shared memory control unit in the computer device determines that the byte index n of the storage library is 2, that is, the width of the storage library is 4 bytes. The shared memory control unit determines the data format channel bpc8 bits per channel, and the number of channels ch num If ch_num is 2, the storage channel value ch_num is determined by the following formula (I): in_bank :

[0067]

[0068] Among them, it can be known from the above formula that the storage channel value is 2, that is, at most 2 channels can be stored in the same storage bank. The shared memory control unit determines whether the channel value is not less than the first threshold value (for example: the first threshold value can be "1"). If the channel value is greater than 1, it is determined that the storage bank corresponding to the work item to be processed meets the channel integration condition. Among them, for other data formats, such as 16 / 32 / 64bpc, etc., the channel value can be determined according to the above formula based on the configuration information of the shared memory, the number of channels and the data format.

[0069] It should be noted that the channel integration condition can determine whether the repository can reflect the storage situation of the repository, that is, the storage capacity. Among them, for a repository that does not meet the channel integration condition, the maximum number of channels that can be stored in its repository for the work item to be detected is 1, while for a repository that meets the channel integration condition, the maximum number of channels that can be stored in its repository is greater than 1, which means that the number of channels stored in the repository that meets the channel integration condition is relatively large, and the storage situation is more complicated.

[0070] In this embodiment, according to the configuration information of the shared memory and the channel information of the work item to be processed, the storage channel value of the storage library corresponding to the work item to be processed is determined, so that the maximum number of channels that the storage library can store can be determined. When the storage channel value is greater than the first threshold value, it is determined that the storage library corresponding to the work item to be processed meets the channel integration condition, so that the storage channel situation of the storage library corresponding to the work item to be processed can be simply and accurately determined.

[0071] Figure 6 FIG. 1 is a schematic diagram of a method for accessing a shared memory in another embodiment of the present invention. Figure 6 As shown, in step S602, access information corresponding to each access request is obtained, and channel information of each to-be-processed work item is extracted from the access information.

[0072] The access request may be a read request to read data from the storage repository or a write request to write data to the storage repository. The access request includes channel information and address information, wherein the channel information includes data format and channel number, and the address information is the address of the work item.

[0073] For example, when the access request is a write request, the shared memory control unit in the computer device obtains access information corresponding to the write request, and extracts channel information from the access information, wherein the channel information includes a data format, a number of channels, and data to be written. When the access request is a read request, the shared memory control unit obtains access information corresponding to the read request, and extracts channel information from the access information, wherein the channel information includes a data format and a number of channels.

[0074] Next, in step S604, the number of the access requests is determined, and if the number of the access requests obtained is less than the second threshold number, the access requests continue to be obtained.

[0075] For example, a buffer in a computer device obtains an access request and stores the access information. If the number of access situations is less than a second threshold number, the access request continues until the number of access requests reaches the threshold number.

[0076] It should be noted that the first threshold number and the second threshold number are different threshold numbers, the first threshold number is used to determine the storage channel value, that is, the maximum value of the storage channel value, and the second threshold number is used to determine the number of access requests, that is, the maximum number of access requests.

[0077] Then, in step S606, if the number of access requests obtained reaches the second threshold number, for each work item to be processed, the step of determining the storage channel value of the repository corresponding to the work item to be processed based on the configuration information of the shared memory and the channel information of the work item to be processed is executed.

[0078] Specifically, if the number of access requests obtained reaches a second threshold number, the computer device directly determines the channel integration of the storage library corresponding to the work to be processed, and for each work item to be processed, executes the step of determining the storage channel value of the storage library corresponding to the work item to be processed based on the configuration information of the shared memory and the channel information of the work item to be processed.

[0079] For example, if the number of access requests obtained by the buffer in the computer device reaches a second threshold number, the shared memory control unit of the computer device obtains the access information stored in the buffer, and for each pending work item, the shared memory control unit executes the step of determining the storage channel value of the storage library corresponding to the pending work item based on the configuration information of the shared memory and the channel information of the pending work item.

[0080] In this embodiment, if the number of access requests meets the second threshold number, the step of processing the storage channel value of the storage repository corresponding to the work item to be processed is directly triggered. If the number of access requests is less than the second threshold number, the access requests continue to be obtained. In this way, parallel processing of data is ensured, greatly improving the efficiency of data processing.

[0081] Figure 7 FIG. 1 is a schematic diagram of a method for accessing a shared memory in another embodiment of the present invention. Figure 7 As shown, in step S702, based on the channel address information corresponding to the work item to be detected, it is determined whether the multiple channels corresponding to the work item to be detected span at least two storage libraries.

[0082] Specifically, the computer device obtains the channel address information corresponding to the work item to be detected, and determines the location information of the cache line corresponding to the work item to be detected, the location information of the storage library, and the starting byte location information in the storage library based on the channel address information. Based on the location information of the cache line, the location information of the storage library, and the starting byte location information in the storage library, it is determined whether the multiple channels corresponding to the work item to be detected span at least two storage libraries.

[0083] Next, in step S704, if the multiple channels corresponding to the work item to be detected span at least two storage bins, the corresponding work item to be detected is used as the first work item to be detected, and the multiple storage bins corresponding to the first work item to be detected are used as the first storage bins.

[0084] Next, in step S706, based on the first channel address information, the first channel number, and the first data format corresponding to the first work item to be detected, the first storage memory bank corresponding to the first work item to be detected is split to determine the first storage channel number stored in each first storage memory bank.

[0085] Specifically, the first channel address information corresponding to the first work item to be detected is obtained, and the starting byte position information in the storage library corresponding to the first channel address information is determined. The number of first storage libraries is determined based on the byte index, starting byte position information, first channel number, and first data format of the storage library, and the first storage library corresponding to the first work item to be detected is split based on the number of the first storage library, the byte index, starting byte position information, first channel number, and first data format of the storage library to determine the number of first storage channels stored in each first storage library.

[0086] For example, the shared memory control unit in the computer device obtains the first channel address information corresponding to the first work item to be detected, and determines the starting byte index byte_idx in the storage bank corresponding to the first channel address information. The shared memory control unit obtains the first channel number ch_num corresponding to the first work item to be detected, and the data format bpc, and then determines the number bank of the first storage bank according to the following formula (II): num :

[0087]

[0088] in, Based on the number of the first memory bank num , and determine the index bank of each first storage bank based on formula (III) x , and the first storage channel number ch_num stored in each first storage bank in_bankx :

[0089] bank x =bank idx

[0090]

[0091] bank x+1 =bank idx +1

[0092]

[0093] …

[0094]

[0095]

[0096]

[0097] in, is the index of each first storage repository.

[0098] The number of first storage channels stored in each first storage bank.

[0099] Next, in step S708, for each first storage memory bank corresponding to the first work item to be detected, a channel processing mode corresponding to the corresponding first work item to be detected is determined based on the number of first storage channels respectively corresponding to each first storage memory bank.

[0100] Specifically, for each first storage library corresponding to the first work item to be detected, the computer device determines whether each first storage library meets the integration condition, and obtains the judgment results corresponding to each first storage library. Based on the judgment results corresponding to each first storage library, the channel processing mode corresponding to the corresponding first work item to be detected is determined.

[0101] In this embodiment, through the channel address information corresponding to the work item to be detected, it is possible to timely determine whether the multiple channels corresponding to the work item to be detected span at least two storage bins. If the multiple channels corresponding to the work item to be detected span two storage bins, based on the first channel address information, the first channel number, and the first data format, the position of each first storage bin and the number of first storage channels stored in each first storage bin can be accurately determined. In this way, based on each first storage channel number, the channel processing mode that matches the channel of the corresponding first work item to be detected can be accurately determined, thereby greatly improving the efficiency of accessing the shared memory.

[0102] In one embodiment, the method further includes: if the multiple channels corresponding to the work item to be detected do not span different storage repositories, taking the corresponding work item to be detected as the second work item to be detected, and determining that the channel processing mode corresponding to the second work item to be detected is the channel integration mode.

[0103] Specifically, if the multiple channels corresponding to the work item to be detected do not span different storage bins, the computer device uses the work item to be detected corresponding to the multiple channels that do not span different storage bins as the second work item to be detected. The computing device directly determines that the channel processing mode corresponding to the second work item to be detected is the channel integration mode.

[0104] In this embodiment, once it is determined that the multiple channels corresponding to the work item to be detected do not span different storage bins, the corresponding work item to be detected is used as the second work item to be detected, and the channel processing mode corresponding to the second work item to be detected can be quickly and accurately determined to be the integrated channel mode, which greatly simplifies the situation where the multiple channels do not span different storage bins, thereby improving the efficiency of accessing the shared memory.

[0105] Figure 8 FIG. 1 is a schematic diagram of a method for accessing a shared memory in another embodiment of the present invention. Figure 8 As shown, in step S802, based on the configuration information of the shared memory, the number of storage banks in the shared memory and the width of each storage bank are determined.

[0106] Next, in step S804, based on the channel address information corresponding to the work item to be detected, the number of storage libraries, and the width of the storage library, a row index calculation is performed to determine the row index corresponding to the work item to be detected; wherein the row index is used to represent the row position of the storage library corresponding to the work item to be detected in the shared memory.

[0107] For example, set the channel address information corresponding to the work item to be detected as Addr, the number of storage banks m, the width of the storage bank 2 n , the row index line_idx of the repository corresponding to the work item to be detected in the shared memory can be determined according to the following formula:

[0108] line_idx = Addr / (m*2 n )

[0109] Among them, the m×2 n Can be considered as the length (width) of the shared memory storage line.

[0110] Step S806, based on the row index corresponding to the work item to be detected, the channel address information, and the number and width of the storage library, a starting byte index calculation is performed to determine the starting byte index in the storage library corresponding to the work item to be detected; wherein the starting byte index is used to represent the starting byte position of the channel address corresponding to the work item in the storage library.

[0111] Specifically, the computer device determines the length of the shared memory based on the number and width of the memory bank, and determines the product of the length of the shared memory and the row index. The computer device determines the difference between the channel address information corresponding to the work item to be detected and the product, and divides the difference with the width of the memory bank to determine the quotient and the remainder, and the computer device uses the quotient as the memory bank index corresponding to the work item to be detected, and uses the remainder as the starting byte index in the memory bank corresponding to the work item to be detected.

[0112] For example, set the line index line_idx corresponding to the work item to be detected, the channel address information to Addr, the number of storage banks m, and the width of the storage bank 2 n , the bank index bank_idx corresponding to the work item to be detected and the starting byte index byte_idx in the bank can be determined according to the following formula:

[0113] bank_idx=(Addr-line_idx*m*2 n ) / 2 n

[0114] byte_idx=(Addr-line idx *m*2 n )%2n

[0115] Step S808 , performing a cross-memory bank detection based on the data format of the channel corresponding to the work item to be detected and the starting byte index corresponding to the work item to be detected, and obtaining a cross-memory bank detection result.

[0116] Specifically, the computer device determines the storage channel threshold corresponding to the data format based on the data format of the channel corresponding to the work item to be detected. The computer device determines the width to be detected based on the starting byte index, storage channel value, and data format corresponding to the work item to be detected, and determines the spanning storage library detection result based on the comparison result of the width to be detected and the width of the storage library.

[0117] For example, set the starting byte index byte_idx and storage channel value ch_num in the storage library corresponding to the work item to be detected. in_bank , data format bpc, width of repository 2 n , the width D to be detected can be determined according to the following formula:

[0118] D=byte_idx+ch_num in_bank *(bpc>>3)

[0119] The width D to be detected is compared with the width of the storage bank to determine a cross-storage bank detection result, wherein the cross-storage bank detection result includes at least one of the following: the width to be detected is greater than the width of the storage bank, and the width to be detected is less than the width of the storage bank.

[0120] Step S810: Based on the cross-repository detection result, determine whether a plurality of channels corresponding to the work item to be detected spans at least two repositories.

[0121] Specifically, if the detection result of spanning the storage bins is that the width to be detected is greater than the width of the storage bins, it is determined that the multiple channels corresponding to the work item to be detected span at least two storage bins. If the detection result of spanning the storage bins is that the width to be detected is less than the width of the storage bins, it is determined that the multiple channels corresponding to the work item to be detected do not span at least two storage bins.

[0122] For example, set the starting byte index byte_idx and storage channel value ch_num in the storage library corresponding to the work item to be detected. in_bank , data format bpc, width of repository 2 n , it can be determined whether the multiple channels corresponding to the work item to be detected span at least two storage repositories according to the following formula:

[0123] bAcrossBank=(byte_idx+ch_num in_bank*(bpc>>3))>2 n ? 1:0

[0124] If the bAcrossBank is 0, it is determined that the multiple channels corresponding to the work item to be detected do not span at least two storage banks; if the bAcrossBank is not 0, it is determined that the multiple channels corresponding to the work item to be detected span at least two storage banks.

[0125] In this embodiment, in combination with the channel address information corresponding to the work item to be detected, the number of storage bins, and the width of the storage bins, the row index of the storage bin corresponding to the work item to be detected in the shared memory, the storage bin index corresponding to the work item to be detected, and the starting byte index of the storage bin can be accurately determined, thereby accurately determining whether the multiple channels corresponding to the work item to be detected span at least two storage bins, that is, it can clearly and unambiguously reflect the storage position of the multiple channels corresponding to the work item to be detected in the storage bins, which is conducive to the subsequent accurate determination of the channel processing mode corresponding to the work item to be detected according to the spanning result of whether the multiple channels span at least two storage bins, and further, it can greatly improve the efficiency of accessing the shared memory.

[0126] Fig. 9 FIG. 1 is a schematic diagram of a channel integration process in an embodiment of the present invention. Fig. 9 As shown, for each first storage bin corresponding to the first work item to be detected, the channel processing mode corresponding to the corresponding first work item to be detected is determined based on the number of first storage channels corresponding to each first storage bin, including:

[0127] Step S902: For each first storage library corresponding to each first work item to be detected, the number of first storage channels is compared with the first threshold number, and the first storage library that meets the channel integration condition is used as the integrated storage library, and the channel processing mode of multiple first channels stored in the integrated storage library is determined as the channel integration mode.

[0128] Specifically, for each first storage library corresponding to each first work item to be detected, the computer device compares the number of first storage channels with the first threshold number to obtain a comparison result. If the comparison result indicates that the number of first storage channels is greater than the first threshold number, it is determined that the first storage library meets the channel integration condition. The computer device uses the first storage library that meets the channel integration condition as an integrated storage library. The computer device determines the channel processing mode of the multiple first channels stored in the integrated storage library as the channel integration mode.

[0129] Step S904: the first storage library that does not meet the channel integration condition is used as a non-integrated storage library, and the channel processing mode of the plurality of first channels stored in the non-integrated storage library is determined as a channel non-integrated mode.

[0130] Specifically, for each first storage bank corresponding to each first work item to be detected, the computer device compares the number of first storage channels with the first threshold number to obtain a comparison result. If the comparison result indicates that the number of first storage channels is equal to the first threshold number, it is determined that the first storage bank does not meet the channel integration condition. The computer device regards the first storage bank that does not meet the channel integration condition as a non-integrated storage bank, and determines the channel processing mode of the multiple first channels stored in the non-integrated storage bank as a channel non-integrated mode.

[0131] The implementation subject of the following embodiments is executed by a shared memory control unit of a general-purpose image processor, wherein the general-purpose image processor is deployed in a computer device. The topology diagram of the shared memory control unit is as follows: Fig.10 The shared memory control unit includes a channel address continuity detection unit, a request splitting unit, a write operation, a read operation, and a shared memory cache unit.

[0132] In an alternative embodiment, if Fig.11 As shown, the shared memory control unit includes a channel address continuity detection unit. For each first storage bank corresponding to each first work item to be detected, the channel address continuity detection unit in the shared memory unit determines whether the first storage channel number Is it not equal to the value 1? If so, the processing mode selection unit in the channel address continuity detection unit determines the first storage library that meets the channel integration condition as an integrated storage library. The channel address continuity detection unit determines the channel processing mode of the multiple first channels stored in the integrated storage library as the channel integration mode. If not, the processing mode selection unit in the channel address continuity detection unit determines the first storage library that meets the channel integration condition as a non-integrated storage library. The channel address continuity detection unit determines the channel processing mode of the multiple first channels stored in the integrated storage library as the channel non-integrated mode.

[0133] For the channel non-integration mode, each first channel is set as a channel integration mode of 1 channel. For the channel integration mode, multiple first channels are combined to obtain a combined first channel, that is, an integration mode of several channels of the first storage channels is selected.

[0134] In this embodiment, the number of first storage channels corresponding to each first storage memory bank is compared to determine whether the first storage memory bank satisfies the channel integration condition. If so, the channel processing mode of the first channel corresponding to the first storage memory bank is directly determined to be the channel integration mode. If not, the channel processing mode of the first channel corresponding to the first storage memory bank is determined to be the channel non-integration mode. In this way, the channel address of the first work item to be detected can be accurately determined to obtain a channel processing mode that matches the channel of the first work item to be detected.

[0135] In one embodiment, Fig.12 As shown, the channel address continuity detection unit determines the number m of storage banks from the configuration information, determines the byte index n of each storage bank, and determines the width 2 of each storage bank based on the byte index of each storage bank. n . The channel address continuity detection unit determines the width of the shared memory based on the number of memory banks and the width of the memory banks, and the channel address continuity detection unit divides the channel address information corresponding to the work item to be detected by the length of the shared memory to determine the row index of the work item to be detected. The channel address continuity detection unit determines the length of the shared memory based on the number and width of the memory banks, and determines the product of the length of the shared memory and the row index. The channel address continuity detection unit determines the difference between the channel address information corresponding to the work item to be detected and the product, and divides the difference by the width of the memory bank to determine the quotient and the remainder, and the channel address continuity detection unit uses the quotient as the memory bank index corresponding to the work item to be detected, and uses the remainder as the starting byte index in the memory bank corresponding to the work item to be detected.

[0136] Step ① spanning the storage library: the channel address continuity detection unit determines whether the multiple channels corresponding to the work item to be detected span at least two storage libraries (i.e., judging whether they span the storage library in the corresponding figure) according to the starting byte index in the storage library corresponding to the work item to be detected, the width of the storage library, and the data format. If the judgment result is represented by the character "0", it is determined that it does not span the storage library, that is, the multiple channels corresponding to the work item to be detected do not span at least two storage libraries, and the work item to be detected is the second work item to be detected. The processing mode selection unit in the channel address continuity detection unit directly determines that the channel processing mode corresponding to the second work item to be detected is the channel integration mode. Among them, when the channel processing mode is the channel integration mode, the multiple second storage channel numbers corresponding to the second work item to be detected are combined to obtain the combined second channel, and access is performed based on the combined second channel.

[0137] Step ② Bank splitting: If the judgment result is represented by the character "1", it is determined that the bank spans, that is, the multiple channels corresponding to the work item to be detected span at least two banks, and the work item to be detected is the first work item to be detected. The channel address continuity detection unit regards the multiple banks corresponding to the first work item to be detected as the first bank, and determines the number of the first bank num , and based on the number of the first storage banks, the byte index of the storage banks, the starting byte position information, the first channel number, and the first data format, split the first storage banks corresponding to the first work item to be detected to determine the index bank of each first storage bank x, and the first storage channel number ch_num stored in each in_bankx .

[0138] Step ③: The channel address continuity detection unit performs an integration detection on the first storage banks, that is, compares the number of first storage channels of each first storage bank with the preset unit data to obtain a comparison result. If the comparison result indicates that the number of first storage channels is greater than the first threshold value (such as a value of 1), the processing mode selection unit in the channel address continuity detection unit determines that the first storage bank meets the channel integration condition. The processing mode selection unit uses the first storage bank that meets the channel integration condition as an integrated storage bank, and determines the channel processing mode of the multiple first channels stored in the integrated storage bank as the channel integration mode.

[0139] In the present embodiment, through the channel address information corresponding to the work item to be detected, it is possible to timely determine whether the multiple channels corresponding to the work item to be detected span at least two storage bins. If the multiple channels corresponding to the work item to be detected span two storage bins, then based on the first channel address information, the first channel number, and the first data format, accurately determine the position of each first storage bin and the first storage channel number stored in each first storage bin, so that, based on each first storage channel number, it is possible to accurately determine the channel processing mode that matches the channel of the corresponding first work item to be detected, thereby greatly improving the efficiency of shared memory access. Once it is determined that the multiple channels corresponding to the work item to be detected do not span different storage bins, the corresponding work item to be detected is used as the second work item to be detected, and it is possible to quickly and accurately determine that the channel processing mode corresponding to the second work item to be detected is the integrated channel mode, which greatly simplifies the situation that the multiple channels do not span different storage bins, thereby, it is possible to improve the efficiency of shared memory access.

[0140] In one embodiment, the method further includes: when it is determined according to the configuration information and the channel information that the storage repository corresponding to the pending work item does not meet the channel integration condition, directly determining that the channel processing mode corresponding to the pending work item is a channel non-integration mode.

[0141] Specifically, the computer device determines the storage channel value of the storage library corresponding to the work item to be processed according to the configuration information of the shared memory and the channel information of the work item to be processed. When the storage channel value is greater than the first threshold value, it is determined that the storage library corresponding to the work item to be processed does not meet the channel integration condition, and the channel processing mode corresponding to the work item to be processed is directly determined to be the channel non-integration mode, that is, multiple channels of the work item to be processed are not integrated.

[0142] In this embodiment, when it is determined based on the configuration information and the channel information that the storage repository corresponding to the work item to be processed does not meet the channel integration condition, the channel processing mode corresponding to the work item to be processed is directly determined to be the channel non-integration mode, thereby greatly simplifying the determination of the storage channel situation of the storage repository corresponding to the work item to be processed, and further, the channel processing mode of the work item to be processed can be determined in a timely and accurate manner when the channel integration condition is not met, thereby improving the efficiency of accessing the shared memory.

[0143] In order to facilitate a clearer understanding of the technical method of the present application, a more detailed embodiment is provided for explanation. The implementation subject of this embodiment is specifically a computer device, which is provided with a general image processor. Among them, the general image processor includes a shared memory control unit, and the shared memory control unit includes a channel address continuity detection unit, a request splitting unit, a shared memory cache unit, etc. Fig.13 As shown, the channel address continuity detection unit includes a processing mode selection unit.

[0144] It should be noted that the shared memory is usually SRAM (Static Random-Access Memory), which is integrated in the CPU (central processing unit) or GPU (graphics processing unit). The size of the shared memory is very small, usually tens of KB. However, since the shared memory is closer to the ALU unit (arithmetic and logic unit) of the CPU or GPU, the ALU computing unit can read quickly, that is, the shared memory has a fast reading speed.

[0145] like Fig.14 As shown, the shared memory control unit receives the access request sent by the arithmetic logic unit, and extracts the channel information of each to-be-processed work item from the access information. The shared memory control unit stores the access request and the access information in a buffer.

[0146] Step 1: If the buffer has collected a certain number of access requests or access information, the shared memory control unit directly determines the channel integration of the storage library corresponding to the pending work, and for each pending work item, determines the storage channel value ch_num of the storage library corresponding to the pending work item according to the configuration information of the shared memory and the channel information of the pending work item. in_bank If the storage channel value is greater than the first threshold value, the integration processing mode of the work item to be processed is directly determined to be the channel non-integration mode.

[0147] Step 2: If the storage channel value is greater than the first threshold number, the work item to be processed is used as the work item to be detected, that is, integrated detection is performed. Specifically, the channel address continuity detection unit in the shared memory control unit determines the storage channel threshold corresponding to the data format based on the data format of the channel corresponding to the work item to be detected. The channel address continuity detection unit determines the width to be detected based on the starting byte index, storage channel value, and data format corresponding to the work item to be detected, and determines the spanning storage library detection result based on the comparison result of the width to be detected and the width of the storage library. Based on the spanning storage library detection result, it is determined whether the multiple channels corresponding to the work item to be detected span at least two storage libraries (that is, it is determined whether they span the library in the corresponding figure). If the detection result of spanning the storage library is that the width to be detected is less than the width of the storage library, it is determined that the multiple channels corresponding to the work item to be detected do not span at least two storage libraries, and the channel address continuity detection unit uses the work item to be detected corresponding to the multiple channels that do not span different storage libraries as the second work item to be detected. The processing mode selection unit in the channel address continuity detection unit directly determines that the channel processing mode corresponding to the second work item to be detected is the channel integration mode.

[0148] If the detection result across the storage bins is that the width to be detected is greater than the width of the storage bins, it is determined that the multiple channels corresponding to the work item to be detected span at least two storage bins, and the corresponding work item to be detected is used as the first work item to be detected, and the multiple storage bins corresponding to the first work item to be detected are obtained and the multiple storage bins corresponding to the first work item to be detected are used as the first storage bin. The channel address continuity detection unit determines the number of first storage bins based on the byte index, the starting byte position information, the first channel number, and the first data format of the storage bin, and splits the first storage bin corresponding to the first work item to be detected based on the number of the first storage bins, the byte index, the starting byte position information, the first channel number, and the first data format of the storage bin to determine the number of first storage channels stored in each first storage bin. The channel address continuity detection unit performs integration detection, that is, for each first storage bin corresponding to each first work item to be detected, the number of first storage channels is compared with the first threshold number to obtain a comparison result. If the comparison result indicates that the number of first storage channels is greater than the first threshold number, it is determined that the first storage bin meets the channel integration condition. The channel address continuity detection unit regards the first storage bank that meets the channel integration condition as an integrated storage bank, and the processing mode selection unit determines the channel processing mode of the multiple first channels stored in the integrated storage bank as the channel integration mode. If the comparison result indicates that the number of the first storage channels is equal to the first threshold number, it is determined that the first storage bank does not meet the channel integration condition. The channel address continuity detection unit regards the first storage bank that does not meet the channel integration condition as a non-integrated storage bank, and the processing mode selection unit determines the channel processing mode of the multiple first channels stored in the non-integrated storage bank as the channel non-integrated mode.

[0149] The process of step 1 to step 3 above is illustrated by an example: Set the shared memory configuration: 32 memory banks, memory bank width is 8 bytes, 1024 memory rows. For the number of channels is 2C / 3C / 4C and the data format is 32 / 16 / 8bpc (bits).

[0150] (1) The number of channels is 2C and the data format is 32bpc

[0151] (1.1) The work item byte address is 0x128

[0152] Step 1: According to

[0153] Step 2: First determine whether the work item spans the repository and calculate:

[0154]

[0155]

[0156] byte idx =(0x128-1*32*2 3 )%2 3 =0

[0157] bAcrossBank=(0+2*4)>2 3 ? 1:0=0

[0158] If the work item does not span the memory bank, the two channels of the work item are located in the same memory bank. The work item is stored in the fifth memory bank of the first memory row line1, bank5, with a relative start address of 0, i.e., byte0, as shown in Table 1 below:

[0159] Table 1 Work item byte address is 0x128

[0160]

[0161] Step 3: Determine that the channel processing mode is the channel integration mode, that is, the integration mode is 2C.

[0162] (1.2) The work item byte address is 0x124

[0163] Based on the same calculation process as above, it is determined that the work item is stored in the first storage row, spanning two storage banks, namely the 4th storage bank bank4 and the 5th storage bank bank5, and the relative start address is the 4th byte of the 4th storage bank. The storage situation of the 4th storage bank is shown in Table 2, and the storage situation of the 5th storage bank is shown in Table 3:

[0164] Table 2 Work item byte address is 0x124

[0165]

[0166] Table 3 Work item byte address is 0x124

[0167]

[0168] It is determined through calculation in step 3 that the work item spans two memory banks, and both the fourth memory bank bank4 and the fifth memory bank bank5 are in channel non-integration mode, that is, both are in 1C mode.

[0169] (2) The number of channels is 3C and the data format is 16bpc

[0170] (2.1) The work item byte address is 0x122

[0171] Based on the same calculation process as above, it is determined that the work item is stored in the first storage row, does not span the storage bank, and has a relative start address of 2, as shown in Table 4 below:

[0172] Table 4 Work item byte address is 0x122

[0173]

[0174] It is determined through calculation in step 3 that the work item does not span two storage repositories, and the channel processing mode is the channel integration mode, that is, the 3C mode.

[0175] (2.2) The work item byte address is 0x134

[0176] Based on the same calculation process as above, it is determined that the work item is stored in the first storage row, spanning two storage banks, namely the 6th storage bank6 and the 7th storage bank7, and the relative start address is the 4th byte of the 6th storage bank. The storage situation of the 6th storage bank is shown in Table 5, and the storage situation of the 7th storage bank is shown in Table 6:

[0177] Table 5 Work item byte address is 0x134

[0178]

[0179] Table 6 Work item byte address is 0x134

[0180]

[0181] According to the calculation in step 3, it is determined that the work item spans two banks, the sixth bank bank6 and the seventh bank bank7. The sixth bank is in channel integration mode, i.e., 2C mode, and the seventh bank is in channel non-integration mode, i.e., 1C mode.

[0182] (2.2) The work item byte address is 0x136

[0183] Based on the same calculation process as above, it is determined that the work item is stored in the first storage row, spanning two storage banks, namely the 6th storage bank6 and the 7th storage bank7, and the relative start address is the 6th byte of the 6th storage bank. The storage situation of the 6th storage bank is shown in Table 7, and the storage situation of the 7th storage bank is shown in Table 8:

[0184] Table 7 Work item byte address is 0x136

[0185]

[0186] Table 8 Work item byte address is 0x136

[0187]

[0188] According to the calculation in step 3, it is determined that the work item spans two banks, the sixth bank bank6 and the seventh bank bank7. The sixth bank is in a channel non-integrated mode, i.e., 1C mode, and the seventh bank is in a channel integrated mode, i.e., 2C mode.

[0189] (3) The number of channels is 3C and the data format is 16bpc

[0190] (3.1) The work item byte address is 0x204

[0191] Based on the same calculation process as above, it is determined that the work item is stored in the second storage line line2, does not span the storage bank, and has a relative start address of 4, as shown in Table 9 below:

[0192] Table 9 Work item byte address is 0x204

[0193]

[0194] It is determined through calculation in step 3 that the work item does not span two storage repositories, and the channel processing mode is the channel integration mode, that is, the 4C mode.

[0195] (3.2) The work item byte address is 0x205

[0196] Based on the same calculation process as above, it is determined that the work item is stored in the second storage row, spanning two storage banks, namely the 0th storage bank0 and the 1st storage bank1, and the relative starting address is the 5th byte of the 0th storage bank. The storage situation of the 0th storage bank is shown in Table 10, and the storage situation of the 1st storage bank is shown in Table 11:

[0197] Table 10 The work item byte address is 0x205

[0198]

[0199] Table 11 Work item byte address is 0x205

[0200]

[0201] According to the calculation in step 3, it is determined that the work item spans two banks, the 0th bank 0 and the 1st bank 1. The 0th bank is in channel integration mode, that is, 3C mode, and the 1st bank is in channel non-integration mode, that is, 1C mode.

[0202] (3.2) The work item byte address is 0x206

[0203] Based on the same calculation process as above, it is determined that the work item is stored in the second storage row, spanning two storage banks, namely the 0th storage bank0 and the 1st storage bank1, and the relative start address is the 6th byte of the 0th storage bank. The storage situation of the 0th storage bank is shown in Table 12, and the storage situation of the 1st storage bank is shown in Table 13:

[0204] Table 12 The work item byte address is 0x206

[0205]

[0206] Table 13 Work item byte address is 0x206

[0207]

[0208] Through calculation in step 3, it is determined that the work item spans two banks, the 0th bank 1 and the 1st bank 1. The 0th bank is in channel integration mode, that is, 2C mode, and the 1st bank is in channel integration mode, that is, 2C mode.

[0209] (3.3) The work item byte address is 0x207

[0210] Based on the same calculation process as above, it is determined that the work item is stored in the second storage row, spanning two storage banks, namely the 0th storage bank0 and the 1st storage bank1, and the relative start address is the 7th byte of the 0th storage bank. The storage situation of the 0th storage bank is shown in Table 14, and the storage situation of the 1st storage bank is shown in Table 15:

[0211] Table 14 Work item byte address is 0x207

[0212]

[0213] Table 15 The work item byte address is 0x207

[0214]

[0215] Through calculation in step 3, it is determined that the work item spans two banks, the 0th bank 0 and the 1st bank 1. The 0th bank is in a channel non-integrated mode, i.e., the 1C mode, and the 1st bank is in a channel integrated mode, i.e., the 3C mode.

[0216] In the above example, after the channel integration mode is determined, the request is split by the request splitting unit, and the shared memory is accessed based on the split granularity.

[0217] In addition, in order to further determine the number of accesses in this application, Tables 16, 17, 18, and 19 are used to further compare the number of read / write requests for work items when the integration solution of this application is adopted and when the integration solution of this application is not adopted.

[0218] Table 16 Comparison of visit times

[0219] Integration Unconformity 2C 2C 1C Number of visits 1 2

[0220] Table 17 Comparison of visit times

[0221]

[0222] Table 18 Comparison of visit times

[0223]

[0224] Table 19 Comparison of visit times

[0225]

[0226] As shown in Tables 16 to 19 above, when a work item has three channels (3C), if the three channels are all located in the same repository, that is, the integration mode is 3C, then only one access to the shared memory is required, and no splitting is required; if it spans two repositories, the integration mode is 2C, that is, the 2C integration mode and the 1C channel non-integration mode. If it is a channel non-integration mode, it needs to be accessed three times, at which point each channel of the work item can independently access the shared memory. For any number of channels kC, the shared memory can be accessed according to the solution of this application.

[0227] In the present embodiment, by acquiring the configuration information of the shared memory, and determining the channel information of the work item to be processed. When it is determined according to the configuration information and the channel information that the storage library corresponding to the work item to be processed meets the channel integration condition, the work item to be processed is used as the work item to be detected. In this way, by judging whether the storage library meets the channel integration condition, a preliminary detection of the storage library of the work item to be processed is realized to ensure that the shared memory can be accessed effectively and accurately in the future. Based on the channel information of the work item to be detected, the channel address corresponding to the work item to be detected is tested for channel address continuity to determine the channel processing mode corresponding to the work item to be detected, and the channel processing mode includes a channel integration mode and a channel non-integration mode. In this way, based on the channel address continuity detection, the channel address of the work item to be detected can be accurately determined to obtain a channel processing mode that matches the channel of the work item to be detected. Based on the channel processing mode, the channel address of the work item to be detected is processed accordingly, and the shared memory is accessed based on the processed channel address. In this way, based on the channel processing mode that matches the channel of the work item to be detected, it is possible to ensure that the access to the shared memory is completed while reducing the number of accesses to the shared memory, thereby reducing the storage repository conflict, thereby greatly improving the access efficiency to the shared memory. In addition, the method of the present application can be applied to all parallel computing scenarios, and is also applicable to different shared memory configurations, work item multi-channel numbers, and data format combinations, that is, the applicable scenarios are wide.

[0228] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0229] Based on the same inventive concept, the embodiment of the present application also provides a shared memory access device for implementing the shared memory access method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more shared memory access device embodiments provided below can refer to the limitations on the shared memory access method above, and will not be repeated here.

[0230] In one embodiment, Fig.15 As shown, a shared memory access device is provided, including: an acquisition module 1502, a determination module 1504, a detection module 1506 and a processing module 1508, wherein:

[0231] The acquisition module 1502 is used to acquire the configuration information of the shared memory and determine the channel information of the work item to be processed.

[0232] The determination module 1504 is configured to, if it is determined according to the configuration information and the channel information that the storage repository corresponding to the work item to be processed meets the channel integration condition, use the work item to be processed as the work item to be detected.

[0233] The detection module 1506 is used to perform a channel address continuity detection on the channel address corresponding to the work item to be detected based on the channel information of the work item to be detected, so as to determine the channel processing mode corresponding to the work item to be detected, and the channel processing mode includes a channel integration mode and a channel non-integration mode.

[0234] The processing module 1508 is used to process the channel address of the work item to be detected based on the channel processing mode, and access the shared memory based on the processed channel address.

[0235] In one embodiment, the determination module 1504 is further configured to determine the storage channel value of the storage repository corresponding to the work item to be processed according to the configuration information of the shared memory and the channel information of the work item to be processed. When the storage channel value is greater than the first threshold value, it is determined that the storage repository corresponding to the work item to be processed meets the channel integration condition.

[0236] In one embodiment, the acquisition module 1502 is used to acquire access information corresponding to each access request, and extract the channel information of each work item to be processed from the access information. The determination module 1504 is also used to determine the number of the access requests, and if the number of the access requests acquired is less than the second threshold number, continue to acquire the access requests. If the number of the access requests acquired reaches the second threshold number, for each work item to be processed, the step of determining the storage channel value of the storage library corresponding to the work item to be processed according to the configuration information of the shared memory and the channel information of the work item to be processed is executed.

[0237] In one embodiment, the detection module 1506 is used to determine whether the multiple channels corresponding to the work item to be detected span at least two storage bins based on the channel address information corresponding to the work item to be detected. If the multiple channels corresponding to the work item to be detected span at least two storage bins, the corresponding work item to be detected is used as the first work item to be detected, and the multiple storage bins corresponding to the first work item to be detected are used as the first storage bin. Based on the first channel address information, the first channel number, and the first data format corresponding to the first work item to be detected, the first storage bin corresponding to the first work item to be detected is split and processed to determine the number of first storage channels stored in each first storage bin. For each first storage bin corresponding to the first work item to be detected, the channel processing mode corresponding to the corresponding first work item to be detected is determined based on the number of first storage channels corresponding to each first storage bin.

[0238] In one embodiment, the detection module 1506 is further used to, if the multiple channels corresponding to the work item to be detected do not span different storage repositories, use the corresponding work item to be detected as the second work item to be detected, and determine that the channel processing mode corresponding to the second work item to be detected is the channel integration mode.

[0239] In one embodiment, the detection module 1506 is also used to determine the number of storage banks in the shared memory and the width of each storage bank based on the configuration information of the shared memory. Based on the channel address information corresponding to the work item to be detected, the number of storage banks, and the width of the storage bank, a row index calculation is performed to determine the row index corresponding to the work item to be detected; wherein the row index is used to characterize the row position of the storage bank corresponding to the work item to be detected in the shared memory. Based on the row index corresponding to the work item to be detected, the channel address information, and the number and width of the storage bank, a starting byte index calculation is performed to determine the starting byte index in the storage bank corresponding to the work item to be detected; wherein the starting byte index is used to characterize the starting byte position of the channel address corresponding to the work item in the storage bank. Based on the data format of the channel corresponding to the work item to be detected and the starting byte index corresponding to the work item to be detected, a cross-storage bank detection is performed to obtain a cross-storage bank detection result. Based on the cross-storage bank detection result, it is determined whether the multiple channels corresponding to the work item to be detected span at least two storage banks.

[0240] In one embodiment, the detection module 1506 is further used to compare the number of first storage channels with the first threshold number for each first storage library corresponding to each first work item to be detected, and to use the first storage library that meets the channel integration condition as the integrated storage library, and to determine the channel processing mode of the multiple first channels stored in the integrated storage library as the channel integration mode. Use the first storage library that does not meet the channel integration condition as the non-integrated storage library, and to determine the channel processing mode of the multiple first channels stored in the non-integrated storage library as the channel non-integrated mode.

[0241] In one embodiment, the determination module 1504 is further used to directly determine that the channel processing mode corresponding to the work item to be processed is a channel non-integration mode when it is determined according to the configuration information and the channel information that the storage repository corresponding to the work item to be processed does not meet the channel integration condition.

[0242] Each module in the above-mentioned shared memory access device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0243] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.15 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store access data of the shared memory. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for accessing a shared memory is implemented.

[0244] Those skilled in the art will understand that Fig.16The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0245] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0246] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0247] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0248] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The processor involved in each embodiment provided in this application can be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, etc., but is not limited thereto.

[0249] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0250] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for accessing a shared memory, characterized in that: The method comprises: Acquire configuration information of the shared memory, and determine channel information of the work item to be processed, wherein the configuration information includes the number of storage banks in the shared memory, the byte index of the storage bank width, and the number of cache lines, and the channel information includes the data format of the channel and the number of channels of the work item; Determine a storage channel value of a storage repository corresponding to the work item to be processed according to the configuration information of the shared memory and the channel information of the work item to be processed; When the storage channel value is greater than a first threshold value, it is determined that the storage repository corresponding to the work item to be processed meets the channel integration condition, and the work item to be processed is used as a work item to be detected; Based on the channel address information corresponding to the work item to be detected, determining whether a plurality of channels corresponding to the work item to be detected spans across at least two storage bins; If the multiple channels corresponding to the work item to be detected span at least two storage bins, the corresponding work item to be detected is used as a first work item to be detected, and the multiple storage bins corresponding to the first work item to be detected are used as the first storage bins; Based on the first channel address information, the first channel number, and the first data format corresponding to the first work item to be detected, splitting the first storage memory bank corresponding to the first work item to be detected to determine the number of first storage channels stored in each first storage memory bank; For each first storage bin corresponding to the first work item to be detected, a channel processing mode corresponding to the corresponding first work item to be detected is determined based on the number of first storage channels respectively corresponding to each first storage bin, wherein the channel processing mode includes a channel integration mode and a channel non-integration mode; The channel address of the work item to be detected is processed based on the channel processing mode, and the shared memory is accessed based on the processed channel address.

2. The method according to claim 1, characterized in that The method further comprises: Obtain access information corresponding to each access request, and extract channel information of each to-be-processed work item from the access information; Before determining the storage channel value of the storage library corresponding to the work item to be processed according to the configuration information of the shared memory and the channel information of the work item to be processed, Determining the number of the access requests, and if the number of the access requests obtained is less than a second threshold number, continuing to obtain access requests; If the number of access requests obtained reaches the second threshold number, for each work item to be processed, the step of determining the storage channel value of the storage library corresponding to the work item to be processed based on the configuration information of the shared memory and the channel information of the work item to be processed is executed.

3. The method according to claim 1, characterized in that The method further comprises: If the multiple channels corresponding to the work item to be detected do not span different storage libraries, the corresponding work item to be detected is used as the second work item to be detected, and the channel processing mode corresponding to the second work item to be detected is determined to be the channel integration mode.

4. The method according to claim 1, characterized in that: The determining, based on the channel address information corresponding to the work item to be detected, whether the multiple channels corresponding to the work item to be detected span at least two storage bins includes: Determine the number of storage banks in the shared memory and the width of each storage bank based on the configuration information of the shared memory; Based on the channel address information corresponding to the work item to be detected, the number of storage banks, and the width of the storage banks, a row index calculation is performed to determine the row index corresponding to the work item to be detected; wherein the row index is used to represent the row position of the storage bank corresponding to the work item to be detected in the shared memory; Based on the row index corresponding to the work item to be detected, the channel address information, and the number and width of the storage memory, a starting byte index calculation is performed to determine the starting byte index in the storage memory corresponding to the work item to be detected; wherein the starting byte index is used to represent the starting byte position of the channel address corresponding to the work item in the storage memory; Based on the data format of the channel corresponding to the work item to be detected and the starting byte index corresponding to the work item to be detected, a cross-repository detection is performed to obtain a cross-repository detection result; Based on the cross-repository detection result, it is determined whether a plurality of channels corresponding to the work item to be detected spans at least two repositories.

5. The method according to claim 1, characterized in that The first storage bin corresponding to each first work item to be detected, based on the number of first storage channels respectively corresponding to each first storage bin, determines the channel processing mode corresponding to the corresponding first work item to be detected, including: For each first storage bank corresponding to each first work item to be detected, the number of first storage channels is compared with the first threshold number, and the first storage bank that meets the channel integration condition is used as the integrated storage bank, and the channel processing mode of the multiple first channels stored in the integrated storage bank is determined as the channel integration mode; The first storage memory bank that does not meet the channel integration condition is used as a non-integrated storage memory bank, and the channel processing mode of the plurality of first channels stored in the non-integrated storage memory bank is determined as a channel non-integrated mode.

6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: When it is determined according to the configuration information and the channel information that the storage repository corresponding to the work item to be processed does not meet the channel integration condition, the channel processing mode corresponding to the work item to be processed is directly determined to be the channel non-integration mode.

7. A shared memory access device, characterized in that: The device comprises: An acquisition module, used to acquire configuration information of a shared memory and determine channel information of a work item to be processed, wherein the configuration information includes the number of storage banks in the shared memory, the byte index of the storage bank width, and the number of cache lines, and the channel information includes the data format of the channel and the number of channels of the work item; A determination module, configured to determine a storage channel value of a storage repository corresponding to the work item to be processed according to the configuration information of the shared memory and the channel information of the work item to be processed; when the storage channel value is greater than a first threshold value, it is determined that the storage repository corresponding to the work item to be processed meets the channel integration condition, and the work item to be processed is used as a work item to be detected; A detection module, configured to determine, based on the channel address information corresponding to the work item to be detected, whether the multiple channels corresponding to the work item to be detected span at least two storage bins; if the multiple channels corresponding to the work item to be detected span at least two storage bins, the corresponding work item to be detected is used as a first work item to be detected, and the multiple storage bins corresponding to the first work item to be detected are used as first storage bins; based on the first channel address information, the first channel number, and the first data format corresponding to the first work item to be detected, the first storage bin corresponding to the first work item to be detected is split and processed to determine the number of first storage channels stored in each first storage bin; for each first storage bin corresponding to the first work item to be detected, based on the number of first storage channels respectively corresponding to each first storage bin, a channel processing mode corresponding to the corresponding first work item to be detected is determined, the channel processing mode including a channel integration mode and a channel non-integration mode; A processing module is used to process the channel address of the work item to be detected based on the channel processing mode, and access the shared memory based on the processed channel address.

8. The device according to claim 7, characterized in that The acquisition module is used to obtain access information corresponding to each access request, and extract the channel information of each pending work item from the access information; the determination module is also used to judge the number of the access requests, and if the number of the access requests obtained is less than the second threshold number, continue to obtain the access requests; if the number of the access requests obtained reaches the second threshold number, for each pending work item, the step of determining the storage channel value of the storage library corresponding to the pending work item based on the configuration information of the shared memory and the channel information of the pending work item is executed.

9. The device according to claim 7, characterized in that The detection module is used to, if the multiple channels corresponding to the work item to be detected do not span different storage libraries, take the corresponding work item to be detected as the second work item to be detected, and determine that the channel processing mode corresponding to the second work item to be detected is the channel integration mode.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Shared memory access method and unit, graphics processor and universal graphics processor

    CN118429177A