Main device, cache, integrated circuit system, electronic component and device, pre-fetching method

By carrying specific indication information in the write request and triggering the residency and prefetching status of the cache line, the problem of data prefetching time point prediction in heterogeneous calculations is solved, and more efficient data prefetching and performance improvement is achieved.

CN117971725BActive Publication Date: 2024-11-01BEIJING XIANGDIXIAN COMPUTING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410370813.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-29
Publication Date
2024-11-01
Estimated Expiration
2044-03-29

AI Technical Summary

Technical Problem

The existing data prefetching methods cannot effectively predict the data usage time point in heterogeneous computing scenarios, resulting in software prefetching being unable to be adopted, and hardware prefetching is limited to the memory mode of the memory that cannot fully improve performance.

Method used

By carrying cached resident indication information and memory fetch prefetch indication information in a write request, the resident and prefetch status of the cache line is triggered, ensuring that the data is not moved out when not read and pre-pre-loaded from memory when needed Get data, combined with software and hardware prompt mechanisms, improve the applicability and performance of cache prefetching.

Benefits of technology

It realizes a wider applicability and performance improvement in data prefetching in heterogeneous computing scenarios, ensuring the continuity and efficiency of data flows, and avoiding the problem of data flow outage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117971725B_ABST
    Figure CN117971725B_ABST
Patent Text Reader

Abstract

The present disclosure provides a master device, a cache, an integrated circuit system, an electronic component and device, and a prefetch method to improve data prefetch performance. The prefetch method is as follows: in response to cache residency indication information carried in a write request of a data stream, the cache residency state of a first target cache line is set to be valid, and the first target cache line at least includes a cache line for temporarily storing the starting data segment of the data stream; in response to memory access prefetch indication information carried in the write request, the memory access prefetch state of the first target cache line is set to be valid; during the effective period of the cache residency state, the data of the data stream temporarily stored in the first target cache line is not removed if it is not read; in response to the data of the data stream temporarily stored in the first target cache line being read and the memory access prefetch state being valid, the data of the data stream prefetched from the memory is stored in the corresponding first target cache line.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of data pre-fetching, and in particular to a host device, a cache, an integrated circuit system, an electronic component, an electronic device and a pre-fetching method. Background Art

[0002] There is a large delay between the master device and the memory, and there is a certain waiting time each time data is read from the memory. When the master device executes an instruction, it usually reads the data from the memory and stores it in the cache for subsequent reuse to improve performance. The cache is a high-speed and small-capacity memory used to temporarily store the most frequently accessed data to provide lower memory access latency and higher memory access bandwidth.

[0003] The purpose of data prefetching is to load the data that may be accessed into the cache in advance to reduce the memory access latency. By preloading the data that will be used, the master device can directly obtain it from the cache when needed without waiting for the latency of memory access.

[0004] Data prefetching can be implemented in both hardware and software. Hardware prefetching is performed automatically by the master device or cache control module. It can predict the data to be accessed based on the program's historical memory access pattern and load it into the cache. Hardware prefetching is usually based on spatial and temporal predictions, and loads data in advance through continuous access patterns and temporal access patterns. Software prefetching is a prefetch instruction manually inserted by the programmer or prefetch code automatically generated by the compiler. Software prefetching can load data that may be accessed into the cache in a targeted manner based on the characteristics of the program and the memory access pattern. Software prefetching can insert prefetch instructions before the start of a loop or inside a loop to load data that may be accessed in the loop into the cache in advance.

[0005] Existing prefetching methods, whether hardware prefetching or software prefetching, all have prerequisites. Hardware prefetching requires that the memory access operation conforms to several preset hardware-recognizable patterns, so that the hardware can spontaneously perform prefetching operations according to the predicted patterns during the dynamic operation of the program. Software prefetching requires that the program can accurately predict the time point when the data will be used in a static state, so as to insert the prefetch operation at the appropriate instruction position before that.

[0006] In scenarios where heterogeneous computing is widely used, data may be operated by multiple masters with different instruction streams in turn, and the operation time of each master cannot be determined in advance. In this scenario, software prefetching cannot be used because it cannot predict the time when each master uses the data; hardware prefetching not only has the problem of memory access mode limitations, but also cannot prefetch the beginning of the data stream, and cannot fully achieve the purpose of performance improvement. Summary of the invention

