Information acquisition method, device and electronic device
Through parallel query and priority determination methods in cache cache, the problems of information acquisition time and power consumption are solved, and faster and more efficient information acquisition is achieved.
Patent Information
- Application Number
- CN202111044239.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-07
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2041-09-07
AI Technical Summary
In the prior art, the information acquisition time is long and consumes a lot of power, especially when querying information in cache cache.
The information to be obtained is queried in parallel in the cache cache, and the candidate cache with the highest priority is determined based on the amount of stored information, and information is obtained from the sub cache to shorten the information acquisition time and reduce power consumption.
Through parallel query and priority determination methods, the information acquisition speed is effectively improved, the information acquisition time is shortened, the required power consumption is reduced, and the information acquisition efficiency and convenience are improved.
Smart Images

Figure CN113836053B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer application technology, and in particular to an information acquisition method, device, electronic device and storage medium. Background Art
[0002] At present, cache memory has advantages such as fast access speed and is widely used to store memory information. When the central processing unit (CPU) needs to obtain memory information, it can first query in the cache. If the cache stores the memory information to be obtained, the memory information is obtained from the cache, and the information can be obtained without accessing the memory. However, the information acquisition method in the related art has the problem of long information acquisition time and high power consumption. Summary of the invention
[0003] The present application aims to solve, at least to a certain extent, one of the technical problems in the related art that information acquisition takes a long time and consumes a lot of power.
[0004] To this end, the first aspect of the present application proposes an information acquisition method, which can query the information to be acquired in parallel in multiple sub-caches in a cache memory cache based on the identification information of the information to be acquired. The parallel query effectively improves the query speed of the cache, and can determine the candidate sub-cache with the highest priority as the first target sub-cache. The candidate sub-cache is the sub-cache that stores the information to be acquired, and the information to be stored is acquired from the first target sub-cache. The information to be acquired can be acquired from the candidate sub-cache with the least amount of stored information, which effectively shortens the time for obtaining information, reduces the power consumption required for obtaining information, and makes obtaining information more convenient and quick.
[0005] A second aspect of the present application provides an information acquisition device.
[0006] A third aspect of the present application provides an electronic device.
[0007] The fourth aspect of the present application provides a computer-readable storage medium.
[0008] The first aspect of the present application proposes an information acquisition method, including: acquiring identification information of information to be acquired; querying the information to be acquired in parallel in multiple sub-caches in a cache memory cache based on the identification information; in response to the existence of at least one candidate sub-cache storing the information to be acquired, acquiring the priority of the candidate sub-cache, determining the candidate sub-cache with the highest priority as a first target sub-cache, wherein the priority of the sub-cache is negatively correlated with the amount of information stored; and acquiring the information to be acquired from the first target sub-cache.
[0009] According to the information acquisition method of the embodiment of the present application, the information to be acquired can be queried in parallel in multiple sub-caches in the cache memory cache based on the identification information of the information to be acquired. The parallel query effectively improves the query speed of the cache, and can determine the candidate sub-cache with the highest priority as the first target sub-cache. The candidate sub-cache is the sub-cache that stores the information to be acquired, and the information to be stored is acquired from the first target sub-cache. The information to be acquired can be acquired from the candidate sub-cache that stores the least amount of information, which effectively shortens the time for obtaining information, reduces the power consumption required for obtaining information, and makes obtaining information more convenient and quick.
[0010] In addition, the information acquisition method according to the above embodiment of the present application may also have the following additional technical features:
[0011] In one embodiment of the present application, after acquiring the information to be acquired from the first target sub-cache, the method further includes: storing the information to be acquired in each second target sub-cache, where the second target sub-cache is the sub-cache that does not store the information to be acquired.
[0012] In one embodiment of the present application, after obtaining the information to be obtained from the first target sub-cache, it also includes: determining the candidate sub-cache with the lowest priority as the third target sub-cache; querying the information to be stored in the third target sub-cache based on the identification information, and the information to be stored includes at least the information to be obtained; storing the queried information to be stored in each second target sub-cache, and the second target sub-cache is the sub-cache that does not store the information to be obtained.
[0013] In one embodiment of the present application, the method further includes: in response to any of the sub-cache not storing the information to be acquired, querying the information to be acquired in the memory based on the identification information, and acquiring the queried information to be acquired.
[0014] In one embodiment of the present application, after obtaining the queried information to be obtained, the method further includes: storing the queried information to be obtained in each of the sub-caches.
[0015] In one embodiment of the present application, after obtaining the queried information to be obtained, it also includes: querying the memory for information to be stored based on the identification information, and the information to be stored includes at least the information to be obtained; storing the queried information to be stored in each of the sub-cache.
[0016] In one embodiment of the present application, the queried information to be stored is stored in each of the sub-caches, including: sorting the multiple sub-caches from low to high according to priority; storing the queried information to be stored in the sub-cache ranked first, and storing part of the queried information to be stored as first information to be stored in the sub-cache ranked second, and storing part of the first information to be stored as second information to be stored in the sub-cache ranked third, until the storage of the last-ranked sub-cache is completed, wherein the first information to be stored and the second information to be stored at least include the information to be obtained.
[0017] In one embodiment of the present application, the cache includes a first sub-cache and a second sub-cache, the first sub-cache is a memory on a chip, the second sub-cache is a hardware register on a chip, and the priority of the second sub-cache is higher than that of the first sub-cache.
[0018] In one embodiment of the present application, the information to be acquired includes pixel information of pixels in an image, and the identification information includes position information of the pixels.
[0019] The second aspect of the present application proposes an information acquisition device, including: a first acquisition module, used to acquire identification information of information to be acquired; a query module, used to query the information to be acquired in parallel in multiple sub-caches in a cache memory cache based on the identification information; a determination module, used to obtain the priority of the candidate sub-cache in response to the existence of at least one candidate sub-cache storing the information to be acquired, and determine the candidate sub-cache with the highest priority as the first target sub-cache, wherein the priority of the sub-cache is negatively correlated with the amount of stored information; a second acquisition module, used to acquire the information to be acquired from the first target sub-cache.
[0020] The information acquisition device of the embodiment of the present application can query the information to be acquired in parallel in multiple sub-caches in the cache memory cache based on the identification information of the information to be acquired. The parallel query effectively improves the query speed of the cache, and can determine the candidate sub-cache with the highest priority as the first target sub-cache. The candidate sub-cache is the sub-cache that stores the information to be acquired, and the information to be stored is acquired from the first target sub-cache. The information to be acquired can be acquired from the candidate sub-cache with the least amount of stored information, which effectively shortens the time for acquiring information, reduces the power consumption required for acquiring information, and makes acquiring information more convenient and quick.
[0021] In addition, the information acquisition device according to the above embodiment of the present application may also have the following additional technical features:
[0022] In one embodiment of the present application, the device further includes: a first storage module, the first storage module being configured to: store the information to be acquired in each second target sub-cache, the second target sub-cache being the sub-cache that does not store the information to be acquired.
[0023] In one embodiment of the present application, the device also includes: a second storage module, the second storage module is used to: determine the candidate sub-cache with the lowest priority as the third target sub-cache; query the information to be stored in the third target sub-cache based on the identification information, and the information to be stored includes at least the information to be obtained; store the queried information to be stored in each second target sub-cache, and the second target sub-cache is the sub-cache that does not store the information to be obtained.
[0024] In one embodiment of the present application, the query module is further used to: in response to any of the sub-cache not storing the information to be obtained, query the information to be obtained in the memory based on the identification information, and obtain the queried information to be obtained.
[0025] In one embodiment of the present application, the device further includes: a third storage module, and the third storage module is used to: store the queried information to be acquired in each of the sub-cache.
[0026] In one embodiment of the present application, the device also includes: a fourth storage module, and the fourth storage module is used to: query the information to be stored in the memory based on the identification information, and the information to be stored at least includes the information to be obtained; and store the queried information to be stored in each of the sub-cache.
[0027] In one embodiment of the present application, the second storage module or the fourth storage module is also used to: sort the multiple sub-caches from low to high priority; store the queried information to be stored in the sub-cache ranked first, and store part of the queried information to be stored as first information to be stored in the sub-cache ranked second, and store part of the first information to be stored as second information to be stored in the sub-cache ranked third, until the storage of the last-ranked sub-cache is completed, wherein the first information to be stored and the second information to be stored at least include the information to be obtained.
[0028] In one embodiment of the present application, the cache includes a first sub-cache and a second sub-cache, the first sub-cache is a memory on a chip, the second sub-cache is a hardware register on a chip, and the priority of the second sub-cache is higher than that of the first sub-cache.
[0029] In one embodiment of the present application, the information to be acquired includes pixel information of pixels in an image, and the identification information includes position information of the pixels.
[0030] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the information acquisition method as described in the first aspect of the present application is implemented.
[0031] The electronic device of the embodiment of the present application can execute a computer program stored in the memory through the processor, and can query the information to be obtained in parallel in multiple sub-caches in the cache memory cache based on the identification information of the information to be obtained. The parallel query effectively improves the query speed of the cache, and can determine the candidate sub-cache with the highest priority as the first target sub-cache. The candidate sub-cache is the sub-cache that stores the information to be obtained, and obtains the information to be stored from the first target sub-cache, that is, the information to be obtained can be obtained from the candidate sub-cache that stores the least amount of information, which effectively shortens the time for obtaining information, reduces the power consumption required for obtaining information, and makes obtaining information more convenient and quick.
[0032] The fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the information acquisition method as described in the first aspect of the present application is implemented.
[0033] The computer-readable storage medium of the embodiment of the present application, by storing a computer program and being executed by a processor, can query the information to be obtained in parallel in multiple sub-caches in the cache memory cache based on the identification information of the information to be obtained. The parallel query effectively improves the query speed of the cache, and can determine that the candidate sub-cache with the highest priority is the first target sub-cache. The candidate sub-cache is the sub-cache that stores the information to be obtained, and the information to be stored is obtained from the first target sub-cache, that is, the information to be obtained is obtained from the candidate sub-cache that stores the least amount of information, which effectively shortens the time for obtaining information, reduces the power consumption required for obtaining information, and makes obtaining information more convenient and quick.
[0034] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0036] Figure 1 A schematic diagram of a flow chart of an information acquisition method according to an embodiment of the present application;
[0037] Figure 2 This is a schematic diagram of a process after obtaining the information to be obtained from the first target sub-cache in the information obtaining method according to an embodiment of the present application;
[0038] Figure 3 A schematic diagram of a flow chart after obtaining the queried information to be obtained in the information obtaining method according to an embodiment of the present application;
[0039] Figure 4 A flowchart of an information acquisition method according to a specific example of the present application;
[0040] Figure 5 is a schematic diagram of the structure of an information acquisition device according to an embodiment of the present application; and
[0041] Figure 6 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0042] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0043] The following describes the information acquisition method, device, electronic device and storage medium of the embodiments of the present application with reference to the accompanying drawings.
[0044] Figure 1 The figure is a flowchart of an information acquisition method according to an embodiment of the present application.
[0045] like Figure 1 As shown, the information acquisition method of the embodiment of the present application includes:
[0046] S101, obtaining identification information of information to be obtained.
[0047] It should be noted that the execution subject of the information acquisition method of the embodiment of the present application may be an information acquisition device, and the information acquisition device of the embodiment of the present application may be configured in any electronic device so that the electronic device can execute the information acquisition method of the embodiment of the present application. Among them, the electronic device may be a personal computer (PC), a cloud device, a mobile device, etc., and the mobile device may be, for example, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, a vehicle-mounted device, and other hardware devices with various operating systems, touch screens, and / or display screens. In one embodiment, the execution subject of the information acquisition method of the embodiment of the present application may be a central processing unit (CPU).
[0048] In the embodiment of the present application, the information to be acquired has identification information for distinguishing different information to be acquired. It should be noted that there are no excessive restrictions on the types of the information to be acquired and the identification information.
[0049] In one implementation, in an image transformation application scenario, the information to be acquired may include pixel information of pixels in the image, and the identification information may include position information of the pixels.
[0050] In one implementation, in a speech synthesis application scenario, the information to be acquired may include text information, and the identification information may include speaker identification information (such as speaker name, account number, etc.).
[0051] S102, querying multiple sub-caches in the cache memory cache in parallel for information to be acquired based on the identification information.
[0052] In the embodiment of the present application, the cache memory cache has a plurality of sub-caches. It should be noted that there is no excessive limitation on the number of sub-caches, for example, the number of sub-caches may be 2.
[0053] In one implementation, the cache includes a first sub-cache and a second sub-cache, the first sub-cache is a memory on a chip, and the second sub-cache is a hardware register on the chip.
[0054] Optionally, the storage capacity of the first sub-cache is greater than the storage capacity of the second sub-cache, the first sub-cache obtains and stores the cache information of the first storage unit from the memory at one time, and the second sub-cache obtains and stores the cache information of the second storage unit from the memory or the first sub-cache at one time. The size of the first storage unit is greater than the size of the second storage unit, and the sizes of the first storage unit and the second storage unit are not excessively limited, for example, the first storage unit is 64 bits (bit) and the second storage unit is 8 bits.
[0055] Optionally, the amount of information stored in the first sub-cache is greater than the amount of information stored in the second sub-cache. In one embodiment, the information to be stored may be obtained from the memory, and the information to be stored may be stored in the first sub-cache, and part of the information to be stored may be stored in the second sub-cache. For example, the 64-bit pixel information of pixel point A may be obtained from the memory, the 64-bit pixel information of pixel point A may be stored in the first sub-cache, 8-bit pixel information may be filtered out from the 64-bit pixel information of pixel point A, and the filtered 8-bit pixel information of pixel point A may be stored in the second sub-cache.
[0056] In an embodiment of the present application, multiple sub-caches in the cache may be queried in parallel for information to be acquired based on identification information, that is, multiple sub-caches may be queried in parallel for information to be acquired based on identification information. Continuing with the example of a cache including a first sub-cache and a second sub-cache, information to be acquired may be queried in parallel in the first sub-cache and the second sub-cache based on identification information.
[0057] In one embodiment, the identification information of the information to be obtained has a corresponding relationship with the storage location of the information to be obtained in the sub-cache. It is understandable that the storage locations of the same sub-cache corresponding to different identification information of the information to be obtained may be different, and the storage locations of different sub-caches corresponding to the identification information of the same information to be obtained may be different. Querying the information to be obtained in the sub-cache based on the identification information may include determining the storage location of the sub-cache corresponding to the identification information of the information to be obtained based on the above-mentioned corresponding relationship, and querying the information to be obtained at the storage location of the sub-cache.
[0058] S103, in response to the existence of at least one candidate sub-cache storing information to be obtained, obtaining priorities of the candidate sub-caches, and determining the candidate sub-cache with the highest priority as the first target sub-cache, wherein the priority of the sub-cache is negatively correlated with the amount of stored information.
[0059] In the embodiment of the present application, the sub-cache may store the information to be obtained, or may not store the information to be obtained.
[0060] In an embodiment of the present application, a priority may be set for a sub-cache in advance, and the priority of the sub-cache is negatively correlated with the amount of information stored. Continuing to take the example that the cache includes a first sub-cache and a second sub-cache, the amount of information stored in the first sub-cache is greater than the amount of information stored in the second sub-cache, and the priority of the second sub-cache is higher than the priority of the first sub-cache.
[0061] In an embodiment of the present application, in response to the existence of at least one candidate sub-cache storing information to be acquired, the priority of the candidate sub-cache can be obtained, and the candidate sub-cache with the highest priority can be determined as the first target sub-cache, that is, the candidate sub-cache storing the least amount of information can be determined as the first target sub-cache, and the first target sub-cache stores the information to be acquired.
[0062] It is understandable that the number of candidate sub-caches may be one or more, and no further limitation is given here.
[0063] S104: Obtain the information to be obtained from the first target sub-cache.
[0064] In the embodiment of the present application, the information to be acquired may be acquired from the first target sub-cache, that is, the information to be acquired may be acquired from the candidate sub-cache storing the least amount of information.
[0065] Continuing with the example that the cache includes the first sub-cache and the second sub-cache, the priority of the second sub-cache is higher than the priority of the first sub-cache. If the first sub-cache and the second sub-cache store information to be acquired, the second sub-cache is determined to be the first target sub-cache, and the information to be acquired is acquired from the first target sub-cache. Therefore, when the first sub-cache and the second sub-cache both store information to be acquired, the method preferentially acquires the information to be acquired from the second sub-cache, which can reduce the number of operations on the first sub-cache and help reduce power consumption.
[0066] Alternatively, in response to the first sub-cache storing the information to be obtained and the second sub-cache not storing the information to be obtained, the first sub-cache is determined to be the first target sub-cache, and the information to be obtained is obtained from the first target sub-cache. Thus, when the first sub-cache stores the information to be obtained and the second sub-cache does not store the information to be obtained, the method can obtain the information to be obtained from the first sub-cache.
[0067] In one embodiment, the identification information of the information to be obtained has a corresponding relationship with the storage location of the information to be obtained in the sub-cache. Acquiring the information to be obtained from the first target sub-cache may include determining the storage location of the first target sub-cache corresponding to the identification information of the information to be obtained based on the corresponding relationship, and acquiring the information to be obtained at the storage location of the first target sub-cache.
[0068] In summary, according to the information acquisition method of the embodiment of the present application, the information to be acquired can be queried in parallel in multiple sub-caches in the cache memory cache based on the identification information of the information to be acquired. The parallel query effectively improves the query speed of the cache, and can determine the candidate sub-cache with the highest priority as the first target sub-cache. The candidate sub-cache is the sub-cache that stores the information to be acquired, and the information to be stored is acquired from the first target sub-cache. The information to be acquired can be acquired from the candidate sub-cache with the least amount of stored information, which effectively shortens the time for information acquisition, reduces the power consumption required for information acquisition, and makes it more convenient and quick to acquire information.
[0069] Based on any of the above embodiments, after obtaining the information to be obtained from the first target sub-cache in step S104, the step may include storing the information to be obtained in each second target sub-cache, where the second target sub-cache is a sub-cache that does not store the information to be obtained.
[0070] Continuing with the example of a cache including a first sub-cache and a second sub-cache, in response to the first sub-cache storing information to be obtained and the second sub-cache not storing the information to be obtained, it can be determined that the first sub-cache is the first target sub-cache and the second sub-cache is the second target sub-cache, and the information to be obtained is obtained from the first sub-cache and stored in the second sub-cache.
[0071] Therefore, the method can store the information to be obtained in each sub-cache that does not store the information to be obtained, and can update the cache information of the sub-cache in real time, which helps to improve the query hit rate of the sub-cache.
[0072] Based on any of the above embodiments, Figure 2As shown, after obtaining the information to be obtained from the first target sub-cache in step S104, the following may be included:
[0073] S201: Determine a candidate sub-cache with the lowest priority as a third target sub-cache.
[0074] In an embodiment of the present application, the candidate sub-cache with the lowest priority may be determined as the third target sub-cache, that is, the candidate sub-cache storing the largest amount of information may be determined as the third target sub-cache, and the third target sub-cache stores the information to be acquired.
[0075] Taking the cache including the first sub-cache, the second sub-cache, the third sub-cache and the fourth sub-cache as an example, the priorities of the first sub-cache, the second sub-cache, the third sub-cache and the fourth sub-cache are increased in sequence. If, in response to the first sub-cache and the second sub-cache storing information to be obtained, and the third sub-cache and the fourth sub-cache do not store information to be obtained, then at this time, it can be determined that the first sub-cache and the second sub-cache are candidate sub-caches, and the first sub-cache is the third target sub-cache.
[0076] S202: Search the third target sub-cache for information to be stored based on the identification information, where the information to be stored at least includes information to be obtained.
[0077] In an embodiment of the present application, the information to be stored can be queried in the third target sub-cache based on the identification information, and the information to be stored at least includes the information to be acquired. For example, the information to be acquired can be 8-bit pixel information of pixel point A, and the 64-bit pixel information of pixel point A can be queried in the third target sub-cache based on the position information of pixel point A, and the 64-bit pixel information of pixel point A includes the above-mentioned 8-bit pixel information of pixel point A, and the 64-bit pixel information of pixel point A is used as the information to be stored.
[0078] In one embodiment, the identification information of the information to be acquired has a corresponding relationship with the storage location of the information to be stored in the sub-cache. For example, the identification information of the information to be stored is the same as the identification information of the information to be acquired. It is understandable that the information to be stored corresponding to the identification information of different information to be acquired may have different storage locations in the same sub-cache, and the information to be stored corresponding to the identification information of the same information to be acquired may have different storage locations in different sub-caches. Querying the information to be stored in the third target sub-cache based on the identification information may include determining the storage location of the information to be stored corresponding to the identification information of the information to be acquired in the third target sub-cache based on the above-mentioned corresponding relationship, and querying the information to be stored at the storage location of the third target sub-cache.
[0079] S203: Store the retrieved information to be stored in each second target sub-cache, where the second target sub-cache is a sub-cache that does not store the information to be obtained.
[0080] Continuing with the example of a cache including a first sub-cache, a second sub-cache, a third sub-cache, and a fourth sub-cache, the priorities of the first sub-cache, the second sub-cache, the third sub-cache, and the fourth sub-cache are increased in sequence. If, in response to the first sub-cache and the second sub-cache storing information to be acquired, and the third sub-cache and the fourth sub-cache not storing information to be acquired, then at this time, the first sub-cache and the second sub-cache can be determined as candidate sub-caches, and the first sub-cache can be determined as the third target sub-cache, and the third sub-cache and the fourth sub-cache can also be determined as the second target sub-cache.
[0081] Further, the information to be stored may be searched in the first sub-cache based on the identification information, the information to be stored at least includes the information to be obtained, and the information to be stored is stored in the third sub-cache and the fourth sub-cache.
[0082] Therefore, the method can determine that the candidate sub-cache with the lowest priority is the third target sub-cache, and query the information to be stored in the third target sub-cache based on the identification information, where the information to be stored at least includes the information to be obtained, and store the queried information to be stored in each sub-cache that does not store the information to be obtained. Compared with only storing the information to be obtained in each sub-cache that does not store the information to be obtained, more cached information can be updated to the sub-cache, which helps to improve the query hit rate of the sub-cache.
[0083] Based on any of the above embodiments, after the multiple sub-caches in the cache memory cache are searched in parallel for the information to be obtained based on the identification information in step S102, it may also include, in response to any sub-cache not storing the information to be obtained, searching the memory for the information to be obtained based on the identification information, and obtaining the queried information to be obtained.
[0084] Continuing with the example that the cache includes a first sub-cache and a second sub-cache, if the first sub-cache and the second sub-cache do not store the information to be obtained, the information to be obtained can be queried in the memory based on the identification information, and the queried information to be obtained can be obtained.
[0085] In one embodiment, the identification information of the information to be acquired has a corresponding relationship with the storage location of the information to be acquired in the memory. It is understandable that the storage location of the memory corresponding to the identification information of different information to be acquired may be different. Querying the information to be acquired in the memory based on the identification information may include determining the storage location of the memory corresponding to the identification information of the information to be acquired based on the above-mentioned corresponding relationship, and querying the information to be acquired at the storage location in the memory.
[0086] Therefore, when any sub-cache does not store the information to be obtained, the method can query the information to be obtained in the memory based on the identification information, and obtain the queried information to be obtained from the memory.
[0087] On the basis of any of the above embodiments, after obtaining the queried information to be obtained, the method may further include storing the queried information to be obtained in each sub-cache.
[0088] Continuing with the example of a cache including a first sub-cache and a second sub-cache, if in response to the fact that neither the first sub-cache nor the second sub-cache stores the information to be obtained, the information to be obtained can be queried in the memory based on the identification information, and the queried information to be obtained can be obtained, and the queried information to be obtained can be stored in the first sub-cache and the second sub-cache respectively.
[0089] Therefore, the method can store the information to be obtained from the memory in each sub-cache, and can update the cache information of the sub-cache in real time, which helps to improve the query hit rate of the sub-cache.
[0090] Based on any of the above embodiments, Figure 3 As shown, after obtaining the queried information to be obtained, it also includes:
[0091] S301, searching the memory for information to be stored based on identification information, where the information to be stored at least includes information to be obtained.
[0092] In an embodiment of the present application, the information to be stored can be queried in the memory based on the identification information, and the information to be stored includes at least the information to be acquired. For example, the information to be acquired can be the 8-bit pixel information of pixel point A, and the 64-bit pixel information of pixel point A can be queried in the memory based on the position information of pixel point A, and the 64-bit pixel information of pixel point A includes the above-mentioned 8-bit pixel information of pixel point A, and the 64-bit pixel information of pixel point A is used as the information to be stored.
[0093] In one embodiment, the identification information of the information to be acquired has a corresponding relationship with the storage location of the information to be stored in the memory. For example, the identification information of the information to be stored is the same as the identification information of the information to be acquired. It is understandable that the storage locations of the information to be stored in the memory corresponding to the identification information of different information to be acquired may be different. Querying the information to be stored in the memory based on the identification information may include determining the storage location of the information to be stored in the memory corresponding to the identification information of the information to be acquired based on the above-mentioned corresponding relationship, and querying the information to be stored at the storage location in the memory.
[0094] S302: Store the retrieved information to be stored in each sub-cache.
[0095] Continuing with the example of a cache including a first sub-cache and a second sub-cache, if in response to the fact that neither the first sub-cache nor the second sub-cache stores information to be obtained, the information to be stored can be queried in the memory based on the identification information, and the information to be stored at least includes the information to be obtained, and the queried information to be stored is stored in the first sub-cache and the second sub-cache, respectively.
[0096] Therefore, this method can store the information to be stored retrieved from the memory in each sub-cache. Compared with only storing the information to be obtained in each sub-cache, more cache information can be updated to the sub-cache, which helps to improve the query hit rate of the sub-cache.
[0097] Based on any of the above embodiments, storing the queried information to be stored in each sub-cache may include sorting multiple sub-caches from low to high priority, storing the queried information to be stored in the first-ranked sub-cache, and storing part of the queried information to be stored as first information to be stored in the second-ranked sub-cache, and storing part of the first information to be stored as second information to be stored in the third-ranked sub-cache, until the storage of the last-ranked sub-cache is completed, wherein the first information to be stored and the second information to be stored at least include information to be obtained.
[0098] Continuing with the example that the cache includes the first sub-cache, the second sub-cache, the third sub-cache, and the fourth sub-cache, the priorities of the first sub-cache, the second sub-cache, the third sub-cache, and the fourth sub-cache are increased in sequence. If, in response to the first sub-cache, the second sub-cache, the third sub-cache, and the fourth sub-cache not storing information to be obtained, the information to be stored can be queried in the memory based on the identification information, and the information to be stored at least includes the information to be obtained.
[0099] Furthermore, multiple sub-caches can be sorted from low to high according to priority, and the sorting result is the first sub-cache, the second sub-cache, the third sub-cache, and the fourth sub-cache. The queried information to be stored can be stored in the first sub-cache, and part of the queried information to be stored can be stored in the second sub-cache as the first information to be stored, and part of the first information to be stored can be stored in the third sub-cache as the second information to be stored, and part of the second information to be stored can be stored in the fourth sub-cache as the third information to be stored.
[0100] Alternatively, in response to the first sub-cache and the second sub-cache storing information to be obtained, and the third sub-cache and the fourth sub-cache not storing information to be obtained, then at this time it can be determined that the first sub-cache and the second sub-cache are candidate sub-caches, and the first sub-cache is the third target sub-cache, and it can also be determined that the third sub-cache and the fourth sub-cache are the second target sub-cache, then the information to be stored can be queried in the first sub-cache based on the identification information, and the information to be stored at least includes the information to be obtained.
[0101] Furthermore, the third sub-cache and the fourth sub-cache may be sorted from low to high priority, and the sorting result is the third sub-cache and the fourth sub-cache. The queried information to be stored may be stored in the third sub-cache, and part of the queried information to be stored may be stored in the fourth sub-cache as the first information to be stored.
[0102] Therefore, the method can store the queried information to be stored in the sub-cache according to the priority of the sub-cache, and can ensure that the amount of information stored in the sub-cache is negatively correlated with the priority.
[0103] Based on any of the above embodiments, after the queried information to be obtained or to be stored is stored in each sub-cache, the method can return to continue to perform step S102 of querying the information to be obtained in parallel in multiple sub-caches in the cache memory based on the identification information and subsequent steps. Thus, after the information to be obtained or to be stored queried from the memory is stored in each sub-cache, the method can continue to query the information to be obtained in parallel in multiple sub-caches based on the identification information, and then obtain the information to be obtained from the cache.
[0104] In order to make those skilled in the art understand this application more clearly, Figure 4 is a flowchart of an information acquisition method according to a specific example of the present application, such as Figure 4 As shown, the information acquisition method may include the following steps:
[0105] S401, obtaining identification information of information to be obtained.
[0106] S402, querying multiple sub-caches in the cache in parallel for information to be acquired based on the identification information.
[0107] S403: Determine whether there is at least one candidate sub-cache storing information to be obtained.
[0108] If yes, execute step S404; if no, execute step S407.
[0109] S404, obtaining priorities of candidate sub-caches, and determining the candidate sub-cache with the highest priority as the first target sub-cache, wherein the priority of the sub-cache is negatively correlated with the amount of stored information.
[0110] S405: Obtain the information to be obtained from the first target sub-cache.
[0111] S406: Store the information to be acquired in each second target sub-cache, where the second target sub-cache is a sub-cache that does not store the information to be acquired.
[0112] S407, searching the memory for information to be obtained based on the identification information, and obtaining the found information to be obtained.
[0113] S408, storing the queried information to be obtained in each sub-cache, and returning to continue executing step S402 and subsequent steps.
[0114] For the detailed description of steps S401 to S408, please refer to the relevant contents in the above embodiment, which will not be repeated here.
[0115] With the above Figures 1 to 4 Corresponding to the information acquisition method provided in the embodiment, the present application also provides an information acquisition device. Figures 1 to 4 The information acquisition method provided in the embodiment corresponds to the information acquisition method, so the implementation method of the information acquisition method is also applicable to the information acquisition device provided in the embodiment of the present application, and will not be described in detail in the embodiment of the present application.
[0116] Figure 5 It is a structural diagram of an information acquisition device according to an embodiment of the present application.
[0117] like Figure 5 As shown, the information acquisition device 100 of the embodiment of the present application may include: a first acquisition module 110 , a query module 120 , a determination module 130 and a second acquisition module 140 .
[0118] The first acquisition module 110 is used to acquire identification information of the information to be acquired;
[0119] The query module 120 is used for querying the information to be acquired in parallel in multiple sub-caches in the cache memory cache based on the identification information;
[0120] The determination module 130 is used for obtaining the priority of the candidate sub-cache in response to the existence of at least one candidate sub-cache storing the information to be obtained, and determining the candidate sub-cache with the highest priority as the first target sub-cache, wherein the priority of the sub-cache is negatively correlated with the amount of stored information;
[0121] The second acquisition module 140 is configured to acquire the information to be acquired from the first target sub-cache.
[0122] In one embodiment of the present application, the information acquisition device 100 further includes: a first storage module, the first storage module being used to: store the information to be acquired in each second target sub-cache, the second target sub-cache being the sub-cache that does not store the information to be acquired.
[0123] In one embodiment of the present application, the information acquisition device 100 also includes: a second storage module, the second storage module is used to: determine the candidate sub-cache with the lowest priority as the third target sub-cache; query the information to be stored in the third target sub-cache based on the identification information, and the information to be stored includes at least the information to be acquired; store the queried information to be stored in each second target sub-cache, and the second target sub-cache is the sub-cache that does not store the information to be acquired.
[0124] In one embodiment of the present application, the query module 120 is further used to: in response to any of the sub-cache not storing the information to be obtained, query the information to be obtained in the memory based on the identification information, and obtain the queried information to be obtained.
[0125] In one embodiment of the present application, the information acquisition device 100 further includes: a third storage module, and the third storage module is used to: store the queried information to be acquired in each of the sub-cache.
[0126] In one embodiment of the present application, the information acquisition device 100 also includes: a fourth storage module, and the fourth storage module is used to: query the information to be stored in the memory based on the identification information, and the information to be stored at least includes the information to be acquired; and store the queried information to be stored in each of the sub-cache.
[0127] In one embodiment of the present application, the second storage module or the fourth storage module is also used to: sort the multiple sub-caches from low to high priority; store the queried information to be stored in the sub-cache ranked first, and store part of the queried information to be stored as first information to be stored in the sub-cache ranked second, and store part of the first information to be stored as second information to be stored in the sub-cache ranked third, until the storage of the last-ranked sub-cache is completed, wherein the first information to be stored and the second information to be stored at least include the information to be obtained.
[0128] In one embodiment of the present application, the cache includes a first sub-cache and a second sub-cache, the first sub-cache is a memory on a chip, the second sub-cache is a hardware register on a chip, and the priority of the second sub-cache is higher than that of the first sub-cache.
[0129] In one embodiment of the present application, the information to be acquired includes pixel information of pixels in an image, and the identification information includes position information of the pixels.
[0130] The information acquisition device of the embodiment of the present application can query the information to be acquired in parallel in multiple sub-caches in the cache memory cache based on the identification information of the information to be acquired. The parallel query effectively improves the query speed of the cache, and can determine the candidate sub-cache with the highest priority as the first target sub-cache. The candidate sub-cache is the sub-cache that stores the information to be acquired, and the information to be stored is acquired from the first target sub-cache. The information to be acquired can be acquired from the candidate sub-cache with the least amount of stored information, which effectively shortens the time for acquiring information, reduces the power consumption required for acquiring information, and makes acquiring information more convenient and quick.
[0131] In order to implement the above embodiment, Figure 6 As shown, the present application also proposes an electronic device 200, comprising: a memory 210, a processor 220, and a computer program stored in the memory 210 and executable on the processor 220. When the processor 220 executes the program, the information acquisition method proposed in the aforementioned embodiment of the present application is implemented.
[0132] The electronic device of the embodiment of the present application can execute a computer program stored in the memory through the processor, and can query the information to be obtained in parallel in multiple sub-caches in the cache memory cache based on the identification information of the information to be obtained. The parallel query effectively improves the query speed of the cache, and can determine the candidate sub-cache with the highest priority as the first target sub-cache. The candidate sub-cache is the sub-cache that stores the information to be obtained, and obtains the information to be stored from the first target sub-cache, that is, the information to be obtained can be obtained from the candidate sub-cache that stores the least amount of information, which effectively shortens the time for obtaining information, reduces the power consumption required for obtaining information, and makes obtaining information more convenient and quick.
[0133] In order to implement the above embodiments, the present application also proposes a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the information acquisition method proposed in the above embodiments of the present application is implemented.
[0134] The computer-readable storage medium of the embodiment of the present application, by storing a computer program and being executed by a processor, can query the information to be obtained in parallel in multiple sub-caches in the cache memory cache based on the identification information of the information to be obtained. The parallel query effectively improves the query speed of the cache, and can determine that the candidate sub-cache with the highest priority is the first target sub-cache. The candidate sub-cache is the sub-cache that stores the information to be obtained, and the information to be stored is obtained from the first target sub-cache, that is, the information to be obtained is obtained from the candidate sub-cache that stores the least amount of information, which effectively shortens the time for obtaining information, reduces the power consumption required for obtaining information, and makes obtaining information more convenient and quick.
[0135] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0136] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0137] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0138] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0139] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0140] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0141] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0142] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for obtaining information, characterized in that: include: Acquire identification information of information to be acquired, the information to be acquired includes pixel information of pixel points in the image, and the identification information includes position information of the pixel points; Based on the identification information, multiple sub-caches in a cache memory cache are searched in parallel for the information to be acquired, wherein the cache memory cache has multiple sub-caches, the cache includes a first sub-cache and a second sub-cache, the first sub-cache is a memory on a chip, and the second sub-cache is a hardware register on a chip; In response to the existence of at least one candidate sub-cache storing the information to be obtained, obtaining the priority of the candidate sub-cache, and determining the candidate sub-cache with the highest priority as the first target sub-cache, wherein the priority of the sub-cache is negatively correlated with the amount of stored information; Acquire the information to be acquired from the first target sub-cache; After obtaining the information to be obtained from the first target sub-cache, the method further includes: Determine the candidate sub-cache with the lowest priority as the third target sub-cache; querying the third target sub-cache for information to be stored based on the identification information, where the information to be stored at least includes the information to be obtained; The queried information to be stored is stored in each second target sub-cache, where the second target sub-cache is the sub-cache that does not store the information to be obtained.
2. The method according to claim 1, characterized in that After obtaining the information to be obtained from the first target sub-cache, the method further includes: The information to be acquired is stored in each second target sub-cache, where the second target sub-cache is the sub-cache that does not store the information to be acquired.
3. The method according to claim 1, characterized in that The method further comprises: In response to any of the sub-caches not storing the information to be obtained, querying the information to be obtained in the memory based on the identification information, and obtaining the queried information to be obtained.
4. The method according to claim 3, characterized in that After obtaining the queried information to be obtained, the method further includes: The queried information to be obtained is stored in each of the sub-cache.
5. The method according to claim 3, characterized in that: After obtaining the queried information to be obtained, the method further includes: Based on the identification information, searching the memory for information to be stored, where the information to be stored at least includes the information to be acquired; The queried information to be stored is stored in each of the sub-cache.
6. The method according to claim 1 or 5, characterized in that: The queried information to be stored is stored in each of the sub-cache, including: Sort the multiple sub-caches according to priority from low to high; The queried information to be stored is stored in the sub-cache ranked first, and part of the queried information to be stored is stored as first information to be stored in the sub-cache ranked second, and part of the first information to be stored is stored as second information to be stored in the sub-cache ranked third, until the storage of the sub-cache ranked last is completed, wherein the first information to be stored and the second information to be stored at least include the information to be obtained.
7. The method according to any one of claims 1 to 5, characterized in that: The priority of the second sub-cache is higher than the priority of the first sub-cache.
8. An information acquisition device, characterized in that: include: A first acquisition module, used to acquire identification information of information to be acquired, wherein the information to be acquired includes pixel information of pixels in an image, and the identification information includes position information of the pixels; A query module, configured to query the information to be acquired in parallel in multiple sub-caches in a cache memory cache based on the identification information, wherein the cache memory cache has multiple sub-caches, the cache includes a first sub-cache and a second sub-cache, the first sub-cache is a memory on a chip, and the second sub-cache is a hardware register on a chip; a determination module, configured to obtain the priority of the candidate sub-cache in response to the existence of at least one candidate sub-cache storing the information to be obtained, and determine the candidate sub-cache with the highest priority as the first target sub-cache, wherein the priority of the sub-cache is negatively correlated with the amount of stored information; A second acquisition module, configured to acquire the information to be acquired from the first target sub-cache; The device further includes: a second storage module, wherein the second storage module is configured to: Determine the candidate sub-cache with the lowest priority as the third target sub-cache; querying the third target sub-cache for information to be stored based on the identification information, where the information to be stored at least includes the information to be obtained; The queried information to be stored is stored in each second target sub-cache, where the second target sub-cache is the sub-cache that does not store the information to be obtained.
9. The device according to claim 8, characterized in that The device further includes: a first storage module, wherein the first storage module is configured to: The information to be acquired is stored in each second target sub-cache, where the second target sub-cache is the sub-cache that does not store the information to be acquired.
10. The device according to claim 8, characterized in that The query module is also used for: In response to any of the sub-caches not storing the information to be obtained, querying the information to be obtained in the memory based on the identification information, and obtaining the queried information to be obtained.
11. The device according to claim 10, characterized in that The device further includes: a third storage module, wherein the third storage module is configured to: The queried information to be obtained is stored in each of the sub-cache.
12. The device according to claim 10, characterized in that The device further includes: a fourth storage module, wherein the fourth storage module is configured to: Based on the identification information, searching the memory for information to be stored, where the information to be stored at least includes the information to be acquired; The queried information to be stored is stored in each of the sub-cache.
13. The device according to claim 8 or 12, characterized in that The second storage module or the fourth storage module is further used for: Sort the multiple sub-caches according to priority from low to high; The queried information to be stored is stored in the sub-cache ranked first, and part of the queried information to be stored is stored as first information to be stored in the sub-cache ranked second, and part of the first information to be stored is stored as second information to be stored in the sub-cache ranked third, until the storage of the sub-cache ranked last is completed, wherein the first information to be stored and the second information to be stored at least include the information to be obtained.
14. The device according to any one of claims 8 to 12, characterized in that: The priority of the second sub-cache is higher than the priority of the first sub-cache.
15. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the information acquisition method according to any one of claims 1 to 7 is implemented.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the information acquisition method according to any one of claims 1 to 7 is implemented.
