A method, system and device for accelerating base recognition operators based on in-memory computing

By adopting the fuzzy matching mechanism of in-memory calculation and the in-cache conversion architecture in the base identification tool, the performance bottleneck of beam search and string conversion in the base identification tool is solved, and the throughput and energy consumption efficiency of genetic analysis are improved. Achieving high parallelism and high throughput acceleration effects.

CN118072817BActive Publication Date: 2024-09-13CHINA SCI & TECH WESTERN RES INST OF COMPUTING TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410180723.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-18
Publication Date
2024-09-13
Estimated Expiration
2044-02-18

AI Technical Summary

Technical Problem

Existing base calling tools have performance bottlenecks in the encoding and decoding stages, resulting in low throughput of genetic analysis. There is also a huge gap between the throughput of sequencers and the throughput of base calling tools, and the capabilities of base calling models The consumption efficiency is not high.

Method used

Adopting an approach based on in-memory computing, the beam search and string conversion operations are accelerated through the beam search of the fuzzy matching mechanism and the in-situ character conversion architecture calculated in the cache, and the non-aligned cache in-cache multiply-add architecture is used for multiplication and addition during the encoding stage. Accumulate and reduce calculation latency.

Benefits of technology

It improves the throughput and energy consumption efficiency of base identification, reduces data moving costs, improves the computational efficiency of genetic analysis, and achieves high parallelism, high throughput, and lightweight acceleration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118072817B
    Figure CN118072817B
Patent Text Reader

Abstract

The present invention discloses a method, system and device for accelerating a base recognition operator based on in-memory calculation, which relates to the field of biological gene data processing and is used for high-parallelism, high-throughput and lightweight accelerated base recognition. In the decoding stage of the present invention, a beam search method based on a fuzzy matching mechanism is used to retrieve the probability distribution matrix, which uses a multi-layer mask mechanism to search for the target string step by step in the cache. And an in-situ character conversion architecture based on in-cache calculation is used to convert the retrieved target string into a continuous base sequence, which uses a conversion equation based on De Morgan's law to perform transcoding in the cache. In addition, for the multiplication and addition calculation in the encoding stage, an unaligned in-cache multiplication and addition architecture is used for calculation. The present invention unloads the beam search calculation to the cache, improves the efficiency and throughput of base recognition calculation, and eliminates the data transmission overhead in string conversion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of biological gene data processing and computer system structure design, and in particular to a base recognition operator acceleration method, system and device based on in-memory calculation. Background Art

[0002] Gene sequencing is the cornerstone of realizing evolutionary theory, personalized medicine and forensics. The emerging nanopore (third generation) genome sequencing technology introduced by D. Branton et al. in "The potential and challenges of nanopore sequencing" is revolutionizing genome research, industry, and the market. It can generate ultra-long DNA fragments (long reads), which is the key to identifying large structural variations and improving the quality of de novo assembly. Base recognition is the first step of third-generation gene analysis, responsible for restoring current information to original bases. Base recognition has two parts: encoding and decoding. The encoding stage converts continuous electrical signals into a probability distribution matrix of base encoding, while the decoding stage further converts the probability distribution matrix into a continuous base sequence. At present, mainstream base recognition tools have achieved an accuracy rate of more than 90%, but there is an order of magnitude difference between its throughput and the throughput of sequencers. Both the encoding and decoding stages of base recognition are performance bottlenecks. The low throughput problem caused by the bottleneck is a key problem in gene analysis and occupies a very important position in the research of gene analysis acceleration.

[0003] Currently, there are performance bottlenecks in both the encoding and decoding stages of base recognition, and both need to be accelerated. The bottlenecks in the encoding stage are general matrix multiplication (GEMM) operations and tensor (Element-Wise) operations, which account for 32% to 48% of the execution time in the entire process. The bottlenecks in the decoding stage are beam search operations and string conversion operations, which also account for 36% to 48% of the execution time. Data movement and all other operations together account for 15% to 18.63% of the execution time. In order to achieve a good acceleration effect, all key operators of base recognition need to be accelerated, and the remaining operators also need to provide computing support.

