Data access method and related device

By configuring cache space for peripheral devices and checking and executing cache hit operations, the problem of data access latency for peripheral devices is solved, and data access efficiency is improved.

CN120448300BActive Publication Date: 2026-11-24HYGON INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510522136.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2026-11-24
Estimated Expiration
2045-04-24

AI Technical Summary

Technical Problem

Data access latency from peripheral devices is relatively high, especially under high load or when multiple devices access the system simultaneously, which affects system performance. Existing technologies are unable to effectively improve data access efficiency.

Method used

Configure peripheral devices with a cache. Check if the data to be accessed exists in the cache space. If it exists, perform the access operation in the cache. Otherwise, send a request to the peripheral device and obtain the access result. This achieves cache hit for data access and reduces the number of times the peripheral device is accessed directly.

Benefits of technology

By using a cache hit mechanism, direct access to peripheral devices is reduced, access latency is lowered, and data access efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448300B_ABST
    Figure CN120448300B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a data access method and related equipment, wherein the data access method applied to a peripheral cache comprises: obtaining a to-be-processed access request, the to-be-processed access request being used to request to access a to-be-accessed address of a peripheral device; determining, based on the to-be-processed access request, whether there is to-be-accessed data corresponding to the to-be-accessed address in a cache space corresponding to the peripheral device; if yes, performing, based on the to-be-processed access request, access to the to-be-accessed data in the cache space, and feeding back an access result corresponding to the to-be-processed access request to a request issuing party; if no, sending the to-be-processed access request to the peripheral device, and forwarding an access result corresponding to the to-be-processed access request fed back by the peripheral device to the request issuing party when the access result is obtained. Embodiments of the present application can improve data access efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a data access method and related equipment. Background Technology

