Data sharing method, device, equipment and medium

By dividing streaming multi-processors into clusters in a general-purpose graphics processor, and using arbitration units and prediction units for data sharing, the problem of data sharing between streaming multi-processors is solved, data processing performance is improved and energy consumption is reduced. Consumption.

CN118642984BActive Publication Date: 2024-10-22YUANQIXIN (SHANDONG) SEMICONDUCTOR TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411110547.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-10-22
Estimated Expiration
2044-08-14

AI Technical Summary

Technical Problem

In general-purpose graphics processors, data sharing between streaming multi-processors is difficult to achieve, resulting in reduced data processing performance and increased energy consumption.

Method used

By dividing the streaming multiprocessor into multiple clusters, each cluster contains arbitration units and prediction units, requests for data not found in the L1 cache are sent to the prediction unit of the target cluster, predict whether the data exists, and pass The arbitration unit determines the target streaming multiprocessor for data sharing.

Benefits of technology

It improves data processing performance, reduces energy consumption, reduces dependence on L2 cache and device memory, and avoids excessive energy consumption caused by global streaming multi-processor queries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118642984B_ABST
    Figure CN118642984B_ABST
Patent Text Reader

Abstract

The present application discloses a data sharing method, device, equipment and medium, which relates to the field of data processing, including: if any streaming multiprocessor in a general graphics processor fails to find the data corresponding to the request address from its own first-level cache, the request address is sent to the prediction unit corresponding to the target cluster where any streaming multiprocessor is located; when the prediction unit predicts that there is shared data corresponding to the request address in the target cluster, the request address is broadcast to other streaming multiprocessors in the target cluster, so that other streaming multiprocessors can find the shared data from their own first-level cache based on the request address, and determine the target streaming multiprocessor from the streaming multiprocessors that find the shared data through the arbitration unit corresponding to the target cluster, and control the target streaming multiprocessor to send the shared data to any streaming multiprocessor. The present application can improve data processing performance and reduce energy consumption by sharing data between streaming multiprocessors in the same cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a data sharing method, device, equipment and medium. Background Art

[0002] In the field of high-performance data processing, parallel processing was initially widely used in scientific computing. In recent years, with the development of artificial intelligence and machine learning, the need to use parallel processing to widely and effectively use computing resources has become more urgent. General-purpose computing on graphics processing units (GPGPU) is suitable for data-intensive or computing-intensive application scenarios, can be used to accelerate large-scale parallel processing tasks, and is easy to program using a general programming framework.

[0003] A general-purpose graphics processor contains multiple streaming multiprocessors, each of which has a first-level cache, so that the spatial locality of data can be used for acceleration. If the streaming multiprocessor does not find the data corresponding to the data request address in its own first-level cache, the streaming multiprocessor needs to request data from the second-level cache outside the core or even the device memory through the on-chip network, but this will consume a lot of time, thereby reducing data processing performance and increasing energy consumption. Since different streaming multiprocessors may use data at the same address in memory, and if data can be requested from other streaming multiprocessors, the time consumption can be reduced compared to the second-level cache and device memory; therefore, how to achieve data sharing between streaming multiprocessors is a problem that needs to be solved at present. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a data sharing method, device, equipment and medium, which can improve data processing performance and reduce energy consumption based on data sharing between streaming multiprocessors in the same cluster. The specific scheme is as follows:

[0005] In a first aspect, the present application provides a data sharing method, which is applied to a general-purpose graphics processor, wherein the general-purpose graphics processor includes a plurality of streaming multiprocessors, wherein the plurality of streaming multiprocessors are divided into a plurality of clusters, and each cluster corresponds to an arbitration unit and a prediction unit; wherein the method comprises:

[0006] If any streaming multiprocessor fails to find data corresponding to the data request address from its own first-level cache, a data request generated based on the data request address is sent to a target prediction unit corresponding to a target cluster; the target cluster is the cluster where any streaming multiprocessor is located;

[0007] When the target prediction unit predicts that there is shared data corresponding to the data request address in the target cluster, a first search request generated based on the data request address is broadcast to other streaming multiprocessors in the target cluster, so that the other streaming multiprocessors determine whether the shared data corresponding to the data request address is found from their own first-level cache, and send the determination result to the target arbitration unit corresponding to the target cluster;

[0008] The target arbitration unit determines a target streaming multiprocessor from the streaming multiprocessors that send target judgment results, and sends a send permission signal to the target streaming multiprocessor, so that the target streaming multiprocessor sends the shared data to any of the streaming multiprocessors based on the send permission signal; the target judgment result is a judgment result that characterizes that the shared data has been found.

[0009] Optionally, sending the data request generated based on the data request address to a target prediction unit corresponding to the target cluster includes:

[0010] An address request signal requesting a sending address to the target prediction unit is sent to the target arbitration unit through any of the streaming multiprocessors, and after receiving an address enable signal sent by the target arbitration unit based on the address request signal, a data request generated based on the data request address is sent to the target prediction unit using a shared address bus.

[0011] Optionally, determining the target streaming multiprocessor from the streaming multiprocessors that send the target determination result by the target arbitration unit includes:

[0012] Determine, by the target arbitration unit, a target streaming multiprocessor closest to the head of the queue from the streaming multiprocessors to be determined based on the position of the streaming multiprocessor to be determined in the current queue, and move the position of the target streaming multiprocessor in the current queue to the end of the queue to obtain a new current queue;