[0004] There is a huge gap between the throughput of sequencers and the throughput of base calls. If we only look at the throughput, the sequencing throughput of the sequencer is 2,050,000 bases per second (samples / s), and the throughput of many base recognition tools can meet this requirement. However, these tools that can achieve throughput consume a lot of computing resources. For example, Bonito needs to use a high-end NVIDIA A100 GPU to achieve a throughput of 4,300,000 bases per second. The throughput power consumption ratio is an indicator that needs more attention. The current critical throughput power consumption ratio of sequencers is 34,167 bases per second per watt (samples / s / watt). If the performance of the tool exceeds this value, it means that delay-free processing can be achieved under energy consumption requirements. However, the performance of mainstream base recognition tools is 1 to 3 orders of magnitude behind that of sequencers. Even the most advanced accelerator Helix is ​​nearly an order of magnitude behind the performance required by sequencers.

[0005] Compared with other applications, the base recognition neural network model is relatively lightweight. The parameter size of the base recognition model is mainly concentrated in 0.2MB to 6.4MB. In contrast, even small natural language processing models have reached 100MB, and large models such as GPT-3 have reached 1750GB of parameters.

[0006] In summary, the operators in base recognition in genetic analysis at the current stage require a new type of acceleration structure with high parallelism, high throughput and lightweight. Summary of the invention

[0007] The object of the present invention is to provide a method, system and device for accelerating a base recognition operator based on in-memory computing to achieve high-throughput and lightweight acceleration of the bottleneck operator in base recognition in order to solve all or part of the above-mentioned problems.

[0008] The technical solution adopted by the present invention is as follows:

[0009] A base recognition operator acceleration method based on in-memory calculation, wherein the base recognition includes an encoding stage and a decoding stage, wherein the encoding stage converts a continuous electrical signal into a probability distribution matrix of base coding, and the decoding stage converts the probability distribution matrix into a continuous base sequence;

[0010] In the decoding stage, the probability distribution matrix is ​​searched using a beam search method based on a fuzzy matching mechanism, wherein the beam search method based on the fuzzy matching mechanism searches for a target string in a cache layer by layer using a multi-layer mask mechanism; and

[0011] The retrieved target character string is converted into a continuous base sequence using an in-situ character conversion architecture based on in-cache calculation, wherein the in-situ character conversion architecture based on in-cache calculation uses a conversion equation based on De Morgan's law to perform transcoding in the cache.

[0012] Furthermore, the search interval of the beam search method based on the fuzzy matching mechanism is (P×2 n ,P×2 n +2 n -1), where log 2 P+n=N, N is the number of exponential bits in the search space, P is the number of mask network numbers at each layer, log 2 P∈ is a positive integer, n is the number of host numbers in each mask layer; the P value of each mask layer increases step by step.

[0013] Furthermore, a margin threshold σ is configured in the beam search method based on the fuzzy matching mechanism. When the difference margin between the number of character strings searched from the cache and the required number of clusters is less than σ, probability calculation is performed on the character strings of the difference margin.

[0014] Furthermore, the beam search method based on the fuzzy matching mechanism uses CAM search to search for the target character string in the cache.

[0015] Furthermore, searching the target string in the cache includes: storing the extended sequence in DRAM, storing the corresponding pointer in the cache, and when searching the target string, reading the corresponding extended sequence from the DRAM through the pointer in the cache for searching.

[0016] Furthermore, the in-situ character conversion architecture based on in-cache calculation is configured to perform parallel conversion on the retrieved target character string, arrange the conversion output in a Z-shape, and utilize a transposition management unit to transpose the arranged elements and then concatenate them.

[0017] Furthermore, the conversion equation based on De Morgan's law is inputted as i , i∈[0,3], and output r j , j∈[0,7], the transformation relationship is configured as:

[0018] r 7 =0,

[0019]

[0020]

[0021]

[0022]

[0023]

[0024]

[0025]

[0026] Furthermore, in the encoding stage, an unaligned cache-internal multiplication-addition architecture is used to perform calculations of multiplication followed by addition and accumulation.