[0007] The purpose of the present disclosure is to provide a host device, a cache, an integrated circuit system, an electronic component, an electronic device and a pre-fetching method to improve data pre-fetching performance.

[0008] According to one aspect of the present disclosure, a master device is provided, the master device being arranged in an integrated circuit system and being configured to: send a write request of a data stream, at least one of the write requests carrying cache residency indication information and memory access pre-fetch indication information;

[0009] The cache residency indication information is used to trigger that the cache residency state of the first target cache line is valid; the cache residency state is valid indicating that the data of the data stream temporarily stored in the first target cache line will not be removed without being read, and the first target cache line at least includes a cache line temporarily storing the starting data segment of the data stream;

[0010] The memory prefetch indication information is used to trigger that the memory prefetch state of the first target cache line is valid; the memory prefetch state of the first target cache line is valid, indicating that when the data of the data stream temporarily stored in the first target cache line is read, the memory prefetch corresponding to the first target cache line is triggered.

[0011] Optionally, the memory prefetch indication information is further used to trigger that the memory prefetch state of the second target cache line is valid, and the memory prefetch state of the second target cache line is valid, indicating that the memory prefetch corresponding to the second target cache line is triggered when a trigger condition is met; when the data of the data stream is temporarily stored in the second target cache line, the trigger condition includes: the data of the data stream temporarily stored in the second target cache line is read; when the data of the data stream is not temporarily stored in the second target cache line, the trigger condition includes: the data of the data stream temporarily stored in the cache is read;

[0012] The second target cache line includes MN cache lines storing continuous memory address mappings of the data stream, where M is the number of groups of the cache module, and N is the number of first target cache lines. The continuous memory addresses include the memory address corresponding to the starting data segment.

[0013] Optionally, the write request also carries a prefetch span, and the prefetch span is used to indicate a memory address for memory access prefetch.

[0014] According to another aspect of the present disclosure, a cache is provided, the cache comprising a cache control module and a cache module;

[0015] The cache control module is configured to: in response to cache residency indication information carried in a write request of a data stream, set a cache residency state of a first target cache line to be valid, wherein the first target cache line at least includes a cache line temporarily storing a starting data segment of the data stream; in response to memory prefetch indication information carried in the write request, set a memory prefetch state of the first target cache line to be valid; during the validity period of the cache residency state, the data of the data stream temporarily stored in the first target cache line will not be removed if it is not read;

[0016] The cache control module is further configured to: in response to the data of the data stream temporarily stored in the first target cache line being read and the memory access prefetch state being valid, prefetch the data of the data stream from the memory and store it into the corresponding first target cache line.

[0017] Optionally, the cache control module is further configured to: in response to data of the data stream temporarily stored in the first target cache line being read, switch the state of the first target cache line to invalid.

[0018] Optionally, the cache control module is further configured to:

[0019] In response to the memory access prefetch indication information carried in the write request, setting the memory access prefetch state of the second target cache line to valid;

[0020] In a case where the data of the data stream is not temporarily stored in the second target cache line, in response to the data of the data stream temporarily stored in the cache being read and the memory access prefetch state being valid, prefetching the data of the data stream from the memory and storing it in the corresponding second target cache line; in a case where the data of the data stream is temporarily stored in the second target cache line, in response to the data of the data stream temporarily stored in the second target cache line being read and the memory access prefetch state being valid, prefetching the data of the data stream from the memory and storing it in the corresponding second target cache line;

[0021] The second target cache line includes MN cache lines storing continuous memory address mappings of the data stream, where M is the number of groups of the cache module, and N is the number of first target cache lines. The continuous memory addresses include the memory address corresponding to the starting data segment.

[0022] Optionally, the cache control module is configured to: when the data of the data stream is not temporarily stored in the second target cache line in the i+j group of the cache module, in response to the data of the data stream temporarily stored in the cache line in the i-th group of the cache module being read and the memory access prefetch state of the second target cache line in the i+j-th group being valid, prefetch the data of the data stream from the memory and store it in the corresponding second target cache line in the i+j-th group.