[0013] The to-be-determined streaming multiprocessor is a streaming multiprocessor that sends a target determination result; and the current queue is used to store all streaming multiprocessors in the target cluster.

[0014] Optionally, the target prediction unit includes an input cache, a prediction buffer and an output cache;

[0015] Correspondingly, when the target prediction unit predicts that there is shared data corresponding to the data request address in the target cluster, broadcasting a first search request generated based on the data request address to other streaming multiprocessors in the target cluster includes:

[0016] The target prediction unit stores the data request address in the input buffer, and determines a prediction result based on a current prediction value corresponding to the data request address stored in the prediction buffer; wherein the prediction result is used to indicate whether there is shared data corresponding to the data request address in the target cluster;

[0017] If the prediction result indicates that the shared data exists in the target cluster, a first search request is generated by the target prediction unit based on the data request address stored in the output cache, and the first search request is broadcast to other streaming multiprocessors in the target cluster; the data request address stored in the output cache is the address that the target prediction unit will store in the output cache after reading the data request address from the input cache.

[0018] Optionally, the predicted value is an integer not less than a predicted lower limit value and not greater than a predicted upper limit value, the difference between the predicted lower limit value and the predicted upper limit value is an odd number greater than 1, and the predicted value corresponding to the prediction result representing that the shared data exists in the target cluster is greater than the predicted value corresponding to the prediction result representing that the shared data does not exist in the target cluster;

[0019] Correspondingly, after sending the determination result to the target arbitration unit corresponding to the target cluster, the method further includes:

[0020] When the target arbitration unit determines an actual result based on the judgment result and sends the actual result to the update unit in the target prediction unit, the update unit compares the actual result with the prediction result to obtain a comparison result; the actual result is used to indicate whether the shared data exists in the target cluster;

[0021] If the comparison result indicates that the actual result is consistent with the predicted result, and the current predicted value is less than the predicted upper limit, the current predicted value is incremented by one by the updating unit, and the prediction buffer is updated based on the new current predicted value;

[0022] If the comparison result indicates that the actual result and the predicted result are inconsistent, and the current predicted value is greater than the predicted lower limit, the current predicted value is decremented by one by the updating unit, and the prediction buffer is updated based on the new current predicted value.

[0023] Optionally, after determining the prediction result based on the current prediction value corresponding to the data request address stored in the prediction buffer, the method further includes:

[0024] If the prediction result indicates that the shared data does not exist in the target cluster, a second search request is generated by the target prediction unit based on the data request address stored in the output cache, and the shared data corresponding to the data request address is searched from a secondary cache based on the second search request; the secondary cache is located inside the general graphics processor and outside the plurality of streaming multiprocessors;

[0025] If the shared data is found from the secondary cache, the shared data in the secondary cache is sent to the primary cache in any of the streaming multiprocessors through the target prediction unit, and the current prediction value is incremented by one based on the update unit, and the prediction buffer is updated based on the new current prediction value.

[0026] Optionally, after searching the shared data corresponding to the data request address from the secondary cache based on the second search request, the method further includes:

[0027] If the shared data is not found in the secondary cache, a third search request is generated by the target prediction unit based on the data request address stored in the output cache, and the shared data corresponding to the data request address is searched from a device memory based on the third search request; the device memory is located on the device board where the general-purpose graphics processor is located and is located outside the general-purpose graphics processor;

[0028] If the shared data is found in the device memory, the shared data in the device memory is sent to the first-level cache in any streaming multiprocessor via the second-level cache through the target prediction unit, and the current prediction value is incremented by one based on the update unit, and the prediction buffer is updated based on the new current prediction value.

[0029] In a second aspect, the present application provides a data sharing device, which is applied to a general-purpose graphics processor, wherein the general-purpose graphics processor includes a plurality of streaming multiprocessors, wherein the plurality of streaming multiprocessors are divided into a plurality of clusters, and each cluster corresponds to an arbitration unit and a prediction unit; wherein the device includes:

[0030] A data request sending module, configured to send a data request generated based on the data request address to a target prediction unit corresponding to a target cluster if any streaming multiprocessor fails to find data corresponding to the data request address from its own first-level cache; the target cluster is the cluster where any streaming multiprocessor is located;

[0031] a search request broadcast module, configured to broadcast a first search request generated based on the data request address to other streaming multiprocessors in the target cluster when the target prediction unit predicts that there is shared data corresponding to the data request address in the target cluster, so that the other streaming multiprocessors can determine whether the shared data corresponding to the data request address is found in their own first-level cache, and send the determination result to the target arbitration unit corresponding to the target cluster;

[0032] A shared data sending module is used to determine a target streaming multiprocessor from the streaming multiprocessors that send target judgment results through the target arbitration unit, and send a permission to send signal to the target streaming multiprocessor, so that the target streaming multiprocessor sends the shared data to any of the streaming multiprocessors based on the permission to send signal; the target judgment result is a judgment result that characterizes the finding of the shared data.

[0033] In a third aspect, the present application provides an electronic device, including:

[0034] Memory, used to store computer programs;

[0035] A processor is used to execute the computer program to implement the aforementioned data sharing method.

[0036] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned data sharing method when executed by a processor.