[0027] The present invention also designs a base recognition operator acceleration system based on in-memory calculation. The system is configured with a processor, and the processor is configured to execute the above-mentioned base recognition operator acceleration method based on in-memory calculation during operation.

[0028] The present invention also designs a base recognition operator acceleration device based on in-memory calculation, and the device is equipped with the above-mentioned base recognition operator acceleration system based on in-memory calculation.

[0029] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:

[0030] 1. For the beam search operation, it has been found that partial sorting is the bottleneck of the beam search algorithm. In this regard, the present invention proposes a cluster search method based on a fuzzy matching mechanism, which offloads the calculation of the beam search to the cache through the collaborative design of the algorithm and the architecture to improve the efficiency of base recognition calculation and increase the throughput of base recognition without changing the CPU selection.

[0031] 2. For string conversion operations, the present invention analyzes the pros and cons of various ways to accelerate this process, and finds that data movement and flexibility are the two key implementation challenges of this process, and proposes an in-situ character conversion architecture. The present invention proposes a specific algorithm mapping, which can eliminate the data movement overhead of string conversion. The present invention determines that data movement and flexibility are two key implementation challenges of string conversion operations, and proposes a specific algorithm mapping technology to eliminate the data transmission overhead in string conversion.

[0032] 3. For the multiplication and addition operations involved in the neural network in the encoding stage, the present invention expands the existing design and introduces an unaligned multiplication and addition structure based on data statistics, which further reduces the delay required for exponential alignment during addition and subtraction operations, and also provides cache support for other necessary operators in the base recognition process. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The present invention will now be described by way of example with reference to the accompanying drawings, in which:

[0034] Figure 1 FIG. 4 is a schematic diagram of a multi-layer mask mechanism according to an example of the present invention.

[0035] Figure 2 A schematic diagram of a customized data mapping and required supporting architecture for character conversion according to an example of the present invention.

[0036] Figure 3 A schematic diagram of an in-cache non-aligned multiply-add architecture according to an example of the present invention.

[0037] Figure 4 A schematic diagram of a CAM fuzzy search within a cache according to an example of the present invention. DETAILED DESCRIPTION

[0038] All features disclosed in this specification, or steps in all methods or processes disclosed, except mutually exclusive features and / or steps, can be combined in any manner.

[0039] Any feature disclosed in this specification (including any additional claims and abstract), unless otherwise stated, may be replaced by other equivalent or alternative features having similar purposes. That is, unless otherwise stated, each feature is only an example of a series of equivalent or similar features.

[0040] Example 1

[0041] A method for accelerating a base recognition operator based on in-memory computing, wherein base recognition includes an encoding stage and a decoding stage. The encoding stage converts a continuous electrical signal into a probability distribution matrix of base encoding, and the decoding stage converts the probability distribution matrix into a continuous base sequence. The bottlenecks of the encoding stage are general matrix multiplication operations and tensor operations, and the bottlenecks of the decoding stage are beam search operations and string conversion operations.

[0042] To this end, in the decoding stage, the embodiment of the present invention uses a beam search method based on a fuzzy matching mechanism to retrieve the probability distribution matrix. The beam search method based on the fuzzy matching mechanism uses a multi-layer mask mechanism to search for the target string level by level in the cache.

[0043] Since the operations supported in the cache are limited, it is inefficient to perform sorting operations directly in the cache. However, beam search requires sorting all the beams and then taking the first bw elements (bw is the width of the defined beam search). Therefore, this sorting operation can be combined into an operation to find the largest first bw elements, which can be implemented efficiently using cache operations. Considering that floating point numbers have a unique storage format (taking Float 16 as an example, (-1) Sign ×2 Exp-31 ×1.Mnt), so the comparison problem of numerical values ​​can be transformed into the comparison problem of exponential bit sizes by using the beam search method based on fuzzy matching mechanism.