[0002] Peripheral devices refer to various external hardware devices connected to the computer host, such as printers, monitors, storage devices, coprocessors (e.g., field-programmable gate arrays (FPGAs), graphics processing units (GPUs), and general-purpose graphics processing units (GPGPUs). They exchange data with the computer through interfaces, expanding the computer's functionality and providing users with rich input, output, and storage capabilities.

[0003] However, since peripheral devices typically communicate with the host via a bus and external interfaces, their data transmission speed is limited by interface bandwidth, protocol overhead, and the device's own processing power, resulting in significant latency when accessing peripheral devices. This latency issue is particularly pronounced under high load or when multiple devices access the system simultaneously, and may even affect the overall system performance.

[0004] Therefore, improving data access efficiency for data in peripheral devices has become a crucial factor restricting computer response speed and work efficiency. Summary of the Invention

[0005] In view of this, embodiments of this application provide a data access method and related equipment that can improve data access efficiency.

[0006] To achieve the above objectives, the embodiments of this application provide the following technical solutions.

[0007] In a first aspect, embodiments of this application provide a data access method applied to a peripheral device cache, comprising:

[0008] Obtain pending access requests, which are used to request access to the address of the peripheral device to be accessed;

[0009] Based on the pending access request, determine whether there is any data to be accessed corresponding to the address to be accessed in the cache space of the peripheral device;

[0010] If so, based on the pending access request, the access to the data to be accessed is performed in the cache space, and the access result corresponding to the pending access request is fed back to the peripheral controller;

[0011] If not, send the pending access request to the peripheral device, obtain the access result corresponding to the pending access request from the peripheral device, and forward the access result to the peripheral controller.

[0012] Optionally, determining whether the data to be accessed corresponding to the address to be accessed exists in the cache space of the peripheral device based on the access request to be processed includes:

[0013] Based on the request information of the pending access request, determine the peripheral device corresponding to the pending access request;

[0014] Determine the preset cache partition corresponding to the peripheral device;

[0015] Determine whether the data to be accessed corresponding to the address to be accessed exists in the preset cache partition.

[0016] Optionally, if the access operation corresponding to the pending access request is a read operation, the step of accessing the data to be accessed in the cache space based on the pending access request and feeding back the access result corresponding to the pending access request to the peripheral controller specifically involves: reading the data to be accessed from the cache space and feeding back the read data to be accessed as the access result to the peripheral controller.

[0017] Optionally, if the access operation corresponding to the pending access request is a write operation, the step of performing access to the data to be accessed in the cache space based on the pending access request and feeding back the access result corresponding to the pending access request to the peripheral controller specifically involves: writing the data to be written at the position of the data to be accessed in the cache space, and feeding back the successful write feedback message as the access result to the peripheral controller.

[0018] Optionally, after sending a successful write feedback message as an access result to the requester, when the data to be written is replaced in the peripheral cache with data at other addresses of the peripheral device, the method further includes: updating the data to be written to the address corresponding to the peripheral device.

[0019] Optionally, after the step of obtaining the access result corresponding to the pending access request fed back by the peripheral device and forwarding the access result to the peripheral controller, the method further includes:

[0020] The system determines the data to be accessed from the obtained access results and caches the data to be accessed in the cache space of the corresponding peripheral device.

[0021] Optionally, in the step of caching the data to be accessed to the cache space of the corresponding peripheral device, the data to be accessed is cached to the cache space of the peripheral device based on a cache replacement mechanism;

[0022] The cache replacement mechanism includes: when there is free space in the cache space corresponding to the peripheral device, storing the data to be accessed in the free space; when there is no free space in the cache space corresponding to the peripheral device, selecting a cache space to be replaced that meets the preset conditions based on a preset algorithm, storing the data to be accessed in the cache space to be replaced, and updating the peripheral cache data in the cache space to be replaced to the peripheral device.

[0023] Optionally, before the step of obtaining the access request to be processed, the method further includes:

[0024] Obtain a prefetch request, the prefetch request being used to request data reading from the address to be prefetched of a peripheral device;

[0025] Based on the prefetch request, the data to be prefetched at the address to be prefetched is read from the peripheral device, and the data to be prefetched is updated to the peripheral cache;

[0026] The prefetch task completion message is sent to the peripheral controller.

[0027] Optionally, the step of reading the data to be prefetched from the address to be prefetched in the peripheral device based on the prefetch request, and updating the data to be prefetched to the peripheral device cache, includes:

[0028] Based on the prefetch request, a corresponding data read command is generated; wherein, the generated data read command is one or more, and each data read command corresponds to a read address, wherein the read address is at least a part of the prefetch address;

[0029] Select and send a data read command to the peripheral device, so that the peripheral device can read and return the corresponding data to be prefetched based on the data read command;

[0030] After acquiring the data to be prefetched, the acquired data to be prefetched is updated in the cache space of the corresponding peripheral device;

[0031] Confirm whether the prefetching task corresponding to the prefetching request has been completed;

[0032] If not, the step of selecting and sending a data read command to the peripheral device is executed, and the step of updating the acquired data to be prefetched to the cache space of the corresponding peripheral device after acquiring the data to be prefetched, and the step of confirming whether the prefetching task corresponding to the prefetching request is completed, continues until the prefetching task corresponding to the prefetching request is confirmed to be completed.

[0033] If so, execute the step of sending the feedback prefetch task completion message to the peripheral controller.

[0034] Optionally, the step of generating a corresponding data read command based on the prefetch request further includes configuring an identifier bit for the data read command to indicate the processing status of the data read command;

[0035] In the step of selecting and sending a data read command to the peripheral device, the flag bit of the data read command is also configured to be in a sent state;

[0036] In the step of updating the acquired data to be prefetched to the cache space of the corresponding peripheral device after acquiring the data to be prefetched, the flag bit of the data reading command is also configured to be in a completed state.

[0037] In the step of confirming whether the prefetch task corresponding to the prefetch request has been completed, the identifier bit of the data read command is used to determine whether there is a data read command that has not yet been executed, so as to determine whether the prefetch task corresponding to the prefetch request has been completed.

[0038] Secondly, embodiments of this application provide a data access method applied to a peripheral controller, comprising:

[0039] Obtain pending access requests, which are used to request access to the address of the peripheral device to be accessed;

[0040] The pending access request is configured to the peripheral cache of the corresponding peripheral device, so that the peripheral cache executes the data access method;

[0041] Obtain the access result of the peripheral device cache and send the access result back to the requester.

[0042] Optionally, before obtaining the access request to be processed, the method further includes:

[0043] Obtain a prefetch request, the prefetch request being used to request data reading from the address to be prefetched of a peripheral device;

[0044] The prefetch request is configured to the peripheral cache of the corresponding peripheral device, so that the peripheral cache executes the data access method;

[0045] After obtaining the prefetch task completion message, the prefetch task completion message is forwarded to the requester.

[0046] Thirdly, embodiments of this application provide a data access method applied to a peripheral device, including:

[0047] The peripheral device cache retrieves pending access requests, which are used to request access to the address of the peripheral device to be accessed; the peripheral device cache is used to execute the data access method.

[0048] Based on the pending access request, the access to the data to be accessed is performed, and the access result is fed back to the peripheral cache.

[0049] Optionally, if the access operation corresponding to the pending access request is a read operation, the step of performing access to the data to be accessed based on the pending access request and feeding back the access result to the peripheral cache specifically involves: reading the data to be accessed at the corresponding address based on the pending access request, and feeding back the read data to be accessed as the access result to the peripheral cache.

[0050] Optionally, if the access operation corresponding to the pending access request is a write operation, the step of performing access to the data to be accessed based on the pending access request and feeding back the access result to the peripheral cache specifically involves: writing the data to be written into the space corresponding to the address to be accessed on the peripheral device based on the pending access request, and feeding back the successful write feedback message as the access result to the peripheral cache.

[0051] Fourthly, embodiments of this application provide a peripheral cache, including access control logic and cache space;

[0052] The access control logic is used to obtain pending access requests, which are requests to access the address to be accessed of a peripheral device; based on the pending access request, it is determined whether there is data to be accessed corresponding to the address to be accessed in the cache space of the peripheral device; if so, based on the pending access request, the access to the data to be accessed is performed in the cache space, and the access result corresponding to the pending access request is fed back to the peripheral controller; if not, the pending access request is sent to the peripheral device, and the access result corresponding to the pending access request fed back by the peripheral device is obtained, and the access result is forwarded to the peripheral controller.

[0053] Optionally, prefetch control logic may also be included;

[0054] The prefetch control logic is used to obtain a prefetch request, which requests to read data from the address to be prefetched of the peripheral device; based on the prefetch request, the access control logic reads the data to be prefetched from the address to be prefetched in the peripheral device and updates the data to be prefetched to the peripheral device cache; and sends a prefetch task completion message to the peripheral controller.

[0055] Fifthly, embodiments of this application provide a computing device, including: at least one peripheral controller, at least one peripheral cache, and at least one peripheral device; the peripheral controller is configured to execute a data access method applied to the peripheral controller, the peripheral cache is configured to execute a data access method applied to the peripheral cache, and the peripheral device executes a data access method applied to the peripheral device.

[0056] In a sixth aspect, embodiments of this application provide a storage medium storing one or more computer-executable instructions, wherein the one or more computer-executable instructions are applied to a data access method for a peripheral cache, and / or, to a data access method for a peripheral controller, and / or, to a data access method for a peripheral device.

[0057] In a seventh aspect, embodiments of this application provide a computer program including one or more computer-executable instructions, wherein when the one or more computer-executable instructions are executed, they implement a data access method applied to a peripheral cache, and / or implement a data access method applied to a peripheral controller, and / or implement a data access method applied to a peripheral device.

[0058] This application provides a data access method and related device. The data access method applied to a peripheral device cache includes: obtaining a pending access request, wherein the pending access request is used to request access to a pending address of a peripheral device; based on the pending access request, determining whether there is pending data corresponding to the pending address in the cache space of the peripheral device; if yes, based on the pending access request, performing access to the pending data in the cache space, and feeding back the access result corresponding to the pending access request to the request sender; if no, sending the pending access request to the peripheral device, and when obtaining the access result corresponding to the pending access request fed back by the peripheral device, forwarding the access result to the peripheral controller.

[0059] As can be seen, this application embodiment configures a peripheral cache for the peripheral device, so that when executing a pending access request for the peripheral device, it first determines whether there is data to be accessed corresponding to the address to be accessed in the cache space of the peripheral device. If there is data to be accessed corresponding to the address to be accessed, it performs access to the data to be accessed in the cache space based on the pending access request, without having to access the peripheral device. This avoids access to the peripheral device to a certain extent, thereby avoiding the latency caused by accessing the peripheral device and improving data access efficiency. Attached Figure Description

[0060] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0061] Figure 1 This is an optional frame diagram of a computing device;

