Information acquisition method and device and electronic equipment

文档序号:435832 发布日期:2021-12-24 浏览:2次 中文

阅读说明:本技术 信息获取方法、装置和电子设备 (Information acquisition method and device and electronic equipment ) 是由 龚文彪 于 2021-09-07 设计创作,主要内容包括:本申请提出一种信息获取方法、装置和电子设备。其中,信息获取方法包括:获取待获取信息的标识信息;基于标识信息在cache中的多个子cache并行查询待获取信息;响应于存在至少一个候选子cache存储有待获取信息,获取候选子cache的优先级,确定优先级最高的候选子cache为第一目标子cache,其中,子cache的优先级与存储的信息量负相关;从第一目标子cache获取待获取信息。由此,可基于待获取信息的标识信息在多个子cache并行查询待获取信息,有效提高了cache的查询速度,并可从存储信息量最少的候选子cache中获取待获取信息,有效缩短了信息获取时长,降低了信息获取所需功耗。(The application provides an information acquisition method and device and electronic equipment. The information acquisition method comprises the following steps: acquiring identification information of information to be acquired; parallelly inquiring information to be acquired by a plurality of sub-caches in the cache based on the identification information; responding to the fact that at least one candidate sub-cache stores information to be obtained, obtaining the priority of the candidate sub-cache, and determining the candidate sub-cache with the highest priority as a first target sub-cache, wherein the priority of the sub-cache is inversely related to the amount of the stored information; and obtaining the information to be obtained from the first target sub-cache. Therefore, the information to be acquired can be queried in parallel in the plurality of sub-caches based on the identification information of the information to be acquired, the query speed of the caches is effectively improved, the information to be acquired can be acquired from the candidate sub-caches with the least information storage amount, the information acquisition duration is effectively shortened, and the power consumption required by information acquisition is reduced.)

1. An information acquisition method, comprising:

acquiring identification information of information to be acquired;

based on the identification information, parallelly inquiring the information to be acquired by a plurality of sub-caches in a cache of a cache memory;

responding to the situation that at least one candidate sub-cache stores the information to be acquired, acquiring the priority of the candidate sub-cache, and determining the candidate sub-cache with the highest priority as a first target sub-cache, wherein the priority of the sub-cache is negatively related to the amount of the stored information;

and acquiring the information to be acquired from the first target sub-cache.

2. The method according to claim 1, wherein after the obtaining the information to be obtained from the first target sub-cache, further comprising:

and storing the information to be acquired into each second target sub-cache, wherein the second target sub-caches are the sub-caches which do not store the information to be acquired.

3. The method according to claim 1, wherein after the obtaining the information to be obtained from the first target sub-cache, further comprising:

determining the candidate sub-cache with the lowest priority as a third target sub-cache;

querying information to be stored in the third target sub-cache based on the identification information, wherein the information to be stored at least comprises the information to be acquired;

and storing the inquired information to be stored into each second target sub-cache, wherein the second target sub-caches are the sub-caches which do not store the information to be acquired.

4. The method of claim 1, further comprising:

and responding to the situation that the information to be acquired is not stored in any sub-cache, inquiring the information to be acquired in a memory based on the identification information, and acquiring the inquired information to be acquired.

5. The method according to claim 4, wherein after the obtaining the queried information to be obtained, further comprising:

and storing the inquired information to be acquired into each sub cache.

6. The method according to claim 4, wherein after the obtaining the queried information to be obtained, further comprising:

inquiring information to be stored in the memory based on the identification information, wherein the information to be stored at least comprises the information to be acquired;

and storing the inquired information to be stored into each sub cache.

7. The method according to claim 3 or 6, wherein the step of storing the queried information to be stored in each sub-cache comprises:

sequencing the plurality of sub-caches from low to high according to the priority;

storing the inquired information to be stored into the first sub-cache in the sequence, storing part of the inquired information to be stored into the second sub-cache in the sequence as the first information to be stored, and storing part of the first information to be stored into the third sub-cache in the sequence as the second information to be stored until the storage of the last sub-cache in the sequence is finished, wherein the first information to be stored and the second information to be stored at least comprise the information to be acquired.

8. The method according to any one of claims 1 to 6, wherein the Cache comprises 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 the chip, and the priority of the second sub-Cache is higher than that of the first sub-Cache.

9. The method according to any one of claims 1 to 6, wherein the information to be acquired includes pixel information of a pixel point in the image, and the identification information includes position information of the pixel point.

10. An information acquisition apparatus characterized by comprising:

the first acquisition module is used for acquiring the identification information of the information to be acquired;

the query module is used for parallelly querying the information to be acquired in a plurality of sub caches in the cache of the cache memory based on the identification information;

the determining module is used for responding that at least one candidate sub-cache stores the information to be acquired, acquiring the priority of the candidate sub-cache, and determining the candidate sub-cache with the highest priority as a first target sub-cache, wherein the priority of the sub-cache is negatively related to the amount of the stored information;

and the second acquisition module is used for acquiring the information to be acquired from the first target sub-cache.

11. The apparatus of claim 10, further comprising: a first storage module, the first storage module to:

and storing the information to be acquired into each second target sub-cache, wherein the second target sub-caches are the sub-caches which do not store the information to be acquired.

12. The apparatus of claim 10, further comprising: a second storage module, the second storage module to:

determining the candidate sub-cache with the lowest priority as a third target sub-cache;

querying information to be stored in the third target sub-cache based on the identification information, wherein the information to be stored at least comprises the information to be acquired;

and storing the inquired information to be stored into each second target sub-cache, wherein the second target sub-caches are the sub-caches which do not store the information to be acquired.

13. The apparatus of claim 10, wherein the query module is further configured to:

and responding to the situation that the information to be acquired is not stored in any sub-cache, inquiring the information to be acquired in a memory based on the identification information, and acquiring the inquired information to be acquired.

14. The apparatus of claim 13, further comprising: a third storage module, the third storage module to:

and storing the inquired information to be acquired into each sub cache.

15. The apparatus of claim 13, further comprising: a fourth storage module, the fourth storage module to:

inquiring information to be stored in the memory based on the identification information, wherein the information to be stored at least comprises the information to be acquired;

and storing the inquired information to be stored into each sub cache.

16. The apparatus of claim 12 or 15, wherein the second storage module or the fourth storage module is further configured to:

sequencing the plurality of sub-caches from low to high according to the priority;

storing the inquired information to be stored into the first sub-cache in the sequence, storing part of the inquired information to be stored into the second sub-cache in the sequence as the first information to be stored, and storing part of the first information to be stored into the third sub-cache in the sequence as the second information to be stored until the storage of the last sub-cache in the sequence is finished, wherein the first information to be stored and the second information to be stored at least comprise the information to be acquired.

17. The device according to any one of claims 10 to 15, wherein the Cache comprises 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 the chip, and the priority of the second sub-Cache is higher than that of the first sub-Cache.

18. The apparatus according to any one of claims 10 to 15, wherein the information to be acquired includes pixel information of a pixel point in the image, and the identification information includes position information of the pixel point.

19. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the information acquisition method according to any one of claims 1 to 9 when executing the program.

20. A computer-readable storage medium on which a computer program is stored, the program, when being executed by a processor, implementing the information acquisition method according to any one of claims 1 to 9.

Technical Field

The present application relates to the field of computer application technologies, and in particular, to an information obtaining method, an information obtaining apparatus, an electronic device, and a storage medium.

Background

At present, a cache of a cache memory has the advantages of high access speed and the like, and is widely used for storing memory information, a Central Processing Unit (CPU) can firstly query the cache when the memory information needs to be obtained, if the cache stores the memory information needing 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 problems of long information acquisition time and high consumption power.

Disclosure of Invention

The method and the device aim to solve at least one of the technical problems of long information acquisition time and high power consumption in the related technology to a certain extent.

Therefore, an embodiment of the first aspect of the present application provides an information obtaining method, which can query information to be obtained in parallel through multiple sub-caches in a cache memory based on identification information of the information to be obtained, the parallel query effectively increases the query speed of the caches, and can determine that a candidate sub-cache with the highest priority is a first target sub-cache, the candidate sub-cache is a sub-cache storing the information to be obtained, and obtain the information to be stored from the first target sub-cache, that is, obtain the information to be obtained from the candidate sub-cache with the smallest amount of stored information, thereby effectively shortening the information obtaining duration, reducing power consumption required by information obtaining, and obtaining the information more conveniently and quickly.

The embodiment of the second aspect of the present application provides an information acquisition apparatus.

The embodiment of the third aspect of the application provides an electronic device.

An embodiment of a fourth aspect of the present application provides a computer-readable storage medium.

An embodiment of a first aspect of the present application provides an information obtaining method, including: acquiring identification information of information to be acquired; based on the identification information, parallelly inquiring the information to be acquired by a plurality of sub-caches in a cache of a cache memory; responding to the situation that at least one candidate sub-cache stores the information to be acquired, acquiring the priority of the candidate sub-cache, and determining the candidate sub-cache with the highest priority as a first target sub-cache, wherein the priority of the sub-cache is negatively related to the amount of the stored information; and acquiring the information to be acquired from the first target sub-cache.

According to the information acquisition method, the information to be acquired can be parallelly inquired by a plurality of sub-caches in the cache of the cache based on the identification information of the information to be acquired, the inquiry speed of the caches is effectively improved through parallel inquiry, the candidate sub-cache with the highest priority can be determined to be the first target sub-cache, the candidate sub-cache is the sub-cache for storing the information to be acquired, 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 information storage amount, the information acquisition duration is effectively shortened, the power consumption required by information acquisition is reduced, and the information acquisition is more convenient and faster.

In addition, the information acquisition method according to the above embodiment of the present application may further have the following additional technical features:

in an embodiment of the present application, after the obtaining the information to be obtained from the first target sub-cache, the method further includes: and storing the information to be acquired into each second target sub-cache, wherein the second target sub-caches are the sub-caches which do not store the information to be acquired.

