Methods, devices, and media for accessing graphics processor and ray tracing data
By introducing tag fields and data fields into cache lines to store multiple sets of key data, the problem of wasted cache space in existing technologies is solved, achieving more efficient cache utilization and improved system performance.
Patent Information
- Application Number
- CN202611627844.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-21
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, when storing special data areas, graphics processors need to read the entire cache line, resulting in wasted cache space and reduced system performance.
Introducing a tag field and a data field into the cache line, the tag field contains a slot mask indicator and an index indicator, and the data field stores multiple sets of key data. The validity of the cache line is determined by the valid status indicator and the data location is determined by the index indicator, thus achieving efficient storage and retrieval of key data.
It improves cache space utilization and system performance, reduces unnecessary data reads, and enhances the operating efficiency of the graphics processor.
Smart Images

Figure CN123118345A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graphics processor technology, and in particular to a graphics processor and a method, apparatus, and medium for accessing ray tracing data. Background Technology
[0002] In a graphics processing unit (GPU), different types of caches are used. Typically, a contiguous block of data from external memory is loaded into a cache line. When the GPU needs to read relevant data from the cache to execute instructions or perform calculations, it can directly read the data from the corresponding cache line, improving GPU performance and reducing memory bandwidth consumption.
[0003] In memory, there exists a special type of data region characterized by the presence of multiple data types, but only a subset of these data types need to be accessed during specific processing stages. These subsets of data accessed during specific processing stages are also known as critical data.
[0004] Currently, special data regions are typically stored in cache lines in units of 512 bits or 1024 bits. When critical data within these special regions is needed, the entire cache line must be read, resulting in wasted cache space and reduced system performance. Summary of the Invention
[0005] The purpose of this invention is at least to provide a method, device, and medium for accessing graphics processor and ray tracing data, which stores multiple sets of key data in a cache line, thereby improving the utilization efficiency of cache space and system performance.
[0006] In a first aspect, the present invention provides a graphics processor, comprising: a cache module, the cache module comprising N cache lines, the i-th cache line comprising: a label field and a data field; wherein, the label field of the i-th cache line comprises a valid status indicator bit, a slot mask indicator bit, and an index indicator bit, the valid status indicator bit being used to indicate whether the i-th cache line is valid, the slot mask indicator bit being used to indicate the valid status of each set of key data stored in the data field, and the index indicator bit being used to indicate the index corresponding to each set of key data stored in the data field; the data field of the i-th cache line comprises M sets of key data, the key data comprising at least one of the following: during the thread bundle creation and startup phase, the shader memory address corresponding to a shader that is not hit in the shader binding table and the number of general-purpose registers used; during the thread bundle creation and startup phase, the shader memory address corresponding to a shader that is hit in the shader binding table and the number of general-purpose registers used; wherein i, M, and N are all positive integers, and 1≤i≤N, M≥2.
[0007] Optionally, the label field of the i-th cache line may further include a base address identifier; the base address identifier is associated with a base address lookup table, and the value of the base address identifier is associated with the base address corresponding to the key data.
[0008] Optionally, the length of the base address identifier is 1 bit; in the base address lookup table, the base address identifier takes a first value, and the corresponding base address is the base address of the missed shader; the base address identifier takes a second value, and the corresponding base address is the base address of the hit shader.
[0009] Optionally, when the graphics processor supports dual context features, the length of the base address identifier is 2 bits.
[0010] Optionally, in the base address lookup table, the base address identifier can take the value of a first value or a third value, and the corresponding base address is the base address of the shader that was not hit; the base address identifier can take the value of a second value or a fourth value, and the corresponding base address is the base address of the shader that was hit.
[0011] Secondly, the present invention provides a method for accessing ray tracing data, comprising: in response to receiving a shader request instruction, searching for target key data corresponding to the shader request instruction in a cache module; the cache module includes N cache lines, the i-th cache line of the N cache lines including a label field and a data field; the label field of the i-th cache line includes a valid status indicator bit, a slot mask indicator bit, and an index indicator bit, the valid status indicator bit being used to indicate whether the i-th cache line is valid, the slot mask indicator bit being used to indicate the valid status of each set of key data stored in the data field, and the index indicator bit being used to indicate... The index corresponding to each set of key data stored in the data field is shown; the data field of the i-th cache line includes M sets of key data, the key data including at least one of the following: the shader memory address and the number of general-purpose registers used by the shader corresponding to the shader that was not hit in the shader binding table during the thread bundle creation startup phase; the shader memory address and the number of general-purpose registers used by the shader corresponding to the shader that was hit in the shader binding table during the thread bundle creation startup phase; where i, M, and N are all positive integers, and 1≤i≤N, M≥2; in response to detecting that the cache module has a target cache line, the target key data is read from the target cache line.
[0012] Optionally, if the target key data does not exist in the caching module, the target key data is read from memory and stored in the corresponding cache line in the caching module.
[0013] Optionally, after reading the target key data from memory, the method further includes: reading key data corresponding to adjacent shaders from memory, and storing the key data corresponding to the adjacent shaders in the corresponding cache line; the identifier of the adjacent shader is adjacent to the identifier of the target shader, and the target shader is the shader corresponding to the target key data.
[0014] Optionally, the memory access method for ray tracing data further includes: after writing the target key data and the key data corresponding to the adjacent shaders into the cache module, updating the data status indicator bit of the tag field in the corresponding cache line.
[0015] Optionally, reading the target key data from the memory includes: obtaining the data returned by the memory; determining the location of the target register in the data returned by the memory based on a valid flag generated during the address alignment process; and determining the target key data based on the location of the target register.
[0016] Optionally, the label field of the i-th cache line may further include a base address identifier; the base address identifier is associated with a base address lookup table, and the value of the base address identifier is associated with the base address corresponding to the key data.
[0017] Optionally, the length of the base address identifier is 1 bit; in the base address lookup table, the base address identifier takes a first value, and the corresponding base address is the base address of the missed shader; the base address identifier takes a second value, and the corresponding base address is the base address of the hit shader.
[0018] Optionally, when the graphics processor supports dual context features, the length of the base address identifier is 2 bits; in the base address lookup table, the value of the base address identifier is the first value or the third value, and the corresponding base address is the base address of the missed shader; the value of the base address identifier is the second value or the fourth value, and the corresponding base address is the base address of the hit shader.
[0019] Thirdly, the present invention provides a terminal device including the graphics processor described above.
[0020] Fourthly, the present invention also provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transient storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, performs the steps of any of the above-described methods for accessing ray tracing data.
[0021] Compared with the prior art, the technical solution provided by the present invention has at least the following beneficial effects: Each cache line in the caching module includes a tag field and a data field. The tag field includes a slot mask indicator and an index indicator, and the data field includes M sets of key data. In other words, a cache line stores multiple sets of key data. Therefore, when there is a need for key data, the corresponding key data can be read directly from the cache line, without having to read the entire cache line. This effectively improves cache space utilization and system performance. Attached Figure Description
[0022] Figure 1 This is a schematic diagram of the structure of a graphics processor according to an embodiment of the present invention; Figure 2 This is a flowchart of a method for accessing ray tracing data in an embodiment of the present invention. Detailed Implementation
[0023] As described in the background section, when storing special data regions in memory into cache lines, they are typically stored in units of 512 bits, 1024 bits, or similar lengths. When critical data within these special data regions is needed, the entire cache line must be read, resulting in wasted cache space and reduced system performance.
[0024] In this embodiment of the invention, any cache line of the caching module includes a tag field and a data field. The tag field includes a slot mask indicator bit and an index indicator bit, and the data field includes M sets of key data. That is, a cache line stores multiple sets of key data. Therefore, when there is a need for key data, the corresponding key data can be read directly from the cache line, without needing to read all the data stored in the entire cache line. This effectively improves the utilization efficiency of cache space and system performance.
[0025] To make the above-mentioned objectives, features and beneficial effects of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0026] This invention provides a graphics processor, referring to... Figure 1 The following is a detailed explanation.
[0027] In this embodiment of the invention, the graphics processor may include a cache module 102. The graphics processor may also include memory 103 and a scheduling module 101.
[0028] Upon receiving a shader request instruction, the scheduling module can first perform a hit test in the cache module to determine whether the cache module stores the target key data corresponding to the shader request instruction. If the target key data exists in the cache module, it is returned directly; otherwise, the target key data is retrieved from memory and stored in the cache line of the cache module.
[0029] In this embodiment of the invention, the caching module may include N cache lines. For any cache line among the N cache lines (hereinafter referred to as the i-th cache line), it includes: a tag field and a data field.
[0030] In a specific implementation, the label field of the i-th cache line may include a valid status indicator bit, a slot mask indicator bit, and an index indicator bit, wherein: the valid status indicator bit is used to indicate whether the i-th cache line is valid, the slot mask indicator bit is used to indicate the valid status of each set of key data stored in the data field, and the index indicator bit is used to indicate the index corresponding to each set of key data stored in the data field.
[0031] The data field corresponding to the i-th cache line includes M sets of key data, which may include shader memory addresses and the number of general-purpose registers used. i, M, and N are all positive integers, and 1 ≤ i ≤ N, M ≥ 2.
[0032] In this embodiment of the invention, the key data refers to the shader identifier and the base address of the corresponding shader that need to be obtained during the thread bundle creation and startup phase.
[0033] In practical applications, the Shader Binding Table (SBT) is a resource in ray tracing and is stored in memory. The SBT includes three main categories: Ray Generation Shader (RGS), Miss Shader (MIS), and Hit Group Shader. There are numerous shaders corresponding to Miss and Hit Group Shaders.
[0034] For missed shaders, all missed shaders are stored contiguously in memory at a single base address, hereinafter named mis_sbt.base. Each missed shader consists of two parts: a shader identifier and local root arguments. The shader identifier occupies 32 bytes of memory; the local root arguments are the shader resources used by the shader's internal instructions during runtime, such as texture resources, and their size can range from 0 to 4096 bytes, with their length being an integer multiple of 32 bytes. Within the same ray tracing entry point (dispatch ray call), all corresponding missed shaders occupy the same amount of memory.
[0035] During the creation and startup phase of a warp for a ray tracing shader, two crucial pieces of information are required: the shader memory address and the number of general-purpose registers (GPRs) used. GPRs store source / destination data during instruction execution. These two pieces of information are also known as critical data. This critical data is stored in a 32-byte shader identifier. Therefore, during the warp creation and startup phase, the corresponding critical data includes the MIS0 shader indentator, the MIS1 shader indentator, the MIS2 shader indentator, and so on.
[0036] Similarly, for hit shaders, during the thread bundle creation and startup phase, it is only necessary to obtain the shader identifier corresponding to each hit shader, such as the identifier for hit shader 0 (HitGroup0 shader indentifier), the identifier for hit shader 1 (HitGroup1 shader indentifier), the identifier for hit shader 2 (HitGroup2 shader indentifier), etc. The difference is that the hit shader identifier (HitGroup shader indentifier) includes: the memory address of the most recently hit shader (CHS shader) and the corresponding number of GPRs used; its length is the memory address of any hit shader (AHS shader) and the corresponding number of GPRs used; and the memory address of the intersecting shader (IS shader) and the corresponding number of GPRs used.
[0037] In other words, for a hit shader, during the thread bundle creation and startup phase, the key data includes: the memory address of the most recently hit shader (CHS shader) and the corresponding number of GPRs used, the memory address of any hit shader (AHS shader) and the corresponding number of GPRs used, and the memory address of the intersecting shader (IS shader) and the corresponding number of GPRs used.
[0038] In some embodiments, the specific length of the shader identifier can be determined based on the memory bus width and the number of GPR resources. For example, the shader memory address occupies 7 bytes, and the number of GPUs used occupies 1 byte.
[0039] Referring to Table 1, a schematic diagram of a cache module in an embodiment of the present invention is given.
[0040] Table 1
[0041] In Table 1, the caching module includes a total of 512 cache lines, with the corresponding line identifiers being line0 to line511.
[0042] For any cache line, it includes a label field and a data field. Taking cache line 0 as an example, its corresponding label field includes a valid status indicator (vld), a slot mask indicator (slot_mask), and an index indicator (index); the corresponding data field is data.
[0043] In some embodiments, the length of the valid status indicator bit can be 1 bit. When its value is 0, it indicates that the data in the cache line is invalid; when its value is 1, it indicates that the data in the cache line is valid.
[0044] The slot mask indicator bit can be 8 bits long, or it can be 4 bits, 6 bits, 16 bits, or an odd number of bits such as 5 bits, 7 bits, or 11 bits. The value of each bit in the slot mask indicator bit is used to indicate whether the corresponding key data is valid.
[0045] For example, the slot mask indicator bit is 8 bits long. When a bit is 0, it indicates that the corresponding key data is invalid; when a bit is 1, it indicates that the corresponding key data is valid.
[0046] The value of the index indicator bit is used to represent the base address index of the shader binding table index for each key data. In specific implementations, the index indicator bit can be 32 bits or other values.
[0047] In some embodiments, when the length of the slot mask indicator bit is 8, the value of the index indicator bit can be shifted right by 3 bits.
[0048] The length of the data field is related to the number of key data sets M in the cache line. Taking 8 sets of key data as an example, since the length of each set of key data is 8 bytes, the length of 8 sets of key data is 512 bits.
[0049] Therefore, if the number of key data sets in a cache line is other than a certain value, the length of the data field can also be set to other values accordingly.
[0050] In other words, the length of the slot mask indicator bit can be other values, and the length of the data field can also be other corresponding values.
[0051] In this embodiment of the invention, the label field of the i-th cache line may also include a base address identifier (base_id). The base address identifier may be associated with a base address lookup table, and the value of the base address identifier may be used to represent the base address corresponding to the key data.
[0052] In practice, the base address identifier can be 1 bit long. In the base address lookup table, when the base address identifier takes the first value, the corresponding base address is the base address of the missed shader; when the base address identifier takes the second value, the corresponding base address is the base address of the hit shader.
[0053] The first value mentioned above is different from the second value. Specifically, when the first value is 1, the second value is 0; when the first value is 0, the second value is 1.
[0054] Referring to Table 2 below, a schematic diagram of a basic address lookup table in an embodiment of the present invention is given.
[0055] Table 2
[0056] In Table 2, when the base address identifier is 0, the corresponding base address is mis_sbt.base; when the base address identifier is 1, the corresponding base address is hit_sbt.base.
[0057] In practice, when the graphics processor supports the double context feature, the length of the base address identifier can be 2 bits.
[0058] Accordingly, in the base address lookup table, when the base address identifier takes the first or third value, the corresponding base address is the base address of the missed shader; when the base address identifier takes the second or fourth value, the corresponding base address is the base address of the hit shader.
[0059] The first, second, third, and fourth values mentioned above are all different, and the first, second, third, and fourth values can be one of the four values: 00, 01, 10, and 11.
[0060] For example, the first value is 00, the second value is 01, the third value is 10, and the fourth value is 11.
[0061] Referring to Table 3 below, a schematic diagram of a basic address lookup table in an embodiment of the present invention is given.
[0062] Table 3
[0063] In Table 3, when the base address identifier is 00 or 10, the corresponding base address is mis_sbt.base; when the base address identifier is 01 or 11, the corresponding base address is hit_sbt.base.
[0064] In practical applications, it is known that for a given ray tracing entry point (dispatch ray call), its corresponding `mis_sbt.base` or `hit_sbt.base` is unique. That is, for the same ray tracing entry point (dispatch ray call), different missed shaders will have the same `mis_sbt.base`, and different hit shaders will also have the same `hit_sbt.base`. If `hit_sbt.base` or `mis_sbt.base` were also placed in the cache line, it would inevitably consume a large amount of cache space.
[0065] Therefore, in this embodiment of the invention, by setting a base address lookup table and then looking up mis_sbt.base or hit_sbt.base from the base address lookup table based on the base address identifier, the cache space used can be further reduced and the system performance improved.
[0066] In summary, in the graphics processor provided in this embodiment of the invention, each cache line of the cache module stores multiple sets of key data. When there is a need to access key data, the corresponding key data can be read from the cache line, without having to read all the data stored in the entire cache line. This effectively improves the utilization efficiency of cache space and system performance.
[0067] Reference Figure 2 This invention provides a method for accessing ray tracing data in memory, which will be described in detail below through specific steps.
[0068] In practice, the following method for accessing ray tracing data can be executed by the scheduling module.
[0069] Step 201: In response to receiving a shader request instruction, search for the target key data corresponding to the shader request instruction in the cache module.
[0070] Step 202: In response to the detection that the target cache line exists in the cache module, the target key data is read from the target cache line.
[0071] In this embodiment of the invention, the cache module involved in step 201 can refer to the cache module provided in the above embodiment.
[0072] Specifically, the aforementioned caching module includes N cache lines, where the i-th cache line includes a label field and a data field. The label field of the i-th cache line includes a valid status indicator bit, a slot mask indicator bit, and an index indicator bit, wherein: the valid status indicator bit is used to indicate whether the i-th cache line is valid, the slot mask indicator bit is used to indicate the valid status of each set of key data stored in the data field, and the index indicator bit is used to indicate the index corresponding to each set of key data stored in the data field; the data field of the i-th cache line includes M sets of key data, which include shader memory addresses and the number of general-purpose registers used; where i, M, and N are all positive integers, and 1≤i≤N, M≥2.
[0073] In practice, if a target cache line containing key target data is detected in the caching module, the key target data is read from that cache line. This avoids reading all the data in the target cache line, thus improving cache space utilization efficiency.
[0074] In this embodiment of the invention, if the target key data is not present in the caching module, the target key data corresponding to the shader request instruction can be read from memory and stored in the corresponding cache line in the caching module. The cache line containing the target key data becomes the target cache line the next time a shader request is received to access the target key data.
[0075] For example, if the target key data corresponding to the shader request instruction does not exist in the cache module, the target key data corresponding to the shader request instruction is retrieved from memory and stored in cache line 1 of the cache module. The next time a shader request instruction corresponding to the target key data is received, cache line 1 will be the target cache line.
[0076] In practical implementation, after reading the target key data from memory, the key data corresponding to the adjacent shaders can also be read from memory, and the key data corresponding to the adjacent shaders can be stored in the corresponding cache line. The aforementioned adjacent shaders are those whose identifiers are adjacent to the identifier of the target shader, and the target shader is the shader corresponding to the target key data.
[0077] For example, the key data for the target shader read from memory is the MIS0 shader indentifier. A single cache line can store the key data for eight sets of missed shaders. After reading the MIS0 shader indentifier, the MIS1, MIS2, ..., MIS7 shader indentifiers are read from memory, and all MIS0 to MIS7 shader indentifiers are stored in cache line 1.
[0078] Accordingly, after reading the MIS8 shader indentifier, the MIS8 shader indentifier to MIS15 shader indentifier can be stored in another cache line (such as cache line 3).
[0079] For example, the key data for the target shader read from memory is the HitGroup0 shader indentifier. A cache line can store 8 sets of key data. For a hit shader, the corresponding number of key data sets is 3. Corresponding to the HitGroup0 shader indentifier, its key data includes the following three sets: HitGroup0.CHS, HitGroup0.AHS, and HitGroup0.IS. Here, HitGroup0.CHS is the memory address of the most recently hit shader corresponding to the HitGroup0 shader indentifier and the corresponding number of GPRs used; HitGroup0.AHS is the memory address of any hit shader corresponding to the HitGroup0 shader indentifier and the corresponding number of GPRs used; HitGroup0.IS is the memory address of the intersecting shader corresponding to the HitGroup0 shader indentifier and the corresponding number of GPRs used, and so on.
[0080] Therefore, cache line 1 stores: HitGroup0.CHS, HitGroup0.AHS, HitGroup0.IS, HitGroup1.CHS, HitGroup1.AHS, HitGroup1.IS, HitGroup2.CHS, and HitGroup2.AHS.
[0081] In other words, after reading the key data of the target shader from memory, even if no shader request instruction for key data corresponding to an adjacent shader has been received, the corresponding key data can be read from memory and stored in the corresponding cache line by pre-reading and storing. Therefore, when the corresponding key data is needed later, it can be directly retrieved from the corresponding cache line, improving data reading efficiency.
[0082] In practice, the number of key data sets corresponding to adjacent shaders that are pre-read can be no greater than the maximum number of key data sets that a cache line can store, that is, no greater than M.
[0083] For example, in a cache line, you can pre-read only the key data corresponding to an adjacent shader.
[0084] In this embodiment of the invention, after writing the target key data and the key data corresponding to the adjacent shaders into the corresponding cache line in the cache module, the data status indicator bit of the tag field in the corresponding cache line can be updated.
[0085] For example, the data status indicator bit in the label field corresponding to cache line 1 is 00000000. After writing the MIS0 shader indentifier to the MIS7 shader indentifier to cache line 1, the data status indicator bit in the label field corresponding to cache line 1 is updated, and the updated data status indicator bit is 11111111.
[0086] In practice, the process of reading target critical data from memory can include the following: obtaining the data returned from memory; determining the location of the target register in the returned memory based on the valid flag generated during address alignment; and determining the target critical data based on the location of the target register. The aforementioned target register is the register in memory that stores the target critical data.
[0087] When reading target critical data from memory, since the length of the data returned from memory each time is 512 bits, a 2-bit valid flag is generated during the address alignment process to determine whether the first 256 bits or the last 256 bits of the returned 512 bits are written to the cache line.
[0088] In summary, the memory access method for ray tracing data provided in this embodiment of the invention stores multiple sets of key data in a single cache line. Therefore, when there is a need for key data, the corresponding key data can be read directly from the cache line, without having to read all the data stored in the entire cache line. This effectively improves the utilization efficiency of cache space and system performance.
[0089] In specific implementation, the modules / units included in the various devices and products described in the above embodiments can be software modules / units, hardware modules / units, or a combination of both.
[0090] For example, for various devices and products applied to or integrated into a chip, each module / unit can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs that run on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits; for various devices and products applied to or integrated into a chip module, each module / unit can be implemented using hardware methods such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware methods such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.
[0091] This invention also provides a computer-readable storage medium, which is a non-volatile or non-transient storage medium, storing a computer program thereon. When the computer program is run by a processor, it executes the steps of the ray tracing data access method provided in any of the above embodiments.
[0092] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include ROM, RAM, disk, or optical disk, etc.
[0093] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.
Claims
1. A graphics processor, characterized in that, include: Cache module; The caching module includes N cache lines; the i-th cache line in the N cache lines includes a tag field and a data field; The tag field of the i-th cache line includes a valid status indicator bit, a slot mask indicator bit, and an index indicator bit. The valid status indicator bit is used to indicate whether the i-th cache line is valid. The slot mask indicator bit is used to indicate the valid status of each set of key data stored in the data field. The index indicator bit is used to indicate the index corresponding to each set of key data stored in the data field. The data field of the i-th cache line includes M sets of key data, which include at least one of the following: the shader memory address and the number of general-purpose registers used by the shader corresponding to the shader that was not hit in the shader binding table during the thread bundle creation and startup phase; and the shader memory address and the number of general-purpose registers used by the shader corresponding to the shader that was hit in the shader binding table during the thread bundle creation and startup phase. Where i, M, and N are all positive integers, and 1≤i≤N, M≥2.
2. The graphics processor as described in claim 1, characterized in that, The tag field of the i-th cache line also includes a base address identifier; the base address identifier is associated with a base address lookup table, and the value of the base address identifier is associated with the base address corresponding to the key data.
3. The graphics processor as described in claim 2, characterized in that, The length of the basic address identifier is 1 bit; In the base address lookup table, the base address identifier takes a first value, and the corresponding base address is the base address of the missed shader; the base address identifier takes a second value, and the corresponding base address is the base address of the hit shader.
4. The graphics processor as described in claim 2, characterized in that, When the graphics processor supports dual context features, the length of the base address identifier is 2 bits.
5. The graphics processor as described in claim 4, characterized in that, In the base address lookup table, the base address identifier takes the first or third value, and the corresponding base address is the base address of the missed shader. The base address identifier takes the second or fourth value, and the corresponding base address is the base address of the hit shader.
6. A method for accessing ray tracing data, characterized in that, include: In response to receiving a shader request instruction, the target key data corresponding to the shader request instruction is searched in the cache module; The caching module includes N cache lines. The i-th cache line includes a label field and a data field. The label field of the i-th cache line includes a valid status indicator bit, a slot mask indicator bit, and an index indicator bit. The valid status indicator bit indicates whether the i-th cache line is valid. The slot mask indicator bit indicates the valid status of each set of key data stored in the data field. The index indicator bit indicates the index corresponding to each set of key data stored in the data field. The data field of the i-th cache line includes M sets of key data. The key data includes at least one of the following: the shader memory address and the number of general-purpose registers used by the shader corresponding to the shader that was not hit in the shader binding table during the thread bundle creation and startup phase; and the shader memory address and the number of general-purpose registers used by the shader corresponding to the shader that was hit in the shader binding table during the thread bundle creation and startup phase. Where i, M, and N are all positive integers, and 1≤i≤N, M≥2. In response to the detection that the cache module has a target cache line, the target key data is read from the target cache line.
7. The method for accessing ray tracing data as described in claim 6, characterized in that, If the target key data is not present in the cache module, the target key data is read from memory and stored in the corresponding cache line in the cache module.
8. The method for accessing ray tracing data as described in claim 7, characterized in that, After reading the target key data from memory, the process further includes: The key data corresponding to the adjacent shader is read from the memory and stored in the corresponding cache line; the identifier of the adjacent shader is adjacent to the identifier of the target shader, and the target shader is the shader corresponding to the target key data.
9. The method for accessing ray tracing data as described in claim 8, characterized in that, Also includes: After writing the target key data and the key data corresponding to the adjacent shaders into the cache module, the data status indicator bit of the tag field in the corresponding cache line is updated.
10. The method for accessing ray tracing data as described in claim 7, characterized in that, The step of reading the target key data from the memory includes: Obtain the data returned by the memory; Based on the valid flags generated during the address alignment process, the location of the target register in the data returned from the memory is determined. Based on the location of the target register, the key data of the target are determined.
11. The method for accessing ray tracing data as described in claim 7, characterized in that, The tag field of the i-th cache line also includes a base address identifier; the base address identifier is associated with a base address lookup table, and the value of the base address identifier is associated with the base address corresponding to the key data.
12. The method for accessing ray tracing data as described in claim 11, characterized in that, The length of the base address identifier is 1 bit; in the base address lookup table, the base address identifier takes the first value, and the corresponding base address is the base address of the missed shader; the base address identifier takes the second value, and the corresponding base address is the base address of the hit shader.
13. The method for accessing ray tracing data as described in claim 11, characterized in that, When the graphics processor supports dual context features, the length of the base address identifier is 2 bits; in the base address lookup table, the value of the base address identifier is the first value or the third value, and the corresponding base address is the base address of the missed shader; the value of the base address identifier is the second value or the fourth value, and the corresponding base address is the base address of the hit shader.
14. A terminal device, characterized in that, Including the graphics processor as described in any one of claims 1 to 5.
15. A computer-readable storage medium, said computer-readable storage medium being a non-volatile storage medium or a non-transient storage medium, having stored thereon a computer program, characterized in that, When the computer program is run by the processor, it performs the steps of the memory access method for ray tracing data according to any one of claims 6 to 13.