[0062] Figure 2 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application;

[0063] Figure 3 An optional flowchart of a data access method provided in an embodiment of this application;

[0064] Figure 4 Another optional flowchart of a data access method provided in an embodiment of this application;

[0065] Figure 5 An optional example diagram of a data prefetching process provided for an embodiment of this application;

[0066] Figure 6 Another optional example diagram of a data prefetching process provided in this application embodiment;

[0067] Figure 7 This is an optional structural diagram of a computing device provided in an embodiment of this application. Detailed Implementation

[0068] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0069] refer to Figure 1 The diagram illustrates an optional framework of a computing device, which may include a host and peripheral devices coupled to the host. The host may include a processor, a DMA (Direct Memory Access) device, etc., and the host and peripheral devices may communicate based on a bus and an external interface.

[0070] It is understandable that there can be one or more peripheral devices connected to the host. Furthermore, when there are many peripheral devices, the host can also cascade peripheral devices to the host based on switch cascading technology.

[0071] However, with the development of peripheral devices, their bandwidth has gradually increased, and the corresponding access latency has also increased significantly. In particular, in the case of cascading peripheral devices, the access latency will increase further.

[0072] In the embodiments provided in this application, a data access method and related device are provided. The data access method applied to a peripheral device cache includes: obtaining a pending access request, wherein the pending access request is used to request access to a pending address of a peripheral device; based on the pending access request, determining whether there is pending data corresponding to the pending address in the cache space of the peripheral device; if yes, based on the pending access request, performing access to the pending data in the cache space, and feeding back the access result corresponding to the pending access request to the request sender; if no, sending the pending access request to the peripheral device, and when obtaining the access result corresponding to the pending access request fed back by the peripheral device, forwarding the access result to the peripheral controller.

[0073] As can be seen, this application embodiment configures a peripheral cache for the peripheral device, so that when executing a pending access request for the peripheral device, it first determines whether there is data to be accessed corresponding to the address to be accessed in the cache space of the peripheral device, and if there is data to be accessed, it performs access to the data to be accessed in the cache space based on the pending access request, without having to access the peripheral device, thereby avoiding access to the peripheral device to a certain extent, thus avoiding the latency caused by accessing the peripheral device and improving data access efficiency.

[0074] The proposed scheme in this application will be described in detail below.

[0075] Figure 2 An exemplary schematic diagram of the structure of a computing device is shown, such as... Figure 2 As shown, the computing device may include a host and peripheral devices coupled to the host. The host includes a processor core, a DMA device, a peripheral controller, a peripheral cache, and other main devices. The processor core, DMA device, peripheral controller, and other main devices interact with each other via an on-chip network, while the peripheral controller connects to the peripheral devices via the peripheral cache. The other main devices may be, for example, other processor cores.

[0076] Peripheral controllers manage peripheral resources and access processes for peripheral devices. There can be multiple peripheral controllers or a single peripheral controller. If there are multiple peripheral controllers, they can correspond one-to-one or one-to-many, meaning one peripheral controller controls multiple peripheral devices. In the peripheral device access process, the peripheral controller configures access tasks to the corresponding peripheral devices and, upon receiving result data from the peripheral devices, sends the result data back to the requesting party.

[0077] Peripheral caches provide data caching space for peripheral devices. By caching at least a portion of the peripheral device's data, partial data access to the peripheral device is achieved based on the peripheral cache, thereby reducing the probability of the host accessing the peripheral device when performing a corresponding access task. The peripheral cache can be configured on the host chip (such as a system-on-a-chip, SOC), enabling access to the cached data through intra-chip communication. There can be multiple peripheral caches or a single peripheral cache. The peripheral cache is matched with a peripheral device; that is, a one-to-one correspondence or a one-to-many correspondence can exist, meaning one peripheral cache corresponds to multiple peripheral devices. In an optional example, the peripheral cache can also be matched with a peripheral controller; that is, a one-to-one correspondence or a one-to-many correspondence can exist.

[0078] In any case, if one peripheral cache corresponds to multiple peripheral devices, the peripheral cache can be configured with a cache partition to achieve the correspondence with the peripheral devices. Specifically, a preset cache partition area can be divided in the peripheral cache as a cache partition to be matched, and the cache partition to be matched can be further configured to the peripheral device to be configured so that the peripheral device to be configured corresponds to the cache partition to be matched.