[0023] Optionally, the cache control module is configured to determine a memory access prefetch address according to a prefetch span carried in the write request.

[0024] Optionally, the cache control module is further configured to: store the prefetch span carried in the write request into a designated register.

[0025] Optionally, the cache control module is further configured to: in response to the number of consecutive prefetches corresponding to the first target cache line reaching a specified number of prefetches, invalidate the cache residency state of the first target cache line and invalidate the memory access prefetch state of the first target cache line.

[0026] According to another aspect of the present disclosure, an integrated circuit system is provided, comprising the master device described in any one of the above embodiments, and the buffer described in any one of the above embodiments.

[0027] According to another aspect of the present disclosure, an electronic component is provided, comprising the integrated circuit system described in the above embodiment.

[0028] According to another aspect of the present disclosure, an electronic device is provided, comprising the electronic component described in any one of the above embodiments.

[0029] According to another aspect of the present disclosure, a pre-fetching method is provided, the method comprising:

[0030] In response to cache residency indication information carried in a write request of a data stream, a cache residency state of a first target cache line is set to be valid, wherein the first target cache line at least includes a cache line temporarily storing a starting data segment of the data stream; in response to memory prefetch indication information carried in the write request, a memory prefetch state of the first target cache line is set to be valid; during the validity period of the cache residency state, the data of the data stream temporarily stored in the first target cache line is not removed if it is not read;

[0031] In response to the data of the data stream temporarily stored in the first target cache line being read and the memory access prefetch state being valid, the data of the data stream is prefetched from the memory and stored in the corresponding first target cache line. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of the structure of a buffer provided by an embodiment of the present disclosure;

[0033] Figure 2 A schematic diagram of the structure of an integrated circuit system provided by one embodiment of the present disclosure. DETAILED DESCRIPTION

[0034] Before introducing the embodiments of the present disclosure, it should be noted that:

[0035] Some embodiments of the present disclosure are described as processing flows. Although the various operation steps of the flow may be given sequential step numbers, the operation steps therein may be implemented in parallel, concurrently or simultaneously.

[0036] In the embodiments of the present disclosure, the terms "first", "second", etc. may be used to describe various features, but these features should not be limited by these terms. These terms are used only to distinguish one feature from another.

[0037] The term “and / or” may be used in embodiments of the present disclosure. “And / or” includes any and all combinations of one or more of the associated features listed.

[0038] It should be understood that when describing the connection or communication relationship between two components, unless it is explicitly stated that the two components are directly connected or directly communicating, the connection or communication between the two components can be understood as direct connection or communication, or as indirect connection or communication through an intermediate component.

[0039] In order to make the technical solutions and advantages of the embodiments of the present disclosure more clearly understood, the exemplary embodiments of the present disclosure are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0040] Due to the limitations of the existing prefetching mechanism, the disclosed embodiment provides a prefetching mechanism that combines software and hardware. The software prompts the hardware to operate, and then the hardware performs data retention and data prefetching, so as to improve the applicability of cache prefetching in a wider range and improve performance to a greater extent.

[0041] An embodiment of the present disclosure provides an integrated circuit system, which includes a cache and at least one master device.

[0042] In the disclosed embodiment, the master device refers to a device that can send read and write requests.

[0043] As a data provider, the master device provided by the embodiment of the present disclosure is configured to: send a write request for a data stream, at least one write request carries cache residency indication information and memory prefetch indication information; the cache residency indication information is used to trigger that the cache residency state of the first target cache line is valid; the cache residency state is valid, indicating that the data of the data stream temporarily stored in the first target cache line will not be removed without being read, and the first target cache line at least includes a cache line for storing the starting data segment of the data stream; the memory prefetch indication information is used to trigger that the memory prefetch state of the first target cache line is valid; the memory prefetch state of the first target cache line is valid, indicating that when the data of the data stream temporarily stored in the first target cache line is read, the memory prefetch corresponding to the first target cache line is triggered.

[0044] In the disclosed embodiment, the memory writing of the data stream may be completed through one write request, or may be completed through multiple write requests.