In an embodiment of the present application, after the obtaining the information to be obtained from the first target sub-cache, the method further includes: determining the candidate sub-cache with the lowest priority as a third target sub-cache; querying information to be stored in the third target sub-cache based on the identification information, wherein the information to be stored at least comprises the information to be acquired; and storing the inquired information to be stored into each second target sub-cache, wherein the second target sub-caches are the sub-caches which do not store the information to be acquired.

In one embodiment of the present application, the method further comprises: and responding to the situation that the information to be acquired is not stored in any sub-cache, inquiring the information to be acquired in a memory based on the identification information, and acquiring the inquired information to be acquired.

In an embodiment of the application, after the obtaining the queried information to be obtained, the method further includes: and storing the inquired information to be acquired into each sub cache.

In an embodiment of the application, after the obtaining the queried information to be obtained, the method further includes: inquiring information to be stored in the memory based on the identification information, wherein the information to be stored at least comprises the information to be acquired; and storing the inquired information to be stored into each sub cache.

In an embodiment of the present application, storing the queried information to be stored in each of the sub-caches includes: sequencing the plurality of sub-caches from low to high according to the priority; storing the inquired information to be stored into the first sub-cache in the sequence, storing part of the inquired information to be stored into the second sub-cache in the sequence as the first information to be stored, and storing part of the first information to be stored into the third sub-cache in the sequence as the second information to be stored until the storage of the last sub-cache in the sequence is finished, wherein the first information to be stored and the second information to be stored at least comprise the information to be acquired.

In an embodiment of the present application, the Cache includes a first sub-Cache and a second sub-Cache, where the first sub-Cache is a memory on a chip, the second sub-Cache is a hardware register on the chip, and a priority of the second sub-Cache is higher than a priority of the first sub-Cache.

In an embodiment of the present application, the information to be acquired includes pixel information of a pixel point in an image, and the identification information includes position information of the pixel point.

An embodiment of a second aspect of the present application provides an information acquiring apparatus, including: the first acquisition module is used for acquiring the identification information of the information to be acquired; the query module is used for parallelly querying the information to be acquired in a plurality of sub caches in the cache of the cache memory based on the identification information; the determining module is used for responding that at least one candidate sub-cache stores the information to be acquired, acquiring the priority of the candidate sub-cache, and determining the candidate sub-cache with the highest priority as a first target sub-cache, wherein the priority of the sub-cache is negatively related to the amount of the stored information; and the second acquisition module is used for acquiring the information to be acquired from the first target sub-cache.

The information acquisition device of the embodiment of the application can parallelly inquire the information to be acquired in a plurality of sub-caches in the cache based on the identification information of the information to be acquired, the parallel inquiry effectively improves the inquiry speed of the caches, the candidate sub-cache with the highest priority can be determined as the first target sub-cache, the candidate sub-cache is the sub-cache for storing the information to be acquired, the information to be stored can be acquired from the first target sub-cache, the information to be acquired can be acquired from the candidate sub-cache with the least information storage amount, the information acquisition time is effectively shortened, the power consumption required by information acquisition is reduced, and the information acquisition is more convenient and faster.

In addition, the information acquisition apparatus according to the above-described embodiment of the present application may further have the following additional technical features:

in one embodiment of the present application, the apparatus further comprises: a first storage module, the first storage module to: and storing the information to be acquired into each second target sub-cache, wherein the second target sub-caches are the sub-caches which do not store the information to be acquired.

In one embodiment of the present application, the apparatus further comprises: a second storage module, the second storage module to: determining the candidate sub-cache with the lowest priority as a third target sub-cache; querying information to be stored in the third target sub-cache based on the identification information, wherein the information to be stored at least comprises the information to be acquired; and storing the inquired information to be stored into each second target sub-cache, wherein the second target sub-caches are the sub-caches which do not store the information to be acquired.

In an embodiment of the application, the query module is further configured to: and responding to the situation that the information to be acquired is not stored in any sub-cache, inquiring the information to be acquired in a memory based on the identification information, and acquiring the inquired information to be acquired.

In one embodiment of the present application, the apparatus further comprises: a third storage module, the third storage module to: and storing the inquired information to be acquired into each sub cache.

In one embodiment of the present application, the apparatus further comprises: a fourth storage module, the fourth storage module to: inquiring information to be stored in the memory based on the identification information, wherein the information to be stored at least comprises the information to be acquired; and storing the inquired information to be stored into each sub cache.

In an embodiment of the application, the second storage module or the fourth storage module is further configured to: sequencing the plurality of sub-caches from low to high according to the priority; storing the inquired information to be stored into the first sub-cache in the sequence, storing part of the inquired information to be stored into the second sub-cache in the sequence as the first information to be stored, and storing part of the first information to be stored into the third sub-cache in the sequence as the second information to be stored until the storage of the last sub-cache in the sequence is finished, wherein the first information to be stored and the second information to be stored at least comprise the information to be acquired.

In an embodiment of the present application, the Cache includes a first sub-Cache and a second sub-Cache, where the first sub-Cache is a memory on a chip, the second sub-Cache is a hardware register on the chip, and a priority of the second sub-Cache is higher than a priority of the first sub-Cache.