[0044] As for the multi-layer mask mechanism. In order to find the smallest exponent bit in the cache, we proposed a multi-layer mask mechanism. Let the total number of bits in the search space be N. In order to ensure that the search space is continuous, we define the interval of the fuzzy string as (P×2 n ,P×2 n +2 n -1), where log 2 P+n=N,log 2 P∈ is a positive integer. N is the number of exponent bits in the search space, which is determined by the range of the exponent bits of the floating point number. P is the number of network numbers in each mask layer, and n is the number of host numbers in each mask layer. The so-called network number is the bits that are determined and unchanged, while the host number is the remaining uncertain bits. P and n will increase and decrease respectively as the matching level deepens, that is, the P value of each mask layer increases step by step, and on the contrary, the N value decreases step by step. Figure 1 Take Float 16 as an example, the number of exponent bits N is 5, the first-level mask (i.e., the first-layer mask) has n of 3 and P of 4. This can generate 4 fuzzy matching strings, namely "00XXX", "01XXX", "10XXX", and "11XXX". In the 5-bit string, the first two bits are the network number and the last three bits are the host number. By using these four strings, the exponent range of 0 to 31 can be divided into 0 to 7, 8 to 15, 16 to 23, and 24 to 31. The second-level mask has n of 2 and P of 8, generating 8 fuzzy matching strings, namely "000XX" and "001XX", which belong to the two branches of the first-level mask "00XXX". Similarly, the fuzzy matching strings also include "010XX", "011XX", "100XX", "101XX", "110XX", and "111XX", further dividing each exponent range in half. The third-level and fourth-level masks are set in the same way. As shown in the figure, by using 4 fuzzy matches, the first 16 largest clusters can be found.

[0045] Considering that accurate matching is not easy to obtain, we set a positive margin threshold σ for matching. When the difference margin between the number of clusters found and the number of clusters required is less than σ, we will continue to perform subsequent probability calculations on the excess margin.

[0046] The core of the beam search method based on fuzzy matching mechanism is CAM search. Figure 4(b) shows how to search for a specific string in the cache. Assume that there are strings "01011" and "01110" in the cache, and the string to be matched is "01110" (i.e., the target string). In beat 0, we activate the cache cells corresponding to "1" in the search string, and read the results in the cache cells into the Hits register through BL (Bit-Line). Because the Hit register will only be "1" if all cache cells are "1" at the same time, the column with the Hit register being "1" indicates that there is the same "1" pattern as the target string. Similarly, we can activate the cache cells corresponding to "0" in the search string, and read the results from the BLB into the Hit register. The column where the Hit register is 1 twice is the column corresponding to the searched target string. As shown in the figure, the nth column is the column where the target string appears.

[0047] The characteristic of this search method is that it can find out how many strings identical to the target string exist in all columns within two cycles (depending on the number of network bits of the target string). Figure 4 (a) Given the schematic diagram of querying the first-level mask “01XXX”, we can find 4 columns in 128 that satisfy the index range of 8 to 15 within two cycles.

[0048] In addition, the beam search architecture based on the fuzzy matching mechanism also optimizes memory. During the execution of the beam search, the extended sequence increases successively. Considering that the length of the output sequence is 1k~2M, the memory overhead is as high as 128MB, which far exceeds the size of the CPU edge cache. In addition, considering that each expansion is performed on the basis of the original sequence, in this embodiment, when searching for the target string in the cache, the extended sequence is stored in DRAM and the corresponding pointer is stored in the cache. After completing the search of the entire sequence, the corresponding extended sequence is read from DRAM through the pointer in the cache for search to re-read the sequence with the highest probability from the memory.

[0049] Furthermore, in the decoding phase, the retrieved target character string is converted into a continuous base sequence using an in-situ character conversion architecture based on in-cache calculation, wherein the in-situ character conversion architecture based on in-cache calculation uses a conversion equation based on De Morgan's law to perform transcoding in the cache.

[0050] The in-situ character conversion architecture based on in-cache calculation simplifies the string conversion process into a base conversion problem and a base splicing problem. Figure 2 The figure shows the data mapping architecture customized to solve these problems, namely the in-situ character conversion architecture.