[0045] If the memory writing of the data stream is completed through one write request, the write request needs to carry cache residency indication information and memory access pre-fetch indication information. If the memory writing of the data stream is completed through multiple write requests, at least the write request corresponding to the above-mentioned starting data segment needs to carry cache residency indication information and memory access pre-fetch indication information.

[0046] In the embodiment of the present disclosure, the length of the starting data segment is not limited, and the length of the starting data segment is defined in the application according to actual conditions and requirements.

[0047] If the number of first target cache lines is small, the prefetch result may not hit the first target cache line during the prefetch process. In order to ensure that the main device as the data user reads the data stream continuously, optionally, the memory access prefetch indication information is also used to trigger the memory access prefetch state of the second target cache line to be valid. The memory access prefetch state of the second target cache line is valid, which means that when the trigger condition is met, the memory access prefetch corresponding to the second target cache line is triggered; when the data of the data stream is temporarily stored in the second target cache line, the trigger condition includes: the data of the data stream temporarily stored in the second target cache line is read; when the data of the data stream is not temporarily stored in the second target cache line, the trigger condition includes: the data of the data stream temporarily stored in the cache is read; the second target cache line includes MN cache lines for storing continuous memory address mapping of the data stream, M is the number of groups of the cache module, N is the number of first target cache lines, and the continuous memory address includes the memory address corresponding to the starting data segment.

[0048] More specifically, if the memory writing of the data stream is completed through a write request, the memory prefetch indication information carried in the write request is used to trigger the memory prefetch status of the first target cache line and the second target cache line to be valid. If the memory writing of the data stream is completed through multiple write requests, the memory prefetch indication information that triggers the memory prefetch status of the second target cache line to be valid can be carried in the write request corresponding to the second target cache line.

[0049] In order to ensure that the master device, which is the data consumer, does not stop when reading the data stream, the write request may also carry a prefetch span, which is used to indicate the memory address for prefetching memory access.

[0050] The buffer structure provided in the embodiment of the present disclosure is as follows Figure 1 As shown, it includes a cache control module and a cache module;

[0051] The cache control module is configured to: in response to cache residency indication information carried in a write request of a data stream, set the cache residency state of a first target cache line in the cache module to be valid, wherein the first target cache line at least includes a cache line temporarily storing a starting data segment of the data stream; in response to memory prefetch indication information carried in the write request, set the memory prefetch state of the first target cache line to be valid; during the validity period of the cache residency state, the data of the data stream temporarily stored in the first target cache line will not be removed if it is not read;

[0052] The cache control module is further configured to: in response to the data of the data stream temporarily stored in the first target cache line being read and the memory access prefetch state being valid, prefetch the data of the data stream from the memory and store it into the corresponding first target cache line.

[0053] Optionally, the cache control module is further configured to: in response to data of the data stream temporarily stored in the first target cache line being read, switch the state of the first target cache line to invalid.

[0054] Optionally, the cache control module is further configured to:

[0055] In response to the memory access prefetch indication information carried in the write request, setting the memory access prefetch state of the second target cache line to valid;

[0056] In a case where the data of the data stream is not temporarily stored in the second target cache line, in response to the data of the data stream temporarily stored in the cache being read and the memory access prefetch state being valid, prefetching the data of the data stream from the memory and storing it in the corresponding second target cache line; in a case where the data of the data stream is temporarily stored in the second target cache line, in response to the data of the data stream temporarily stored in the second target cache line being read and the memory access prefetch state being valid, prefetching the data of the data stream from the memory and storing it in the corresponding second target cache line;

[0057] The second target cache line includes MN cache lines storing continuous memory address mappings of the data stream, where M is the number of groups of the cache module, and N is the number of first target cache lines. The continuous memory addresses include the memory address corresponding to the starting data segment.

[0058] Optionally, the cache control module is configured to: when the data of the data stream is not temporarily stored in the second target cache line in the i+j group of the cache module, in response to the data of the data stream temporarily stored in the cache line in the i-th group of the cache module being read and the memory access prefetch state of the second target cache line in the i+j-th group being valid, prefetch the data of the data stream from the memory and store it in the corresponding second target cache line in the i+j-th group.

[0059] That is, data pre-fetching is performed on the second target cache line j groups in advance to ensure that data is continuously streamed. The embodiment of the present disclosure does not limit the value of j and can be flexibly configured according to actual conditions.

