Ecc engine selection method, apparatus, storage medium, and electronic device
Patent Information
- Application Number
- CN202311477163.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-07
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-11-07
AI Technical Summary
[0003]然而,传统的芯片和设备通常使用固定的ECC引擎来对数据进行处理,无法适应不同数据质量和环境条件的变化,降低了ECC引擎的数据处理灵活性
[0057] In summary, the ECC engine selection method provided in this application includes obtaining the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored; inputting the target wear coefficient, the flash memory type, and the entropy value into an engine prediction model for preprocessing to determine a target ECC engine among multiple ECC engines, wherein the multiple ECC engines are used to generate ECC codes of different code lengths; matching the entropy value with multiple H matrices in the target ECC engine to obtain a target H matrix; and using the target ECC engine that adopts the target H matrix to process the data to be stored. This scheme can predict and determine the target ECC engine based on the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored, and then determine the H matrix that the target ECC engine should currently use based on the entropy value. That is, this scheme can dynamically select a suitable ECC engine and the corresponding H matrix based on the relevant parameters of the target memory and the data to be stored, thereby improving the flexibility of the ECC engine in data processing.
Smart Images

Figure CN117453450B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of memory technology, specifically to an ECC engine selection method, apparatus, storage medium, and electronic device. Background Technology
[0002] Error detection and correction code (ECC) decoding technology can determine the location of abnormal data in the original data and correct errors based on the location of the abnormal data. Therefore, ECC encoding / decoding technology is widely used in related chips and devices in the field of data storage.
[0003] However, traditional chips and devices typically use fixed ECC engines to process data, which cannot adapt to changes in different data quality and environmental conditions, thus reducing the data processing flexibility of the ECC engine. Summary of the Invention
[0004] This application provides an ECC engine selection method, apparatus, storage medium, and electronic device, which can improve the data processing flexibility of the ECC engine.
[0005] In a first aspect, embodiments of this application provide an ECC engine selection method, including:
[0006] Obtain the flash memory type of the target memory, the target wear factor of the block used to store the data to be stored, and the entropy value of the data to be stored;
[0007] The target wear coefficient, the flash memory type, and the entropy value are input into the engine prediction model for preprocessing to determine the target ECC engine among multiple ECC engines. The multiple ECC engines are used to generate ECC codes of different code lengths.
[0008] The entropy value is matched with multiple H matrices in the target ECC engine to obtain the target H matrix;
[0009] The data to be stored is processed using the target ECC engine that employs the target H matrix.
[0010] In the ECC engine selection method provided in this application embodiment, the step of inputting the target wear coefficient, the flash memory type, and the entropy value into the engine prediction model for preprocessing to determine the target ECC engine among multiple ECC engines includes:
[0011] The target wear coefficient, the flash memory type, and the entropy value are input into the engine prediction model for preprocessing to output the error probability index;
[0012] The target ECC engine among the multiple ECC engines is determined based on the error probability index, wherein each ECC engine corresponds to a different interval of the error probability index, and the error probability index of the different intervals is positively correlated with the code length of the ECC code generated by the corresponding ECC engine.
[0013] In the ECC engine selection method provided in this application embodiment, the step of inputting the target wear coefficient, the flash memory type, and the entropy value into the engine prediction model for preprocessing to output an error probability index includes:
[0014] The target wear coefficient, the flash memory type, and the entropy value are input into the input layer of the engine prediction model for first data processing, and then the first processing result is input into the hidden layer of the engine prediction model to generate corresponding feature vectors respectively.
[0015] The feature vectors are input into the feature attention layer of the engine prediction model to obtain the probability weights of each feature vector.
[0016] The feature vector and the probability weight are subjected to a second data processing, and the error probability index is determined based on the second processing result.
[0017] In the ECC engine selection method provided in this application embodiment, the step of performing a second data processing on the feature vector and the probability weight, and determining the error probability index based on the second processing result, includes:
[0018] Calculate the weighted sum of the feature vector and the probability weight;
[0019] The weighted result is input into the fully connected layer of the engine prediction model for feature mapping to generate an error probability index.
[0020] In the ECC engine selection method provided in this application embodiment, the step of matching the entropy value with multiple H matrices in the target ECC engine to obtain the target H matrix includes:
[0021] The entropy value is input into a preset relational mapping table to determine the H matrix corresponding to the entropy value. The preset relational mapping table reflects the H matrix corresponding to each range of entropy values.
[0022] The target H matrix is determined from the multiple H matrices in the target ECC engine based on the H matrix corresponding to the entropy value.
[0023] In the ECC engine selection method provided in this application embodiment, obtaining the target wear factor of the block used to store the data to be stored includes:
[0024] Determine the wear coefficient of each block in the target memory used to store the data to be stored, wherein the wear coefficient is the ratio of the number of erases to the number of allowable erases;
[0025] The average value is calculated based on the wear coefficient of each block, and the average value is determined as the target wear coefficient.
[0026] In the ECC engine selection method provided in this application embodiment, obtaining the entropy value of the data to be stored includes:
[0027] Obtain the percentage of each bit type in the data to be stored;
[0028] The proportion of data of each bit type is used as the input to the information entropy function to output the entropy value of the data to be stored.
[0029] The ECC engine selection method provided in this application embodiment further includes obtaining the engine prediction model; obtaining the engine prediction model includes:
[0030] Construct an LSTM network, which includes an input layer, a hidden layer, a feature attention layer, and a fully connected layer;
[0031] Obtain a dataset for training and testing the LSTM network. The dataset consists of several sets of flash memory types, target wear coefficients, entropy values, and corresponding error probability indices collected in time sequence when the target memory stores data.
[0032] a. Input the data from the dataset into the input layer for preprocessing to generate input data;
[0033] b. Input the input data into the hidden layer and output the feature vector;
[0034] c. Input the feature vector into the feature attention layer, calculate the probability weights of different feature vectors, and output the weighted result of the feature vector and the probability weights;
[0035] d. Input the weighted result of the feature vector and the probability weight into the fully connected layer, map the weighted feature vector, and output the prediction result;
[0036] e. Input the prediction result and the corresponding error probability index into the loss function to obtain the loss value;
[0037] When the loss value is greater than a preset threshold, the parameters of the LSTM network are adjusted so that the LSTM network updates in the direction of decreasing loss function, and steps a to e are repeated until the loss value is less than or equal to the preset threshold, at which point the engine prediction model is generated.
[0038] In the ECC engine selection method provided in this application embodiment, the step of inputting the input data into the hidden layer and outputting a feature vector includes:
[0039] The values of the input gate, forget gate, output gate, and candidate memory units of the hidden layer are calculated based on the input data.
[0040] Update the value of the long-term memory unit based on the values of the input gate, forget gate, and candidate memory units;
[0041] The hidden layer output is calculated based on the values of the output gate and the long-term memory unit to obtain the feature vector;
[0042] The calculation formula includes:
[0043] Forgotten Gate: F t =σ(W F [h t-1 ,X t ]+b F )
[0044] Input gate: I t =σ(W I [h t-1 ,X t ]+b I )
[0045] Output gate: O t =σ(W0[h t-1 ,X t ]+b0)
[0046] Candidate memory units:
[0047] Long-term memory units:
[0048] Hidden layer output: h t =0 t *tanh(C t )
[0049] Among them, W F W I W0 For training parameters, b F b I b0 X is the bias term, σ and tanh are the activation functions, and X is the bias term. t This is the input data currently being entered.
[0050] Secondly, embodiments of this application provide an ECC engine selection device, comprising:
[0051] The acquisition unit is used to acquire the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored;
[0052] The prediction unit is used to input the target wear coefficient, the flash memory type and the entropy value into the engine prediction model for preprocessing, and to determine the target ECC engine among multiple ECC engines. The multiple ECC engines are used to generate ECC codes of different code lengths.
[0053] A matching unit is used to match the entropy value with multiple H matrices in the target ECC engine to obtain the target H matrix;
[0054] The processing unit is used to process the data to be stored using the target ECC engine employing the target H matrix.
[0055] Thirdly, this application provides a storage medium storing a plurality of instructions adapted for loading by a processor to execute the ECC engine selection method described in any of the preceding claims.
[0056] Fourthly, this 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 computer program to implement the ECC engine selection method described in any of the preceding claims.
[0057] In summary, the ECC engine selection method provided in this application includes obtaining the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored; inputting the target wear coefficient, the flash memory type, and the entropy value into an engine prediction model for preprocessing to determine a target ECC engine among multiple ECC engines, wherein the multiple ECC engines are used to generate ECC codes of different code lengths; matching the entropy value with multiple H matrices in the target ECC engine to obtain a target H matrix; and using the target ECC engine that adopts the target H matrix to process the data to be stored. This scheme can predict and determine the target ECC engine based on the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored, and then determine the H matrix that the target ECC engine should currently use based on the entropy value. That is, this scheme can dynamically select a suitable ECC engine and the corresponding H matrix based on the relevant parameters of the target memory and the data to be stored, thereby improving the flexibility of the ECC engine in data processing. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a flowchart illustrating the ECC engine selection method provided in the embodiments of this application.
[0060] Figure 2 This is a flowchart illustrating the method for obtaining the engine prediction model provided in this application embodiment.
[0061] Figure 3 This is a schematic diagram of the engine prediction model provided in the embodiments of this application.
[0062] Figure 4 This is a schematic diagram of the hidden layer structure of the engine prediction model provided in the embodiments of this application.
[0063] Figure 5 This is a schematic diagram of the structure of the ECC engine selection device provided in the embodiments of this application.
[0064] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0065] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0066] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, components, features, and elements with the same names in different embodiments of this application may have the same meaning or different meanings, the specific meaning of which must be determined by its interpretation in that specific embodiment or further in conjunction with the context of that specific embodiment.
[0067] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0068] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustrative purposes and has no specific meaning in itself. Therefore, "module," "part," or "unit" may be used interchangeably.
[0069] In the description of this application, it should be noted that terms such as "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0070] Traditional chips and devices typically use fixed ECC engines to process data, which cannot adapt to changes in data quality and environmental conditions, reducing the data processing efficiency of the ECC engine and posing challenges to data security.
[0071] Based on this, embodiments of this application provide an ECC engine selection method, apparatus, storage medium, and electronic device. Specifically, the ECC engine selection apparatus can be integrated into a solid-state drive (SSD), which can be integrated into an electronic device, such as a server or a terminal. The terminal can include mobile phones, wearable smart devices, tablets, laptops, and personal computers (PCs). The server can be a single server or a server cluster composed of multiple servers, and can be a physical server or a virtual server.
[0072] The technical solutions shown in this application will be described in detail below through specific embodiments. It should be noted that the order of description of the following embodiments is not intended to limit the priority of the embodiments.
[0073] Please see Figure 1 , Figure 1 This is a flowchart illustrating the ECC engine selection method provided in the embodiments of this application.
[0074] The specific process for selecting the ECC engine can be as follows:
[0075] 101. Obtain the flash memory type of the target memory, the target wear factor of the block used to store the data to be stored, and the entropy value of the data to be stored.
[0076] Common flash memory types include SLC, MLC, TLC, and QLC. Different types of flash memory have different structural characteristics, cell bit width, and durability. Durability is determined by the number of program erase / write (P / E) cycles a flash memory cell can complete before it begins to wear out. Erasing and writing to a cell constitutes one P / E cycle. The higher the nominal P / E cycle value, the more times the flash memory chip can be erased and written, meaning its durability is higher. The lifespan ranking of the aforementioned flash memory types is SLC > MLC > TLC > QLC.
[0077] Specifically, obtaining the target wear factor of the block used to store the data to be stored includes:
[0078] Determine the wear factor of each block in the target memory used to store the data to be stored. The wear factor is the ratio of the number of erases to the number of allowable erases.
[0079] The average value is calculated based on the wear coefficient of each block, and the average value is determined as the target wear coefficient.
[0080] Understandably, the target memory is composed of multiple physical blocks, each with its own wear coefficient. Furthermore, when data to be stored needs to be stored across multiple blocks, the wear coefficients of each block may not be the same. Therefore, when it is necessary to comprehensively evaluate the common wear coefficient of multiple blocks, the average wear coefficient of the multiple blocks can be calculated as the target wear coefficient. This target wear coefficient is used to evaluate the overall wear degree of these blocks. In addition, the wear coefficient is the ratio of the number of erases a block has to the allowed number of erases. The allowed number of erases refers to the number of times a block of memory can be erased and rewritten. Each block of memory has its specific erase count limit because erasing operations cause wear and tear on the memory. As the number of erases increases, errors are more likely to occur in the data stored in the corresponding block.
[0081] Further, the entropy value of the data to be stored is obtained, including:
[0082] Obtain the percentage of each bit type in the data to be stored;
[0083] The proportion of data of each bit type is used as the input to the information entropy function to output the entropy value of the data to be stored.
[0084] Entropy represents the degree of disorder in data to be stored. Data is typically stored in binary form, meaning it contains only 0s and 1s. If the ratio of 0s to 1s in the data to be stored is close to an even distribution, the entropy is high, indicating that the data has a high information content and uncertainty, making it prone to errors during storage. Conversely, if the data to be stored has high repetition, meaning that certain bit types appear frequently, the entropy is low, indicating a lower probability of errors during storage.
[0085] Specifically, the information entropy function can be used to calculate the degree of disorder in the data to be stored, and its calculation formula is as follows:
[0086]
[0087] Where H(D) is the calculated entropy value, D is the set of bit types, d is the bit type, which can be 1 or 0, and p(d) can represent the frequency of the corresponding bit type in the data.
[0088] 102. Input the target wear coefficient, flash memory type and entropy value into the engine prediction model for preprocessing to determine the target ECC engine among multiple ECC engines. The multiple ECC engines are used to generate ECC codes of different code lengths.
[0089] In this embodiment, the engine prediction model is a Long Short-Term Memory (LSTM) network. In practice, the LSTM network can be trained using a large dataset to generate the engine prediction model.
[0090] Specifically, the target wear factor, flash memory type, and entropy value are input into the engine prediction model for preprocessing to determine the target ECC engine among multiple ECC engines, including:
[0091] The target wear coefficient, flash memory type, and entropy value are input into the engine prediction model for preprocessing to output the error probability index;
[0092] The target ECC engine among multiple ECC engines is determined based on the error probability index. Each ECC engine corresponds to an error probability index in a different range, and the error probability index in different ranges is positively correlated with the code length of the ECC code generated by the corresponding ECC engine.
[0093] The engine prediction model can predict the error probability index of the data to be stored when stored in the target memory using three input variables (target wear coefficient, flash memory type, and entropy value). Based on this error probability index, it determines the target ECC engine among multiple ECC engines to be used for ECC encoding of the data to be stored. In other words, each ECC engine corresponds to a different range of error probability index. By determining the range of the error probability index, the corresponding ECC engine can be identified. In addition, the error probability index of different ranges is positively correlated with the code length of the ECC code generated by the corresponding ECC engine. This ensures that data to be stored with a high error probability index corresponds to an ECC engine with a long ECC code length, thereby obtaining a longer ECC code for data with a high error probability index, thus improving the security of the data when stored in the target memory.
[0094] For details, please refer to Figure 3 The target wear coefficient, flash memory type, and entropy value can be input into the input layer of the engine prediction model for first data processing. The first processing result is then input into the hidden layer of the engine prediction model to generate corresponding feature vectors. The feature vectors are then input into the feature attention layer of the engine prediction model to obtain the probability weights of each feature vector. The feature vectors and probability weights are then processed in the second data processing, and the error probability index is determined based on the second processing result.
[0095] Specifically, the feature vector and probability weights undergo a second data processing step, and the error probability index is determined based on the second processing result. This step can be to calculate the weighted result of the feature vector and probability weights, and then input the weighted result into the fully connected layer of the engine prediction model for feature mapping to generate the error probability index.
[0096] Furthermore, the target wear coefficient, flash memory type, and entropy value are input into the input layer of the engine prediction model for the first data processing. This involves data transformation and normalization of the target wear coefficient, flash memory type, and entropy value, ensuring that all three variables are within the range [0,1]. The flash memory type can be assigned 0.25, 0.5, 0.75, and 1 for SLC, MLC, TLC, and QLC, respectively, thus obtaining the first data result. The hidden layer is the core part of the LSTM network, consisting of multiple LSTM units. Each LSTM unit has a cell state and three gates (forget gate, input gate, and output gate), which can store and update long-term and short-term memories. The generated feature vector is a vector representing data features, which can capture important information from the input data. The feature attention layer is used to enhance the performance of the LSTM network. It can assign different probability weights to different feature vectors, allowing the LSTM network to focus on more important features.
[0097] It should be noted that after generating the error probability index, the target ECC engine among multiple ECC engines can be determined based on the error probability index. For example, the types of ECC engines can include long code (4K Bytes) ECC engines, medium code (2K Bytes) ECC engines, and short code (1K Bytes) ECC engines.
[0098] 103. Match the entropy value with multiple H matrices in the target ECC engine to obtain the target H matrix.
[0099] In some embodiments, before step 101, a preset relationship mapping table can be constructed based on the one-to-one correspondence between entropy values and H matrices. After the target ECC engine and the entropy value are determined, the entropy value can be input into the preset relationship mapping table to determine the H matrix corresponding to the entropy value. Then, the H matrix corresponding to the entropy value is compared with multiple H matrices in the target ECC engine to obtain the target H matrix.
[0100] In the embodiments of this application, each type of ECC engine is equipped with multiple H matrices with different parameters. Different H matrices have different error correction capabilities for different entropy values. That is, each entropy value has a corresponding optimal H matrix, and the optimal H matrix has the best error correction capability for data with the corresponding entropy value.
[0101] In this embodiment, the number of H matrices set in each type of ECC engine is 3. It should be noted that the H matrix is the parity check matrix.
[0102] 104. Use the target ECC engine with the target H matrix to process the data to be stored.
[0103] Understandably, when using the target ECC engine with the H matrix to process the data to be stored, the data processing efficiency and error correction capability are at their best, and the best write and read efficiency can be achieved.
[0104] In summary, the ECC engine selection method provided in this application includes obtaining the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored; inputting the target wear coefficient, flash memory type, and entropy value into an engine prediction model for preprocessing to determine the target ECC engine among multiple ECC engines, wherein the multiple ECC engines are used to generate ECC codes of different code lengths; matching the entropy value with multiple H matrices in the target ECC engine to obtain the target H matrix; and using the target ECC engine that adopts the target H matrix to process the data to be stored. This scheme can predict and determine the target ECC engine based on the target wear coefficient, flash memory type, and entropy value, and then determine the H matrix that the target ECC engine should currently use based on the entropy value. That is, this scheme can dynamically select a suitable ECC engine and its corresponding H matrix based on the relevant parameters of the target memory and the data to be stored, thereby improving the flexibility of the ECC engine in data processing and achieving optimal write and read efficiency under the condition of data security.
[0105] To further elaborate on the above-mentioned ECC engine selection method, embodiments of this application also provide a method for obtaining an engine prediction model, such as... Figure 2 As shown, the specific process for obtaining the prediction model of this engine can be as follows. It should be noted that the specific structure of the prediction model of this engine can be as follows: Figure 3 As shown. Among them, Figure 3 The specific structure of the LSTM hidden layer shown can be as follows: Figure 4 As shown.
[0106] 201. Construct an LSTM network, which includes an input layer, hidden layers, feature attention layers, and fully connected layers.
[0107] The input layer has three nodes: target wear coefficient, entropy value, and flash memory type. It performs preprocessing on the input data, such as normalization. The hidden layer consists of multiple LSTM units, each with a long-term memory unit and three gates (forget gate, input gate, and output gate). These gates store and update long-term and short-term memories, enabling the extraction of important information from the input data. The feature attention layer weights the output of the hidden layers, assigning different attention weights to highlight important features and suppress unimportant ones. The fully connected layer maps the output of the feature attention layer to the target space to output the prediction result. The feature attention layer uses ReLU or Sigmoid activation functions.
[0108] 202. Obtain the dataset for training and testing the LSTM network. The dataset consists of several sets of flash memory types, target wear coefficients, entropy values, and corresponding error probability indices collected in time sequence when the target memory stores data.
[0109] Specifically, a large amount of data can be collected in a time sequence, including the target wear coefficient, flash memory type, entropy value, and corresponding error probability index when storing data in the target memory. Then, the dataset is divided into training set data and test set data. The training set data is used for training the LSTM network, and the test set data is used to test the accuracy of the LSTM network.
[0110] It is important to understand that the error probability index in the dataset can be obtained through large-scale experiments. This is achieved by calculating the number of times errors occur when the corresponding data is repeatedly stored, thereby obtaining the error probability index.
[0111] 203. Input the data from the dataset into the input layer for preprocessing to generate input data.
[0112] 204. Input the input data into the hidden layer and output the feature vector.
[0113] It is important to understand that data can be input according to the set time step.
[0114] 205. Input the feature vectors into the feature attention layer, calculate the probability weights of different feature vectors, and output the weighted result of the feature vectors and probability weights.
[0115] 206. Input the weighted result of the feature vector and probability weight into the fully connected layer, map the weighted feature vector, and output the prediction result.
[0116] 207. Input the prediction results and the corresponding error probability index into the loss function to obtain the loss value.
[0117] 208. Based on this loss value, a prediction model is generated using an engine.
[0118] In some embodiments, step 208 may specifically include: when the loss value is greater than a preset threshold, adjusting the parameters of the LSTM network so that the LSTM network updates in the direction of decreasing loss function, and repeating steps 203 to 207 until the loss value is less than or equal to the preset threshold, and generating an engine prediction model.
[0119] It should be noted that when training and testing the LSTM network, the loss function used can be the root mean square error function, which measures the difference between the predicted and true values. The optimization algorithm is stochastic gradient descent, thereby gradually obtaining the optimal parameters of the LSTM network and generating the target LSTM network. Specifically, the root mean square error function e RMSE as follows:
[0120]
[0121] Where a is the total number of predicted time points, yu Let be the actual value of the error probability exponent at time u. Let be the predicted value of the error probability exponent at time u.
[0122] Further, please refer to Figure 4 The input data is fed into the hidden layer, and the output feature vector includes:
[0123] The values of the input gate, forget gate, output gate, and candidate memory units of the hidden layer are calculated based on the input data.
[0124] Update the values of long-term memory cells based on the values of the input gate, forget gate, and candidate memory cells;
[0125] The hidden layer output is calculated based on the values of the output gate and the long-term memory unit to obtain the feature vector;
[0126] The calculation formula includes:
[0127] Forgotten Gate: F t =σ(W F [h t-1 ,X t ]+b F )
[0128] Input gate: I t =σ(W I [h t-1 ,X t ]+b I )
[0129] Output gate: O t =σ(W0[h t-1 ,X t ]+b0)
[0130] Candidate memory units:
[0131] Long-term memory units:
[0132] Hidden layer output: h t =0 t *tanh(C t )
[0133] Among them, W F W I W0 For training parameters, b F b I b0 X is the bias term, σ and tanh are the activation functions, and X is the bias term. t This is the input data currently being entered.
[0134] Specifically, the long-term memory (LTM) unit is the main component of the LSTM unit, storing information over a long period. The forget gate determines what information is discarded from the LTM unit. The input gate determines what new information is added to the LTM unit. Candidate memory units are used to generate new memory information to update the LTM unit. The output gate determines what information is output from the LTM unit as the final output of the LSTM unit.
[0135] Understandably, W F W I W0 and b F b I b0 These are all parameters that need to be learned. When the loss value is greater than the preset threshold, it is necessary to calculate the forget gate error, input gate error, candidate memory unit error, and output gate error, and calculate the gradient of the above parameters based on these errors, so as to update the parameters so that the LSTM network updates in the direction of loss function descent.
[0136] In summary, the engine prediction model construction method provided in this application can generate an engine prediction model, thereby enabling prediction based on the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored, to determine the target ECC engine, and then determine the H matrix that the target ECC engine should currently use based on the entropy value. That is, this solution can dynamically select a suitable ECC engine and the corresponding H matrix based on the parameters of the target memory and the data to be stored, thereby improving the flexibility of the ECC engine in data processing and achieving the best write and read efficiency.
[0137] To facilitate better implementation of the ECC engine selection method provided in this application, this application also provides an ECC engine selection device. The meanings of the terms used are the same as in the ECC engine selection method described above, and specific implementation details can be found in the descriptions within the method embodiments.
[0138] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of the ECC engine selection device provided in an embodiment of this application. The ECC engine selection device may include an acquisition unit 301, a prediction unit 302, a matching unit 303, and a processing unit 304.
[0139] The acquisition unit 301 is used to acquire the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored;
[0140] Prediction unit 302 is used to input the target wear coefficient, the flash memory type and the entropy value into the engine prediction model for preprocessing, and determine the target ECC engine among multiple ECC engines. The multiple ECC engines are used to generate ECC codes of different code lengths respectively.
[0141] Matching unit 303 is used to match the entropy value with multiple H matrices in the target ECC engine to obtain the target H matrix;
[0142] The processing unit 304 is used to process the data to be stored using the target ECC engine employing the target H matrix.
[0143] For specific implementation methods of each of the above units, please refer to the embodiments of the ECC engine selection method described above, which will not be repeated here.
[0144] In summary, the ECC engine selection device provided in this application embodiment can obtain the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the data to be stored by the acquisition unit 301; the prediction unit 302 inputs the target wear coefficient, flash memory type, and entropy value into the engine prediction model for preprocessing to obtain the target ECC engine; the matching unit 303 matches the entropy value with multiple H matrices in the target ECC engine to obtain the target H matrix; and the processing unit 304 uses the target ECC engine with the target H matrix to process the data in the target memory. This solution can predict and determine the target ECC engine based on the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored, and then determine the H matrix that the target ECC engine needs to use based on the entropy value. That is, this solution can dynamically select a suitable ECC engine and the corresponding H matrix based on the parameters of the target memory and the data to be stored, thereby improving the flexibility of the ECC engine in data processing and achieving the best write and read efficiency.
[0145] This application also provides an electronic device that may integrate the ECC engine selection device of this application embodiment, such as... Figure 6 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically:
[0146] The electronic device may include a radio frequency (RF) circuit 601, a memory 602 including one or more computer-readable storage media, an input unit 603, a display unit 604, a sensor 605, an audio circuit 606, a wireless Fidelity (WiFi) module 607, a processor 608 including one or more processing cores, and a power supply 609, etc. Those skilled in the art will understand that... Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0147] in:
[0148] RF circuit 601 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and hands it over to one or more processors 608 for processing; additionally, it transmits uplink data to the base station. Typically, RF circuit 601 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, etc. Furthermore, RF circuit 601 can also communicate wirelessly with networks and other devices. Wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0149] The memory 602 can be used to store software programs and modules. The processor 608 executes various functional applications and information processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device (such as audio data, telephone directory, etc.). In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide access to the memory 602 for the processor 608 and the input unit 603.
[0150] The input unit 603 can be used to receive input digital or character information, and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control. Specifically, in one embodiment, the input unit 603 may include a touch-sensitive surface and other input devices. The touch-sensitive surface, also known as a touch display or touchpad, can collect user touch operations on or near it (e.g., user operations using fingers, styluses, or any suitable object or accessory on or near the touch-sensitive surface), and drive corresponding connection devices according to a pre-set program. Optionally, the touch-sensitive surface may include a touch detection device and a touch controller. The touch detection device detects the user's touch orientation and the signal generated by the touch operation, transmitting the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 608, and can receive and execute commands from the processor 608. Furthermore, various types of touch-sensitive surfaces, such as resistive, capacitive, infrared, and surface acoustic wave, can be used. In addition to the touch-sensitive surface, the input unit 603 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0151] Display unit 604 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of electronic devices. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Display unit 604 may include a display panel, optionally configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar form. Furthermore, a touch-sensitive surface may cover the display panel. When the touch-sensitive surface detects a touch operation on or near it, it transmits the information to processor 608 to determine the type of touch event. Subsequently, processor 608 provides corresponding visual output on the display panel according to the type of touch event. Although in Figure 6 In this context, the touch-sensitive surface and the display panel are two separate components for implementing input and output functions. However, in some embodiments, the touch-sensitive surface and the display panel can be integrated to achieve both input and output functions.
[0152] The electronic device may also include at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel according to the ambient light level, and the proximity sensor can turn off the display panel and / or backlight when the electronic device is moved to the ear. As a type of motion sensor, a gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. Other sensors that may be configured in the electronic device, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0153] Audio circuitry 606, a speaker, and a microphone provide an audio interface between the user and the electronic device. Audio circuitry 606 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 606, converted back into audio data, and processed by processor 608. The processed data is then transmitted via RF circuitry 601 to, for example, another electronic device, or output to memory 602 for further processing. Audio circuitry 606 may also include an earphone jack to facilitate communication between external headphones and the electronic device.
[0154] WiFi is a short-range wireless transmission technology. Electronic devices using the WiFi module 607 can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 6 The diagram shows a WiFi module 607, but it is understood that it is not a necessary component of an electronic device and can be omitted as needed without changing the nature of the invention.
[0155] The processor 608 is the control center of the electronic device. It connects various parts of the phone via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 602, and by calling data stored in the memory 602, thereby providing overall monitoring of the phone. Optionally, the processor 608 may include one or more processing cores; preferably, the processor 608 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 608.
[0156] The electronic device also includes a power supply 609 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 608 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 609 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0157] Although not shown, the electronic device may also include a camera, Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 608 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 608 runs the applications stored in the memory 602 to realize various functions, such as:
[0158] Obtain the flash memory type of the target memory, the target wear factor of the block used to store the data to be stored, and the entropy value of the data to be stored;
[0159] The target wear coefficient, flash memory type and entropy value are input into the engine prediction model for preprocessing to determine the target ECC engine among multiple ECC engines. The multiple ECC engines are used to generate ECC codes of different code lengths.
[0160] The entropy value is matched with multiple H matrices in the target ECC engine to obtain the target H matrix;
[0161] The target ECC engine, which uses the target H matrix, is used to process the data to be stored.
[0162] In summary, the electronic device provided in this application embodiment acquires the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored; inputs the target wear coefficient, flash memory type, and entropy value into the engine prediction model for preprocessing to determine the target ECC engine among multiple ECC engines, and the multiple ECC engines are used to generate ECC codes of different code lengths; matches the entropy value with multiple H matrices in the target ECC engine to obtain the target H matrix; and uses the target ECC engine that adopts the target H matrix to process the data to be stored. This solution can predict and determine the target ECC engine based on the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored, and then determine the H matrix that the target ECC engine should currently use based on the entropy value. That is, this solution can dynamically select a suitable ECC engine and the corresponding H matrix based on the parameters of the target memory and the data to be stored, thereby improving the flexibility of the ECC engine in data processing.
[0163] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed description of the ECC engine selection method above, which will not be repeated here.
[0164] It should be noted that, for the ECC engine selection method in the embodiments of this application, those skilled in the art will understand that all or part of the process of implementing the ECC engine selection method in the embodiments of this application can be accomplished by a computer program controlling the relevant hardware. The computer program can be stored in a computer-readable storage medium, such as the memory of a terminal, and executed by at least one processor in the terminal. During the execution process, it can include the process of the embodiments of the ECC engine selection method.
[0165] For the ECC engine selection device in this application embodiment, its functional modules can be integrated into a single processing chip, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0166] To this end, embodiments of this application provide a storage medium storing multiple instructions that can be loaded by a processor to execute steps in any of the ECC engine selection methods provided in embodiments of this application. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), etc.
[0167] The above provides a detailed description of the ECC engine selection method, apparatus, storage medium, and electronic device provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the core ideas of this application. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. An ECC engine selection method, characterized in that, include: Obtain the flash memory type of the target memory, the target wear factor of the block used to store the data to be stored, and the entropy value of the data to be stored; The target wear coefficient, the flash memory type, and the entropy value are input into the input layer of the engine prediction model for first data processing, and then the first processing result is input into the hidden layer of the engine prediction model to generate corresponding feature vectors. The feature vectors are input into the feature attention layer of the engine prediction model to obtain the probability weights of each feature vector. Calculate the weighted sum of the feature vector and the probability weight; The weighted result is input into the fully connected layer of the engine prediction model for feature mapping to generate an error probability index; The target ECC engine among the multiple ECC engines is determined based on the error probability index, wherein each ECC engine corresponds to the error probability index in a different interval, and the error probability index in different intervals is positively correlated with the code length of the ECC code generated by the corresponding ECC engine. The multiple ECC engines are used to generate ECC codes of different code lengths. The entropy value is matched with multiple H matrices in the target ECC engine to obtain the target H matrix; The data to be stored is processed using the target ECC engine that employs the target H matrix.
2. The ECC engine selection method as described in claim 1, characterized in that, The step of matching the entropy value with multiple H matrices in the target ECC engine to obtain the target H matrix includes: The entropy value is input into a preset relational mapping table to determine the H matrix corresponding to the entropy value. The preset relational mapping table reflects the H matrix corresponding to each range of entropy values. The target H matrix is determined from the multiple H matrices in the target ECC engine based on the H matrix corresponding to the entropy value.
3. The ECC engine selection method as described in claim 1, characterized in that, The process of obtaining the target wear coefficient of the block used to store the data to be stored includes: Determine the wear coefficient of each block in the target memory used to store the data to be stored, wherein the wear coefficient is the ratio of the number of erases to the number of allowable erases; The average value is calculated based on the wear coefficient of each block, and the average value is determined as the target wear coefficient.
4. The ECC engine selection method as described in claim 1, characterized in that, The process of obtaining the entropy value of the data to be stored includes: Obtain the percentage of each bit type in the data to be stored; The proportion of data of each bit type is used as the input to the information entropy function to output the entropy value of the data to be stored.
5. The ECC engine selection method as described in claim 1, characterized in that, It also includes obtaining the engine prediction model; obtaining the engine prediction model includes: Construct an LSTM network, which includes an input layer, a hidden layer, a feature attention layer, and a fully connected layer; Obtain a dataset for training and testing the LSTM network. The dataset consists of several sets of flash memory types, target wear coefficients, entropy values, and corresponding error probability indices collected in time sequence when the target memory stores data. a. Input the data from the dataset into the input layer for preprocessing to generate input data; b. Input the input data into the hidden layer and output the feature vector; c. Input the feature vector into the feature attention layer, calculate the probability weights of different feature vectors, and output the weighted result of the feature vector and the probability weights; d. Input the weighted result of the feature vector and the probability weight into the fully connected layer, map the weighted feature vector, and output the prediction result; e. Input the prediction result and the corresponding error probability index into the loss function to obtain the loss value; When the loss value is greater than a preset threshold, the parameters of the LSTM network are adjusted so that the LSTM network updates in the direction of decreasing loss function, and steps a to e are repeated until the loss value is less than or equal to the preset threshold, at which point the engine prediction model is generated.
6. The ECC engine selection method as described in claim 5, characterized in that, The step of inputting the input data into the hidden layer and outputting a feature vector includes: The values of the input gate, forget gate, output gate, and candidate memory units of the hidden layer are calculated based on the input data. Update the value of the long-term memory unit based on the values of the input gate, forget gate, and candidate memory units; The hidden layer output is calculated based on the values of the output gate and the long-term memory unit to obtain the feature vector; The calculation formula includes: in, , , , For training parameters, , , , For bias terms, , For activation function, The input data is the current input, and t represents the index of the time step.
7. An ECC engine selection device, characterized in that, include: The acquisition unit is used to acquire the flash memory type of the target memory, the target wear coefficient of the block used to store the data to be stored, and the entropy value of the data to be stored; The prediction unit is configured to input the target wear coefficient, the flash memory type, and the entropy value into the input layer of the engine prediction model for first data processing, and then input the first processing result into the hidden layer of the engine prediction model to generate corresponding feature vectors; input the feature vectors into the feature attention layer of the engine prediction model to obtain the probability weights of each feature vector; calculate the weighted result of the feature vectors and the probability weights; input the weighted result into the fully connected layer of the engine prediction model for feature mapping to generate an error probability index; and determine the target ECC engine among multiple ECC engines based on the error probability index, wherein each ECC engine corresponds to the error probability index in different intervals, and the error probability index in different intervals is positively correlated with the code length of the ECC code generated by the corresponding ECC engine; the multiple ECC engines are used to generate ECC codes of different code lengths. A matching unit is used to match the entropy value with multiple H matrices in the target ECC engine to obtain the target H matrix; The processing unit is used to process the data to be stored using the target ECC engine employing the target H matrix.
8. A storage medium, characterized in that, The storage medium stores a plurality of instructions adapted for loading by a processor to execute the ECC engine selection method according to any one of claims 1-6.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the ECC engine selection method as described in any one of claims 1-6.
Citation Information
Patent Citations
Method for storing data with different lengths through ECC (error correction code) memory
CN103559914A
Data storage method and device based on erasure codes
CN115577399A