[0037] The data sharing method of the present application is applied to a general-purpose graphics processor, wherein the general-purpose graphics processor includes a plurality of streaming multiprocessors, wherein the plurality of streaming multiprocessors are divided into a plurality of clusters, and each cluster corresponds to an arbitration unit and a prediction unit; wherein the method comprises: if any streaming multiprocessor fails to find data corresponding to a data request address from its own first-level cache, then a data request generated based on the data request address is sent to a target prediction unit corresponding to a target cluster; the target cluster is the cluster where any streaming multiprocessor is located; when the target prediction unit predicts that there is shared data corresponding to the data request address in the target cluster, an arbitration unit and a prediction unit are sent to other clusters in the target cluster; The streaming multiprocessor broadcasts a first search request generated based on the data request address, so that the other streaming multiprocessors determine whether the shared data corresponding to the data request address is found from their own first-level cache, and send the determination result to the target arbitration unit corresponding to the target cluster; the target arbitration unit determines the target streaming multiprocessor from the streaming multiprocessors that send the target determination result, and sends a permission to send signal to the target streaming multiprocessor, so that the target streaming multiprocessor sends the shared data to any of the streaming multiprocessors based on the permission to send signal; the target determination result is a determination result that indicates that the shared data is found. It can be seen that the present application divides several streaming multiprocessors into multiple clusters, and when any streaming multiprocessor fails to find the data corresponding to the data request address from its own first-level cache, through the prediction unit and the arbitration unit, it can query other streaming multiprocessors in the cluster where any streaming multiprocessor is located, and obtain the shared data corresponding to the data request address from other streaming multiprocessors, thereby realizing data sharing between streaming multiprocessors in the same cluster, which can reduce time consumption compared to the second-level cache and device memory, thereby improving data processing performance and reducing energy consumption; and, the present application only needs to query other streaming multiprocessors in the cluster where any streaming multiprocessor is located, thereby avoiding the problem of excessive energy consumption caused by querying all streaming multiprocessors in a general-purpose graphics processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0039] Figure 1 A flow chart of a data sharing method disclosed in this application;

[0040] Figure 2A schematic diagram of the connection between a cluster streaming multiprocessor, a prediction unit and an arbitration unit disclosed in the present application;

[0041] Figure 3 A structural diagram of a prediction unit disclosed in this application;

[0042] Figure 4 A data sharing flow chart disclosed in this application;

[0043] Figure 5 This is a schematic diagram of the structure of a data sharing device disclosed in this application;

[0044] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0046] A general-purpose graphics processor contains multiple streaming multiprocessors, each of which has a first-level cache, so that the spatial locality of data can be used for acceleration. If the streaming multiprocessor does not find the data corresponding to the data request address in its own first-level cache, the streaming multiprocessor needs to request data from the second-level cache outside the core or even the device memory through the on-chip network, but this will consume a lot of time, thereby reducing data processing performance and increasing energy consumption. To this end, the present application provides a data sharing method, which can improve data processing performance and reduce energy consumption by sharing data between streaming multiprocessors in the same cluster.

[0047] See also Figure 1 As shown, an embodiment of the present invention discloses a data sharing method, which is applied to a general-purpose graphics processor, wherein the general-purpose graphics processor includes a plurality of streaming multiprocessors, wherein the plurality of streaming multiprocessors are divided into a plurality of clusters, and each cluster corresponds to an arbitration unit and a prediction unit; wherein the method includes:

[0048] Step S11: If any streaming multiprocessor fails to find data corresponding to the data request address from its own first-level cache, a data request generated based on the data request address is sent to a target prediction unit corresponding to a target cluster; the target cluster is the cluster where any streaming multiprocessor is located.

[0049] In this embodiment, for cluster division, a plurality of streaming multiprocessors in a general graphics processor are divided into a plurality of clusters based on a preset number and a physical distance between the streaming multiprocessors, wherein the preset number is the number of streaming multiprocessors included in a cluster, for example, it can be set to 8. Moreover, the preset number is determined by continuous testing to determine how many streaming multiprocessors are included in a cluster to ensure data processing performance to the greatest extent; and the physical distance between the streaming multiprocessors is to divide the preset number of streaming multiprocessors in the general graphics processor that are physically closest into the same cluster.

[0050] In this embodiment, a data request address is obtained through any streaming multiprocessor in the general graphics processor, and data corresponding to the data request address is searched from its own first-level cache. If the data is not found, a data request is generated based on the data request address, and the data request is sent to the target prediction unit corresponding to the target cluster; wherein the target cluster is the cluster where any streaming multiprocessor is located.

[0051] Among them, sending the data request generated based on the data request address to the target prediction unit corresponding to the target cluster specifically includes: sending an address request signal of the request sending address to the target prediction unit to the target arbitration unit through any streaming multiprocessor, and after receiving the address enable signal sent by the target arbitration unit based on the address request signal, using the shared address bus to send the data request generated based on the data request address to the target prediction unit.

[0052] like Figure 2 As shown, Figure 2 It reflects the connection relationship between the streaming multiprocessor and the arbitration unit and prediction unit in a cluster. Specifically, the streaming multiprocessor communicates data with the arbitration unit through a star-shaped arbitration network, and the streaming multiprocessor communicates addresses with the prediction unit through a shared address bus. The prediction unit and the arbitration unit communicate data through the prediction network, and the streaming multiprocessors communicate data through the shared data bus. It should be noted that the bandwidth of the shared data bus and the shared address bus can both be 256 bits.