[0060] Optionally, the cache control module is configured to determine a memory access prefetch address according to a prefetch span carried in the write request.

[0061] Optionally, the cache control module is further configured to: store the prefetch span carried in the write request into a designated register.

[0062] Optionally, the cache control module is further configured to: in response to the number of consecutive prefetches corresponding to the first target cache line reaching a specified number of prefetches, invalidate the cache residency state of the first target cache line and invalidate the memory access prefetch state of the first target cache line.

[0063] Below Figure 2 Taking the heterogeneous multi-master system shown as an example, the pre-fetching method provided by the embodiment of the present disclosure is described.

[0064] like Figure 2As shown in the figure, the heterogeneous multi-master system includes at least master1 and master2, and each master runs in its own independent program flow. Among them, master1 writes a data stream to the memory under the control of the driver, and the data stream is a sequential access data stream. Before writing the data stream to the memory, it is first cached in the system-level cache (SLC), and the mapping relationship between SLC and memory is a group-connected mapping. At a subsequent time point, master2 reads the above data stream under the control of the firmware.

[0065] In this embodiment, multiple write requests are required to write the data stream into the memory, and master1 carries pre-fetch related indication information through the write request. The pre-fetch related indication information includes cache residency indication information, memory access pre-fetch indication information and memory access span. The definition of these memory access information can refer to the description of the above embodiment and will not be repeated here. Due to the size of the cache space, it is impossible to store all the data of the data stream in the cache module. Even if the size of the cache space allows all the data of the data stream to reside in the cache module, it is necessary to reserve enough cache space to meet the cache requirements of other memory access tasks. For this reason, the pre-fetch related indication information is only carried in the write request corresponding to the starting data segment of the data stream.

[0066] In the first scenario, the first X write requests carry cache residency indication information, memory access prefetch indication information, and memory access span. The first X write requests correspond to M cache lines, where M is the number of cache line groups (sets). For example, the cache lines of SLC are divided into 4 groups, and the span of the memory access address carried in a write request is two adjacent memory lines, which corresponds to two cache lines belonging to two adjacent groups (for example, way0 in set0, and way1 in sat1). Then, the cache residency indication information, memory access prefetch indication information, and memory access span are carried in the first two write requests.

[0067] In the second scenario, the first X write requests carry cache residency indication information, memory access prefetch indication information, and memory access span, and the next Y write requests carry memory access prefetch indication information and memory access span. The first X write requests correspond to N cache lines, where N is less than the number of cache line groups M, and the next Y write requests correspond to MN cache lines. For example, the cache lines of SLC are divided into 4 groups, and the span of the memory access address carried in a write request is two adjacent memory lines, which corresponds to two cache lines belonging to two adjacent groups (for example, way0 in set0, and way1 in sat1). Then, the first write request carries cache residency indication information, memory access prefetch indication information, and memory access span, and the second write request carries memory access prefetch indication information and memory access span.

[0068] In this embodiment, the SLC includes a cache control module and a cache module, the cache module includes multiple cache lines, and adopts a set-associated mapping method. Each cache line corresponds to three dedicated registers for prefetch operations: Wait1 register, Prefetch_En register and Prefetch_Stride register.

[0069] Among them, when data is written to a cache line, if the corresponding write request carries cache residency indication information, then the cache control module assigns a value to the corresponding bit in the Wait1 register corresponding to the cache line to indicate that the cache residency status of the cache line is valid. In this case, the cache line does not participate in the cache replacement strategy, will not be replaced out of the cache, and will directly become invalid after waiting for a read operation to ensure that when the data user performs a read operation on the data, the data stream can be read with a cache hit. At the same time, the cache control module assigns a value to the corresponding bit in the Prefetch_En register corresponding to the cache line to indicate that the prefetch status of the cache line is valid, so as to allow the hardware to generate a new prefetch operation for the data when the cache line data is invalid. The Prefetch_Stride register is also set in conjunction with the Prefetch_En register to determine the memory access address for subsequent prefetch operations.