[0079] After the peripheral cache is configured to the preset cache partition of the peripheral device, the preset cache partition can store the peripheral data stored in the corresponding peripheral device (i.e., the data stored in the peripheral device). In the preset cache partition, the peripheral data can be marked based on its corresponding storage address in the peripheral device, so that the existence of the corresponding peripheral data in the preset cache partition can be determined based on the address information in the access request of the corresponding peripheral device.

[0080] In a specific implementation, the peripheral cache is configured between the peripheral controller and the peripheral device, thereby caching and accessing data in the peripheral device based on the access information in the peripheral controller, thus improving data access efficiency.

[0081] In a further implementation, this application also provides a corresponding data access method, which can be applied to the aforementioned computing device to achieve data access control of peripheral devices based on peripheral cache. (Reference) Figure 3 An optional flowchart of a data access method is shown, the method comprising:

[0082] Step S100: The peripheral controller obtains an access request to be processed, which is used to request access to the address to be accessed of the peripheral device.

[0083] The pending access request can be issued from any data processing device in the host (e.g., processor core, DMA device) and transmitted to the peripheral controller via the bus.

[0084] It is understood that the peripheral device can be any peripheral device coupled to the host, and correspondingly, the pending access request is used to access the address to be accessed of that peripheral device. The address to be accessed is the address requested by the pending access request.

[0085] Step S110: The peripheral controller configures the pending access request to the peripheral cache of the corresponding peripheral device;

[0086] It is understandable that, for the peripheral device requested by the pending access request, the peripheral controller can configure the pending access request to the peripheral cache corresponding to the peripheral device to execute the corresponding data access task.

[0087] In a specific implementation, the pending access request may include relevant access information, such as the identifier information of the peripheral device to be accessed, the address information of the corresponding address to be accessed, and relevant operation information. Accordingly, the peripheral controller can configure the pending access request to the peripheral cache corresponding to the peripheral device based on the access information in the pending access request.

[0088] Correspondingly, the peripheral cache can obtain the access request to be processed.

[0089] Step S120: Based on the pending access request, the peripheral device cache determines whether there is data to be accessed corresponding to the address to be accessed in the cache space of the corresponding peripheral device.

[0090] In a specific implementation, after obtaining the access request to be processed, the corresponding peripheral device is confirmed based on the request information of the access request to be processed, and then the cache space of the corresponding peripheral device is determined.

[0091] Taking the cache space corresponding to the peripheral device in the peripheral cache as a preset cache partition as an example, the peripheral device corresponding to the access request to be processed can be determined based on the request information of the access request to be processed, thereby determining the preset cache partition corresponding to the peripheral device, and then determining whether there is access data corresponding to the access address in the preset cache partition.

[0092] In an optional implementation, the address to be accessed can be confirmed based on the address information in the request information.

[0093] If the data to be accessed exists in the cache space of the corresponding peripheral device, then step S130 is executed; otherwise, step S140 is executed.

[0094] Step S130: Based on the pending access request, the peripheral cache performs access to the data to be accessed in the cache space and feeds back the access result corresponding to the pending access request to the peripheral controller.

[0095] Based on the request information in the pending access request, the corresponding access operation can be performed on the data to be accessed in the cache space.

[0096] In an optional example, if the access operation corresponding to the access request to be processed is a read operation, and the existence of data to be accessed in the cache space of the peripheral device can be understood as a read hit in the cache, then this step can specifically be to read the data to be accessed from the cache space, and correspondingly, the read data to be accessed can be fed back to the peripheral controller as the access result.

[0097] In an optional example, if the access operation corresponding to the pending access request is a write operation, the pending access request may include the corresponding data to be written. The existence of the data to be accessed in the cache space of the peripheral device can be understood as a write hit in the cache. In this case, this step can specifically be to write the data to be written to the location of the data to be accessed in the cache space (that is, to update the data to be written to the cache space where the data to be accessed is located). Correspondingly, the feedback message of successful writing can be fed back to the peripheral controller as the access result.

[0098] It should be noted that after the data to be written is written to the corresponding cache space, the data to be written can be updated to the address of the peripheral device at a preset time. In an optional example, the preset time can be when the data to be written is replaced with data at other addresses of the peripheral device in the peripheral cache after the write success feedback message is sent to the peripheral controller as the access result.

[0099] Specifically, after the access result is fed back to the peripheral controller, the peripheral controller can execute step S170 to obtain the access result and feed it back to the requester.

[0100] Step S140: The peripheral cache sends the pending access request to the peripheral device;

[0101] If the data to be accessed corresponding to the address to be accessed does not exist in the cache space of the peripheral device in the peripheral cache, the access request to be processed can be sent to the peripheral device so that the peripheral device can execute the access task corresponding to the access request to be processed.

[0102] Correspondingly, peripheral devices can acquire the access request to be processed.

[0103] Step S150: Based on the pending access request, the peripheral device performs access to the data to be accessed and feeds back the access result to the peripheral cache.

[0104] After receiving the access request to be processed, the peripheral device can perform the corresponding access based on the corresponding request information.

[0105] In an optional example, if the access operation corresponding to the pending access request is a read operation, this step can specifically be to read the data to be accessed at the corresponding address based on the pending access request, and accordingly, the read data to be accessed can be fed back to the peripheral cache as the access result.

[0106] In an optional example, if the access operation corresponding to the pending access request is a write operation, the corresponding pending access request may include the corresponding data to be written. In this step, the data to be written may be written in the space corresponding to the pending access address of the peripheral device based on the pending access request (that is, the data to be written is updated to the location of the data to be accessed). Accordingly, the feedback message of successful writing can be fed back to the peripheral device cache as the access result.

[0107] It is understandable that the peripheral device sends the corresponding access result to the peripheral cache, and the peripheral cache can obtain the access result corresponding to the pending access request sent by the peripheral device.

[0108] Step S160: The peripheral cache obtains the access result corresponding to the pending access request fed back by the peripheral device, and forwards the access result to the peripheral controller.