[0053] Step S12: When the target prediction unit predicts that there is shared data corresponding to the data request address in the target cluster, a first search request generated based on the data request address is broadcast to other streaming multiprocessors in the target cluster, so that the other streaming multiprocessors can determine whether the shared data corresponding to the data request address is found from their own first-level cache, and send the determination result to the target arbitration unit corresponding to the target cluster.

[0054] In this embodiment, when the target prediction unit predicts that there is shared data corresponding to the data request address in the target cluster, a broadcast request signal requesting a broadcast search request is sent to the target arbitration unit using the prediction network, and after receiving a broadcast permission signal sent by the target arbitration unit based on the broadcast request signal, a first search request generated based on the data request address is broadcast to other streaming multiprocessors in the target cluster using the shared address bus, so that other streaming multiprocessors can search their own first-level cache based on the data request address to determine whether the shared data corresponding to the data request address is found, and send the determination result to the target arbitration unit corresponding to the target cluster.

[0055] Step S13, determining a target streaming multiprocessor from the streaming multiprocessors that send target judgment results through the target arbitration unit, and sending a permission to send signal to the target streaming multiprocessor, so that the target streaming multiprocessor sends the shared data to any of the streaming multiprocessors based on the permission to send signal; the target judgment result is a judgment result that characterizes the finding of the shared data.

[0056] In this embodiment, after the target arbitration unit receives the judgment results sent by other streaming multiprocessors in the target cluster, if there is a target judgment result for indicating that shared data has been found in the judgment results, a data ready signal is sent to any streaming multiprocessor, so that any streaming multiprocessor is ready to receive data based on the data ready signal. If there is no target judgment result for indicating that shared data has been found in the judgment results, a no shared data signal is sent to any streaming multiprocessor, so that any streaming multiprocessor knows that there is no data corresponding to the data request address in the target cluster.

[0057] Furthermore, if there is a target judgment result in the judgment result that is used to characterize the search for shared data, the target streaming multiprocessor is determined from the streaming multiprocessors that send the target judgment result through the target arbitration unit, and the arbitration network is used to send a send permission signal to the target streaming multiprocessor, so that the target streaming multiprocessor sends the shared data to any streaming multiprocessor via the shared data bus based on the send permission signal.

[0058] It should be noted that for the target streaming multiprocessor, the target arbitration unit can determine the target streaming multiprocessor closest to the head of the queue from the to-be-determined streaming multiprocessors based on the position of the to-be-determined streaming multiprocessor in the current queue, and move the position of the target streaming multiprocessor in the current queue to the end of the queue to obtain a new current queue. Among them, the to-be-determined streaming multiprocessor is the streaming multiprocessor that sends the target judgment result; and the current queue is used to store all streaming multiprocessors in the target cluster. The closer the streaming multiprocessor in the current queue is to the head of the queue, the higher the priority, and the higher the possibility of being selected as the target streaming multiprocessor. In this way, through the current queue, the possibility of each streaming multiprocessor in the target cluster being selected as the target streaming multiprocessor can be balanced, avoiding the problem of reduced efficiency caused by a certain streaming multiprocessor being frequently selected as the target streaming multiprocessor.

[0059] For step S12, the target prediction unit includes an input buffer, a prediction buffer, and an output buffer. Figure 3 As shown, when the target prediction unit obtains a data request generated based on a data request address sent by any streaming multiprocessor, the target prediction unit stores the data request address in the input cache, and determines the prediction result based on the current prediction value corresponding to the data request address stored in the prediction buffer; wherein the prediction result is used to characterize whether there is shared data corresponding to the data request address in the target cluster. If the prediction result characterizes that there is shared data in the target cluster, a first search request is generated based on the data request address stored in the output cache by the target prediction unit, and the first search request is broadcast to other streaming multiprocessors in the target cluster; wherein the data request address stored in the output cache is the address that the target prediction unit stores the data request address read from the input cache in the output cache.

[0060] It should be noted that the one-bit prediction mechanism can set the prediction value to 0 and 1. When the prediction result indicates that there is no shared data in the target cluster, the prediction value is 0, and when the prediction result indicates that there is shared data in the target cluster, the prediction value is 1. In this case, if the prediction result is wrong, the prediction value will be flipped immediately, and there is no buffer mechanism. Therefore, this embodiment adopts a two-bit prediction mechanism or a multi-bit prediction mechanism to play a buffering role.

[0061] Specifically, in this embodiment, the predicted value can be set to an integer not less than the predicted lower limit value and not greater than the predicted upper limit value, wherein the difference between the predicted lower limit value and the predicted upper limit value is an odd number greater than 1, and the predicted value corresponding to the prediction result for characterizing the existence of shared data in the target cluster is greater than the predicted value corresponding to the prediction result for characterizing the absence of shared data in the target cluster. For example, if a two-bit prediction mechanism is adopted, the predicted value can be set to 0, 1, 2, 3, wherein 0 and 1 correspond to the prediction results for characterizing the absence of shared data in the target cluster, and 2 and 3 correspond to the prediction results for characterizing the existence of shared data in the target cluster.