In an embodiment of the present application, the information to be acquired includes pixel information of a pixel point in an image, and the identification information includes position information of the pixel point.

An embodiment of a third aspect of the present application provides an electronic device, including: a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the information obtaining method according to the foregoing first aspect embodiment.

According to the electronic equipment, the processor executes the computer program stored on the memory, the information to be acquired can be parallelly inquired by the aid of the sub-caches in the cache memory based on identification information of the information to be acquired, the inquiry speed of the caches can be effectively increased through parallel inquiry, the candidate sub-cache with the highest priority can be determined as the first target sub-cache, the candidate sub-cache is the sub-cache for storing the information to be acquired, 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 smallest information storage amount, the information acquisition time length is effectively shortened, power consumption required by information acquisition is reduced, and the information acquisition is more convenient and faster.

An embodiment of a fourth aspect of the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the information obtaining method according to the embodiment of the first aspect.

The computer-readable storage medium of the embodiment of the application stores a computer program and is executed by a processor, the information to be acquired can be parallelly inquired by a plurality of sub-caches in a cache memory based on identification information of the information to be acquired, the inquiry speed of the caches can be effectively improved through parallel inquiry, the candidate sub-cache with the highest priority can be determined as a first target sub-cache, the candidate sub-cache is a sub-cache for storing the information to be acquired, 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 information storage amount, the information acquisition duration is effectively shortened, the power consumption required by information acquisition is reduced, and the information acquisition is more convenient and faster.

Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.

Drawings

The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:

fig. 1 is a schematic flow chart of an information acquisition method according to an embodiment of the present application;

fig. 2 is a schematic flow chart illustrating a process after information to be acquired is acquired from a first target sub-cache in the information acquisition method according to an embodiment of the present application;

fig. 3 is a schematic flow chart illustrating a process of acquiring queried information to be acquired in an information acquisition method according to an embodiment of the present application;

FIG. 4 is a flow chart of an information acquisition method according to a specific example of the present application;

FIG. 5 is a schematic structural diagram of an information acquisition device according to an embodiment of the present application; and

fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.

Detailed Description

Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary and intended to be used for explaining the present application and should not be construed as limiting the present application.

An information acquisition method, an apparatus, an electronic device, and a storage medium according to embodiments of the present application are described below with reference to the drawings.

Fig. 1 is a flowchart illustrating an information obtaining method according to an embodiment of the present application.

As shown in fig. 1, an information obtaining method according to an embodiment of the present application includes:

s101, obtaining identification information of information to be obtained.

It should be noted that the executing body of the information acquiring method in the embodiment of the present application may be an information acquiring apparatus, and the information acquiring apparatus in the embodiment of the present application may be configured in any electronic device, so that the electronic device may execute the information acquiring method in the embodiment of the present application. The electronic device may be a Personal Computer (PC), a cloud device, a mobile device, and the like, and the mobile device may be a hardware device having various operating systems, touch screens, and/or display screens, such as a mobile phone, a tablet Computer, a Personal digital assistant, a wearable device, and an in-vehicle device. In an embodiment, an execution body of the information obtaining method according to the embodiment of the present application may be a Central Processing Unit (CPU).

In the embodiment of the application, the information to be acquired has identification information for distinguishing different information to be acquired. It should be noted that the types of the information to be acquired and the identification information are not limited too much.

In an embodiment, in an application scenario of image transformation, the information to be acquired may include pixel information of a pixel point in the image, and the identification information may include position information of the pixel point.

In one embodiment, in a speech synthesis application scenario, the information to be acquired may include text information, and the identification information may include speaker identification information (e.g., a speaker name, an account number, etc.).

S102, based on the identification information, parallelly inquiring the information to be acquired in a plurality of sub caches in the cache of the cache memory.

In an embodiment of the present application, a cache memory cache has a plurality of sub-caches. It should be noted that the number of the sub-caches is not limited too much, for example, the number of the sub-caches may be 2.

In one embodiment, the cache includes a first sub-cache and a second sub-cache, where the first sub-cache is a memory on the chip and the second sub-cache is a hardware register on the chip.

Optionally, the storage capacity of the first sub-cache is greater than that of the second sub-cache, the first sub-cache acquires and stores the cache information of the first storage unit from the memory at one time, and the second sub-cache acquires 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 larger than that of the second storage unit, and the sizes of the first storage unit and the second storage unit are not limited too much, for example, the first storage unit is 64 bits (bit), and the second storage unit is 8 bits.

Optionally, the amount of information stored by the first sub-cache is greater than the amount of information stored by the second sub-cache. In one embodiment, the information to be stored can be obtained from the memory, the information to be stored is stored in the first sub-cache, and part of the information to be stored is stored in the second sub-cache. For example, 64-bit pixel information of the pixel point a can be acquired from the memory, the 64-bit pixel information of the pixel point a is stored into the first sub-cache, 8-bit pixel information is screened out from the 64-bit pixel information of the pixel point a, and the screened 8-bit pixel information of the pixel point a is stored into the second sub-cache.