[0070] In the disclosed embodiment, the data returned by the prefetch enters the cache line, and the cache residency state continues to be valid. The number of settings of Prefetch_En and Prefetch_Stride is determined by the hardware prefetch design of the cache, that is, if the hardware prefetch needs to predict the mode through several memory access histories of a specific Stride, then Prefetch_En can be configured with several valid times.

[0071] Based on the first scenario above, assume that the first two write requests based on the data stream hit 4 cache lines, namely way0 of set0, way1 of set1, way0 of set2, and way0 of set3. Then, while temporarily storing the data in the data stream in these 4 cache lines, assign values ​​to the exclusive registers of these 4 cache lines based on the cache residency indication information, memory access prefetch indication information, and memory access span carried in the first two write request commands. Correspondingly, before master2 reads the data temporarily stored in these 4 cache lines, the data temporarily stored in these 4 cache lines will not be replaced out of the cache lines. When master2 initiates a read request to read the data stream sequentially, if the memory address corresponding to read request 0 is memory line d0, d0 is mapped to set0, and since wait1 is valid, it can hit way0 of set0, then the cache line is immediately invalidated, and the cache control module prefetches the data stream from memory line d4 according to the preset prefetch span and stores it in the cache line. Similarly, the memory address corresponding to the read request 1 of the sequential data stream is the memory row d1, which is mapped to set1. Since wait1 is valid, way1 of set1 can be hit, and the cache row is immediately invalidated, and the cache control module pre-fetches the data of the data stream from memory row d5 according to the preset pre-fetch span and stores it in the cache row; the memory address corresponding to the read request 2 of the sequential data stream is the memory row d2, which is mapped to set2. Since wait1 is valid, way0 of set2 can be hit, and the cache row is immediately invalidated, and the cache control module pre-fetches the data of the data stream from memory row d6 according to the preset pre-fetch span and stores it in the cache row; the memory address corresponding to the read request 3 of the sequential data stream is the memory row d3, which is mapped to set3. Since wait1 is valid, way0 of set3 can be hit, and the cache row is immediately invalidated, and the cache control module pre-fetches the data of the data stream from memory row d7 according to the preset pre-fetch span and stores it in the cache row. And so on, until master2 finishes reading the above data stream. Among them, d0-d7 is a continuous address space.

[0072] Based on the second scenario above, assume that the first write request based on the data stream hits two cache lines, namely way0 of set0 and way1 of set1, and the second write request based on the data stream hits two cache lines, namely way0 of set2 and way0 of set3. Then, while temporarily storing the data of the data stream in the first two cache lines, the exclusive registers of these two cache lines are assigned based on the cache residency indication information, memory access prefetch indication information, and memory access span carried in the first two write request commands. While temporarily storing the data of the data stream in the second two cache lines, the exclusive registers of these two cache lines are assigned based on the memory access prefetch indication information and memory access span carried in the second two write request commands. Accordingly, before master2 reads the data temporarily stored in the first two cache lines, the data temporarily stored in these two cache lines will not be replaced out of the cache lines. When master2 initiates a read request to read the data stream sequentially, if the memory address corresponding to read request 0 is memory line d0, d0 is mapped to set0, and since wait1 is valid, it can hit way0 of set0, then the cache line is immediately invalidated, and the cache control module pre-fetches the data stream data from memory line d4 according to the preset pre-fetch span and stores it in the cache line. Similarly, the memory address corresponding to read request 1 of the sequential data stream is memory line d1, d1 is mapped to set1, and since wait1 is valid, it can hit way1 of set1, then the cache line is immediately invalidated, and the cache control module pre-fetches the data stream data from memory line d5 according to the preset pre-fetch span and stores it in the cache line. In addition, since the wait1 registers of way0 of set2 and way0 of set3 are not assigned valid values, the data cached in these two cache lines may have been replaced out of the cache line before master2 reads the data stream. To avoid data interruption, data can be pre-fetched in advance, that is, when way0 of set0 is read, the data of the data stream is pre-fetched from memory row d6 according to the preset pre-fetch span and stored in the cache line; when way1 of set1 is read, the data of the data stream is pre-fetched from memory row d7 according to the preset pre-fetch span and stored in the cache line.