[0062] For updating the predicted value, first, after the target arbitration unit receives the judgment result sent by other streaming multiprocessors in the target cluster, the actual result is determined based on the judgment result, and the actual result is sent to the update unit in the target prediction unit. Among them, for the actual result, if there is a target judgment result for characterizing that shared data is found in the judgment result, then the actual result is the result that shared data corresponding to the data request address exists in the target cluster; if there is no target judgment result for characterizing that shared data is found in the judgment result, then the actual result is the result that shared data corresponding to the data request address does not exist in the target cluster.

[0063] Further, such as Figure 3 As shown, after the update unit in the target prediction unit receives the actual result, the update unit compares the actual result with the prediction result in the prediction buffer for consistency to obtain a comparison result. If the comparison result indicates that the actual result is consistent with the prediction result, and the current prediction value is less than the prediction upper limit, the update unit performs a self-increment operation on the current prediction value, and updates the prediction buffer in the target prediction unit based on the new current prediction value; if the comparison result indicates that the actual result is inconsistent with the prediction result, and the current prediction value is greater than the prediction lower limit, the update unit performs a self-decrement operation on the current prediction value, and updates the prediction buffer in the target prediction unit based on the new current prediction value. In addition, if the current prediction value is equal to the prediction upper limit or the prediction lower limit, the prediction buffer is not updated.

[0064] In this embodiment, after determining the prediction result based on the current prediction value corresponding to the data request address stored in the prediction buffer, if the prediction result indicates that there is no shared data in the target cluster, a second search request is generated based on the data request address stored in the output cache by the target prediction unit, and based on the second search request, the shared data corresponding to the data request address is searched from the secondary cache; wherein the secondary cache is located inside a general-purpose graphics processor and outside several streaming multiprocessors.

[0065] If shared data is found in the L2 cache, the shared data in the L2 cache is sent to the L1 cache in any streaming multiprocessor through the target prediction unit, and the current prediction value is incremented by one based on the update unit, and the prediction buffer is updated based on the new current prediction value.

[0066] If the shared data is not found in the secondary cache, a third search request is generated by the target prediction unit based on the data request address stored in the output cache, and the shared data corresponding to the data request address is searched from the device memory based on the third search request; wherein the device memory is located on the device board where the general-purpose graphics processor is located and is located outside the general-purpose graphics processor.

[0067] If shared data is found from the device memory, the shared data in the device memory is sent to the first-level cache in any streaming multiprocessor via the second-level cache through the target prediction unit, and the current prediction value is incremented by one based on the update unit, and the prediction buffer is updated based on the new current prediction value.

[0068] Take a two-bit prediction mechanism and the prediction values ​​are set to 0, 1, 2, and 3 as an example, where 0 and 1 correspond to the prediction results for characterizing that there is no shared data in the target cluster, and 2 and 3 correspond to the prediction results for characterizing that there is shared data in the target cluster. It should be noted that the prediction value corresponding to the data request address stored in the prediction buffer is initially 0. When the target prediction unit first obtains a data request generated based on the data request address sent by any streaming multiprocessor, the target prediction unit determines the prediction result based on the current prediction value 0 corresponding to the data request address stored in the prediction buffer. At this time, the prediction result characterizes that there is no shared data in the target cluster, and then searches for the shared data corresponding to the data request address from the secondary cache or device memory. If found, the shared data is sent to the primary cache in any streaming multiprocessor, and the current prediction value is incremented by one based on the update unit, and the prediction buffer is updated based on the new current prediction value 1. In this way, this embodiment can reduce the negative impact of prediction errors caused by prediction results based on the buffer mechanism by adopting a two-bit prediction mechanism.

[0069] It can be seen that the present application divides several streaming multiprocessors into multiple clusters, and when any streaming multiprocessor fails to find the data corresponding to the data request address from its own first-level cache, through the prediction unit and the arbitration unit, it can query other streaming multiprocessors in the cluster where any streaming multiprocessor is located, and obtain the shared data corresponding to the data request address from other streaming multiprocessors, thereby realizing data sharing between streaming multiprocessors in the same cluster, which can reduce time consumption compared to the second-level cache and device memory, thereby improving data processing performance and reducing energy consumption; and, the present application only needs to query other streaming multiprocessors in the cluster where any streaming multiprocessor is located, thereby avoiding the problem of excessive energy consumption caused by querying all streaming multiprocessors in a general-purpose graphics processor.

[0070] See also Figure 4 As shown, an embodiment of the present invention discloses a data sharing method, which is applied to a general-purpose graphics processor, wherein the general-purpose graphics processor includes a plurality of streaming multiprocessors, wherein the plurality of streaming multiprocessors are divided into a plurality of clusters, and each cluster corresponds to an arbitration unit and a prediction unit; wherein the method includes:

[0071] A data request address is obtained through any streaming multiprocessor in the general graphics processor, and data corresponding to the data request address is searched from its own first-level cache. If the data is not found, it indicates that the first-level cache of any streaming multiprocessor is missing, and a data request generated based on the data request address is sent to a target prediction unit corresponding to a target cluster; wherein the target cluster is the cluster where any streaming multiprocessor is located.

[0072] When the target prediction unit obtains a data request generated based on the data request address, the target prediction unit determines whether there is shared data corresponding to the data request address in the target cluster based on the current prediction value corresponding to the data request address stored in the prediction buffer, thereby obtaining a prediction result.