[0109] After obtaining the corresponding access result, the peripheral cache can forward the access result to the peripheral controller, so that the peripheral controller can forward the access result to the request issuer. Accordingly, the peripheral controller can execute step S170 to obtain the access result and feed it back to the request issuer.

[0110] Step S170: The peripheral controller obtains the access result and sends the access result back to the requester.

[0111] By sending the access results back to the requester, it is shown that the corresponding access task has been completed.

[0112] In a further optional example, after obtaining the access result in step S160, the peripheral cache can further update the data of the peripheral cache based on the access result.

[0113] For details, please refer to Figure 4 Another optional flowchart of a data access method is shown. After the peripheral cache obtains the access result, if the access operation corresponding to the access request to be processed is a read operation, the access result includes the read data to be accessed. In this example, step S180 can be further executed.

[0114] In step S180, the peripheral device cache determines the data to be accessed from the obtained access results and caches the data to be accessed in the cache space of the corresponding peripheral device.

[0115] It is understood that the access result is obtained when the aforementioned pending access request does not hit the peripheral device cache, indicating that the peripheral device cache does not cache the data to be accessed. By caching the data to be accessed in the corresponding cache space, subsequent pending access requests can directly retrieve the data from the corresponding cache space without having to retrieve it from the peripheral device again.

[0116] In an optional example, the data to be accessed can be cached in the cache space of the peripheral device based on a cache replacement mechanism. The cache replacement mechanism can be understood as a data replacement rule for the cache, which can be implemented based on a preset algorithm. Specifically, the cache replacement mechanism may include, for example, storing the data to be accessed in the free space when there is free space in the cache space corresponding to the peripheral device; and, when there is no free space in the cache space corresponding to the peripheral device, selecting a cache space to be replaced that meets preset conditions based on a preset algorithm, storing the data to be accessed in that cache space, and updating the peripheral cache data in the cache space to be replaced to the peripheral device.

[0117] The preset algorithm can be, for example, a cached data replacement algorithm such as Least Recently Used (LRU), First In First Out (FIFO), Least Frequently Used (LFU), or a random replacement algorithm.

[0118] It should be noted that when the access request corresponds to a write operation, the data to be written is written to the corresponding cache space. This means that the peripheral cache data stored in the peripheral cache may be data that has not yet been updated in the peripheral device. Therefore, the data in the peripheral device can be updated by updating the peripheral cache data in the cache space to be replaced to the peripheral device.

[0119] It is understood that the step of updating the peripheral cache data to the peripheral device is essentially a process after the access request has been executed, and therefore does not affect the processing time of the access request. Thus, this embodiment of the application can improve data access efficiency while updating the data of the peripheral device and avoid data errors in the peripheral device.

[0120] In a further optional example, this application embodiment also provides a data prefetching process for prefetching preset data into a peripheral cache before performing data access, thereby reducing the probability of accessing peripheral devices during the data access process and improving data access efficiency. In a specific implementation, this data prefetching process can be executed before step S100 of the data access method or after step S170, that is, before or after an access request is executed, to provide a basis for the execution of subsequent access requests. Specifically, refer to... Figure 5 An optional example diagram of a data prefetching process is shown, including:

[0121] Step S200: The peripheral controller obtains a prefetch request, which is used to request data reading from the address to be prefetched of the peripheral device;

[0122] The prefetch request can be a data prefetching processing task issued by the requester, used to provide a cached data foundation for subsequent data access. The prefetch request can be issued from any data processing device in the host (e.g., processor core, DMA device) and transmitted to the peripheral controller via a bus. The prefetch request can be generated based on software or hardware requirements; software includes programs, operating systems, etc., while hardware includes instruction processing logic in the host.

[0123] The peripheral device can determine the peripheral device indicated in the expected request based on the request information of the prefetch request. It is understood that the request information may include the peripheral device's identification information, request type, request operation information, address to be prefetched, etc.

[0124] When subsequent access to peripheral data of peripheral devices is likely to occur, a prefetch request is issued first to prefetch the potentially accessed data, thereby reducing data access latency and improving data access efficiency. Therefore, issuing a prefetch request indicates that data of peripheral devices may be accessed subsequently.

[0125] It should be noted that, given that the peripheral cache configured for peripheral devices is typically smaller than the storage space of the peripheral device, the prefetch request can select a portion of the peripheral device's data for prefetching. Accordingly, the selected prefetch data can be the data to be prefetched from the address to be prefetched.

[0126] Step S210: The peripheral controller configures the prefetch request to the peripheral cache of the corresponding peripheral device;

[0127] The corresponding data prefetching task is executed by configuring the prefetch request to the peripheral cache of the corresponding peripheral device.

[0128] In a specific implementation, the prefetch request may include corresponding prefetch information, such as the identifier information of the peripheral device requesting prefetching, the address information of the corresponding address to be prefetched, and corresponding operation information. Accordingly, the peripheral controller can configure the prefetch request to the peripheral cache corresponding to the peripheral device based on the prefetch information in the prefetch request.

[0129] Correspondingly, the peripheral cache can obtain the prefetch request.

[0130] Step S220: Based on the prefetch request, the peripheral cache reads the data to be prefetched from the address to be prefetched in the peripheral device and updates the data to be prefetched to the peripheral cache.

[0131] After obtaining the prefetch request, the peripheral cache can determine the peripheral device corresponding to the prefetch request based on the corresponding request information, and then read the data to be prefetched from the address to be prefetched from the peripheral device.

[0132] It should be noted that the data reading process corresponding to the prefetch request can be executed once or multiple times. The number of executions can be determined based on the amount of data to be prefetched and the distribution of its storage location (i.e., the data to be prefetched is distributed in continuous or non-contiguous storage space).