[0073] The solution provided by the embodiment of the present disclosure takes into account the advantages of both hardware prefetching and software prefetching. It is a hybrid prefetching design with software hint and hardware execution. The software provides prefetch hint and cooperates with the Wait1 Bit (invalidated after reading once). It can achieve good performance optimization effect.

[0074] The integrated circuit system provided by the embodiments of the present disclosure may be, but is not limited to, a SOC (System on Chip) chip, an ASIC chip, and the like.

[0075] Based on the same inventive concept, the embodiment of the present disclosure also provides an electronic component, which includes the integrated circuit system described in any of the above embodiments. In some usage scenarios, the product form of the electronic component is a graphics card; in other usage scenarios, the product form of the electronic component is a CPU motherboard.

[0076] Based on the same inventive concept, the disclosed embodiment also provides an electronic device, which includes the above-mentioned electronic components. In some usage scenarios, the product form of the electronic device is a portable electronic device, such as a smart phone, a tablet computer, a VR device, etc.; in some usage scenarios, the product form of the electronic device is a personal computer, a game console, etc.

[0077] Based on the same inventive concept, an embodiment of the present disclosure provides a pre-fetching method, the method comprising:

[0078] In response to cache residency indication information carried in a write request of a data stream, a cache residency state of a first target cache line is set to be valid, wherein the first target cache line at least includes a cache line temporarily storing a starting data segment of the data stream; in response to memory prefetch indication information carried in the write request, a memory prefetch state of the first target cache line is set to be valid; during the validity period of the cache residency state, the data of the data stream temporarily stored in the first target cache line is not removed if it is not read;

[0079] In response to the data of the data stream temporarily stored in the first target cache line being read and the memory access prefetch state being valid, the data of the data stream is prefetched from the memory and stored in the corresponding first target cache line.

[0080] The method provided by the embodiment of the present disclosure is applicable to pre-fetching of a sequentially accessed data stream. Accordingly, for a sequentially accessed data stream, cache residency indication information, pre-fetch indication information, etc. may be carried only in the write request corresponding to the beginning of the data stream, or may be carried in all write requests corresponding to the data stream. After the application layer determines which data in the data stream is written to the cache line, the above-mentioned dedicated register of the cache line needs to be configured.

[0081] The specific implementation process of the pre-fetching method can refer to the description of the above embodiment, which will not be repeated here.

[0082] Although the preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present disclosure.

[0083] Obviously, those skilled in the art can make various changes and modifications to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is also intended to include these modifications and variations.

Claims

1. A master device, provided in an integrated circuit system, wherein the master device is configured as follows: Sending a write request for the data stream, at least one of the write requests carrying cache residency indication information and memory access pre-fetch indication information; The cache residency indication information is used to trigger that the cache residency state of the first target cache line is valid; the cache residency state is valid indicating that the data of the data stream temporarily stored in the first target cache line will not be removed without being read, and the first target cache line at least includes a cache line temporarily storing the starting data segment of the data stream; The memory prefetch indication information is used to trigger that the memory prefetch state of the first target cache line is valid; the memory prefetch state of the first target cache line is valid, indicating that when the data of the data stream temporarily stored in the first target cache line is read, the memory prefetch corresponding to the first target cache line is triggered; The memory prefetch indication information is further used to trigger that the memory prefetch state of the second target cache line is valid, and the memory prefetch state of the second target cache line is valid, indicating that the memory prefetch corresponding to the second target cache line is triggered when the trigger condition is met; In the case where the data of the data stream is temporarily stored in the second target cache line, the trigger condition includes: the data of the data stream temporarily stored in the second target cache line is read; in the case where the data of the data stream is not temporarily stored in the second target cache line, the trigger condition includes: the data of the data stream temporarily stored in the cache is read; The second target cache line includes MN cache lines storing continuous memory address mappings of the data stream, where M is the number of groups of the cache module, and N is the number of first target cache lines. The continuous memory addresses include the memory address corresponding to the starting data segment.

2. According to the master device according to claim 1, the write request also carries a prefetch span, and the prefetch span is used to indicate a memory address for memory access prefetch.