In the embodiment of the application, the information to be acquired can be queried in parallel based on a plurality of sub-caches of the identification information in the cache, that is, the information to be acquired can be queried simultaneously in the plurality of sub-caches based on the identification information. Continuing to take the example that the cache comprises the first sub-cache and the second sub-cache, the information to be acquired can be parallelly queried in the first sub-cache and the second sub-cache based on the identification information.

In one embodiment, the identification information of the information to be acquired and the storage position of the information to be acquired in the sub-cache have a corresponding relationship. It can be understood that the storage locations of the same sub-cache corresponding to the identification information of different information to be acquired may be different, and the storage locations of different sub-caches corresponding to the identification information of the same information to be acquired may be different. Querying the information to be acquired in the sub-cache based on the identification information may include determining a storage location of the sub-cache corresponding to the identification information of the information to be acquired based on the correspondence, and querying the information to be acquired in the storage location of the sub-cache.

S103, responding to the fact that at least one candidate sub-cache stores information to be obtained, obtaining the priority of the candidate sub-cache, and determining the candidate sub-cache with the highest priority as a first target sub-cache, wherein the priority of the sub-cache is inversely related to the amount of the stored information.

In the embodiment of the application, the sub-cache may store information to be acquired or may not store the information to be acquired.

In the embodiment of the application, the priority can be set for the sub-caches in advance, and the priority of the sub-caches is inversely related to the stored information amount. And continuing taking the example that the cache comprises a first sub-cache and a second sub-cache, wherein the information quantity stored by the first sub-cache is larger than that stored by the second sub-cache, and the priority of the second sub-cache is higher than that of the first sub-cache.

In the embodiment of the 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 is acquired, and the candidate sub-cache with the highest priority is determined as the first target sub-cache, that is, the candidate sub-cache with the least amount of stored information is determined as the first target sub-cache, and the first target sub-cache stores the information to be acquired.

It is understood that the number of candidate sub-caches may be one or more, and is not limited herein.

And S104, obtaining the information to be obtained from the first target sub-cache.

In the embodiment of the application, the information to be acquired can be acquired from the first target sub-cache, that is, the information to be acquired is acquired from the candidate sub-cache with the least amount of stored information.

Continuing to take the example that the cache comprises a first sub-cache and a second sub-cache, wherein the priority of the second sub-cache is higher than that of the first sub-cache, if the information to be acquired is stored in response to the first sub-cache and the second sub-cache, determining the second sub-cache as a first target sub-cache, and acquiring the information to be 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, so that the operation times of the first sub-cache can be reduced, and the power consumption is reduced.

Or, if the information to be acquired is stored in response to the first sub-cache and the information to be acquired is not stored in the second sub-cache, determining that the first sub-cache is the first target sub-cache, and acquiring the information to be acquired from the first target sub-cache. Therefore, the method can acquire the information to be acquired from the first sub-cache when the first sub-cache stores the information to be acquired and the second sub-cache does not store the information to be acquired.

In one embodiment, the identification information of the information to be acquired and the storage position of the information to be acquired in the sub-cache have a corresponding relationship. And obtaining the information to be obtained from the first target sub-cache, which may include determining a storage position of the first target sub-cache corresponding to the identification information of the information to be obtained based on the correspondence, and obtaining the information to be obtained at the storage position of the first target sub-cache.

To sum up, according to the information acquisition method of the embodiment of the application, the information to be acquired can be queried in parallel by a plurality of sub-caches in the cache based on the identification information of the information to be acquired, the query speed of the caches is effectively improved by parallel query, the candidate sub-cache with the highest priority can be determined as the first target sub-cache, the candidate sub-cache is the sub-cache storing the information to be acquired, 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, the information acquisition duration is effectively shortened, the power consumption required by information acquisition is reduced, and the information acquisition is more convenient and faster.

On the basis of any of the above embodiments, after the information to be acquired is acquired from the first target sub-caches in step S104, the information to be acquired may be stored into each second target sub-cache, where the second target sub-caches are sub-caches that do not store the information to be acquired.

And continuing taking the example that the cache comprises a first sub-cache and a second sub-cache, responding to the condition that the first sub-cache stores information to be acquired and the second sub-cache does not store the information to be acquired, determining that the first sub-cache is a first target sub-cache and the second sub-cache is a second target sub-cache, acquiring the information to be acquired from the first sub-cache, and storing the information to be acquired into the second sub-cache.

Therefore, the method can store the information to be acquired into each sub-cache which does not store the information to be acquired, can update the cache information of the sub-caches in real time, and is beneficial to improving the query hit rate of the sub-caches.

On the basis of any of the above embodiments, as shown in fig. 2, after the information to be acquired is acquired from the first target sub-cache in step S104, the method may include:

s201, determining the candidate sub-cache with the lowest priority as a third target sub-cache.

In the embodiment of the application, the candidate sub-cache with the lowest priority can be determined as the third target sub-cache, that is, the candidate sub-cache with the largest information storage amount is determined as the third target sub-cache, and the third target sub-cache stores information to be acquired.

