A data processing device, method, medium and computing equipment
By using four state machines and multipliers and adders in the data processing device to perform sparse dimensionality reduction calculations, the problem of low efficiency of sparse dimensionality reduction calculations in the existing technology is solved, efficient and fast data processing is achieved, and resources and management are reduced. cost.
Patent Information
- Application Number
- CN202410766306.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-06-14
AI Technical Summary
In the existing technology, when sparse dimensionality reduction operations are performed based on FPGA or integrated circuits, the calculation amount is large, the speed is slow, and the efficiency is low. In addition, the use of interpreted languages in integrated circuits leads to unpredictable performance, difficult maintenance, difficult management and debugging, and waste of resources. The cost is high.
Design a data processing device, including four state machines and a multiplier and an adder. By reading and accumulating original vector data in rounds, it converts sparse dimensionality reduction calculations into multiple accumulation processes, avoids multiplication calculations, and improves data throughput and processing. speed.
It achieves the high efficiency of sparse dimensionality reduction calculation, with small calculation volume, fast speed and high efficiency, simplifying the data processing process and reducing resource and management costs.
Smart Images

Figure CN118349213B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing in computers, and in particular to a data processing apparatus, method, medium and computing device. Background Art
[0002] In the prior art, when faced with sparse data dimensionality reduction, FPGA (Field Programmable Gate Array, a semi-customized circuit in dedicated integrated circuits) or integrated circuits are generally used for this purpose.
[0003] Among them, FPGA usually uses the CSR (Compressed sparse row) method to store sparse matrices in non-zero format, but the CSR method mainly relies on matrix-vector multiplication, and the sparse dimensionality reduction operation is large, the speed is slow, and the efficiency is low. For example, the patent application with application number 202010535432.8 and the patent application with application number 201911160359.4.
[0004] Integrated circuits are mainly based on image processing units, and when using image processing units, interpreted languages (such as Python) are usually required. The automatic memory management of interpreted languages will lead to unpredictable performance issues, making it impossible to achieve a balanced training load, and it is difficult for third-party libraries to squeeze out the full performance of the hardware. The details covered by interpreted languages will also lead to difficulties in maintenance and debugging. In addition, different training may require libraries of different periods and versions, or different libraries, which can easily cause compilation environment pollution and make it difficult to manage and isolate the environment that model training depends on. Compared with using dedicated hardware acceleration architectures and environments, integrated circuits will waste more time, resources, and management costs. Summary of the invention
[0005] The main purpose of this application is to propose a data processing device, method, medium and computing equipment, aiming to solve the problems of large amount of calculation, slow speed and low efficiency when performing sparse dimensionality reduction operations based on FPGA or integrated circuits.
[0006] To achieve the above-mentioned purpose, the present application proposes a data processing device, comprising: a first state machine, a second state machine, a third state machine, a fourth state machine and a multiplier-adder;
[0007] The first state machine is configured to: in response to receiving a sparse dimension reduction instruction, send a first read request to the memory module in rounds according to a preset condition, the first read request requesting to read the original vector data in each memory pool of the memory module;
[0008] The second state machine is configured to: receive the original vector data returned by the first read request of each round; send a second read request to the memory module in rounds, the second read request requesting to read the accumulated vector data of the memory pool where the original vector data returned by the current round is located;
[0009] The third state machine is configured to: receive the accumulated vector data returned by the second read request in each round;
[0010] The multiplier-adder is configured to: accumulate the original vector data and the accumulated vector data in each round to obtain an accumulation result of each round;
[0011] The fourth state machine is configured to: receive the accumulation result of each round, and write the accumulation result of each round into the memory module.
[0012] In the embodiment of the present application, the preset conditions include:
[0013] The first read request of each round requests to read the original vector data in each memory pool of the memory module according to the preset bandwidth;
[0014] The memory pools requested to be read by the first read requests of adjacent rounds are adjacent in the memory modules;
[0015] When the memory pool requested to be read by any first read request crosses rows, the pool depth of the memory requested to be read by the first read request in the previous round is increased by one.
[0016] In the embodiment of the present application, the preset bandwidth is two unit bandwidths.
[0017] In an embodiment of the present application, the first state machine is further configured to: parse the sparse dimensionality reduction instruction to obtain the memory address, cumulative cache address, cumulative vector address, and cumulative vector unique hot bitmap of the data to be processed.
[0018] In the embodiment of the present application, the first state machine is further configured as:
[0019] Sending the accumulated cache address, the accumulated vector address, and the accumulated vector one-hot bitmap to the second state machine;
[0020] Sending the accumulated cache address and the accumulated vector one-hot bitmap to the third state machine;
[0021] The accumulated vector address is sent to the fourth state machine.
[0022] In the embodiment of the present application, the second state machine is further configured as:
[0023] Based on the accumulated cache address and the accumulated vector one-hot bitmap, the original vector data of each round is sent to the multiplier-accumulator.
[0024] In the embodiment of the present application, the third state machine is further configured as:
[0025] Based on the accumulated cache address and the accumulated vector one-hot bitmap, the accumulated vector data of each round is sent to the multiplier-accumulator.
[0026] In an embodiment of the present application, the fourth state machine is further configured to: based on the cumulative vector address, write the accumulated result of each round into the cumulative vector position corresponding to the memory pool in the memory module of the original vector data returned in each round.
[0027] In the embodiment of the present application, the second state machine is configured to determine the number of the data header information in the next data list based on the following method:
[0028] If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an even number, then the number of the data header information of the next data list is 1;
[0029] If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the number of the data header information of the next data list is 0;
[0030] If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an even number, the digit of the data header information of the next data list is 0;
[0031] If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the digit of the data header information of the next data list is 1;
[0032] The digital number includes 0 and 1, 0 represents the data located at the front of the memory module in the two original vector data received in this round, and 1 represents the data located at the back of the memory module in the two original vector data received in this round.
[0033] In an embodiment of the present application, the second state machine is configured to determine the round required to receive the next data header information based on the following method:
[0034] If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list divided by 2;
[0035] If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list minus 1 divided by 2;
[0036] If the number of the data header information received by the second state machine in the current round is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list divided by 2 plus one;
[0037] If the digit of the data header information received in the current round by the second state machine is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list plus 1 divided by 2.
[0038] In the embodiment of the present application, the second state machine is further configured as:
[0039] In response to the received original vector data being all-zero data header information, sending a stop reading signal to the first state machine;
[0040] The first state machine is further configured to:
[0041] In response to receiving the stop reading signal, sending the first read request is stopped.
[0042] The present application also proposes a data processing method, which is applied to the data processing device described in any one of the above items, and the data processing method includes:
[0043] In response to the first state machine receiving the sparse dimension reduction instruction, based on the first state machine, sending a first read request to the memory module in rounds according to preset conditions, the first read request requests to read the original vector data in each memory pool of the memory module;
[0044] Receiving the original vector data returned by the first read request of each round based on the second state machine; sending a second read request to the memory module in rounds based on the second state machine, the second read request requesting to read the accumulated vector data of the memory pool where the original vector data returned by the current round is located;
[0045] Receive the accumulated vector data returned by the second read request of each round based on the third state machine;
[0046] The original vector data and the accumulated vector data in each round are accumulated based on the multiplier-adder to obtain the accumulated result of each round;
[0047] The accumulation result of each round is received based on the fourth state machine, and the accumulation result of each round is written into the memory module.
[0048] In the embodiment of the present application, the preset conditions include:
[0049] The first read request of each round requests to read the original vector data in each memory pool of the memory module according to the preset bandwidth;
[0050] The memory pools requested to be read by the first read requests of adjacent rounds are adjacent in the memory modules;
[0051] When the memory pool requested to be read by any first read request crosses rows, the pool depth of the memory requested to be read by the first read request in the previous round is increased by one.
[0052] In the embodiment of the present application, the preset bandwidth is two unit bandwidths.
[0053] In the embodiment of the present application, after receiving the sparse dimension reduction instruction, the data processing method further includes:
[0054] The sparse dimensionality reduction instruction is parsed based on the first state machine to obtain a memory address, a cumulative cache address, a cumulative vector address, and a cumulative vector unique-hot bitmap of the data to be processed.
[0055] In the embodiment of the present application, after obtaining the memory address, the cumulative cache address, the cumulative vector address, and the cumulative vector one-hot bitmap, the data processing method further includes:
[0056] Sending the accumulated cache address, the accumulated vector address, and the accumulated vector one-hot bitmap to the second state machine based on the first state machine;
[0057] Sending the accumulated cache address and the accumulated vector one-hot bitmap to the third state machine based on the first state machine;
[0058] The accumulated vector address is sent to the fourth state machine based on the first state machine.
[0059] In the embodiment of the present application, after the second state machine receives the original vector data of each round, the data processing method further includes:
[0060] Based on the second state machine, the accumulated cache address, and the accumulated vector one-hot bitmap, the original vector data of this round is sent to the multiplier-accumulator.
[0061] In the embodiment of the present application, after the third state machine receives the accumulated vector data of each round, the data processing method further includes:
[0062] Based on the third state machine, the accumulated cache address, and the accumulated vector one-hot bitmap, the accumulated vector data of this round is sent to the multiplier-accumulator.
[0063] In the embodiment of the present application, writing the accumulated result of each round into the memory module includes:
[0064] Based on the fourth state machine and the accumulated vector address, the accumulated result of each round is written into the accumulated vector position corresponding to the memory pool in the memory module of the original vector data returned in each round.
[0065] In the embodiment of the present application, the data processing method further includes: determining the number of the data header information in the next data list by the following method:
[0066] If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an even number, then the number of the data header information of the next data list is 1;
[0067] If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the number of the data header information of the next data list is 0;
[0068] If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an even number, the digit of the data header information of the next data list is 0;
[0069] If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the digit of the data header information of the next data list is 1;
[0070] The digital number includes 0 and 1, 0 represents the data located at the front of the memory module in the two original vector data received in this round, and 1 represents the data located at the back of the memory module in the two original vector data received in this round.
[0071] In an embodiment of the present application, the data processing method further includes: determining the rounds required for the second state machine to receive the next data header information based on the following method:
[0072] If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list divided by 2;
[0073] If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list minus 1 divided by 2;
[0074] If the number of the data header information received by the second state machine in the current round is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list divided by 2 plus one;
[0075] If the digit of the data header information received in the current round by the second state machine is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list plus 1 divided by 2.
[0076] In the embodiment of the present application, the data processing method further includes:
[0077] In response to the original vector data received by the second state machine being all-zero data header information, sending a stop reading signal to the first state machine based on the second state machine;
[0078] In response to the first state machine receiving the stop reading signal, the first state machine is stopped from sending the first read request.
[0079] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements any of the above-described methods when executed by a processor.
[0080] An embodiment of the present application further proposes a computing device, comprising any of the data processing devices described above, wherein a computer program is stored on the data processing device, and when the data processing device executes the computer program, the data processing method described above is implemented.
[0081] The data processing device proposed in the present application converts the sparse dimensionality reduction calculation into a process of multiple accumulations by setting four state machines and multipliers, without the need for multiplication calculations, with a small amount of calculation, a fast speed, and high efficiency. In addition, the first state machine and the second state machine in the present application are respectively used to send a request to read the corresponding accumulated data, while the second state machine and the third state machine are respectively used to receive the corresponding accumulated data, the multiplier is used to calculate the accumulation process, and the fourth state machine is used to write the accumulated results of each round to the memory module. The four state machines work in parallel, which not only improves the data throughput, but also improves the data processing speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.
[0083] Figure 1 A module diagram of a data processing device in an embodiment of the present application;
[0084] Figure 2 A flowchart of a data processing method in an embodiment of the present application;
[0085] Figure 3 This is a schematic diagram of the processing process of the data to be processed in the memory module in one embodiment of the present application;
[0086] Figure 4 This is a schematic diagram of data reading and writing of each state machine in each round in an embodiment of the present application;
[0087] Figure 5 A step diagram of a data processing method in an embodiment of the present application;
[0088] Figure 6 A module diagram of a computer-readable storage medium in an embodiment of the present application;
[0089] Figure 7 A module diagram of a computing device in one embodiment of the present application.
[0090] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0091] The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present application, and are not intended to limit the scope of the present application in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0092] Those skilled in the art know that the embodiments of the present application can be implemented as a system, device, method or computer program product. Therefore, the present disclosure can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0093] According to the implementation manner of the present application, a data processing apparatus, method, medium and computing device are proposed.
[0094] It should be understood herein that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction rather than having any limiting meaning.
[0095] The principles and spirit of the present application are explained in detail below with reference to several representative implementations of the present application.
[0096] Exemplary Devices
[0097] This exemplary embodiment provides a data processing device 100, such as Figure 1 As shown, the data processing device 100 includes: a first state machine 110, a second state machine 120, a third state machine 130, a fourth state machine 140 and a multiplier 150;
[0098] The first state machine 110 is configured to: in response to receiving a sparse dimension reduction instruction, send a first read request to the memory module in rounds according to a preset condition, the first read request requesting to read the original vector data in each memory pool of the memory module;
[0099] The second state machine 120 is configured to: receive the original vector data returned by the first read request of each round; send a second read request to the memory module in rounds, the second read request requesting to read the accumulated vector data of the memory pool where the original vector data returned by the current round is located;
[0100] The third state machine 130 is configured to: receive the accumulated vector data returned by the second read request in each round;
[0101] The multiplier 150 is configured to: accumulate the original vector data and the accumulated vector data in each round to obtain an accumulation result of each round;
[0102] The fourth state machine 140 is configured to receive the accumulation result of each round and write the accumulation result of each round into the memory module.
[0103] Among them, each state machine is composed of a state register and a combinational logic circuit, which can transfer states according to pre-set states based on control signals. It is the control center that coordinates related signal actions and completes specific operations.
[0104] like Figure 2 , Figure 3 As shown, Figure 2 is a flow chart of data processing in each state in a data processing device in one embodiment of the present application, Figure 3 The figure is a schematic diagram of the processing process of the data to be processed in each memory pool in the memory module in one embodiment of the present application. Among them, 0-7 represent the memory pools of the memory module, h-0, h-1, h-2, h-3, h='0 are the data header information in the data to be processed, and d is the non-header data in the data to be processed. The original vector data refers to the data originally stored in the memory pool of the memory module before sparse dimensionality reduction, including data header information and non-header data.
[0105] 0*00, 0*01, 0*02, 0*03 are the depths of the memory pool, 0*04 is the location of the accumulation vector in the memory module; AH are the accumulation vectors of each memory pool 0-7 respectively; the first read request, the second read request, the return data corresponding to the first read request, the return data corresponding to the second read request, the accumulation result of the multiplier 150, and the specific content of the write request are as follows: Figure 3 It should be noted that Figure 3 The schematic diagram is only an illustrative diagram showing the processing process of the data to be processed in the memory module. The present application does not limit the number and depth of the memory pools, and the length of the data to be processed.
[0106] like Figure 4 As shown, Figure 4 This is a schematic diagram of data reading and writing of the first read request, the second read request, the write request and the reflow data in each round in an embodiment of the present application. It should be noted that: Figure 4 Only four rounds, namely the first round to the fourth round, are shown, which does not mean that the data processing device in the present application only includes four processing rounds. The actual number of processing rounds is determined based on the length of the actual data to be processed and the bandwidth of each round of processing.
[0107] In an embodiment of the present application, the first state machine 110 is further configured to: parse the sparse dimensionality reduction instruction to obtain the memory address, cumulative cache address, cumulative vector address, and cumulative vector unique hot bitmap of the data to be processed.
[0108] Among them, after the first state machine 110 receives the sparse dimensionality reduction instruction, the first state machine 110 can parse the sparse dimensionality reduction instruction to obtain the memory address, cumulative cache address, cumulative vector address, and cumulative vector unique hot bitmap of the data to be processed.
[0109] by Figure 3 Taking the data to be processed as an example, the memory address obtained by parsing is the address of the memory module, the cumulative vector address is the address of the memory block 0*04, and the cumulative cache address is Figure 2 The multiplier-adder shown is used to cache the addresses of the accumulated data, and the accumulated vector unique-hot bitmap is the specific position of each data to be accumulated in the multiplier-adder. For example, the unique-hot bitmap of each original vector data of different depths in the multiplier-adder of memory pool 0 is: 10000000; the unique-hot bitmap of each original vector data of different depths in the multiplier-adder of memory pool 1 is: 01000000, the unique-hot bitmap of each original vector data of different depths in the multiplier-adder of memory pool 2 is: 00100000, the unique-hot bitmap of each original vector data of different depths in the multiplier-adder of memory pool 3 is: 00010000, the unique-hot bitmap of each original vector data of different depths in the multiplier-adder of memory pool 4 is: 00001000, the unique-hot bitmap of each original vector data of different depths in the multiplier-adder of memory pool 5 is: 00000100, the unique-hot bitmap of each original vector data of different depths in the multiplier-adder of memory pool 6 is: 00000010, and the unique-hot bitmap of each original vector data of different depths in the multiplier-adder of memory pool 7 is: 00000001.
[0110] After determining the one-hot bitmap of the original vector data in each memory pool in the multiplier-adder, the position of each original vector data when being accumulated in the multiplier-adder can be determined. For example, the one-hot bitmap of each original vector data at different depths in memory pool 0 in the multiplier-adder is: 10000000, that is, each original vector data at different depths in memory pool 0 is accumulated at the position corresponding to "1" in "10000000"; for another example, the one-hot bitmap of each original vector data at different depths in memory pool 1 in the multiplier-adder is: 01000000, then each original vector data at different depths in memory pool 1 is accumulated at the position corresponding to "1" in "01000000", and so on.
[0111] In the embodiment of the present application, after the first state machine 110 parses the sparse dimensionality reduction instruction to obtain the memory address, the accumulated cache address, the accumulated vector address, and the accumulated vector one-hot bitmap, the first state machine 110 is further configured as follows:
[0112] Sending the accumulated cache address, the accumulated vector address and the accumulated vector one-hot bitmap to the second state machine 120;
[0113] Sending the accumulated cache address and the accumulated vector one-hot bitmap to the third state machine 130;
[0114] The accumulated vector address is sent to the fourth state machine 140 .
[0115] Among them, the specific functions of the accumulated cache address, the accumulated vector address, and the accumulated vector unique hot bitmap refer to the specific description in the subsequent embodiments.
[0116] In addition, the first state machine 110 sends a first read request to the memory module according to preset conditions. In an embodiment of the present application, the preset conditions include: the first read request of each round requests to read the original vector data in each memory pool of the memory module according to the preset bandwidth.
[0117] For example, in the embodiment of the present application, the preset bandwidth is two unit bandwidths. Figure 3 As shown, each memory pool of the memory module has a grid (storage location) in the same memory depth, each grid is a unit bandwidth, and the first read request requests to read two unit bandwidths each time, that is, each request reads the original vector data in two grids. For example, the first read request in the first round requests to read the original vector data in 0*00-0 and 0*00-1, and the first read request in the second round requests to read the original vector data in 0*00-2 and 0*00-3.
[0118] In addition, it should be noted that in other embodiments, more or fewer unit bandwidths of raw vector data may be read in each round. For example, three unit bandwidths of raw vector data are read in each round, that is, data of three grids are read each time a request is made, or one unit bandwidth of raw vector data is read in each round, that is, raw vector data of one grid is read each time. The technical solution of the present application does not limit the specific bandwidth read each time.
[0119] In the embodiment of the present application, the preset condition for the first state machine 110 to send the first read request to the memory module also includes: the memory pools requested to be read by the first read requests in adjacent rounds are adjacent in the memory module.
[0120] For example, Figure 3 and Figure 4As shown, in an embodiment of the present application, assuming that the bandwidth of the first read request in each round is two unit bandwidths, the first read request in the first round requests to read the original vector data in 0*00-0 and 0*00-1, the first read request in the second round requests to read the original vector data in 0*00-2 and 0*00-3, and the first read request in the third round requests to read the original vector data in 0*00-4 and 0*00-5, and so on. According to the order of the memory pools of the memory module, the original vector data of two grids are read in each round.
[0121] In an embodiment of the present application, the preset condition for the first state machine 110 to send a first read request to the memory module also includes: when the memory pool requested to be read by any first read request crosses rows, the pool depth of the memory requested to be read by the first read request in the previous round is increased by one.
[0122] Among them, "cross-row" means that the bandwidth of each read under the preset conditions is less than the bandwidth of a single read of the original vector data in the memory pool at a certain depth. Figure 3 As shown, in an embodiment of the present application, taking the bandwidth of the first read request of each round as three unit bandwidths as an example, the first read request in the first round requests to read the original vector data in 0*00-0, 0*00-1, and 0*00-2, and the first read request in the second round requests to read the original vector data in 0*00-3, 0*00-4, and 0*00-5. In the third round, only the original vector data in 0*00-6 and 0*00-7 remain in the memory depth of 0*00, and the original vector data of one unit bandwidth is still missing. At this time, a depth is added to the depth of 0*00 for reading, that is, the original vector data of one unit bandwidth continues to be read from the depth of 0*01, that is, the first read request in the third round requests to read the original vector data in 0*00-6, 0*00-7, and 0*01-0. It should also be noted that after the depth of the memory pool is increased by one, reading starts from the first memory pool.
[0123] In the embodiment of the present application, the second state machine 120 is further configured as follows:
[0124] Based on the accumulated cache address and the accumulated vector one-hot bitmap, the original vector data of each round is sent to the multiplier 150 .
[0125] like Figure 2 , Figure 3 , Figure 4 As shown, in the embodiment of the present application, the first state machine 110 sends a first read request to the memory module, and the second state machine 120 receives the return data corresponding to the first read request. Figure 4As shown, in the first round, the first state machine 110 sends a first read request to the memory module, requesting to read the original vector data in 0*00-0 and 0*00-1, and the second state machine receives the original vector data h-0 and d in 0*00-0 and 0*00-1; in the second round, the first state machine 110 sends a first read request to the memory module, requesting to read the original vector data in 0*00-2 and 0*00-3, and the second state machine 120 receives the original vector data d, d in 0*00-2 and 0*00-3, and so on.
[0126] In addition, in the embodiment of the present application, in each round, the second state machine 120 also sends a second read request to the memory module. The first state machine 110 sends the cumulative vector address to the second state machine 120. After the second state machine 120 receives the return data of this round and determines the memory pool where the return data is located, it can send the second read request to the cumulative vector address to request to read the cumulative vector data of the memory pool where the return data of this round is located.
[0127] For example, in the first round, the reflow data received by the second state machine 120 is the original vector data h-0 and d in 0*00-0 and 0*00-1, then the second read request requests to read the accumulated vector data of memory pools 0 and 1, that is, requests to read the accumulated vector data A and B in 0*04-0 and 0*04-1.
[0128] In addition, in the embodiment of the present application, after receiving the original vector data of each round, the second state machine 120 also sends the original vector data of the round to the multiplier 150 based on the accumulated cache address and the accumulated vector unique hot bitmap.
[0129] For example, the first state machine 110 sends the cumulative cache address and the cumulative vector unique-hot bitmap to the second state machine 120. In the first round, when the second state machine 120 receives the return data: h-0 in 0*00-0, and d in 0*00-1, the second state machine 120 can send the return data: h-0 in 0*00-0, and d in 0*00-1 to the multiplier 150 based on the cumulative cache address and the cumulative vector unique-hot bitmap, for accumulation with the cumulative vector data sent by the third state machine 130 in this round.
[0130] In the embodiment of the present application, in each round, the second state machine 120 sends a second read request to the memory module, and the third state machine 130 receives the reflow data corresponding to the second read request in each round.
[0131] For example, in the first round, the second read request sent by the second state machine 120 requests to read the accumulated vector data of memory pools 0 and 1, that is, requests to read the accumulated vector data A and B in 0*04-0 and 0*04-1, then the third state machine 130 receives the accumulated vector data A and B in the first round. For another example, in the second round, the second read request sent by the second state machine 120 requests to read the accumulated vector data of memory pools 2 and 3, that is, requests to read the accumulated vector data C and D in 0*04-2 and 0*04-3, then the third state machine 130 receives the accumulated vector data C and D in the second round, and so on.
[0132] In the embodiment of the present application, the third state machine 130 is further configured as follows:
[0133] Based on the accumulated cache address and the accumulated vector one-hot bitmap, the accumulated vector data of each round is sent to the multiplier 150 .
[0134] The first state machine 110 also sends the accumulated cache address and the accumulated vector unique-hot bitmap to the third state machine 130. In the first round, when the third state machine 130 receives the accumulated vector data A and B, it can send the accumulated vector data A and B to the multiplier 150 based on the accumulated cache address and the accumulated vector unique-hot bitmap, for accumulation with h-0 and d sent to the multiplier 150 by the second state machine 120 in the first round.
[0135] Among them, when the second state machine 120 sends h-0 and d to the multiplier 150, and when the third state machine 130 sends A and B to the multiplier, it is all based on the accumulated vector unique-hot bitmap, and the accumulated vector unique-hot bitmaps of h-0 and A are the same, and the accumulated vector unique-hot bitmaps of d and B are the same, so h-0 and A are accumulated, and d and B are accumulated to obtain the accumulated result of this round, that is, the original vector data and the accumulated vector data in each round are accumulated based on the multiplier to obtain the accumulated result of each round.
[0136] For example, in the embodiment of the present application, the accumulation result in the first round is {h-0+A, d+B} 0*04-0, 1. Among them, h-0+A is the accumulation result of 0*04-0 after the first round of accumulation, that is, the accumulated vector data of 0*04-0 after the first round, and d+B is the accumulation result of 0*04-1 after the first round of accumulation, that is, the accumulated vector data of 0*04-1 after the first round.
[0137] In an embodiment of the present application, the fourth state machine 140 is further configured to: based on the accumulated vector address, write the accumulated result of each round into the accumulated vector position corresponding to the memory pool in the memory module of the original vector data returned in each round.
[0138] In the first round, the cumulative vector received by the third state machine is the initial cumulative vector, that is, AH is the cumulative vector corresponding to each memory pool at the beginning. After each round, the cumulative vector of each memory pool corresponding to the cumulative vector address 0*04 needs to be updated. Then, in the next round, the cumulative vector received by the third state machine is the result after the update of the previous round.
[0139] In an embodiment of the present application, the accumulation result of each round can be obtained by using the multiplier 150. After the multiplier 150 calculates the accumulation result of each round, it sends it to the fourth state machine 140, and the first state machine 110 has sent the accumulation vector address to the fourth state machine 140. Therefore, when the fourth state machine 140 receives the accumulation result of each round, it can write the accumulation result of each round into the accumulation vector position corresponding to the memory pool in the memory module based on the accumulation vector address. For example, in the first round, the fourth state machine 140 receives the accumulation result of {h-0+A, d+B} 0*04-0,1 , that is, the accumulation result has indicated that the positions of the accumulated vectors that need to be updated are 0*04-0 and 0*04-1, where 0*04-0 is the storage position of the accumulation result corresponding to the memory pool where the original vector data h-0 received by the second state machine 120 in the first round is located, and 0*04-1 is the storage position of the accumulation result corresponding to the memory pool where the original vector data d received by the second state machine 120 in the first round is located. Therefore, the fourth state machine 140 is used to send a write request to the memory module, write h-0+A to the 0*04- position, replace the initial A, and write d+B to 0*04-1, where {h-0+A, d+B} 0*04-0,1 is the content requested to be written in the write request.
[0140] Through the above description, the functions of each state machine of the data processing device 100 in the embodiment of the present application can be clarified. Based on the first state machine 110, the first read request of each round can be continuously sent to the memory module. Based on the second state machine 120, the original vector data returned in each round can be continuously received, and the second read request can be continuously sent. Based on the third state machine 130, the accumulated vector data of each round can be continuously received. Based on the multiplier 150, the original vector data and the accumulated vector data of each round can be accumulated to obtain the accumulated result. Based on the fourth state machine 140, the accumulated result of each round can be written into the memory module. However, the length of the data to be processed is limited. After several rounds, the sparse dimensionality reduction processing can be completed on the data to be processed. In order to ensure the accuracy of the sparse dimensionality reduction results, it is necessary to stop the reading of each state machine after all the data to be processed are processed.
[0141] For any data to be processed, it consists of one or more data lists and an all-zero data header. Each data list includes multiple original vector data, which are further divided into: data header information and non-header data. The data header information is located at the beginning of the data list and contains the number of non-header data in the data list; the all-zero data header is located at the end of the data to be processed, indicating the end of the data to be processed.
[0142] like Figure 3 As shown, 0*00-0 to 0*00-4 is a data list, h-0 is the data header information in the data list, and d in 0*00-1 to 0*00-4 is the non-header data in the data list; for another example, 0*00-5 to 0*01-0 is another data list, h-1 is the data header information in the data list, and d in 0*00-6 to 0*01-0 is the non-header data in the data list. And h in 0*02-3 is also the data header information, but h='0 represents all zeros, that is, the data to be processed ends at the position 0*02-3. Then, when the second state machine 120 receives the all-zero data header information, it can be determined that the data to be processed has been completely processed. However, if the second state machine 120 parses each received raw vector data to determine whether it is an all-zero data header, a large amount of calculation will be increased, and the processing efficiency is low.
[0143] To this end, the embodiment of the present application assigns a number to the original vector data requested to be read each time. Based on the number and the parity of the number of non-header data in each data list, the number of the data header information in each data list can be determined. Then, based on the round in which the next data header information is received, the original vector data corresponding to the number in the round in which the next data header is received can be parsed to determine whether it is an all-zero data header.
[0144] In the embodiment of the present application, the second state machine 120 is configured to determine the number of the data header information in the next data list based on the following method:
[0145] If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an even number, then the number of the data header information of the next data list is 1;
[0146] If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the number of the data header information of the next data list is 0;
[0147] If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an even number, the digit of the data header information of the next data list is 0;
[0148] If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the digit of the data header information of the next data list is 1;
[0149] The digital number includes 0 and 1, 0 represents the data located at the front of the memory module in the two original vector data received in this round, and 1 represents the data located at the back of the memory module in the two original vector data received in this round.
[0150] In the embodiment of the present application, the first state machine 110 requests to read data of two unit bandwidths in each round. Figure 3 As shown, assuming that the raw vector data at the storage location (each grid) in each depth of each memory pool is a unit bandwidth, the raw vector data of two grids are read in each round, and then in each round, the second state machine 120 receives two raw vector data. In the embodiment of the present application, the two raw vector data requested to be read in each round are assigned numbers, wherein the data at the front of the two raw vector data in the memory module is assigned number 0, and the data at the back of the two raw vector data in the memory module is assigned number 1. Figure 3 As shown, the two original vector data requested to be read in the first round are h-0 in 0*00-0 and d in 0*00-1, where h-0 is located at the front position of the memory module and is assigned the number 0, and d is located at the back position of the memory module and is assigned the number 1.
[0151] like Figure 3 As shown, each data header information corresponds to a data list. For example, h-0 in 0*00-0 is the data header information, 0*00-1 to 0*00-4 are the data lists corresponding to the data header information h-0, and each d in 0*00-1 to 0*00-4 is each non-header data in the data list corresponding to the data header information h-0.
[0152] In addition, usually, the data in 0*00-0 are all data header information, and the position of the corresponding data header information in each data list after 0*00-0 is uncertain. For example, data header information h-1 is located at 0*00-5, and data header information h-2 is located at 0*01-1.
[0153] In an embodiment of the present application, the first state machine 110 requests to obtain the original vector data of two grids each time, and the original vector data requested in each round is arranged continuously in each memory pool of the memory module. Therefore, the position of the data header information in the next data list can be judged according to the number of the previous data header information and the number of non-header data in the previous data list.
[0154] For example, Figure 3 As shown, in the first round, the original vector data with the digit 0 in the original vector data received by the second state machine 120 must be the data header information. After the second state machine 120 obtains the original vector data h-0 with the digit 0 in the first round, it parses h-0 to determine that the number of non-header data contained in the data list corresponding to h-0 is 4. Based on the principle that "if the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an even number, then the digit of the data header information of the next data list is 1", it can be determined that the digit of the data header information of the next data list must be 1, such as Figure 3 The data header information of the next data list shown is h-1, which is the data at the rear position in the memory module among the two original vector data received by the second state machine in the third round.
[0155] Continue to refer to Figure 3 , the digit of the data header information h-1 is 1, and the number of non-header data in the data list corresponding to h-1 is 3 (an odd number). Based on the principle that "if the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the digit of the data header information of the next data list is 1", it can be determined that the digit of the data header information of the next data list is 1, such as Figure 3 As shown, h-2 is the latter one in the memory module among the two original vector data received by the second state machine in the fifth round.
[0156] Continue to refer to Figure 3 , the digit of the data header information h-2 is 1, and the number of non-header data in the data list corresponding to h-2 is 4 (an even number). Based on the principle that "if the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an even number, then the digit of the data header information of the next data list is 0", it can be determined that the digit of the data header information of the next data table is 0, such as Figure 3 As shown, h-3 is the one of the two original vector data received by the second state machine in the eighth round that is closer to the front of the memory module.
[0157] Continue to refer to Figure 3 , the digit of the data header information h-3 is 0, and the number of non-header data in the data list corresponding to h-3 is 3 (an odd number). Based on the principle that "if the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the digit of the data header information of the next data list is 0", it can be determined that the digit of the data header information of the next data table is 0, such as Figure 3 As shown, h='0 is the one in front of the memory module among the two original vector data received by the second state machine in the tenth round.
[0158] After introducing how to determine the number of the data header information in the next data list, the following describes how to determine the rounds required to receive the data header information of the next data list.
[0159] In the embodiment of the present application, the second state machine 120 is configured to determine the round required for receiving the next data header information based on the following method:
[0160] If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list divided by 2;
[0161] If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list minus 1 divided by 2;
[0162] If the number of the data header information received by the second state machine in the current round is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list divided by 2 plus one;
[0163] If the digit of the data header information received in the current round by the second state machine is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list plus 1 divided by 2.
[0164] For example, in the first round, the second state machine obtains the data header information h-0. Analysis shows that there are 4 even numbers of non-header data in the data list where h-0 is located. The current data header number is 0, so the rounds required to receive the next data header information are 4 / 2=2, that is, 2 rounds are required. The current round is the first round, and the third round is after two rounds. Combined with the method for determining the number of the data header information, it can be known that the number of the next data header information is 1. After the second state machine receives h-0 in the first round, it can be calculated that the next data header information is the latter one of the two original vector data received in the third round in the memory module.
[0165] For another example, after the second state machine receives two data in the third round, it has determined that h-1 is located at the back of the two original vector data received in the third round in the memory module, that is, the latter data can be parsed. After parsing, it is determined that the number of non-header data in the data list corresponding to h-1 is 3, which is an odd number, and the number of h-1 is 1, so the rounds required to receive the next data information are (3+1) / 2=2. That is, it takes two rounds to receive h-2. Since h-1 is received in the third round, it takes two rounds to receive it in the fifth round. Combined with the method for determining the number of data header information, it can be known that the number of the next data header information is 1. After the second state machine receives h-1 in the third round, it can be calculated that the next data header information is the back of the two original vector data received in the fifth round.
[0166] For another example, after the second state machine receives two data in the fifth round, it has determined that h-2 is the latter one, that is, it can parse the latter data and find that the number of non-header data in the data list corresponding to h-2 is 4, which is an even number, and the digit of h-2 is 1, so the rounds required to receive the next data information are 4 / 2+1=3. In other words, it takes three rounds to receive h-3. Since h-2 is received in the fifth round, it will take three rounds to receive it in the eighth round. Combined with the method of determining the digit of the data header information, it can be known that the digit of the next data header information is 0. After the second state machine receives h-2 in the fifth round, it can be calculated that the next data header information is the one located at the front of the memory module among the two original vector data received in the eighth round.
[0167] For another example, after the second state machine receives two data in the eighth round, it has determined that h-3 is located in the previous one, that is, it can parse the previous data and obtain that the number of non-header data in the data list corresponding to h-3 is 3, which is an odd number, and the digit of h-3 is 0, so the rounds required to receive the next data information are (3+1) / 2=2. In other words, it takes two rounds to receive h='0. Since h-3 is received in the eighth round, it takes two rounds to receive it in the tenth round. Combined with the method of determining the digit of the data header information, it can be known that the digit of the next data header information is 0. After the second state machine receives h-3 in the eighth round, it can be calculated that the next data header information is the one located in the front of the memory module among the two original vector data received in the tenth round.
[0168] In the embodiment of the present application, the second state machine 120 is further configured as follows:
[0169] In response to the received original vector data being all-zero data header information, sending a stop reading signal to the first state machine 110;
[0170] The first state machine 110 is further configured to:
[0171] In response to receiving the stop reading signal, sending the first read request is stopped.
[0172] In the embodiment of the present application, the next data header information can be parsed when it is received, in combination with the round required for the next data header information and the number corresponding to the next data header information. Figure 3 As shown, after the second state machine receives h-3 in the eighth round, it can be calculated that the next data header information is the one of the two original vector data received in the tenth round that is located in the front of the memory module. Then, after receiving the two original vector data in the tenth round, the one in the front of the memory module can be parsed, that is, h in 0*02-2 is parsed, and h='0 in 0*02-2 is all zero data header information, which means that the data to be processed ends here. At this time, a stop reading signal can be sent to the first state machine 110, and the first state machine 110 can stop sending the first read request after receiving the stop reading signal.
[0173] It should be noted that when the first state machine 110 stops sending the first read request, the second state machine 120, the third state machine 130, and the fourth state machine 140 are still in the working state. When the second state machine 120 no longer receives the reflow data, the second state machine 120 also stops sending the second read request; when the third state machine 130 no longer receives the reflow data, the third state machine 130 also stops sending the accumulated vector data to the multiplier 150; when the multiplier 150 no longer receives the data to be accumulated, it also stops sending the accumulated results to the fourth state machine 140; when the fourth state machine 140 no longer receives the accumulated results, it stops sending write requests to the memory module.
[0174] The data processing device proposed in the present application converts the sparse dimensionality reduction calculation into a process of multiple accumulations by setting four state machines and a multiplier 150, without the need for multiplication calculations, with a small amount of calculation, a fast speed, and a high efficiency. In addition, the first state machine 110 and the second state machine 120 in the present application are respectively used to send a read request for reading the corresponding accumulated data, while the second state machine 120 and the third state machine 130 are respectively used to receive the corresponding accumulated data, the multiplier 150 is used to calculate the accumulation process, and the fourth state machine 140 is used to write the accumulated results of each round to the memory module. The four state machines work in parallel, which not only improves the data throughput, but also improves the data processing speed.
[0175] Exemplary Methods
[0176] like Figure 5 As shown, this exemplary embodiment proposes a data processing method, which is applied to the data processing device described in any one of the above exemplary embodiments. In the embodiment of the present application, the data processing method includes the following steps S100-S500:
[0177] Step S100: In response to the first state machine receiving a sparse dimensionality reduction instruction, the first state machine sends a first read request to the memory module in rounds according to preset conditions, and the first read request requests to read the original vector data in each memory pool of the memory module.
[0178] Step S200: Based on the second state machine, the original vector data returned by the first read request of each round is received; based on the second state machine, a second read request is sent to the memory module in rounds, and the second read request requests to read the accumulated vector data of the memory pool where the original vector data returned by the current round is located.
[0179] Step S300: receiving the accumulated vector data returned by the second read request in each round based on the third state machine.
[0180] Step S400: The original vector data and the accumulated vector data in each round are accumulated based on the multiplier-adder to obtain the accumulated result of each round.
[0181] Step S500: receiving the accumulation result of each round based on the fourth state machine, and writing the accumulation result of each round into the memory module.
[0182] The specific implementation of steps S100-S500 refers to the various embodiments of the exemplary device, which will not be described in detail here.
[0183] In the embodiment of the present application, the preset conditions include:
[0184] The first read request of each round requests to read the original vector data in each memory pool of the memory module according to the preset bandwidth;
[0185] The memory pools requested to be read by the first read requests of adjacent rounds are adjacent in the memory modules;
[0186] When the memory pool requested to be read by any first read request crosses rows, the pool depth of the memory requested to be read by the first read request in the previous round is increased by one.
[0187] In the embodiment of the present application, the preset bandwidth is two unit bandwidths.
[0188] In the embodiment of the present application, after receiving the sparse dimension reduction instruction, the data processing method further includes:
[0189] The sparse dimensionality reduction instruction is parsed based on the first state machine to obtain a memory address, a cumulative cache address, a cumulative vector address, and a cumulative vector unique-hot bitmap of the data to be processed.
[0190] In the embodiment of the present application, after obtaining the memory address, the cumulative cache address, the cumulative vector address, and the cumulative vector one-hot bitmap, the data processing method further includes:
[0191] Sending the accumulated cache address, the accumulated vector address, and the accumulated vector one-hot bitmap to the second state machine based on the first state machine;
[0192] Sending the accumulated cache address and the accumulated vector one-hot bitmap to the third state machine based on the first state machine;
[0193] The accumulated vector address is sent to the fourth state machine based on the first state machine.
[0194] In the embodiment of the present application, after the second state machine receives the original vector data of each round, the data processing method further includes:
[0195] Based on the second state machine, the accumulated cache address, and the accumulated vector one-hot bitmap, the original vector data of this round is sent to the multiplier-accumulator.
[0196] In the embodiment of the present application, after the third state machine receives the accumulated vector data of each round, the data processing method further includes:
[0197] Based on the third state machine, the accumulated cache address, and the accumulated vector one-hot bitmap, the accumulated vector data of this round is sent to the multiplier-accumulator.
[0198] In the embodiment of the present application, writing the accumulated result of each round into the memory module includes:
[0199] Based on the fourth state machine and the accumulated vector address, the accumulated result of each round is written into the accumulated vector position corresponding to the memory pool in the memory module of the original vector data returned in each round.
[0200] In the embodiment of the present application, the number of the data header information in the next data list is determined by the following method:
[0201] If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an even number, then the number of the data header information of the next data list is 1;
[0202] If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the number of the data header information of the next data list is 0;
[0203] If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an even number, the digit of the data header information of the next data list is 0;
[0204] If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the digit of the data header information of the next data list is 1;
[0205] The digital number includes 0 and 1, 0 represents the data located at the front of the memory module in the two original vector data received in this round, and 1 represents the data located at the back of the memory module in the two original vector data received in this round.
[0206] In the embodiment of the present application, the rounds required for the second state machine to receive the next data header information are determined based on the following method:
[0207] If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list divided by 2;
[0208] If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list minus 1 divided by 2;
[0209] If the number of the data header information received by the second state machine in the current round is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list divided by 2 plus one;
[0210] If the digit of the data header information received in the current round by the second state machine is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list plus 1 divided by 2.
[0211] In the embodiment of the present application, the data processing method further includes:
[0212] In response to the original vector data received by the second state machine being all-zero data header information, sending a stop reading signal to the first state machine based on the second state machine;
[0213] In response to the first state machine receiving the stop reading signal, the first state machine is stopped from sending the first read request.
[0214] The data processing method proposed in the embodiment of the present application is applied to the data processing device described in any of the above embodiments, and therefore, it has at least all the beneficial effects of the above data processing device, which will not be described one by one here.
[0215] Exemplary Media
[0216] After introducing the method, medium and system of the exemplary embodiments of the present application, next, reference is made to Figure 6 For a description of the computer-readable storage medium of the exemplary embodiment of the present application, please refer to Figure 6, the computer-readable storage medium shown is a CD 70, on which a computer program (i.e., a program product) is stored. When the computer program is executed by the processor, each step recorded in the above method implementation is implemented, for example, in response to the first state machine receiving the sparse dimension reduction instruction, the first state machine sends a first read request to the memory module in rounds according to preset conditions, and the first read request requests to read the original vector data in each memory pool of the memory module; the second state machine receives the original vector data returned by the first read request in each round; the second state machine sends a second read request to the memory module in rounds, and the second read request requests to read the accumulated vector data of the memory pool where the original vector data returned in the current round is located; the third state machine receives the accumulated vector data returned by the second read request in each round; the multiplier adds the original vector data and the accumulated vector data in each round to obtain the accumulated result of each round; the fourth state machine receives the accumulated result of each round, and writes the accumulated result of each round into the memory module. The specific implementation of each step will not be repeated here. It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.
[0217] Exemplary Computing Devices
[0218] After introducing the methods, systems, and media of the exemplary embodiments of the present application, reference is now made to Figure 7 A computing device according to an exemplary embodiment of the present application.
[0219] Figure 7 A block diagram of an exemplary computing device 80 suitable for implementing embodiments of the present application is shown. The computing device 80 may be a computer system or a server. Figure 7 The computing device 80 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0220] like Figure 7 As shown, the components of the computing device 80 may include, but are not limited to: one or more processors or processing units 801 , a system memory 802 , and a bus 803 connecting various system components (including the system memory 802 and the processing unit 801 ).
[0221] The computing device 80 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computing device 80, including volatile and non-volatile media, removable and non-removable media.
[0222] The system storage 802 may include computer system readable media in the form of volatile storage, such as random access memory (RAM) 8021 and / or cache memory 8022. The computing device 70 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the ROM 8023 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 is not shown in the Figure 7 As shown in FIG. 8 , a disk drive for reading and writing a removable non-volatile disk (e.g., a “floppy disk”) and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) can be provided. In these cases, each drive can be connected to the bus 803 via one or more data medium interfaces. The system storage 802 may include at least one program product, which has a set (e.g., at least one) of program modules, which are configured to perform the functions of each embodiment of the present application.
[0223] A program / utility 8025 having a set (at least one) of program modules 8024 may be stored, for example, in system memory 802, and such program modules 8024 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 8024 generally perform the functions and / or methods of the embodiments described herein.
[0224] The computing device 80 may also communicate with one or more external devices 804 (e.g., a keyboard, a pointing device, a display, etc.). Such communication may be performed via an input / output (I / O) interface. In addition, the computing device 80 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 806. Figure 7 As shown, the network adapter 806 communicates with other modules (such as the processing unit 801, etc.) of the computing device 80 via the bus 803. It should be understood that although Figure 7 Not shown, other hardware and / or software modules may be used in conjunction with computing device 80 .
[0225] The processing unit 801 executes various functional applications and data processing by running the program stored in the system memory 802, for example, in response to the first state machine receiving the sparse dimension reduction instruction, based on the first state machine, sending a first read request to the memory module in rounds according to preset conditions, the first read request requests to read the original vector data in each memory pool of the memory module; based on the second state machine, receiving the original vector data returned by the first read request in each round; based on the second state machine, sending a second read request to the memory module in rounds, the second read request requests to read the accumulated vector data of the memory pool where the original vector data returned in the current round is located; based on the third state machine, receiving the accumulated vector data returned by the second read request in each round; based on the multiplier, the original vector data and the accumulated vector data in each round are accumulated to obtain the accumulated result of each round; based on the fourth state machine, receiving the accumulated result of each round, and writing the accumulated result of each round into the memory module. The specific implementation method of each step will not be repeated here. It should be noted that, although several units / modules or sub-units / sub-modules of the computing device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0226] In the description of the present application, it should be noted that the terms "first", "second" and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0227] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0228] In the several embodiments provided in the present application, it should be understood that the disclosed systems, systems and methods can be implemented in other ways. The system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the system or unit can be electrical, mechanical or other forms.
[0229] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0230] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0231] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that can be executed by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computing device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0232] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
[0233] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
Claims
1. A data processing device, comprising: A first state machine, a second state machine, a third state machine, a fourth state machine and a multiplier-accumulator; The first state machine is configured to: in response to receiving a sparse dimension reduction instruction, send a first read request to the memory module in rounds according to a preset condition, the first read request requesting to read the original vector data in each memory pool of the memory module; The second state machine is configured to: receive the original vector data returned by the first read request of each round; send a second read request to the memory module in rounds, the second read request requesting to read the accumulated vector data of the memory pool where the original vector data returned by the current round is located; The third state machine is configured to: receive the accumulated vector data returned by the second read request in each round; The multiplier-adder is configured to: accumulate the original vector data and the accumulated vector data in each round to obtain an accumulation result of each round; The fourth state machine is configured to: receive the accumulation result of each round, and write the accumulation result of each round into the memory module; The preset conditions include: The first read request of each round requests to read the original vector data in each memory pool of the memory module according to a preset bandwidth; the preset bandwidth is two unit bandwidths; The memory pools requested to be read by the first read requests of adjacent rounds are adjacent in the memory modules; When the memory pool requested to be read by any first read request crosses rows, the pool depth of the memory requested to be read by the first read request in the previous round is increased by one; The second state machine is configured to determine the number of the data header information in the next data list based on the following method: If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an even number, then the number of the data header information of the next data list is 1; If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the number of the data header information of the next data list is 0; If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an even number, the digit of the data header information of the next data list is 0; If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the digit of the data header information of the next data list is 1; The digital number includes 0 and 1, 0 represents the data located at the front of the memory module in the two original vector data received in this round, and 1 represents the data located at the back of the memory module in the two original vector data received in this round; The second state machine is configured to determine the round required to receive the next data header information based on the following method: If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list divided by 2; If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list minus 1 divided by 2; If the number of the data header information received by the second state machine in the current round is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list divided by 2 plus one; If the digit of the data header information received in the current round by the second state machine is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list plus 1 divided by 2.
2. According to the data processing device as described in claim 1, the first state machine is also configured to: parse the sparse dimensionality reduction instruction to obtain the memory address, cumulative cache address, cumulative vector address, and cumulative vector unique hot bitmap of the data to be processed.
3. The data processing apparatus according to claim 2, wherein the first state machine is further configured to: Sending the accumulated cache address, the accumulated vector address, and the accumulated vector one-hot bitmap to the second state machine; Sending the accumulated cache address and the accumulated vector one-hot bitmap to the third state machine; The accumulated vector address is sent to the fourth state machine.
4. The data processing apparatus according to claim 3, wherein the second state machine is further configured to: Based on the accumulated cache address and the accumulated vector one-hot bitmap, the original vector data of each round is sent to the multiplier-accumulator.
5. The data processing apparatus according to claim 3, wherein the third state machine is further configured to: Based on the accumulated cache address and the accumulated vector one-hot bitmap, the accumulated vector data of each round is sent to the multiplier-accumulator.
6. The data processing device as claimed in claim 3, wherein the fourth state machine is further configured to: based on the accumulated vector address, write the accumulated result of each round into the accumulated vector position corresponding to the memory pool in the memory module of the original vector data returned in each round.
7. The data processing apparatus according to claim 1, wherein the second state machine is further configured to: In response to the received original vector data being all-zero data header information, sending a stop reading signal to the first state machine; The first state machine is further configured to: In response to receiving the stop reading signal, sending the first read request is stopped.
8. A data processing method, applied to the data processing device according to any one of claims 1 to 7, the data processing method comprising: In response to the first state machine receiving the sparse dimension reduction instruction, based on the first state machine, sending a first read request to the memory module in rounds according to preset conditions, the first read request requests to read the original vector data in each memory pool of the memory module; Receive the original vector data returned by the first read request of each round based on the second state machine; Sending a second read request to the memory module in rounds based on the second state machine, the second read request requests to read the accumulated vector data of the memory pool where the original vector data returned in the current round is located; Receive the accumulated vector data returned by the second read request of each round based on the third state machine; The original vector data and the accumulated vector data in each round are accumulated based on the multiplier-adder to obtain the accumulated result of each round; receiving the accumulated result of each round based on the fourth state machine, and writing the accumulated result of each round into the memory module; The preset conditions include: The first read request of each round requests to read the original vector data in each memory pool of the memory module according to the preset bandwidth; the preset bandwidth is two unit bandwidths The memory pools requested to be read by the first read requests of adjacent rounds are adjacent in the memory modules; When the memory pool requested to be read by any first read request crosses rows, the pool depth of the memory requested to be read by the first read request in the previous round is increased by one; If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an even number, then the number of the data header information of the next data list is 1; If the number of the data header information of the data list where the original vector data currently received by the second state machine is located is 0, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the number of the data header information of the next data list is 0; If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an even number, the digit of the data header information of the next data list is 0; If the digit of the data header information of the data list where the original vector data currently received by the second state machine is located is 1, and the number of non-header data in the data list where the original vector data currently received is located is an odd number, then the digit of the data header information of the next data list is 1; The digital number includes 0 and 1, 0 represents the data located at the front of the memory module in the two original vector data received in this round, and 1 represents the data located at the back of the memory module in the two original vector data received in this round; If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list divided by 2; If the number of the data header information received by the second state machine in the current round is 0, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the round required to receive the next data header information is equal to the number of non-header data in the current data list minus 1 divided by 2; If the number of the data header information received by the second state machine in the current round is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an even number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list divided by 2 plus one; If the digit of the data header information received in the current round by the second state machine is 1, and the number of non-header data in the data list where the data header information received in the current round is located is an odd number, then the rounds required to receive the next data header are equal to the number of non-header data in the current data list plus 1 divided by 2.
9. The data processing method according to claim 8, wherein: After receiving the sparse dimension reduction instruction, the data processing method further includes: The sparse dimensionality reduction instruction is parsed based on the first state machine to obtain a memory address, a cumulative cache address, a cumulative vector address, and a cumulative vector unique-hot bitmap of the data to be processed.
10. The data processing method according to claim 9, after obtaining the memory address, the accumulated cache address, the accumulated vector address, and the accumulated vector one-hot bitmap, the data processing method further comprises: Sending the accumulated cache address, the accumulated vector address, and the accumulated vector one-hot bitmap to the second state machine based on the first state machine; Sending the accumulated cache address and the accumulated vector one-hot bitmap to the third state machine based on the first state machine; The accumulated vector address is sent to the fourth state machine based on the first state machine.
11. The data processing method according to claim 10, wherein: After the second state machine receives the original vector data of each round, the data processing method further includes: Based on the second state machine, the accumulated cache address, and the accumulated vector one-hot bitmap, the original vector data of this round is sent to the multiplier-accumulator.
12. The data processing method according to claim 10, wherein: After the third state machine receives the accumulated vector data of each round, the data processing method further includes: Based on the third state machine, the accumulated cache address, and the accumulated vector one-hot bitmap, the accumulated vector data of this round is sent to the multiplier-adder.
13. The data processing method according to claim 10, wherein: Writing the accumulated result of each round into the memory module comprises: Based on the fourth state machine and the accumulated vector address, the accumulated result of each round is written into the accumulated vector position corresponding to the memory pool in the memory module of the original vector data returned in each round.
14. The data processing method according to claim 8, further comprising: In response to the original vector data received by the second state machine being all-zero data header information, sending a stop reading signal to the first state machine based on the second state machine; In response to the first state machine receiving the stop reading signal, the first state machine is stopped from sending the first read request.
15. A computer-readable storage medium comprising instructions, which, when executed on a computer, enables the computer to execute the method according to any one of claims 8 to 14.
16. A computing device, comprising the data processing apparatus according to any one of claims 1 to 7, wherein a computer program is stored on the data processing apparatus, and when the data processing apparatus executes the computer program, the data processing method according to any one of claims 8 to 14 is implemented.