[0051] (1) Parallel conversion: The retrieved target string is converted in parallel based on the in-situ character conversion architecture calculated in the cache. Figure 2 As shown in (a), the cache array is divided into two parts by row. One part is the output of the beam search (out, each with o b bits), and the other part is the converted basis (results, each with r b If the starting row of a beam search is b i , then the starting line of the converted output is Since different columns of the cache array are calculated simultaneously, and different rows are calculated iteratively, for a conventional 256×256 cache array, the conversion engine of this embodiment can convert 256 bases simultaneously, and the entire cache array can store 47,662 converted bases.

[0052] (2) Eliminate connections. Because different tasks are independent of each other, this embodiment arranges the input conversion outputs into a Z shape and participates in the calculation. Figure 2 As shown in (b), the Z-shaped elements (i.e., the transformation output) can be restored to a spliced ​​form by using a transposition management unit (TMU). Figure 2 (c) is the internal unit implementation of the transposition management unit, which can support data reading and writing in the transposition direction by simply adding two NMOS.

[0053] As for the conversion equation based on De Morgan's law, it performs transcoding in the cache, that is, transcoding the characters into a basis.

[0054] In order to use only operations supported by in-cache computation and support flexible transcoding, we propose a transformation equation based on De Morgan's law. Assume that our transformation rule is {0:'-',1:'A',2:'T',3:'C',4:'G',5:"}, and assume that the input and output are oi(i∈[0,3]) and rj(j∈[0,7]):

[0055] r 7 =0,

[0056]

[0057]

[0058]

[0059]

[0060]

[0061]

[0062]

[0063] By adding r j Convert to in-cache operations (e.g. 0 , o 1 o 0 , nor, etc.). This conversion can be completed in a few cycles. For example, 3 Only one cycle is required, r 4 Only two cycles are required, r 2 Only four cycles are needed. The total number of cycles is 24, which can be further reduced to 6 cycles using the sense amplifier looping technique. These operations are supported by an improved cache array peripheral.

[0064] In the neural network operations in the encoding stage (mainly general matrix multiplication operations and tensor operations), an unaligned cache multiplication-addition architecture is used to perform addition-accumulation calculations after multiplication.

[0065] The key point of this embodiment is to further optimize the addition and accumulation after multiplication. Figure 3 A schematic diagram showing the multiplication and addition in an unaligned cache is shown, which consists of three steps:

[0066] (1) Determine exp best . The present invention studies and counts the exponent bits of the partial products generated by multiplication and addition in different neural network operations. The statistical results show that in the case of Float 16, 95% of the best exponent bits are 0, and the remaining best exponent bits are only small 2, 4, 6, 8, etc. There are two reasons for this phenomenon: the first is that normalization operations are widely used in neural networks, making the values ​​much smaller than 1; the second reason is that each partial product is obtained by multiplying two smaller numbers. Based on this observation, in this embodiment, exp best Set to 0 so that all output exponent bits are also 0.

[0067] (2) Exponent shift. Because exp best is 0, so the number of bits that the mantissa needs to be shifted is the value of the input exponent bit. In order to search and shift all inputs at the same time, this embodiment uses a CAM search structure to search all input exponent bits, and can search for all identical exponent bits at one time and complete the corresponding shift. In order to further reduce the number of CAM searches, in this embodiment, the search interval of the exponent bit is determined to be 1 / 3 of the total exponent range.

[0068] (3) Through the processing of the first two processes, the problem of mantissa shift required for floating point number addition has been solved, and the sum of floating point numbers becomes the sum of integers. This embodiment uses the reduction operation proposed by Neural Cache to complete the remaining summation process.

[0069] Example 2

[0070] Based on Example 1, this example introduces a base recognition operator acceleration system based on in-memory calculation. The system is configured with a processor, and the processor is configured to execute the base recognition operator acceleration method based on in-memory calculation of Example 1 during runtime.

[0071] Specifically, a computer-readable storage medium is configured in the system, and the computer-readable storage medium stores computer codes, and running the codes is to execute the method in Embodiment 1. The processor is connected to the computer-readable storage medium to execute the computer program therein.

[0072] On this basis, the system is configured into the overall device, and with the addition of peripherals, IO ports, RAM, ROM, power supply, etc., a base recognition operator acceleration device based on in-memory computing can be obtained.

[0073] The present invention is not limited to the above-mentioned specific embodiments, but extends to any new features or any new combination disclosed in this specification, as well as any new method or process steps or any new combination disclosed.

Claims

1. A base recognition operator acceleration method based on in-memory computing, wherein the base recognition includes an encoding stage and a decoding stage, wherein the encoding stage converts a continuous electrical signal into a probability distribution matrix of base coding, and the decoding stage converts the probability distribution matrix into a continuous base sequence; characterized in that: In the decoding stage, the probability distribution matrix is ​​retrieved using a beam search method based on a fuzzy matching mechanism. The beam search method based on a fuzzy matching mechanism uses a multi-layer mask mechanism to search for the target string in the cache step by step. The search interval of the beam search method based on the fuzzy matching mechanism is (P×2 n , P×2 n + 2 n −1), where log2P +n=N, N is the number of exponential bits in the search space, P is the number of network numbers in each mask layer, log2P∈ a positive integer, and n is the number of host numbers in each mask layer; the P value of each mask layer increases step by step; The beam search method based on the fuzzy matching mechanism uses CAM search to search for the target string in the cache; Searching for a target string in a cache includes: storing an extended sequence in a DRAM, storing a corresponding pointer in the cache, and when searching for the target string, reading the corresponding extended sequence from the DRAM through the pointer in the cache for searching; as well as The retrieved target character string is converted into a continuous base sequence using an in-situ character conversion architecture based on in-cache calculation, wherein the in-situ character conversion architecture based on in-cache calculation is configured to perform parallel conversion on the retrieved target character string, arrange the conversion output in a zigzag shape, and use a transposition management unit to transpose the arranged elements and then concatenate them; The in-situ character conversion architecture based on in-cache calculation uses a conversion equation based on De Morgan's law to perform transcoding in the cache, and the conversion equation based on De Morgan's law is input into o i , i∈ [0,3], and output r j , j∈[0,7], the transformation relationship is configured as: r7 = 0, r6 = ¬o2o0 (o2o1 nor ¬o2¬o1)¬o0, r5 = ¬o2¬o1¬o0and o2¬o1o0, r4 = ¬o2o1¬o0, r3 = ¬o2¬o1¬o0, r2 = ¬o2¬o1¬o0 and (o2o1 nor ¬o2¬o1)¬o0, r1 = ¬o2o1o0 and o2¬o1¬o0, r0 = ¬o2¬o1 and ¬o2o1o0 and o2¬o1¬o0.

2. The base recognition operator acceleration method based on in-memory computing as claimed in claim 1, characterized in that: The beam search method based on the fuzzy matching mechanism is configured with a margin threshold σ. When the difference margin between the number of character strings searched from the cache and the required number of clusters is less than σ, probability calculation is performed on the character strings with the difference margin.

3. The base recognition operator acceleration method based on in-memory computing as claimed in claim 1, characterized in that: In the encoding stage, a non-aligned cache multiplication-addition architecture is used to perform calculations of multiplication followed by addition-accumulation.

4. A base recognition operator acceleration system based on in-memory computing, characterized in that: The system is configured with a processor, and the processor is configured to execute the base recognition operator acceleration method based on in-memory calculation as described in any one of claims 1 to 3 during operation.

5. A base recognition operator acceleration device based on in-memory computing, characterized in that: The device is configured with the base recognition operator acceleration system based on in-memory computing as described in claim 4.

Citation Information

Patent Citations

  • Data processing method of next-generation sequencing (NGS) data analysis platform (IMP)

    CN107609350A

  • Method for quickly identifying single-molecule nanopore sequencing bases based on deep network

    CN112183486A

  • Password semantic structuralization implementation method based on deep learning

    CN112613325A

  • Binary image compression coding and decoding method based on Base62 coding

    CN114286102A

  • Genome diagram analysis method and device based on memory calculation and medium

    CN116665772A