Taking the example that the caches include 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 sequentially increased, if the information to be acquired is stored in response to the first sub-cache and the second sub-cache, and the information to be acquired is not stored in the third sub-cache and the fourth sub-cache, it may be determined that the first sub-cache and the second sub-cache are candidate sub-caches at this time, and the first sub-cache is a third target sub-cache.

S202, inquiring information to be stored in the third target sub-cache based on the identification information, wherein the information to be stored at least comprises information to be acquired.

In the embodiment of the 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 comprises the information to be acquired. For example, the information to be acquired may be 8-bit pixel information of the pixel point a, 64-bit pixel information of the pixel point a may be queried in the third target sub-cache based on the position information of the pixel point a, and the 64-bit pixel information of the pixel point a includes the 8-bit pixel information of the pixel point a, and the 64-bit pixel information of the pixel point a is used as the information to be stored.

In one embodiment, the identification information of the information to be acquired and the storage position of the information to be stored in the sub-cache have a corresponding relationship. 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 can be understood that the storage positions of the information to be stored corresponding to the identification information of different information to be acquired in the same sub-cache may be different, and the storage positions of the information to be stored corresponding to the identification information of the same information to be acquired in different sub-caches may be different. Querying the information to be stored in the third target sub-cache based on the identification information, which may include determining a storage location of the information to be stored corresponding to the identification information of the information to be obtained in the third target sub-cache based on the correspondence, and querying the information to be stored in the storage location of the third target sub-cache.

S203, storing the inquired information to be stored into each second target sub-cache, wherein the second target sub-caches are sub-caches which do not store the information to be acquired.

Continuing to take the example that the caches include a first sub-cache, a second sub-cache, a third sub-cache and a fourth sub-cache, wherein the priorities of the first sub-cache, the second sub-cache, the third sub-cache and the fourth sub-cache are sequentially increased, if the information to be acquired is stored in response to the first sub-cache and the second sub-cache, and the information to be acquired is not stored in the third sub-cache and the fourth sub-cache, the first sub-cache and the second sub-cache can be determined as candidate sub-caches at the moment, and the first sub-cache is a third target sub-cache, and the third sub-cache and the fourth sub-cache can be determined as a second target sub-cache.

Further, information to be stored can be queried in the first sub-cache based on the identification information, the information to be stored at least comprises information to be acquired, and the information to be stored is stored in the third sub-cache and the fourth sub-cache.

Therefore, the method can determine that the candidate sub-cache with the lowest priority is the third target sub-cache, and query information to be stored in the third target sub-cache based on the identification information, wherein the information to be stored at least comprises information to be acquired, store the queried information to be stored into each sub-cache which does not store the information to be acquired, and update more cache information into the sub-caches compared with the situation that the information to be acquired is only stored into each sub-cache which does not store the information to be acquired, thereby being beneficial to improving the query hit rate of the sub-caches.

On the basis of any of the above embodiments, after the information to be acquired is concurrently queried by the multiple sub-caches in the cache memory based on the identification information in step S102, the method may further include, in response to that any sub-cache does not store 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.

Continuing to take the example that the cache comprises the first sub-cache and the second sub-cache, if the information to be acquired is not stored in response to the first sub-cache and the second sub-cache, the information to be acquired can be queried in the memory based on the identification information, and the queried information to be acquired is acquired.

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 can be understood that the storage locations of the memories 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 a storage location of the memory corresponding to the identification information of the information to be acquired based on the correspondence, and querying the information to be acquired at the storage location of the memory.

Therefore, when any sub-cache does not store the information to be acquired, the method can inquire the information to be acquired in the memory based on the identification information and acquire the inquired information to be acquired from the memory.

On the basis of any of the above embodiments, after the queried information to be obtained is obtained, the queried information to be obtained may also be stored in each sub-cache.

Continuing to take the example that the cache comprises the first sub-cache and the second sub-cache, if the first sub-cache and the second sub-cache do not store the information to be acquired in response to the response, querying the information to be acquired in the memory based on the identification information, acquiring the queried information to be acquired, and storing the queried information to be acquired into the first sub-cache and the second sub-cache respectively.

Therefore, the method can store the information to be acquired, which is inquired from the memory, into each sub-cache, can update the cache information of the sub-caches in real time, and is favorable for improving the inquiry hit rate of the sub-caches.

On the basis of any of the above embodiments, as shown in fig. 3, after acquiring the queried information to be acquired, the method further includes:

s301, inquiring information to be stored in the memory based on the identification information, wherein the information to be stored at least comprises information to be acquired.

In the embodiment of the application, the information to be stored can be queried in the memory based on the identification information, and the information to be stored at least comprises the information to be acquired. For example, the information to be acquired may be 8-bit pixel information of the pixel point a, 64-bit pixel information of the pixel point a may be queried in the memory based on the position information of the pixel point a, and the 64-bit pixel information of the pixel point a includes the 8-bit pixel information of the pixel point a, and the 64-bit pixel information of the pixel point a is used as the information to be stored.

In one embodiment, the identification information of the information to be acquired and the storage position of the information to be stored in the memory have a corresponding relationship. 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 can be understood that the storage locations of the information to be stored corresponding to the identification information of different information to be acquired in the memory may be different. Querying the information to be stored in the memory based on the identification information may include determining a 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 correspondence, and querying the information to be stored in the storage location of the memory.