[0133] In specific examples, refer to Figure 6 The diagram shows another alternative example of a data prefetching process, and the corresponding data reading process may include:

[0134] Step S221: The peripheral cache generates a corresponding data read command based on the prefetch request;

[0135] The data read command is used to read peripheral data within the address to be read. There can be one or more data read commands (i.e., at least two). Each data read command corresponds to one address to be read, and the address to be read is at least a portion of the address to be prefetched. When there is only one data read command, the address to be read is the same as the address to be prefetched; when there are multiple data read commands, the address to be read can be a segment of the address to be prefetched, and the addresses to be read in multiple data read commands can be combined into a single address to be prefetched.

[0136] In a specific example, flags can be further configured for the data read command to indicate the processing status of the data read command, such as whether it has been sent or completed.

[0137] Step S222: The peripheral cache selects and sends a data read command to the peripheral device, so that the peripheral device reads and returns the corresponding data to be prefetched based on the data read command.

[0138] When multiple data read commands exist, the peripheral cache can sort the data read commands and issue them sequentially. In a specific example, after selecting and sending a data read command, the flag of that data read command can be further configured to be in a sent state.

[0139] It is understandable that when there are multiple data read commands, the data to be prefetched is only the peripheral data corresponding to the data read command, that is, the peripheral data corresponding to the address to be read.

[0140] Step S223: After acquiring the data to be prefetched, the peripheral device cache updates the acquired data to the cache space of the corresponding peripheral device.

[0141] The cache space may or may not contain free space. When there is no free space in the cache space, during the update process of the acquired data to be prefetched, the data to be prefetched can be replaced in the corresponding cache space based on a preset algorithm. It should be noted that during this data update process, data to be prefetched belonging to the same prefetching task are not replaced with each other.

[0142] In a specific example, this step can further configure the flag of the data reading command to be in a completed state after updating the acquired data to be prefetched into the cache space of the corresponding peripheral device.

[0143] Step S224: The peripheral cache confirms whether the prefetch task corresponding to the prefetch request has been completed;

[0144] Reading all the data to be prefetched can be understood as completing the corresponding prefetching task. The completion of the prefetching task corresponding to the prefetching request can be determined based on the address to be prefetched. If all the peripheral data corresponding to the address to be prefetched has been read, the prefetching task is considered complete; otherwise, it is not. Alternatively, based on the flag of the data read command generated in step S221, it can be determined whether there are any unexecuted data read commands, thus determining whether the prefetching task corresponding to the prefetching request is complete. It is understood that if there are unexecuted data read commands, the prefetching task corresponding to the prefetching request is not complete; if there are no unexecuted data read commands, the prefetching task is complete.

[0145] If not, it indicates that there are still unexecuted commands to be read, and steps S222 to S224 are executed until the prefetch task corresponding to the prefetch request is completed.

[0146] If so, proceed to step S230.

[0147] In step S230, the peripheral cache sends a prefetch task completion message to the peripheral controller.

[0148] By sending back the prefetch task completion message, it is indicated that the data to be prefetched has been prefetched, so that the peripheral controller can forward the prefetch task completion message to the requester after obtaining the prefetch task completion message.

[0149] Step S240: The peripheral controller forwards the prefetch task completion message to the requester.

[0150] The peripheral controller forwards the prefetch task completion message to the requester so that the requester can know that the prefetch task has been completed.

[0151] In a further example of this application, an optional structure for a peripheral cache is also provided, see reference. Figure 7 The diagram illustrates an optional architecture of a computing device, wherein the peripheral cache includes access control logic and cache space.

[0152] The access control logic is used to implement access-related control in the embodiments of this application. Specifically, the access control logic can be used to obtain a pending access request, which requests access to a pending address of a peripheral device; based on the pending access request, determine whether there is pending data corresponding to the pending address in the cache space of the peripheral device; if so, based on the pending access request, perform access to the pending data in the cache space and feed back the access result corresponding to the pending access request to the peripheral controller; if not, send the pending access request to the peripheral device, obtain the access result corresponding to the pending access request fed back by the peripheral device, and forward the access result to the peripheral controller.

[0153] In a further example, the peripheral cache may further include prefetch control logic, which can control the prefetch process. Specifically, the prefetch control logic can be used to obtain a prefetch request, which requests data reading from the address to be prefetched on the peripheral device; based on the prefetch request, the access control logic reads the data to be prefetched from the address to be prefetched on the peripheral device and updates the data to be prefetched to the peripheral cache; and a prefetch task completion message is sent back to the peripheral controller.

[0154] In a specific implementation, the prefetch control logic can control the access control logic to generate a corresponding data read command based on the prefetch request. The generated data read command can be one or more, with each command corresponding to a read address, which is at least a portion of the prefetch address. The access control logic further selects and sends a data read command to a peripheral device, enabling the peripheral device to read and return the corresponding prefetch data based on the command. After acquiring the prefetch data, the access control logic updates the acquired data to the corresponding cache space of the peripheral device. Further, the access control logic confirms whether the prefetch task corresponding to the prefetch request has been completed. If not, the steps of selecting and sending a data read command to the peripheral device, updating the acquired data to the corresponding cache space of the peripheral device after acquisition, and confirming whether the prefetch task corresponding to the prefetch request has been completed are executed until the prefetch task is confirmed to be completed. If yes, the prefetch control logic sends a prefetch task completion message to the peripheral controller.

[0155] In its implementation, the peripheral controller can parse prefetch requests and configure the prefetch control logic for the peripheral cache. For example, the prefetch control logic can control which addresses or address ranges the peripheral cache uses for prefetching data, and the priority, timeout / busy abandonment of corresponding tasks. Accordingly, the prefetch control logic sends a prefetch operation corresponding to the prefetch request to the access control logic. Based on the prefetch operation, the access control logic generates a read command for the peripheral device and writes the data returned by the peripheral device into the cache space. If the prefetch task consists of only one item, the task is terminated; if there are multiple prefetch tasks, the read command is repeatedly sent, and the feedback data is written into the cache space.

