GPU cache access method and device
By controlling the life cycle of the GPU cache and the thread warp scheduling method, the problem of low data scheduling efficiency of the GPU in parallel computing is solved, the GPU storage resource utilization and algorithm adaptability are improved, and the execution progress of the thread warp is optimized.
Patent Information
- Application Number
- CN202410956541.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-07-17
AI Technical Summary
In parallel computing, GPU has low data scheduling efficiency, which leads to the problem of low utilization efficiency of computing units.
By controlling the life cycle of the L1 cache and combining polling and data write-back priority thread warp scheduling methods, we optimize the thread warp progress of polling execution and balance the execution hit rates of different thread warps. Specific methods include: determining the average delay time T1 when reading data from the L1 cache, counting the hardware execution cycles of instructions hitting the cache, recording the number of accesses to the cache line data, marking the inactive state and skipping execution, and prioritizing the execution of thread warps with successful hits. , update the priority instruction cache, and perform address merging and data reading when the cache hit fails.
It improves the GPU's flexibility in storage resource scheduling and cache line data utilization, enhances the GPU's adaptability to different algorithm applications, optimizes the thread warp progress of polling execution, and balances the execution hit rate of the thread warp.
Smart Images

Figure CN118502925B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer GPU communication technology, for example, to a method and device for accessing a GPU cache. Background Art
[0002] In recent years, with the gradual popularization of graphics processing unit (GPU) application technology, the market demand for GPU devices has become closer and closer to that of CPU. Different from the sequential computing of the central processing unit (CPU), GPU focuses on high-performance parallel computing capabilities by weakening complex control flow capabilities and expanding the number of computing units.
[0003] The main idea of GPU design and application is to keep the computing unit in working state as much as possible and reduce the idle computing cycle of the computing core. To this end, various manufacturers have carried out various design optimizations, such as excessively increasing the number of registers, setting the cache of register files, software controlling the GPU's instruction execution waiting cycle, and polling or complex loop algorithms. Thread bundle scheduling execution waiting. However, compared with CPUs, the versatility of GPUs is still limited, and there are a large number of design methods in hardware design that tend to be specific applications such as artificial intelligence (AI) computing and graphics rendering computing. With the continuous evolution of parallel computing algorithms, the problem of low actual utilization efficiency of computing units caused by low data scheduling efficiency of GPUs often occurs.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical elements or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0006] The GPU cache access method provided by the embodiment of the present disclosure includes:
[0007] Based on the process of reading data from L1 cache, determine the average delay time T1 required for data;
[0008] Count the hardware execution cycles of each instruction when it hits the cache;
[0009] Using twice T1 time as the granularity, detect the number of times the same cache row data is accessed during cache read access within the target time period, and record it as the life cycle of the row data;
[0010] When there is a cache hit failure, the current thread is marked as inactive, and the access instruction of the next active thread bundle is directly executed, and the data reading is sent to the storage access management unit; when the polled active thread bundle has no cache access instruction in this cycle, the execution is directly skipped; when the polled active thread bundle is still in the inactive state, the execution is skipped;
[0011] When the data read back by the storage access management unit is written successfully, the cache line data corresponding to the thread warp written is updated to the priority instruction cache;
[0012] The access arbitration unit caches the thread bundle number Wx for the next poll, and jumps to read the thread bundle instruction from the FIFO for execution. At this time, the read thread bundle instruction is a cache hit. After the execution is completed, the corresponding thread bundle is marked as active; after the FIFO is empty, jump to the cached thread bundle Wx and continue polling execution.
[0013] In some embodiments, the method further includes querying all tag tags of the corresponding row data group in the tag unit, and finding a hit if they are the same, and reducing the life cycle of the corresponding row data by one after reading;
[0014] The life cycle and tag mark of the row data are controlled by a write instruction and are synchronously updated when the storage access management unit writes cache.
[0015] In some embodiments, the method further comprises:
[0016] The storage access management unit receives the storage access request with cache hit failure and performs address merging in a conventional mode;
[0017] When there is available row data space in the L1 cache, the merged address and length information is sent to the L2 cache or global storage for data reading through the data reading unit, and the arbitration unit is notified to update the life cycle, tag mark and reserved status mark of the corresponding row data of the marking unit.
[0018] In some embodiments, the method further comprises:
[0019] Wait for the data to return, write the data to the corresponding row of L1 cache, update the state of the corresponding row data of the marking unit to active state, and notify the arbitration unit that the data reading is completed.
[0020] In some embodiments, the L1 cache line data state includes a reserved state R, which is used to indicate that the data is in the process of being read; an active state L, which is used to indicate that there will be a request for data access in the short term; an updateable state V, which is used to indicate that the data reading is completed and can be updated and replaced;
[0021] When the row data is R and L, in a hit miss state, the storage access management unit cannot update the row data at the corresponding position through the data reading unit.
[0022] In some embodiments, the method uses a write-eviction mode to implement cache writing, and the data writing unit receives a write request from the access arbitration unit and caches the write data in the data cache FIFO.
[0023] In some embodiments, the method may further include:
[0024] Detect the row data status in the corresponding row data group in the tag unit, and when there is an available row with V status, randomly remove the data row with V status to L2 cache or global cache;
[0025] After eviction, the data line in the cache is written to the L1 cache, the tag in the tag unit is updated, and the status tag V and life cycle are not updated.
[0026] In some embodiments, the number of memory access instructions cached by the access arbitration unit is the same as the number of active warps that can be cached by a single hardware computing core.
[0027] The GPU cache access device provided by the embodiment of the present disclosure includes:
[0028] A processing module is used to determine an average delay time T1 required for data based on a process of reading data from an L1 cache;
[0029] Statistics module, used to count the hardware execution cycles of each instruction when it hits the cache;
[0030] The detection module is used to detect the number of accesses to the same cache row data during cache read access within the target time period at a granularity of twice T1 time, and record it as the life cycle of the row data;
[0031] The processing module is further used to mark the current thread as inactive when there is a cache hit failure, and directly execute the access instruction of the next active thread bundle, and send the data read to the storage access management unit; when the polled active thread bundle has no cache access instruction in this cycle, directly skip the execution; when the polled active thread bundle is still in an inactive state, skip the execution;
[0032] An update module, used for updating the cache line data corresponding to the thread warp written into the priority instruction cache when the data read back by the storage access management unit is written successfully;
[0033] The processing module is also used to cache the thread bundle number Wx of the next polling based on the access arbitration unit, and jump to read the thread bundle instruction from the FIFO for execution. At this time, the read thread bundle instruction is a cache hit. After the execution is completed, the corresponding thread bundle is marked as active; after the FIFO is empty, jump to the cached thread bundle Wx and continue polling execution.
[0034] The GPU cache access method and device provided by the embodiments of the present disclosure can achieve the following technical effects:
[0035] By controlling the life cycle of cache line data, the flexibility of GPU in scheduling storage resources and the utilization rate of cache line data are improved, and the adaptability of GPU to different algorithm applications is enhanced; through the thread bundle scheduling method that combines polling with data write-back priority, cache hits are executed sequentially, and thread bundles that complete data readback after a hit failure are executed first, the progress of thread bundles executed by polling is optimized, and the execution hit rates of different thread bundles are balanced.
[0036] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
[0038] Figure 1 It is a flowchart of a method for accessing a GPU cache provided by an embodiment of the present disclosure;
[0039] Figure 2 It is a software-controllable L1 cache access control micro-architecture diagram provided by an embodiment of the present disclosure;
[0040] Figure 3 A cache row data state architecture with a set associative structure provided by an embodiment of the present disclosure;
[0041] Figure 4 It is a structural diagram of a GPU cache access device provided by an embodiment of the present disclosure;
[0042] Figure 5 It is a structural diagram of a GPU cache access system provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0043] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0044] The terms "first", "second", etc. in the embodiments of the present disclosure are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so as to describe the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0045] Unless otherwise stated, the term "plurality" means two or more.
[0046] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0047] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0048] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0049] The following describes the GPU cache access method and device provided by the embodiments of the present disclosure in conjunction with the accompanying drawings.
[0050] Figure 1 is a flowchart of a method for accessing a GPU cache provided by an embodiment of the present disclosure, combined with Figure 1 , describes the access method of GPU cache.
[0051] GPU cache access methods can include:
[0052] S01, based on the process of reading data from L1 cache, determine the average delay time T1 required for data;
[0053] S02, count the hardware execution cycles of each instruction when it hits the cache;
[0054] S03, using twice T1 time as the granularity, detect the number of accesses to the same cache row data during cache read access within the target time period, and record it as the life cycle of the row data;
[0055] S04, when there is a cache hit failure, mark the current thread as inactive, and directly execute the access instruction of the next active thread bundle, and send the data read to the storage access management unit; when the polled active thread bundle has no cache access instruction in this cycle, directly skip the execution; when the polled active thread bundle is still in the inactive state, skip the execution;
[0056] S05, when the data read back by the storage access management unit is written successfully, the cache line data corresponding to the thread warp written is updated to the priority instruction cache;
[0057] S06, access the arbitration unit cache to obtain the thread bundle number Wx for the next poll, and jump to read the thread bundle instruction from the first in first out queue (FIFO) for execution. At this time, the read thread bundle instruction is a cache hit. After the execution is completed, the corresponding thread bundle is marked as active. After the FIFO is empty, jump to the cached thread bundle Wx and continue the polling execution.
[0058] In the present disclosure, the life cycle of cache line data is controlled by software, the flexibility of GPU in scheduling storage resources and the utilization rate of cache line data are improved, and the adaptability of GPU to different algorithm applications is enhanced; through a thread bundle scheduling method combining polling with data write-back priority, cache hits are executed sequentially, and thread bundles that complete data reading back after a hit failure are executed preferentially, the progress of thread bundles executed by polling is optimized, and the execution hit rates of different thread bundles are balanced.
[0059] Figure 2 is a software-controllable L1 cache access control micro-architecture diagram provided by an embodiment of the present disclosure, Figure 3 A cache row data state architecture with a set associative structure provided by the embodiment of the present disclosure is combined with Figure 2 and Figure 3 ,right Figure 1 The GPUcache access method is further described in .
[0060] In some embodiments, Figure 1 The method may further include querying all tag tags of the corresponding row data group in the tag unit, finding a hit if they are the same, and reducing the life cycle of the corresponding row data by one after reading;
[0061] The life cycle and tag mark of the row data are controlled by a write instruction and are synchronously updated when the storage access management unit writes cache.
[0062] In some embodiments, Figure 1 The method may further include a storage access management unit receiving a storage access request with a cache hit failure, and performing address merging in a conventional mode;
[0063] When there is available row data space in the L1 cache, the merged address and length information is sent to the L2 cache or global storage for data reading through the data reading unit, and the arbitration unit is notified to update the life cycle, tag mark and reserved status mark of the corresponding row data of the marking unit.
[0064] In some embodiments, Figure 1 The method may further include waiting for data to be returned, writing the data into a corresponding row of the L1 cache, updating a state of the data in the corresponding row of the marking unit to an active state, and notifying the arbitration unit that the data reading is completed.
[0065] In some embodiments, the L1 cache line data state includes a reserved state R, which is used to indicate that the data is in the process of being read; an active state L, which is used to indicate that there will be a request for data access in the short term; an updateable state V, which is used to indicate that the data reading is completed and can be updated and replaced;
[0066] When the row data is R and L, in a hit miss state, the storage access management unit cannot update the row data at the corresponding position through the data reading unit.
[0067] In some embodiments, Figure 1 The method in the present invention adopts a write eviction mode to implement cache write. The data write unit receives a write request from an access arbitration unit and caches the write data in a data cache FIFO.
[0068] In some embodiments, Figure 1 The method may also include:
[0069] Detect the row data status in the corresponding row data group in the tag unit, and when there is an available row with V status, randomly remove the data row with V status to L2 cache or global cache;
[0070] After eviction, the data line in the cache is written to the L1 cache, the tag in the tag unit is updated, and the status tag V and life cycle are not updated.
[0071] In some embodiments, the number of memory access instructions cached by the access arbitration unit is the same as the number of active warps that can be cached by a single hardware computing core.
[0072] In a specific example, the GPU cache access method provided by the embodiment of the present disclosure marks the data life cycle written to the L1 cache from other caches through assembly instruction tags, and records it to the corresponding register when the instruction is executed; the access arbitration of the hardware microarchitecture includes the instruction cache of the active thread bundle, and the access arbitration performs storage access execution of different thread bundles based on a combination of polling and write-back priority through a scheduling algorithm; the storage access management unit records the memory access address of each thread bundle, performs address merging and read access to the lower-level storage, reads data and writes it to the cache line, and updates the execution priority of the corresponding thread bundle in the same cycle; the marking unit records the tag mark and life cycle of the cache cache line, and when the access hits the cache line data, the life cycle of the cache line is reduced by one, and only the cache line with a life cycle of zero can be eliminated by the write request; the data write cache unit detects the life cycle and write status of the line data in the cache, randomly eliminates the data line with a life cycle of 0, and writes it into the cache. The present invention improves the effective utilization rate of cache data by life cycle counting through a cache access control method coordinated by software and hardware, thereby improving the cache hit efficiency, reducing the interaction between L1 cache and other stored data, and improving the efficiency of the storage card.
[0073] In another specific example, the present disclosure uses a 4-way group-associative cache storage mapping structure, and each data row group needs to record 4 tag marks and life cycle marks. Software is used to control the life cycle of the cache in the computing core. The compiler detects the access frequency requirements for cache data in multiple instructions executed sequentially by judging the function and context of the software algorithm core, and generates the access frequency of the row data written into the cache, that is, the row data life cycle. By rewriting the instructions, the life cycle of the cache row data is added to the control barcode of the memory access instruction.
[0074] First, the present invention counts L1 cache read data hit misses, and the average delay required to read data from other storage is the time unit T1; detects the execution instructions of the algorithm core, and counts the hardware execution cycle of each instruction when the cache hits; with twice T1 time as the granularity, detects the number of times the same cache row data is accessed during the cache read access process within this time period, and records it as the life cycle of the row data.
[0075] The function bit of the control instruction code is adjusted, and a 3-bit life cycle mark is added to indicate the life cycle of the row data corresponding to the memory access instruction. The cycle value is 1 to 7, and a value of 0 also indicates a cycle of 1.
[0076] Preferably, the time granularity can be based on the actual algorithm core application, that is, based on the application corresponding to the actual core algorithm, different time lengths can be selected as test benchmarks to detect the cache hit rate and adjust it through optimization testing.
[0077] Then, the number of memory access instruction caches of the access arbitration unit is the same as the number of active thread warps that can be cached by a single hardware computing core, and the present invention selects 16. The priority instruction cache uses a FIFO structure to store thread warp instructions. When the priority instruction cache is not empty, the thread warp instructions are read and executed from the FIFO first. Otherwise, the arbitration unit sequentially executes the cache read access instructions of the 16 active thread warps in a polling manner.
[0078] When there is a cache hit failure, the current thread is marked as inactive, and the access instruction of the next active thread bundle is directly executed, and the data read is sent to the storage access management unit; when the polled active thread bundle has no cache access instruction in this cycle, the execution is skipped directly; when the polled active thread bundle is still in an inactive state, the execution is skipped.
[0079] When the data read back by the storage access management unit is written successfully, the corresponding thread warp of the written cache line data is updated to the priority instruction cache. The access arbitration unit caches the thread warp number Wx of the next polling, and jumps to read the thread warp instruction from the FIFO for execution. At this time, the read thread warp instruction must be a cache hit. After the execution is completed, the corresponding thread warp is marked as active; after the FIFO is empty, it jumps to the cached thread warp Wx and continues the polling execution.
[0080] The cache hit detection is performed by querying all the tag tags of the corresponding row data group in the tag unit. If they are the same, it is a hit, and the life cycle of the corresponding row data is reduced by one after reading;
[0081] The row data life cycle and tag mark are controlled by a write instruction and are synchronously updated when the storage access management unit writes cache.
[0082] Preferably, when the cache row data life cycle drops to zero, the cache row data is accessed again and the life cycle no longer changes, thereby preventing hardware counting errors caused by software life cycle marking errors.
[0083] After that, the storage access management unit receives the storage access request that failed to hit the cache, and merges the addresses in the normal mode. When there is available row data space in the L1 cache, the merged address and length information are sent to the L2 cache or global storage for data reading through the data reading unit, and the arbitration unit is notified to update the life cycle, tag mark and reserved status mark of the corresponding row data in the marking unit.
[0084] Wait for the data to return, write the data to the corresponding row of L1 cache, update the state of the corresponding row data of the marking unit to active state, and notify the arbitration unit that the data reading is completed.
[0085] The data status of the L1 cache line is as follows: Figure 3 As shown, there are three types: "R" is the reserved state, indicating that the data is in the process of being read; "L" is the active state, indicating that there will be a request for data access in the short term; "V" is the updateable state, indicating that the data reading is completed and can be updated and replaced. When the row data is "R" and "L", in the hit-miss state, the storage access management unit cannot update the row data at the corresponding position through the data reading unit.
[0086] It should also be noted that the present disclosure adopts a write eviction method to implement cache writes. The data write unit receives a write request from the access arbitration unit and caches the write data in the data cache FIFO. The space detection unit detects the row data status in the corresponding row data group in the marking unit. When there is an available row in the "V" state, the data row with the "V" state is randomly removed to the L2 cache or the global cache; after removal, the data row in the cache is written to the L1 cache, and the tag mark in the marking unit is updated. The state mark "V" and the life cycle "zero" are not updated.
[0087] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
[0088] Figure 4 is a schematic diagram of a structure of a GPU cache access device provided by an embodiment of the present disclosure, such as Figure 4 As shown, in this device,
[0089] The processing module 401 is used to determine the average delay time T1 required for data based on the process of reading data from the L1 cache;
[0090] A statistics module 402 is used to count the hardware execution cycles of each instruction when it hits the cache;
[0091] The detection module 403 is used to detect the number of accesses to the same cache row data during the cache read access process within the target time period with a granularity of twice T1 time, and record it as the life cycle of the row data;
[0092] The processing module 401 is further used to mark the current thread as inactive when there is a cache hit failure, and directly execute the access instruction of the next active thread bundle, and send the data read to the storage access management unit; when the polled active thread bundle has no cache access instruction in this cycle, directly skip the execution; when the polled active thread bundle is still in an inactive state, skip the execution;
[0093] An updating module 404 is used to update the cache line data corresponding to the thread warp written into the priority instruction cache when the data read back by the storage access management unit is written successfully;
[0094] The processing module 401 is also used to cache the thread bundle number Wx of the next polling based on the access arbitration unit, and jump to read the thread bundle instruction from the FIFO for execution. At this time, the read thread bundle instruction is a cache hit. After the execution is completed, the corresponding thread bundle is marked as active; after the FIFO is empty, jump to the cached thread bundle Wx to continue polling execution.
[0095] In some embodiments, the processing module 401 is further used to query all tag tags of the corresponding row data group in the tag unit, and if they are the same, they are hits, and after reading, the life cycle of the corresponding row data is reduced by one;
[0096] The life cycle and tag mark of the row data are controlled by a write instruction and are synchronously updated when the storage access management unit writes cache.
[0097] In some embodiments, the storage access management unit receives a storage access request with a cache hit failure and performs address merging in a conventional mode;
[0098] When there is available row data space in the L1 cache, the merged address and length information is sent to the L2 cache or global storage for data reading through the data reading unit, and the arbitration unit is notified to update the life cycle, tag mark and reserved status mark of the corresponding row data of the marking unit.
[0099] In some embodiments, the processing module 401 is further used to wait for data to be returned, write the data into the corresponding row of the L1 cache, update the state of the corresponding row of data of the marking unit to an active state, and notify the arbitration unit that the data reading is completed.
[0100] In some embodiments, the L1 cache line data state includes a reserved state R, which is used to indicate that the data is in the process of being read; an active state L, which is used to indicate that there will be a request for data access in the short term; an updateable state V, which is used to indicate that the data reading is completed and can be updated and replaced;
[0101] When the row data is R and L, in a hit miss state, the storage access management unit cannot update the row data at the corresponding position through the data reading unit.
[0102] In some embodiments, the access device of the GPU cache implements cache writing by using a write-eviction method, and the data writing unit receives a write request from the access arbitration unit and caches the write data in the data cache FIFO.
[0103] In some embodiments, the detection module 403 is further used to detect the row data state in the corresponding row data group in the marking unit, and when there are available rows with V state, randomly remove the data rows with V state to the L2 cache or the global cache;
[0104] After eviction, the data line in the cache is written to the L1 cache, the tag in the tag unit is updated, and the status tag V and life cycle are not updated.
[0105] In some embodiments, the number of memory access instructions cached by the access arbitration unit is the same as the number of active warps that can be cached by a single hardware computing core.
[0106] Combination Figure 5 As shown, the embodiment of the present disclosure provides a GPU cache access system 500, including a processor 504 and a memory 501. Optionally, the system may also include a communication interface 502 and a bus 503. The processor 504, the communication interface 502, and the memory 501 may communicate with each other through the bus 503. The communication interface 502 may be used for information transmission. The processor 504 may call the logic instructions in the memory 501 to execute the GPU cache access method of the above embodiment.
[0107] In addition, the logic instructions in the memory 501 described above can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0108] The memory 501 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 504 executes the functional application and data processing by running the program instructions / modules stored in the memory 501, that is, implementing the GPU cache access method in the above embodiment.
[0109] The memory 501 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 501 may include a high-speed random access memory and may also include a non-volatile memory.
[0110] An embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute a method for accessing a GPU cache.
[0111] The computer-readable storage medium mentioned above may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0112] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method of the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, and other media that can store program codes, or a transient storage medium.
[0113] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, individual components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. As used in the description of the embodiments, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of one or more associated listings. In addition, when used in this application, the term "comprise" and its variants "comprises" and / or including (comprising) refer to the existence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the existence or addition of one or more other features, wholes, steps, operations, elements, components and / or these groups. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same or similar parts between the embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0114] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can 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 the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the systems, devices and units described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0115] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0116] The flowchart and block diagram in the accompanying drawings show the possible architecture, functions and operations of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A method for accessing a GPU cache, characterized in that: The method comprises: Based on the process of reading data from L1 cache, determine the average delay time T1 required for data; Count the hardware execution cycles of each instruction when it hits the cache; Using twice T1 time as the granularity, detect the number of times the same cache row data is accessed during cache read access within the target time period, and record it as the life cycle of the row data; When there is a cache hit failure, the current thread is marked as inactive, and the access instruction of the next active thread bundle is directly executed, and the data reading is sent to the storage access management unit; when the polled active thread bundle has no cache access instruction in this cycle, the execution is directly skipped; when the polled active thread bundle is still in the inactive state, the execution is skipped; When the data read back by the storage access management unit is written successfully, the cache line data corresponding to the thread warp written is updated to the priority instruction cache; The arbitration unit is accessed to cache the thread bundle number Wx for the next poll, and jumps to read the thread bundle instruction from the FIFO for execution. At this time, the read thread bundle instruction is a cache hit. After the execution is completed, the corresponding thread bundle is marked as active. After the FIFO is empty, jump to the cached thread bundle Wx and continue polling execution. The number of accesses to the same cache row data during the cache read access process during the detection target time period is recorded as the life cycle of the row data, including: Detect the row data status in the corresponding row data group in the tag unit, and when there is an available row with V status, randomly remove the data row with V status to L2 cache or global cache; After eviction, the data line in the cache is written to the L1 cache, the tag in the tag unit is updated, and the status tag V and life cycle are not updated.
2. The method according to claim 1, characterized in that The method further includes querying all tag marks of the corresponding row data group in the tag unit, and finding a hit if they are the same, and reducing the life cycle of the corresponding row data by one after reading; The life cycle and tag mark of the row data are controlled by a write instruction and are synchronously updated when the storage access management unit writes cache.
3. The method according to claim 2, characterized in that The method further comprises: The storage access management unit receives the storage access request with cache hit failure and performs address merging in a conventional mode; When there is available row data space in the L1 cache, the merged address and length information is sent to the L2 cache or global storage for data reading through the data reading unit, and the arbitration unit is notified to update the life cycle, tag mark and reserved status mark of the corresponding row data of the marking unit.
4. The method according to claim 3, characterized in that The method further comprises: Wait for the data to return, write the data to the corresponding row of L1 cache, update the state of the corresponding row data of the marking unit to active state, and notify the arbitration unit that the data reading is completed.
5. The method according to claim 3, characterized in that: The L1 cache line data states include the reserved state R, which indicates that the data is in the process of being read; the active state L, which indicates that there will be a request for data access in the short term; and the updateable state V, which indicates that the data has been read and can be updated or replaced. When the row data is R and L, in a hit miss state, the storage access management unit cannot update the row data at the corresponding position through the data reading unit.
6. The method according to claim 1, characterized in that The method adopts a write-evicting mode to implement cache writing, wherein a data writing unit receives a write request from an access arbitration unit and caches the write data in a data cache FIFO.
7. The method according to claim 1, characterized in that The number of memory access instruction caches of the access arbitration unit is the same as the number of active thread warps that a single hardware compute core can cache.
8. A GPU cache access device, characterized in that: The device comprises: A processing module is used to determine an average delay time T1 required for data based on a process of reading data from an L1 cache; Statistics module, used to count the hardware execution cycles of each instruction when it hits the cache; The detection module is used to detect the number of accesses to the same cache row data during cache read access within the target time period at a granularity of twice T1 time, and record it as the life cycle of the row data; The processing module is further used to mark the current thread as inactive when there is a cache hit failure, and directly execute the access instruction of the next active thread bundle, and send the data read to the storage access management unit; when the polled active thread bundle has no cache access instruction in this cycle, directly skip the execution; when the polled active thread bundle is still in an inactive state, skip the execution; An update module, used for updating the cache line data corresponding to the thread warp written into the priority instruction cache when the data read back by the storage access management unit is written successfully; The processing module is further used to cache the thread bundle number Wx of the next polling based on the access arbitration unit, and jump to read the thread bundle instruction from the FIFO for execution. At this time, the read thread bundle instruction is a cache hit. After the execution is completed, the corresponding thread bundle is marked as active; after the FIFO is empty, jump to the cached thread bundle Wx and continue the polling execution; The number of accesses to the same cache row data during the cache read access process during the detection target time period is recorded as the life cycle of the row data, including: Detect the row data status in the corresponding row data group in the tag unit, and when there is an available row with V status, randomly remove the data row with V status to L2 cache or global cache; After eviction, the data line in the cache is written to the L1 cache, the tag in the tag unit is updated, and the status tag V and life cycle are not updated.