S302, storing the inquired information to be stored into each sub cache.

Continuing to take the example that the cache comprises the first sub-cache and the second sub-cache, if the first sub-cache and the second sub-cache do not store the information to be acquired in response to the response, querying the information to be stored in the memory based on the identification information, wherein the information to be stored at least comprises the information to be acquired, and storing the queried information to be stored into the first sub-cache and the second sub-cache respectively.

Therefore, the method can store the information to be stored, which is queried from the memory, into each sub-cache, and can update more cache information into the sub-caches compared with the method that the information to be acquired is only stored into each sub-cache, thereby being beneficial to improving the query hit rate of the sub-caches.

On the basis of any of the above embodiments, storing the queried information to be stored into each sub-cache may include sorting the plurality of sub-caches from low to high according to priority, storing the queried information to be stored into a first sub-cache, storing part of the queried information to be stored as first information to be stored into a second sub-cache, storing part of the first information to be stored as second information to be stored into a third sub-cache, and ending the storage of the last sub-cache, where the first information to be stored and the second information to be stored at least include information to be acquired.

Continuing to take the example that the cache comprises 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 sequentially increased, if the first sub-cache, the second sub-cache, the third sub-cache and the fourth sub-cache do not store the information to be acquired, the information to be stored can be inquired in the memory based on the identification information, and the information to be stored at least comprises the information to be acquired.

Further, the sub-caches can be sorted from low to high according to the priority, the sorting results are a first sub-cache, a second sub-cache, a third sub-cache and a fourth sub-cache, the inquired information to be stored can be stored in the first sub-cache, part of the inquired information to be stored is stored in the second sub-cache as the first information to be stored, part of the first information to be stored is stored in the third sub-cache as the second information to be stored, and part of the second information to be stored is stored in the fourth sub-cache as the third information to be stored.

Or, if the information to be acquired is stored in response to the first sub-cache and the second sub-cache, and the information to be acquired is not stored in the third sub-cache and the fourth sub-cache, it may be determined that the first sub-cache and the second sub-cache are candidate sub-caches, the first sub-cache is a third target sub-cache, and it may also be determined that the third sub-cache and the fourth sub-cache are second target sub-caches, the information to be stored may 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 acquired.

Further, the third sub-cache and the fourth sub-cache can be sorted from low to high according to the priority, and the sorting result is the third sub-cache and the fourth sub-cache, so that the inquired information to be stored can be stored into the third sub-cache, and part of the inquired information to be stored is stored into the fourth sub-cache as the first information to be stored.

Therefore, the method can store the inquired information to be stored into the sub-caches according to the priorities of the sub-caches, and can ensure that the information amount stored by the sub-caches is negatively related to the priorities.

On the basis of any of the above embodiments, after the queried information to be acquired or information to be stored is stored in each sub-cache, the step S102 of parallelly querying the information to be acquired and the subsequent steps thereof in the cache based on the identification information may be returned to continue to be executed. Therefore, after the information to be acquired or the information to be stored, which is inquired from the memory, is stored in each sub-cache, the method can continue to inquire the information to be acquired in the sub-caches in parallel based on the identification information, and further acquire the information to be acquired from the caches.

To make the present application more clear to those skilled in the art, fig. 4 is a flowchart of an information acquisition method according to a specific example of the present application, and as shown in fig. 4, the information acquisition method may include the following steps:

s401, obtaining the identification information of the information to be obtained.

S402, parallelly inquiring information to be acquired based on a plurality of sub-caches of the identification information in the cache.

And S403, judging whether at least one candidate sub-cache stores information to be acquired.

If yes, go to step S404; if not, step S407 is executed.

S404, acquiring the priority of the candidate sub-caches, and determining the candidate sub-cache with the highest priority as a first target sub-cache, wherein the priority of the sub-cache is negatively related to the stored information amount.

S405, obtaining information to be obtained from the first target sub-cache.

S406, storing the information to be acquired into each second target sub-cache, wherein the second target sub-caches are sub-caches which do not store the information to be acquired.

S407, inquiring the information to be acquired in the memory based on the identification information, and acquiring the inquired information to be acquired.

S408, storing the inquired information to be acquired into each sub-cache, and returning to continue executing the step S402 and the subsequent steps.

For specific descriptions of steps S401 to S408, refer to the description of relevant contents in the above embodiments, which are not repeated herein.

Corresponding to the information acquiring method provided in the embodiments of fig. 1 to 4, the present application also provides an information acquiring apparatus, and since the information acquiring apparatus provided in the embodiments of the present application corresponds to the information acquiring method provided in the embodiments of fig. 1 to 4, the embodiments of the information acquiring method are also applicable to the information acquiring apparatus provided in the embodiments of the present application, and will not be described in detail in the embodiments of the present application.

Fig. 5 is a schematic structural diagram of an information acquisition apparatus according to an embodiment of the present application.

As shown in fig. 5, the information acquisition apparatus 100 according to 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.