[0156] This application also provides a computer device, which may include: at least one peripheral controller, at least one peripheral cache, and at least one peripheral device; the peripheral controller is used to execute the data access method for peripheral controller provided in this application, the peripheral cache is used to execute the data access method for peripheral cache provided in this application, and the peripheral device executes the data access method for peripheral device provided in this application.

[0157] This application embodiment also provides a storage medium storing one or more computer-executable instructions, which are used to execute the data access method for a peripheral controller provided in this application embodiment, and / or execute the data access method for a peripheral cache provided in this application embodiment, and / or execute the data access method for a peripheral device provided in this application embodiment.

[0158] This application also provides a computer program including one or more computer-executable instructions. When the one or more computer-executable instructions are executed, they implement the data access method for peripheral cache as provided in this application, and / or implement the data access method for peripheral controller as provided in this application, and / or implement the data access method for peripheral device as provided in this application.

[0159] The foregoing describes multiple embodiment schemes provided by the embodiments of this application. The optional methods described in each embodiment scheme can be combined and cross-referenced with each other without conflict, thereby extending to a variety of possible embodiment schemes. These can all be considered as the embodiment schemes disclosed and published by the embodiments of this application.

[0160] While the embodiments disclosed above are described in this application, this application is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of this application; therefore, the scope of protection of this application should be determined by the scope defined in the claims.

Claims

1. A data access method, characterized in that, Applied to peripheral device caching, the peripheral device caching is configured between the peripheral controller and the peripheral device, and is used to provide data caching space for the peripheral device, including: Obtain a prefetch request, the prefetch request being used to request data reading from the address to be prefetched of a peripheral device; Based on the prefetch request, the data to be prefetched at the address to be prefetched is read from the peripheral device, and the data to be prefetched is updated to the peripheral cache; Send a message indicating that the prefetching task is complete to the peripheral controller; Obtain pending access requests, which are used to request access to the address of the peripheral device to be accessed; Based on the pending access request, determine whether there is data to be accessed corresponding to the address to be accessed in the cache space of the peripheral device; If so, based on the pending access request, the access to the data to be accessed is performed in the cache space, and the access result corresponding to the pending access request is fed back to the peripheral controller; If not, send the pending access request to the peripheral device, obtain the access result corresponding to the pending access request from the peripheral device, and forward the access result to the peripheral controller; The step of reading the data to be prefetched from the address to be prefetched in the peripheral device based on the prefetch request, and updating the data to be prefetched in the peripheral device cache, includes: Based on the prefetch request, a corresponding data read command is generated; wherein, the generated data read command is one or more, and each data read command corresponds to a read address, wherein the read address is at least a part of the prefetch address; Select and send a data read command to the peripheral device, so that the peripheral device can read and return the corresponding data to be prefetched based on the data read command; After acquiring the data to be prefetched, the acquired data to be prefetched is updated in the cache space of the corresponding peripheral device; Confirm whether the prefetching task corresponding to the prefetching request has been completed; If not, the step of selecting and sending a data read command to the peripheral device is executed, and the step of updating the acquired data to be prefetched to the cache space of the corresponding peripheral device after acquiring the data to be prefetched, and the step of confirming whether the prefetching task corresponding to the prefetching request is completed, continues until the prefetching task corresponding to the prefetching request is confirmed to be completed. If so, execute the step of sending the feedback prefetch task completion message to the peripheral controller.

2. The method according to claim 1, characterized in that, The step of determining whether the data to be accessed corresponding to the address to be accessed exists in the cache space of the peripheral device based on the access request to be processed includes: Based on the request information of the pending access request, determine the peripheral device corresponding to the pending access request; Determine the preset cache partition corresponding to the peripheral device; Determine whether the data to be accessed corresponding to the address to be accessed exists in the preset cache partition.

3. The method according to claim 1, characterized in that, If the access operation corresponding to the pending access request is a read operation, the step of accessing the data to be accessed in the cache space based on the pending access request and feeding back the access result corresponding to the pending access request to the peripheral controller is specifically: reading the data to be accessed from the cache space and feeding back the read data to be accessed as the access result to the peripheral controller.

4. The method according to claim 1, characterized in that, If the access operation corresponding to the pending access request is a write operation, the step of accessing the data to be accessed in the cache space based on the pending access request and feeding back the access result corresponding to the pending access request to the peripheral controller is as follows: writing the data to be written at the position of the data to be accessed in the cache space, and feeding back the successful writing feedback message as the access result to the peripheral controller.

5. The method according to claim 4, characterized in that, After sending a successful write feedback message to the requester as an access result, when the data to be written is replaced in the peripheral cache with data at other addresses of the peripheral device, the process further includes: updating the data to be written to the address corresponding to the peripheral device.

6. The method according to claim 1, characterized in that, After the step of obtaining the access result corresponding to the pending access request fed back by the peripheral device and forwarding the access result to the peripheral controller, the method further includes: The system determines the data to be accessed from the obtained access results and caches the data to be accessed in the cache space of the corresponding peripheral device.

7. The method according to claim 6, characterized in that, In the step of caching the data to be accessed to the cache space of the corresponding peripheral device, the data to be accessed is cached to the cache space of the peripheral device based on a cache replacement mechanism; The cache replacement mechanism includes storing the data to be accessed into the free space when there is free space in the cache space corresponding to the peripheral device; When there is no free space in the cache space corresponding to the peripheral device, a cache space to be replaced is selected based on a preset algorithm that meets the preset conditions. The data to be accessed is stored in the cache space to be replaced, and the peripheral cache data in the cache space to be replaced is updated to the peripheral device.

