Localization global dynamic data method based on cross list algorithm
By using the cross-linked list algorithm on FPGA, segmenting and localizing global dynamic data, the problems of large access delay and high time complexity are solved, and efficient data access and computing efficiency are achieved.
Patent Information
- Application Number
- CN202411167068.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-17
AI Technical Summary
The prior art uses large-scale global dynamic data on FPGAs to process large-scale global and time complexity, especially due to the difficulty in hardware pipeline execution and low data update efficiency caused by hash conflicts.
Using a localized method based on the cross-linked list algorithm, by creating firstn nodes and next data items for each secondary keyword, building a linked list, segmenting the global dynamic data into multiple groups of local dynamic data, and transmitting it from off-chip cache to on-chip cache , using local indexes and linked list structure to reduce the time complexity of search and update.
It realizes finding and updating data elements within O(1) time complexity, reducing data access delay, improving computing efficiency, and utilizing the low latency characteristics of on-chip cache, avoiding the serial execution problems caused by hash collisions.
Smart Images

Figure CN119149449A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of cache, and in particular to a localized global dynamic data method based on a cross linked list algorithm. Background Art
[0002] When defining the data structure of a data element, it can contain multiple sub-keyword members. When it is used as global dynamic data on the FPGA, this type of global dynamic data usually uses the method of building a lookup table in the on-chip cache to solve the calculation problems in the algorithm, that is, all global dynamic data are organized in the same lookup table in any order and stored in the on-chip cache. By creating a global index for each data element, the data elements in the table are searched, updated, and moved to complete the relevant calculations.
[0003] The above method, namely the on-chip cache table lookup method, is simple to implement and has high computational efficiency for small systems with small data volumes. However, for large systems, due to the limited on-chip cache of existing FPGAs, the entire lookup table cannot be stored. If a lookup table is needed to complete the search, update, and move of data elements in the table and complete related calculations, it is difficult to implement.
[0004] To this end, there are two solutions in the prior art:
[0005] One method is to still maintain the global dynamic data table, but store it in an off-chip buffer. Although this processing method is simple to implement, it has the problem of greatly increasing access latency and greatly reducing the efficiency of discrete random data access.
[0006] Another method is to take advantage of the locality of access to global dynamic data. In the on-chip cache, a portion of the global dynamic table, namely the local dynamic table, is stored each time. However, since the global index cannot directly index the local dynamic table, and the dynamic data in the table has elements that are updated and moved, a new local index needs to be built for the local dynamic table. A common indexing method is to index through hashing, that is, to hash the global index into a local index, and then search for the corresponding element through the local index. The problem with the hash algorithm is that the existence of hash conflicts makes it difficult to know the deterministic number of hardware beats, so it is difficult to implement hardware pipelining and can only be executed serially, which also greatly increases access latency and reduces computing efficiency. At the same time, when updating local dynamic data, it is also difficult for the hash table to determine the locations of all data elements containing the specified sub-keyword, resulting in increased time complexity. Summary of the invention
[0007] In response to the above-mentioned problems, the present invention provides a localized global dynamic data method based on a cross linked list algorithm, which can solve the problems of large data access delay and high algorithm time complexity when accessing a lookup table composed of global dynamic data in the prior art, thereby reducing data access delay and improving computing efficiency.
[0008] To achieve the above purpose, the technical solution adopted by the present invention is:
[0009] The present invention provides a localized global dynamic data method based on a cross linked list algorithm, comprising the following steps:
[0010] S101: Create a firstn node for each secondary keyword in the global dynamic data, and set a local index in the firstn node to point to the first data element where the secondary keyword is at the nth position in the data element;
[0011] S102: Create a next data item for each secondary keyword in the data element, and set a local index for the next data item to point to the next data element in which the secondary keyword is at the same position in the data element;
[0012] S103: traverse all data elements and construct a linked list with the firstn node as the head node by head insertion method, and organize the linked list into multiple groups of local dynamic data;
[0013] S104: The local dynamic data and the data related to the secondary key are sequentially transferred from the off-chip cache to the on-chip cache.
[0014] The localized global dynamic data method based on the cross linked list algorithm provided by the present invention preferably stores data elements with the same first secondary keyword in the same group of local dynamic data in step S103 when organizing the linked list into multiple groups of local dynamic data.
[0015] The localized global dynamic data method based on the cross linked list algorithm provided by the present invention preferably also includes a method for moving data elements between different local dynamic data; the method for moving data elements between different local dynamic data includes the following steps:
[0016] S201: Obtain the firstn node whose nth position is the first data element of the searched keyword, and obtain the data element;
[0017] S202: traverse all data elements of the linked list with firstn node as the head node;
[0018] S203: Acquire a target local dynamic data space, and move the data element to the local dynamic data space;
[0019] S204: Update the next data item pointing to the data element;
[0020] S205: Update the index pointing to the data element in the linked list starting from the firstn node;
[0021] S206: Search for the next data element in the linked list that has the searched keyword in the same position among the data elements, and execute step S203 until there is no data element in the linked list that meets the search requirement.
[0022] The localized global dynamic data method based on the cross linked list algorithm provided by the present invention preferably also includes a method for searching or updating data elements containing a specified secondary keyword; the method for moving data elements between different local dynamic data includes the following steps:
[0023] S301: Setting a double loop, the outer loop traverses all linked lists containing the specified secondary keyword, and the inner loop traverses the data elements in the linked list;
[0024] S302: In the inner loop, the found data element that meets the conditions is added to the result set, or the non-keyword value related to the specified secondary keyword in the data element is updated.
[0025] The above technical solution has the following advantages or beneficial effects:
[0026] The localized global dynamic data method based on the cross linked list algorithm provided by the present invention, in step S101, the global dynamic data includes a plurality of data elements composed of secondary keywords, in order to facilitate the division of local dynamic data, the secondary keywords in all data elements in the global dynamic data are all provided with a node structure, each identical secondary keyword is marked as a firstn node according to its position in the data element, n is the nth position of the secondary keyword in the data element, the firstn node is a local index, and is used to point to the first data element in which the secondary keyword is in the nth position in the data element, where the first refers to the position of the data element arranged in the global dynamic data; by setting the firstn node for the secondary keywords in all data elements in the global dynamic data, each secondary keyword can be classified according to its position in the data element, so as to facilitate the query of the secondary keyword, and at the same time, the lookup table composed of the entire global dynamic data can be divided into multiple query groups;
[0027] In step S102, a next data item is created for each secondary keyword in the data element. The next data item sets a local index to point to the next data element in which the secondary keyword is at the same position in the data element, which can improve the ability to query the data element containing the secondary keyword to be found. At the same time, the data element of the secondary keyword to be found also includes other secondary keywords set with next data items. Such secondary keywords can also point to the next data element in the same position in the data element, so that other data elements related to the data element to be found can be obtained with a smaller cache space;
[0028] In step S103, all data elements in the global dynamic data are traversed, and a linked list with the firstn node as the head node is constructed by the head insertion method, that is, the data elements containing the same sub-keyword and the same firstn node are put into a linked list by the head insertion method, and the linked list is organized into multiple groups of local dynamic data, which, combined with step S102, can form a cross linked list; compared with the method of hashing the global index into a local index in the prior art, the next data element to be calculated can be read within a certain period through the addressing method of the linked list, ensuring the possibility of pipelining; at the same time, due to the characteristics of the cross linked list, the data element containing the specified sub-keyword at the specified position can be found in O(1) time complexity, reducing the time complexity of updating and moving the data element containing the specified sub-keyword at the specified position in the local dynamic data;
[0029] In step S104, the local dynamic data and the data related to the secondary keyword are transferred from the off-chip cache to the on-chip cache in sequence. Compared with the method of storing all global dynamic data in the off-chip cache in the prior art, the global dynamic data is localized into multiple groups of local dynamic data, and the local dynamic data are transferred from the off-chip cache to the on-chip cache in batches for calculation. This can make full use of the locality of the program and the low latency characteristics of the on-chip cache, thereby reducing data access latency and improving computing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The present invention and its features, configurations and advantages will become more apparent by reading the detailed description of non-limiting embodiments with reference to the following drawings. The same reference numerals indicate the same parts throughout the drawings. The drawings are not drawn to scale, but rather to illustrate the subject matter of the present invention.
[0031] Figure 1 It is a flowchart of a localized global dynamic data method based on a cross linked list algorithm provided in Example 1 of the present invention.
[0032] Figure 2 It is a flowchart of a method for moving data elements between different local dynamic data provided by Example 1 of the present invention.
[0033] Figure 3 It is a flowchart of a method for searching or updating a data element containing a specified secondary keyword provided by Embodiment 1 of the present invention.
[0034] Figure 4 This is a schematic diagram of data distribution after localization of global dynamic data provided by Example 2 of the present invention.
[0035] Figure 5 This is a data distribution diagram of data elements moving between different local dynamic data provided by Example 3 of the present invention. DETAILED DESCRIPTION
[0036] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.
[0037] Embodiment 1:
[0038] like Figure 1 As shown, a localized global dynamic data method based on a cross linked list algorithm provided in Embodiment 1 of the present invention includes the following steps:
[0039] S101: Create a firstn node for each secondary keyword in the global dynamic data, and set a local index in the firstn node to point to the first data element where the secondary keyword is at the nth position in the data element;
[0040] S102: Create a next data item for each secondary keyword in the data element, and set a local index for the next data item to point to the next data element in which the secondary keyword is at the same position in the data element;
[0041] S103: traverse all data elements and construct a linked list with the firstn node as the head node by head insertion method, and organize the linked list into multiple groups of local dynamic data;
[0042] S104: The local dynamic data and the data related to the secondary key are sequentially transferred from the off-chip cache to the on-chip cache.
[0043] Embodiment 1 of the present invention provides a localized global dynamic data method based on a cross linked list algorithm. In step S101, the global dynamic data includes a plurality of data elements composed of secondary keywords. In order to facilitate the division of local dynamic data, the secondary keywords in all data elements in the global dynamic data are all provided with a node structure. Each identical secondary keyword is marked as a firstn node according to its position in the data element, where n is the nth position of the secondary keyword in the data element. The firstn node is a local index used to point to the first data element in which the secondary keyword is in the nth position in the data element. Here, the first refers to the position of the data element arranged in the global dynamic data. By setting the firstn node for the secondary keywords in all data elements in the global dynamic data, each secondary keyword can be classified according to its position in the data element, which is convenient for querying the secondary keywords. At the same time, the lookup table composed of the entire global dynamic data can be divided into multiple query groups.
[0044] In step S102, a next data item is created for each secondary keyword in the data element. The next data item sets a local index to point to the next data element in which the secondary keyword is at the same position in the data element, which can improve the ability to query the data element containing the secondary keyword to be found. At the same time, the data element of the secondary keyword to be found also includes other secondary keywords set with next data items. Such secondary keywords can also point to the next data element in the same position in the data element, so that other data elements related to the data element to be found can be obtained with a smaller cache space;
[0045] In step S103, all data elements in the global dynamic data are traversed, and a linked list with the firstn node as the head node is constructed by the head insertion method, that is, the data elements containing the same sub-keyword and the same firstn node are put into a linked list by the head insertion method, and the linked list is organized into multiple groups of local dynamic data, which, combined with step S102, can form a cross linked list; compared with the method of hashing the global index into a local index in the prior art, the next data element to be calculated can be read within a certain period through the addressing method of the linked list, ensuring the possibility of pipelining; at the same time, due to the characteristics of the cross linked list, the data element containing the specified sub-keyword at the specified position can be found in O(1) time complexity, reducing the time complexity of updating and moving the data element containing the specified sub-keyword at the specified position in the local dynamic data;
[0046] In step S104, the local dynamic data and the data related to the secondary keyword are transferred from the off-chip cache to the on-chip cache in sequence. Compared with the method of storing all global dynamic data in the off-chip cache in the prior art, the global dynamic data is localized into multiple groups of local dynamic data, and the local dynamic data are transferred from the off-chip cache to the on-chip cache in batches for calculation. This can make full use of the locality of the program and the low latency characteristics of the on-chip cache, thereby reducing data access latency and improving computing efficiency.
[0047] The localized global dynamic data method based on the cross linked list algorithm provided in Example 1 of the present invention preferably, in step S103, when organizing the linked list into multiple groups of local dynamic data, the data elements with the same first secondary keyword are stored in the same group of local dynamic data, so that the grouping of the local dynamic data is more specific, avoiding the same data elements from appearing in multiple groups of local dynamic data, reducing data duplication, and thus improving the search efficiency for secondary keywords.
[0048] like Figure 2 As shown, Embodiment 1 of the present invention provides a method for moving data elements between different local dynamic data, which can be applied to a localized global dynamic data method based on a cross linked list algorithm. The method for moving data elements between different local dynamic data includes the following steps:
[0049] S201: Obtain the firstn node whose nth position is the first data element of the searched keyword, and obtain the data element;
[0050] S202: traverse all data elements of the linked list with firstn node as the head node;
[0051] S203: Acquire a target local dynamic data space, and move the data element to the local dynamic data space;
[0052] S204: Update the next data item pointing to the data element;
[0053] S205: Update the index pointing to the data element in the linked list starting from the firstn node;
[0054] S206: Search for the next data element in the linked list that has the searched keyword in the same position among the data elements, and execute step S203 until there is no data element in the linked list that meets the search requirement.
[0055] The method for moving data elements between different local dynamic data provided by Embodiment 1 of the present invention, in steps S201 to S202, obtains the firstn node whose nth position is the first data element of the searched secondary keyword, and obtains the data element, and a linked list with the firstn node as the head node can be obtained according to the obtained data element, so that the data elements in the linked list can be traversed to perform a shift operation on the data elements in the linked list;
[0056] In steps S203 to S205, the data element to be shifted is moved to the free space, and the next data item pointing to it is updated to prevent the next data item of the secondary keyword in the data element before the data element from pointing to an empty address, and the index pointing to the data element in the linked list starting from the firstn node is updated to prevent the linked list pointer from pointing to an incorrect address due to the address change of the data element;
[0057] In step S206, the loop in step S202 is continued to find the next data element in the linked list that has the same position as the searched keyword in the data element, and step S203 is repeated until there are no data elements in the linked list that meet the search requirements, thereby realizing the transfer of data elements in the linked list.
[0058] like Figure 3 As shown, Embodiment 1 of the present invention provides a method for searching or updating a data element containing a specified secondary keyword, which is applied to a localized global dynamic data method based on a cross linked list algorithm. The method for searching or updating a data element containing a specified secondary keyword includes the following steps:
[0059] S301: Setting a double loop, the outer loop traverses all linked lists containing the specified secondary keyword, and the inner loop traverses the data elements in the linked list;
[0060] S302: In the inner loop, the found data element that meets the conditions is added to the result set, or the non-keyword value related to the specified secondary keyword in the data element is updated.
[0061] The method for searching or updating data elements containing specified sub-keywords provided in Example 1 of the present invention, in steps S301 to S302, traverses all linked lists and data elements in the linked lists containing the specified sub-keywords, thereby searching for qualified data elements, or updating non-keyword values related to the specified sub-keywords in the data elements.
[0062] Embodiment 2:
[0063] like Figure 4As shown, Embodiment 2 of the present invention provides a set of global dynamic data, wherein each data element contains two secondary keywords, such as: (a,b)(a,c)(c,b)(c,d)(d,a)(d,b)(e,a)(e,c);
[0064] The global dynamic data is organized into multiple groups of local dynamic data according to the localized global dynamic data method based on the cross linked list algorithm provided in Example 1, and divided into three local dynamic data groups: ①②③;
[0065] Furthermore, the localization rule is to store data elements with the same first sub-keyword in the same set of local dynamic data; local dynamic data ① stores data elements with the first sub-keyword a, that is, the firstn node of sub-keyword a is first1, which points to data element (a, b); local dynamic data ② stores data elements with the first sub-keyword c or d; local dynamic data ③ stores data elements with the first sub-keyword e; the next item of the sub-keyword in each data element can point to the next data element with the same sub-keyword in the data element, such as data element (a, b) in local dynamic data ①, where the next data item of sub-keyword a points to data element (a, c), and the next data item of sub-keyword b points to data element (c, b).
[0066] Embodiment 3:
[0067] The locality of the program will change during the iteration process, so it is necessary to update the local dynamic data. Figure 5 As shown, Embodiment 3 of the present invention adopts the method for moving data elements between different local dynamic data provided in Embodiment 1, taking the local dynamic data in Embodiment 2 as an example;
[0068] Move the data element with c as the first subkeyword from local dynamic data ② to local dynamic data ④; first, move the data elements (c,b) and (c,d) with the first subkeyword c in the linked list from local dynamic data ② to local dynamic data ④. Before that, determine whether there is free space in local dynamic data ④ to transfer (c,b) and (c,d); then modify the local index of the linked list where c, b and d are located, and update the next data items pointing to (c,b) and (c,d). For example, data element (c,b) was originally pointed to by the next data item of subkeyword b in data element (a,b). After data element (c,b) is transferred, it is pointed to by the next data item of subkeyword b in data element (d,b).
[0069] In summary, the localized global dynamic data method based on the cross linked list algorithm provided by the present invention can solve the problems of large data access delay and high algorithm time complexity when accessing the lookup table composed of global dynamic data in the prior art, thereby reducing data access delay and improving computing efficiency.
[0070] Those skilled in the art should understand that those skilled in the art can implement the above-mentioned variations by combining the prior art and the above-mentioned embodiments, which will not be described in detail here. Such variations do not affect the essential content of the present invention, and will not be described in detail here.
[0071] The above describes the preferred embodiments of the present invention. It should be understood that the present invention is not limited to the above-mentioned specific embodiments, and the devices and structures that are not described in detail should be understood to be implemented in a common manner in the art; any technician familiar with the art can make many possible changes and modifications without departing from the technical solution of the present invention, or modify them into equivalent embodiments with equivalent changes, which does not affect the essential content of the present invention. Therefore, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of protection of the technical solution of the present invention.
Claims
1. A localized global dynamic data method based on a cross-linked list algorithm, characterized in that: The following steps are involved: S101: Create a firstn node for each secondary keyword in the global dynamic data, and set a local index in the firstn node to point to the first data element where the secondary keyword is at the nth position in the data element; S102: Create a next data item for each secondary keyword in the data element, and set a local index for the next data item to point to the next data element in which the secondary keyword is at the same position in the data element; S103: traverse all data elements and construct a linked list with the firstn node as the head node by head insertion method, and organize the linked list into multiple groups of local dynamic data; S104: The local dynamic data and the data related to the secondary key are sequentially transferred from the off-chip cache to the on-chip cache.
2. The localized global dynamic data method based on the cross linked list algorithm as claimed in claim 1, characterized in that: In step S103, when the linked list is organized into multiple groups of local dynamic data, data elements with the same first secondary keyword are stored in the same group of local dynamic data.
3. The localized global dynamic data method based on the cross linked list algorithm as claimed in claim 1, characterized in that: Also included is a method for moving data elements between different local dynamic data; the method for moving data elements between different local dynamic data comprises the following steps: S201: Obtain the firstn node whose nth position is the first data element of the searched keyword, and obtain the data element; S202: traverse all data elements of the linked list with the firstn node as the head node; S203: Acquire a target local dynamic data space, and move the data element to the local dynamic data space; S204: Update the next data item pointing to the data element; S205: Update the index pointing to the data element in the linked list starting from the firstn node; S206: Search for the next data element in the linked list that has the searched keyword in the same position among the data elements, and execute step S203 until there is no data element in the linked list that meets the search requirement.
4. The localized global dynamic data method based on the cross linked list algorithm as claimed in claim 1, characterized in that: The method also includes a method for searching or updating a data element containing a specified secondary keyword; the method for searching or updating a data element containing a specified secondary keyword includes the following steps: S301: Setting a double loop, the outer loop traverses all linked lists containing the specified secondary keyword, and the inner loop traverses the data elements in the linked list; S302: In the inner loop, the found data element that meets the conditions is added to the result set, or the non-keyword value related to the specified secondary keyword in the data element is updated.