[0073] If the prediction result indicates that there is shared data in the target cluster, the first search request generated based on the data request address is broadcast to other streaming multiprocessors in the target cluster through the target prediction unit, so that other streaming multiprocessors can search their own first-level cache based on the data request address to determine whether the shared data corresponding to the data request address is found, and send the determination result to the target arbitration unit corresponding to the target cluster.

[0074] After the target arbitration unit receives the judgment results sent by other streaming multiprocessors in the target cluster, it determines whether the search for the target cluster is successful based on whether there is a target judgment result for indicating that the shared data is found in the judgment results. If the search for the target cluster is successful, the target streaming multiprocessor is determined from the streaming multiprocessors that sent the target judgment results through the target arbitration unit, and a permission to send signal is sent to the target streaming multiprocessor, so that the target streaming multiprocessor returns the shared data to the first-level cache in any streaming multiprocessor based on the permission to send signal.

[0075] If the search for the target cluster fails or the prediction result indicates that there is no shared data in the target cluster, a second search request is generated based on the data request address by the target prediction unit, and the secondary cache is searched based on the second search request to determine whether the shared data corresponding to the data request address is found. If the shared data is found in the secondary cache, the shared data in the secondary cache is returned to the primary cache in any streaming multiprocessor through the target prediction unit.

[0076] If the shared data is not found in the secondary cache, a third search request is generated based on the data request address through the target prediction unit, and the shared data corresponding to the data request address is searched from the device memory based on the third search request. The shared data in the device memory is then returned to the primary cache in any streaming multiprocessor via the secondary cache.

[0077] It can be seen that the present application divides several streaming multiprocessors into multiple clusters, and when any streaming multiprocessor fails to find the data corresponding to the data request address from its own first-level cache, through the prediction unit and the arbitration unit, it can query other streaming multiprocessors in the cluster where any streaming multiprocessor is located, and obtain the shared data corresponding to the data request address from other streaming multiprocessors, thereby realizing data sharing between streaming multiprocessors in the same cluster, which can reduce time consumption compared to the second-level cache and device memory, thereby improving data processing performance and reducing energy consumption; and, the present application only needs to query other streaming multiprocessors in the cluster where any streaming multiprocessor is located, thereby avoiding the problem of excessive energy consumption caused by querying all streaming multiprocessors in a general-purpose graphics processor.

[0078] See also Figure 5 As shown, an embodiment of the present invention discloses a data sharing device, which is applied to a general-purpose graphics processor, wherein the general-purpose graphics processor includes a plurality of streaming multiprocessors, and the plurality of streaming multiprocessors are divided into a plurality of clusters, each of which corresponds to an arbitration unit and a prediction unit; wherein the device includes:

[0079] A data request sending module 11 is used to send a data request generated based on the data request address to a target prediction unit corresponding to a target cluster if any streaming multiprocessor fails to find data corresponding to the data request address from its own first-level cache; the target cluster is the cluster where any streaming multiprocessor is located;

[0080] A search request broadcast module 12, configured to broadcast a first search request generated based on the data request address to other streaming multiprocessors in the target cluster when the target prediction unit predicts that there is shared data corresponding to the data request address in the target cluster, so that the other streaming multiprocessors can determine whether the shared data corresponding to the data request address is found from their own first-level cache, and send the determination result to the target arbitration unit corresponding to the target cluster;

[0081] The shared data sending module 13 is used to determine the target streaming multiprocessor from the streaming multiprocessors that send the target judgment result through the target arbitration unit, and send a permission signal to the target streaming multiprocessor so that the target streaming multiprocessor sends the shared data to any of the streaming multiprocessors based on the permission signal; the target judgment result is a judgment result that characterizes the finding of the shared data.

[0082] It can be seen that the present application divides several streaming multiprocessors into multiple clusters, and when any streaming multiprocessor fails to find the data corresponding to the data request address from its own first-level cache, through the prediction unit and the arbitration unit, it can query other streaming multiprocessors in the cluster where any streaming multiprocessor is located, and obtain the shared data corresponding to the data request address from other streaming multiprocessors, thereby realizing data sharing between streaming multiprocessors in the same cluster, which can reduce time consumption compared to the second-level cache and device memory, thereby improving data processing performance and reducing energy consumption; and, the present application only needs to query other streaming multiprocessors in the cluster where any streaming multiprocessor is located, thereby avoiding the problem of excessive energy consumption caused by querying all streaming multiprocessors in a general-purpose graphics processor.

[0083] In some specific embodiments, the data request sending module 11 includes:

[0084] A request sending unit is used to send an address request signal of a request sending address to the target prediction unit to the target arbitration unit through any of the streaming multiprocessors, and after receiving an address enable signal sent by the target arbitration unit based on the address request signal, use a shared address bus to send a data request generated based on the data request address to the target prediction unit.

[0085] In some specific embodiments, the shared data sending module 13 includes:

[0086] A queue updating unit, configured to determine, through the target arbitration unit, a target streaming multiprocessor closest to the head of the queue from the to-be-determined streaming multiprocessors based on the position of the to-be-determined streaming multiprocessor in the current queue, and move the position of the target streaming multiprocessor in the current queue to the end of the queue to obtain a new current queue;

[0087] The to-be-determined streaming multiprocessor is a streaming multiprocessor that sends a target determination result; and the current queue is used to store all streaming multiprocessors in the target cluster.