8. The method according to claim 1, characterized in that, The step of generating a corresponding data read command based on the prefetch request further includes configuring an identifier bit for the data read command to indicate the processing status of the data read command. In the step of selecting and sending a data read command to the peripheral device, the flag bit of the data read command is also configured to be in a sent state; In the step of updating the acquired data to be prefetched to the cache space of the corresponding peripheral device after acquiring the data to be prefetched, the flag bit of the data reading command is also configured to be in a completed state. In the step of confirming whether the prefetch task corresponding to the prefetch request has been completed, the identifier bit of the data read command is used to determine whether there is a data read command that has not yet been executed, so as to determine whether the prefetch task corresponding to the prefetch request has been completed.

9. A data access method, characterized in that, Applications to peripheral controllers, including: Obtain pending access requests, which are used to request access to the address of the peripheral device to be accessed; The pending access request is configured to the peripheral cache of the corresponding peripheral device, so that the peripheral cache executes the data access method according to any one of claims 1-8; Obtain the access result of the peripheral device cache and send the access result back to the requester.

10. The method according to claim 9, characterized in that, Before obtaining the access request to be processed, the process also includes: Obtain a prefetch request, the prefetch request being used to request data reading from the address to be prefetched of a peripheral device; The prefetch request is configured to the peripheral cache of the corresponding peripheral device, so that the peripheral cache performs the data access method according to any one of claims 1-8; After obtaining the prefetch task completion message, the prefetch task completion message is forwarded to the requester.

11. A data access method, characterized in that, Applied to peripheral devices, including: The peripheral device cache retrieves pending access requests, which are used to request access to the address to be accessed of the peripheral device; the peripheral device cache is used to execute the data access method according to any one of claims 1-8; Based on the pending access request, the access to the data to be accessed is performed, and the access result is fed back to the peripheral cache.

12. The method according to claim 11, characterized in that, If the access operation corresponding to the pending access request is a read operation, the step of performing access to the data to be accessed based on the pending access request and feeding back the access result to the peripheral cache is as follows: based on the pending access request, read the data to be accessed at the corresponding address to be accessed, and feed back the read data to be accessed as the access result to the peripheral cache.

13. The method according to claim 11, characterized in that, If the access operation corresponding to the pending access request is a write operation, the step of performing access to the data to be accessed based on the pending access request and feeding back the access result to the peripheral cache is as follows: based on the pending access request, write the data to be written into the space corresponding to the address to be accessed on the peripheral device, and feed back the successful write feedback message as the access result to the peripheral cache.

14. A peripheral cache, characterized in that, The peripheral cache is configured between the peripheral controller and the peripheral device. The peripheral cache is used to provide data caching space for the peripheral device, including prefetch control logic, access control logic and cache space. The prefetch control logic is used to obtain a prefetch request, which requests to read data from the address to be prefetched of the peripheral device; based on the prefetch request, the control access control logic reads the data to be prefetched from the address to be prefetched in the peripheral device and updates the data to be prefetched to the peripheral device cache; Send a message indicating that the prefetching task is complete to the peripheral controller; The access control logic is used to obtain access requests to be processed, and the access requests to be processed are used to request access to the address of the peripheral device to be accessed; Based on the pending access request, determine whether there is data to be accessed corresponding to the address to be accessed in the cache space of the peripheral device; if yes, based on the pending access request, perform access to the data to be accessed in the cache space, and feed back the access result corresponding to the pending access request to the peripheral controller; if no, send the pending access request to the peripheral device, obtain the access result corresponding to the pending access request fed back by the peripheral device, and forward the access result to the peripheral controller. The step of reading the data to be prefetched from the address to be prefetched in the peripheral device based on the prefetch request, and updating the data to be prefetched in the peripheral device cache, includes: Based on the prefetch request, a corresponding data read command is generated; wherein, the generated data read command is one or more, and each data read command corresponds to a read address, wherein the read address is at least a part of the prefetch address; Select and send a data read command to the peripheral device, so that the peripheral device can read and return the corresponding data to be prefetched based on the data read command; After acquiring the data to be prefetched, the acquired data to be prefetched is updated in the cache space of the corresponding peripheral device; Confirm whether the prefetching task corresponding to the prefetching request has been completed; If not, the step of selecting and sending a data read command to the peripheral device is executed, and the step of updating the acquired data to be prefetched to the cache space of the corresponding peripheral device after acquiring the data to be prefetched, and the step of confirming whether the prefetching task corresponding to the prefetching request is completed, continues until the prefetching task corresponding to the prefetching request is confirmed to be completed. If so, execute the step of sending the feedback prefetch task completion message to the peripheral controller.

15. A computing device, characterized in that, include: At least one peripheral controller, at least one peripheral cache, and at least one peripheral device; the peripheral controller is used to execute the data access method of claim 9 or 10, the peripheral cache is used to execute the data access method of any one of claims 1-8, and the peripheral device executes the data access method of any one of claims 11-13.

16. A storage medium, characterized in that, The storage medium stores one or more computer-executable instructions, which are computer-executable according to any one of claims 1-8, and / or according to any one of claims 9-10, and / or according to any one of claims 11-13.

17. A computer program, characterized in that, It includes one or more computer-executable instructions, which, when executed, implement the data access method as described in any one of claims 1-8, and / or implement the data access method as described in any one of claims 10-11, and / or implement the data access method as described in any one of claims 11-13.

Citation Information

Patent Citations

  • Data access method and device, electronic equipment and storage medium

    CN115408431A

  • Transparent host-side caching of virtual disks located on shared storage

    US20140059292A1