The first obtaining module 110 is configured to obtain identification information of information to be obtained;

the query module 120 is configured to query the information to be acquired in parallel by using a plurality of sub-caches in the cache based on the identification information;

the determining module 130 is configured to, in response to that at least one candidate sub-cache stores the information to be acquired, acquire a priority of the candidate sub-cache, and determine the candidate sub-cache with the highest priority as a first target sub-cache, where the priority of the sub-cache is negatively related to the amount of stored information;

the second obtaining module 140 is configured to obtain the information to be obtained from the first target sub-cache.

In one embodiment of the present application, the information acquiring apparatus 100 further includes: a first storage module, the first storage module to: and storing the information to be acquired into each second target sub-cache, wherein the second target sub-caches are the sub-caches which do not store the information to be acquired.

In one embodiment of the present application, the information acquiring apparatus 100 further includes: a second storage module, the second storage module to: determining the candidate sub-cache with the lowest priority as a third target sub-cache; querying information to be stored in the third target sub-cache based on the identification information, wherein the information to be stored at least comprises the information to be acquired; and storing the inquired information to be stored into each second target sub-cache, wherein the second target sub-caches are the sub-caches which do not store the information to be acquired.

In one embodiment of the present application, the query module 120 is further configured to: and responding to the situation that the information to be acquired is not stored in any sub-cache, inquiring the information to be acquired in a memory based on the identification information, and acquiring the inquired information to be acquired.

In one embodiment of the present application, the information acquiring apparatus 100 further includes: a third storage module, the third storage module to: and storing the inquired information to be acquired into each sub cache.

In one embodiment of the present application, the information acquiring apparatus 100 further includes: a fourth storage module, the fourth storage module to: inquiring information to be stored in the memory based on the identification information, wherein the information to be stored at least comprises the information to be acquired; and storing the inquired information to be stored into each sub cache.

In an embodiment of the application, the second storage module or the fourth storage module is further configured to: sequencing the plurality of sub-caches from low to high according to the priority; storing the inquired information to be stored into the first sub-cache in the sequence, storing part of the inquired information to be stored into the second sub-cache in the sequence as the first information to be stored, and storing part of the first information to be stored into the third sub-cache in the sequence as the second information to be stored until the storage of the last sub-cache in the sequence is finished, wherein the first information to be stored and the second information to be stored at least comprise the information to be acquired.

In an embodiment of the present application, the Cache includes a first sub-Cache and a second sub-Cache, where the first sub-Cache is a memory on a chip, the second sub-Cache is a hardware register on the chip, and a priority of the second sub-Cache is higher than a priority of the first sub-Cache.

In an embodiment of the present application, the information to be acquired includes pixel information of a pixel point in an image, and the identification information includes position information of the pixel point.

The information acquisition device of the embodiment of the application can parallelly inquire the information to be acquired in a plurality of sub-caches in the cache based on the identification information of the information to be acquired, the parallel inquiry effectively improves the inquiry speed of the caches, the candidate sub-cache with the highest priority can be determined as the first target sub-cache, the candidate sub-cache is the sub-cache for storing the information to be acquired, the information to be stored can be acquired from the first target sub-cache, the information to be acquired can be acquired from the candidate sub-cache with the least information storage amount, the information acquisition time is effectively shortened, the power consumption required by information acquisition is reduced, and the information acquisition is more convenient and faster.

In order to implement the above-mentioned embodiment, as shown in fig. 6, the present application also proposes an electronic device 200, including: the memory 210, the processor 220, and a computer program stored on the memory 210 and executable on the processor 220, when the processor 220 executes the program, the information obtaining method as proposed in the foregoing embodiments of the present application is implemented.

According to the electronic equipment, the processor executes the computer program stored on the memory, the information to be acquired can be parallelly inquired by the aid of the sub-caches in the cache memory based on identification information of the information to be acquired, the inquiry speed of the caches can be effectively increased through parallel inquiry, the candidate sub-cache with the highest priority can be determined as the first target sub-cache, the candidate sub-cache is the sub-cache for storing the information to be acquired, 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 smallest information storage amount, the information acquisition time length is effectively shortened, power consumption required by information acquisition is reduced, and the information acquisition is more convenient and faster.

In order to implement the foregoing embodiments, the present application also proposes a computer-readable storage medium on which a computer program is stored, which, when executed by a processor, implements the information acquisition method as proposed by the foregoing embodiments of the present application.

The computer-readable storage medium of the embodiment of the application stores a computer program and is executed by a processor, the information to be acquired can be parallelly inquired by a plurality of sub-caches in a cache memory based on identification information of the information to be acquired, the inquiry speed of the caches can be effectively improved through parallel inquiry, the candidate sub-cache with the highest priority can be determined as a first target sub-cache, the candidate sub-cache is a sub-cache for storing the information to be acquired, 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 information storage amount, the information acquisition duration is effectively shortened, the power consumption required by information acquisition is reduced, and the information acquisition is more convenient and faster.

In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.

Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.

Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.

The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.

It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.

It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.

In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.

The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:用于GPU的内存页管理方法和内存页转换方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类