[0088] In some specific embodiments, the target prediction unit includes an input cache, a prediction buffer, and an output cache;

[0089] Correspondingly, the search request broadcast module 12 includes:

[0090] A prediction result determination unit, configured to store the data request address in the input buffer through the target prediction unit, and determine a prediction result based on a current prediction value corresponding to the data request address stored in the prediction buffer; wherein the prediction result is used to indicate whether there is shared data corresponding to the data request address in the target cluster;

[0091] A request broadcast unit is used to generate a first search request based on the data request address stored in the output cache through the target prediction unit if the prediction result indicates that the shared data exists in the target cluster, and broadcast the first search request to other streaming multiprocessors in the target cluster; the data request address stored in the output cache is the address that the target prediction unit stores the data request address read from the input cache to the output cache.

[0092] In some specific embodiments, the predicted value is an integer not less than the predicted lower limit value and not greater than the predicted upper limit value, the difference between the predicted lower limit value and the predicted upper limit value is an odd number greater than 1, and the predicted value corresponding to the prediction result representing the existence of the shared data in the target cluster is greater than the predicted value corresponding to the prediction result representing the absence of the shared data in the target cluster;

[0093] Accordingly, the data sharing device further includes:

[0094] a consistency comparison unit, configured to, when the target arbitration unit determines an actual result based on the judgment result and sends the actual result to the update unit in the target prediction unit, perform consistency comparison between the actual result and the prediction result through the update unit to obtain a comparison result; the actual result is used to characterize whether the shared data exists in the target cluster;

[0095] A first updating unit, configured to, if the comparison result indicates that the actual result is consistent with the predicted result and the current predicted value is less than the prediction upper limit, perform a self-increment operation on the current predicted value through the updating unit, and update the prediction buffer based on the new current predicted value;

[0096] The second updating unit is used to, if the comparison result indicates that the actual result and the predicted result are inconsistent, and the current predicted value is greater than the prediction lower limit, decrement the current predicted value by one through the updating unit, and update the prediction buffer based on the new current predicted value.

[0097] In some specific embodiments, the data sharing device further includes:

[0098] a first data search unit, configured to generate a second search request based on the data request address stored in the output cache through the target prediction unit if the prediction result indicates that the shared data does not exist in the target cluster, and search for the shared data corresponding to the data request address from a secondary cache based on the second search request; the secondary cache is located inside the general graphics processor and outside the plurality of streaming multiprocessors;

[0099] A third update unit is used to send the shared data in the secondary cache to the primary cache in any of the streaming multiprocessors through the target prediction unit if the shared data is found in the secondary cache, and to perform a self-increment operation on the current prediction value based on the update unit, and to update the prediction buffer based on the new current prediction value.

[0100] In some specific embodiments, the data sharing device further includes:

[0101] a second data search unit, configured to generate a third search request based on the data request address stored in the output cache through the target prediction unit if the shared data is not found in the secondary cache, and search for the shared data corresponding to the data request address from a device memory based on the third search request; the device memory is located on the device board where the general-purpose graphics processor is located and is located outside the general-purpose graphics processor;

[0102] A fourth update unit is used for sending the shared data in the device memory to the first-level cache in any streaming multiprocessor through the target prediction unit via the second-level cache if the shared data is found in the device memory, and for adding one to the current prediction value based on the update unit, and for updating the prediction buffer based on the new current prediction value.

[0103] Furthermore, the present application also discloses an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0104] Figure 6 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the data sharing method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0105] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0106] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0107] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, and may be Windows Server, Netware, Unix, Linux, etc. In addition to computer programs that can be used to complete the data sharing method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks.

[0108] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed data sharing method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.

[0109] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0110] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0111] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0112] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0113] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A data sharing method, characterized in that: Applied to a general-purpose graphics processor, the general-purpose graphics processor includes a plurality of streaming multiprocessors, the plurality of streaming multiprocessors are divided into a plurality of clusters, each cluster corresponding to an arbitration unit and a prediction unit; wherein the method comprises: If any streaming multiprocessor fails to find data corresponding to the data request address from its own first-level cache, a data request generated based on the data request address is sent to a target prediction unit corresponding to a target cluster; the target cluster is the cluster where any streaming multiprocessor is located; When the target prediction unit predicts that there is shared data corresponding to the data request address in the target cluster, a first search request generated based on the data request address is broadcast to other streaming multiprocessors in the target cluster, so that the other streaming multiprocessors determine whether the shared data corresponding to the data request address is found from their own first-level cache, and send the determination result to the target arbitration unit corresponding to the target cluster; The target arbitration unit determines a target streaming multiprocessor from the streaming multiprocessors that send target judgment results, and sends a send permission signal to the target streaming multiprocessor, so that the target streaming multiprocessor sends the shared data to any of the streaming multiprocessors based on the send permission signal; the target judgment result is a judgment result that characterizes that the shared data has been found.

2. The data sharing method according to claim 1, characterized in that: The step of sending the data request generated based on the data request address to a target prediction unit corresponding to the target cluster includes: An address request signal requesting a sending address to the target prediction unit is sent to the target arbitration unit through any of the streaming multiprocessors, and after receiving an address enable signal sent by the target arbitration unit based on the address request signal, a data request generated based on the data request address is sent to the target prediction unit using a shared address bus.