3. A cache, comprising a cache control module and a cache module; The cache control module is configured to: in response to cache residency indication information carried in a write request of a data stream, set the cache residency state of a first target cache line in the cache module to be valid, wherein the first target cache line at least includes a cache line temporarily storing a starting data segment of the data stream; in response to memory prefetch indication information carried in the write request, set the memory prefetch state of the first target cache line to be valid; during the validity period of the cache residency state, the data of the data stream temporarily stored in the first target cache line will not be removed if it is not read; The cache control module is further configured to: in response to the data of the data stream temporarily stored in the first target cache line being read and the memory access prefetch state being valid, prefetch the data of the data stream from the memory and store it into the corresponding first target cache line; The cache control module is further configured to: In response to the memory access prefetch indication information carried in the write request, setting the memory access prefetch state of the second target cache line in the cache module to be valid; In a case where the data of the data stream is not temporarily stored in the second target cache line, in response to the data of the data stream temporarily stored in the cache being read and the memory access prefetch state being valid, prefetching the data of the data stream from the memory and storing it in the corresponding second target cache line; in a case where the data of the data stream is temporarily stored in the second target cache line, in response to the data of the data stream temporarily stored in the second target cache line being read and the memory access prefetch state being valid, prefetching the data of the data stream from the memory and storing it in the corresponding second target cache line; The second target cache line includes MN cache lines storing continuous memory address mappings of the data stream, where M is the number of groups of the cache module, and N is the number of first target cache lines. The continuous memory addresses include the memory address corresponding to the starting data segment. 4 . The cache according to claim 3 , wherein the cache control module is further configured to: in response to data of the data stream temporarily stored in the first target cache line being read, switch the state of the first target cache line to invalid.

5. The cache according to claim 3, wherein the cache control module is configured to: in a case where the data of the data stream is not temporarily stored in the second target cache line in the i+jth group of the cache module, in response to the data of the data stream temporarily stored in the cache line in the i-th group of the cache module being read and the memory access prefetch state of the second target cache line in the i+jth group being valid, prefetch the data of the data stream from the memory and store it in the corresponding second target cache line in the i+jth group. 6 . The cache according to claim 3 , wherein the cache control module is configured to determine a memory access prefetch address according to a prefetch span carried in the write request. 7 . The cache according to claim 6 , wherein the cache control module is further configured to: store the prefetch span carried in the write request into a designated register.

8. According to the cache according to any one of claims 3 to 7, the cache control module is further configured to: in response to the number of consecutive prefetches corresponding to the first target cache line reaching a specified number of prefetches, set the cache residency state of the first target cache line to invalid, and set the memory access prefetch state of the first target cache line to invalid.

9. An integrated circuit system, comprising the master device according to claim 1 or 2 and the buffer according to any one of claims 3 to 8.

10. An electronic component comprising the integrated circuit system according to claim 9.

11. An electronic device comprising the electronic component according to claim 10.

12. A pre-fetching method, comprising: In response to cache residency indication information carried in a write request of a data stream, a cache residency state of a first target cache line is set to be valid, wherein the first target cache line at least includes a cache line temporarily storing a starting data segment of the data stream; in response to memory prefetch indication information carried in the write request, a memory prefetch state of the first target cache line is set to be valid; during the validity period of the cache residency state, the data of the data stream temporarily stored in the first target cache line is not removed if it is not read; In response to the data of the data stream temporarily stored in the first target cache line being read and the memory access prefetch state being valid, prefetching the data of the data stream from the memory and storing it into the corresponding first target cache line; In response to the memory access prefetch indication information carried in the write request, setting the memory access prefetch state of the second target cache line to valid; In a case where the data of the data stream is not temporarily stored in the second target cache line, in response to the data of the data stream temporarily stored in the cache being read and the memory access prefetch state being valid, prefetching the data of the data stream from the memory and storing it in the corresponding second target cache line; in a case where the data of the data stream is temporarily stored in the second target cache line, in response to the data of the data stream temporarily stored in the second target cache line being read and the memory access prefetch state being valid, prefetching the data of the data stream from the memory and storing it in the corresponding second target cache line; The second target cache line includes MN cache lines storing continuous memory address mappings of the data stream, where M is the number of groups of the cache module, and N is the number of first target cache lines. The continuous memory addresses include the memory address corresponding to the starting data segment.