3. The data sharing method according to claim 1, characterized in that: The step of determining the target streaming multiprocessor from the streaming multiprocessors that send the target judgment result by the target arbitration unit includes: Determine, by the target arbitration unit, a target streaming multiprocessor closest to the head of the queue from the streaming multiprocessors to be determined based on the position of the streaming multiprocessor to be determined in the current queue, and move the position of the target streaming multiprocessor in the current queue to the end of the queue to obtain a new current queue; The to-be-determined streaming multiprocessor is a streaming multiprocessor that sends a target determination result; and the current queue is used to store all streaming multiprocessors in the target cluster.

4. The data sharing method according to any one of claims 1 to 3, characterized in that: The target prediction unit includes an input buffer, a prediction buffer and an output buffer; Correspondingly, when the target prediction unit predicts that there is shared data corresponding to the data request address in the target cluster, broadcasting a first search request generated based on the data request address to other streaming multiprocessors in the target cluster includes: The target prediction unit stores the data request address in the input buffer, and determines a prediction result based on a current prediction value corresponding to the data request address stored in the prediction buffer; wherein the prediction result is used to indicate whether there is shared data corresponding to the data request address in the target cluster; If the prediction result indicates that the shared data exists in the target cluster, a first search request is generated by the target prediction unit based on the data request address stored in the output cache, and the first search request is broadcast to other streaming multiprocessors in the target cluster; the data request address stored in the output cache is the address that the target prediction unit will store in the output cache after reading the data request address from the input cache.

5. The data sharing method according to claim 4, characterized in that: The predicted value is an integer not less than the predicted lower limit value and not greater than the predicted upper limit value, the difference between the predicted lower limit value and the predicted upper limit value is an odd number greater than 1, and the predicted value corresponding to the prediction result representing that the shared data exists in the target cluster is greater than the predicted value corresponding to the prediction result representing that the shared data does not exist in the target cluster; Correspondingly, after sending the determination result to the target arbitration unit corresponding to the target cluster, the method further includes: When the target arbitration unit determines an actual result based on the judgment result and sends the actual result to the update unit in the target prediction unit, the update unit compares the actual result with the prediction result to obtain a comparison result; the actual result is used to indicate whether the shared data exists in the target cluster; If the comparison result indicates that the actual result is consistent with the predicted result, and the current predicted value is less than the predicted upper limit, the current predicted value is incremented by one by the updating unit, and the prediction buffer is updated based on the new current predicted value; If the comparison result indicates that the actual result and the predicted result are inconsistent, and the current predicted value is greater than the predicted lower limit, the current predicted value is decremented by one by the updating unit, and the prediction buffer is updated based on the new current predicted value.

6. The data sharing method according to claim 5, characterized in that: After determining the prediction result based on the current prediction value corresponding to the data request address stored in the prediction buffer, the method further includes: If the prediction result indicates that the shared data does not exist in the target cluster, a second search request is generated by the target prediction unit based on the data request address stored in the output cache, and the shared data corresponding to the data request address is searched from a secondary cache based on the second search request; the secondary cache is located inside the general graphics processor and outside the plurality of streaming multiprocessors; If the shared data is found from the secondary cache, the shared data in the secondary cache is sent to the primary cache in any of the streaming multiprocessors through the target prediction unit, and the current prediction value is incremented by one based on the update unit, and the prediction buffer is updated based on the new current prediction value.

7. The data sharing method according to claim 6, characterized in that: After searching the shared data corresponding to the data request address from the secondary cache based on the second search request, the method further includes: If the shared data is not found in the secondary cache, a third search request is generated by the target prediction unit based on the data request address stored in the output cache, and the shared data corresponding to the data request address is searched from a device memory based on the third search request; the device memory is located on the device board where the general-purpose graphics processor is located and is located outside the general-purpose graphics processor; If the shared data is found in the device memory, the shared data in the device memory is sent to the first-level cache in any streaming multiprocessor via the second-level cache through the target prediction unit, and the current prediction value is incremented by one based on the update unit, and the prediction buffer is updated based on the new current prediction value.

8. A data sharing device, characterized in that: Applied to a general-purpose graphics processor, the general-purpose graphics processor includes a plurality of streaming multiprocessors, the plurality of streaming multiprocessors are divided into a plurality of clusters, each cluster corresponding to an arbitration unit and a prediction unit; wherein the device includes: A data request sending module, configured to send a data request generated based on the data request address to a target prediction unit corresponding to a target cluster if any streaming multiprocessor fails to find data corresponding to the data request address from its own first-level cache; the target cluster is the cluster where any streaming multiprocessor is located; a search request broadcast module, configured to broadcast a first search request generated based on the data request address to other streaming multiprocessors in the target cluster when the target prediction unit predicts that there is shared data corresponding to the data request address in the target cluster, so that the other streaming multiprocessors can determine whether the shared data corresponding to the data request address is found in their own first-level cache, and send the determination result to the target arbitration unit corresponding to the target cluster; A shared data sending module is used to determine a target streaming multiprocessor from the streaming multiprocessors that send target judgment results through the target arbitration unit, and send a permission to send signal to the target streaming multiprocessor, so that the target streaming multiprocessor sends the shared data to any of the streaming multiprocessors based on the permission to send signal; the target judgment result is a judgment result that characterizes the finding of the shared data.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the data sharing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the data sharing method according to any one of claims 1 to 7.