Numeric data type conversion method, device and accelerator card

By using acceleration cores to perform type conversion of Numeric type data in heterogeneous systems, the problem of high CPU usage is solved, efficient data type conversion and precision adjustment are achieved, and it is suitable for processing a large amount of Numeric type data.

CN117234706BActive Publication Date: 2024-09-27YUSUR TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311110396.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-30
Publication Date
2024-09-27
Estimated Expiration
2043-08-30

AI Technical Summary

Technical Problem

In the existing technology, the type conversion of Numeric type data relies on the central processing unit CPU, resulting in high CPU usage, inability to effectively process large amounts of data, and inability to perform type conversion efficiently and quickly.

Method used

By obtaining the original data of Numeric type and type conversion configuration parameters outside the CPU, the acceleration core is used to perform data type conversion in heterogeneous systems, reducing the burden on the CPU, and performing data type conversion and precision adjustment in the data storage unit.

Benefits of technology

It improves the efficiency and reliability of type conversion of Numeric type data, reduces the CPU usage, and can effectively handle the type conversion tasks of a large number of Numeric type data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117234706B
    Figure CN117234706B
Patent Text Reader

Abstract

The present application provides a method, device and accelerator card for converting Numeric data types, the method comprising: obtaining original data of Numeric type and corresponding type conversion configuration parameters in the host from outside the host where the CPU is located; performing data type conversion on the original data according to the type conversion configuration parameters to obtain corresponding target data, and sending the target data to the host. The present application can realize type conversion of Numeric type data under the heterogeneous architecture of the CPU, and is particularly suitable for type conversion of a large amount of Numeric type data, and can effectively improve the efficiency and reliability of type conversion of Numeric type data, and can effectively reduce CPU occupancy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a Numeric data type conversion method, device and accelerator card. Background Art

[0002] With the development of technology, the continuous improvement of disk read and write and network bandwidth performance, the performance bottleneck in the database field has shifted to computing power. Among them, Numeric is a data type in the database and also a computer programming data type, which uses a standard, variable-length internal format to store numbers. The data type conversion process for Numeric type data also requires sufficient computing power support to meet the current increasing processing speed requirements.

[0003] Currently, the data type conversion process for Numeric data relies on the central processing unit (CPU) to execute database functions. For example, the data type conversion cast function is used in the database to convert data types. However, the CPU instruction set architecture cannot efficiently and quickly convert large amounts of data, and the process will generate a high CPU usage, making it impossible for the server to perform other tasks. Summary of the invention

[0004] In view of this, embodiments of the present application provide a Numeric data type conversion method, device, and accelerator card to eliminate or improve one or more defects existing in the prior art.

[0005] One aspect of the present application provides a method for converting a Numeric data type, including:

[0006] Obtain the original data of the Numeric type and the corresponding type conversion configuration parameters in the host from outside the host where the CPU is located;

[0007] The data type of the original data is converted according to the type conversion configuration parameters to obtain corresponding target data, and the target data is sent to the host.

[0008] In some embodiments of the present application, the step of obtaining the original data of the Numeric type and the corresponding type conversion configuration parameters in the host from outside the host where the CPU is located includes:

[0009] The received data to be converted and the type conversion configuration parameters are read from a local data storage unit, wherein the data to be converted is transmitted from a CPU memory in a host to the data storage unit in advance by a local data interface; the data to be converted includes: at least one original data of Numeric type; wherein the number of original data in each of the data to be converted is determined in advance according to the bit width and data type of the original data.

[0010] In some embodiments of the present application, the type conversion configuration parameters include: the number of data rows of the original data, the original data and the target data correspond to different data types respectively;

[0011] Correspondingly, the reading of the received data to be converted from the local data storage unit includes:

[0012] Read the type conversion configuration parameter; if the number of bits of different data types corresponding to the original data and the target data in the type conversion configuration parameter is 32 or 64, read a received data to be converted from the local data storage unit at intervals of a preset clock cycle;

[0013] Correspondingly, performing data type conversion on the original data according to the type conversion configuration parameter to obtain corresponding target data includes:

[0014] The data type conversion is synchronously performed on each of the original data in the data to be converted within one clock cycle to obtain corresponding target data, and after the conversion is completed, it is determined whether to continue to perform data type conversion on the next data to be converted based on the number of data rows of the original data.

[0015] In some embodiments of the present application, the type conversion configuration parameters include: the number of data rows of the original data, the original data and the target data correspond to different data types respectively;

[0016] Correspondingly, the reading of the received data to be converted from the local data storage unit includes:

[0017] Read the type conversion configuration parameter; if the number of bits of the data type of the original data in the type conversion configuration parameter is 32 and the number of bits of the data type of the target data is 64, read a received data to be converted from the local data storage unit at intervals of two preset clock cycles;

[0018] Correspondingly, performing data type conversion on the original data according to the type conversion configuration parameter to obtain corresponding target data includes:

[0019] Data type conversion is synchronously performed on half of the original data to be converted in one clock cycle, and data type conversion is synchronously performed on the other half of the original data to be converted in another clock cycle to obtain corresponding target data. After the conversion is completed, it is determined whether to continue data type conversion on the next data to be converted based on the number of data rows of the original data.

[0020] In some embodiments of the present application, the type conversion configuration parameters further include: data precisions corresponding to the original data and the target data respectively;

[0021] Correspondingly, before sending the target data to the host, the method further includes:

[0022] During the data type conversion process, the precision of each of the original data in the data to be converted is adjusted according to the data precisions corresponding to the original data and the target data, so as to obtain the corresponding target data.

[0023] In some embodiments of the present application, adjusting the precision of each of the original data in the data to be converted according to the data precisions respectively corresponding to the original data and the target data includes:

[0024] According to the precision difference between the data precisions corresponding to the original data and the target data, searching for the precision adjustment value corresponding to the precision difference in a preset precision adjustment comparison array;

[0025] The precision of each of the original data in the to-be-converted data is synchronously adjusted according to the precision adjustment value.

[0026] In some embodiments of the present application, sending the target data to the host includes:

[0027] Rejoining the target data corresponding to the same data to be converted obtained by conversion into output data;

[0028] The output data is stored in the data storage unit, so as to transmit the output data in the data storage unit to the CPU memory in the host based on the data interface.

[0029] Another aspect of the present application provides a Numeric data type conversion device, comprising:

[0030] The data acquisition module is used to obtain the original data of the Numeric type and the corresponding type conversion configuration parameters in the host from outside the host where the CPU is located;

[0031] The type conversion module is used to perform data type conversion on the original data according to the type conversion configuration parameters to obtain corresponding target data, and send the target data to the host.

[0032] In some embodiments of the present application, the data acquisition module includes:

[0033] A local storage reading unit is used to read the received data to be converted and the type conversion configuration parameters from the local data storage unit, wherein the data to be converted is previously transmitted from the CPU memory in the host to the data storage unit by the local data interface; the data to be converted includes: at least one original data of Numeric type; wherein the number of original data in each of the data to be converted is pre-determined according to the bit width and data type of the original data. A third aspect of the present application provides an acceleration card, including: an acceleration core, a data storage unit, and a data interface;

[0034] The acceleration core is used to execute the Numeric data type conversion method;

[0035] The data interface is used to transfer the data to be converted in the CPU memory in the host to the data storage unit, and to transfer the target data in the data storage unit to the memory;

[0036] The data storage unit is used to store the data to be converted, the type conversion configuration parameters and the target data.

[0037] The fourth aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the Numeric data type conversion method when executing the computer program.

[0038] A fifth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the Numeric data type conversion method when executed by a processor.

[0039] The Numeric data type conversion method provided in the present application obtains the original data of the Numeric type and the corresponding type conversion configuration parameters in the host computer from the outside of the host computer where the CPU is located; performs data type conversion on the original data according to the type conversion configuration parameters to obtain corresponding target data, and sends the target data to the host computer. The method can realize the type conversion of Numeric type data under the heterogeneous architecture of the CPU, is particularly suitable for the type conversion of a large amount of Numeric type data, can effectively improve the efficiency and reliability of the type conversion of Numeric type data, and can effectively reduce the CPU occupancy rate.

[0040] Additional advantages, purposes, and features of the present application will be partially described in the following description, and will become partially apparent to those skilled in the art after studying the following, or may be learned from the practice of the present application. The purposes and other advantages of the present application can be achieved and obtained by the structures specifically pointed out in the specification and the drawings.

[0041] Those skilled in the art will understand that the purposes and advantages that can be achieved by the present application are not limited to the above specific description, and the above and other purposes that can be achieved by the present application will be more clearly understood based on the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The drawings described herein are used to provide a further understanding of the present application, constitute a part of the present application, and do not constitute a limitation of the present application. The components in the drawings are not drawn to scale, but are only for the purpose of illustrating the principles of the present application. In order to facilitate the illustration and description of some parts of the present application, the corresponding parts in the drawings may be enlarged, that is, they may become larger relative to other components in the exemplary device actually manufactured according to the present application. In the drawings:

[0043] Figure 1 This is a schematic diagram of a first flow chart of a method for converting a Numeric data type in an embodiment of the present application.

[0044] Figure 2 Schematic diagram of a second flow chart of a method for converting a Numeric data type in an embodiment of the present application.

[0045] Figure 3 This is a third flow chart of the Numeric data type conversion method in one embodiment of the present application.

[0046] Figure 4 This is a fourth flow chart of the Numeric data type conversion method in one embodiment of the present application.

[0047] Figure 5 Schematic diagram of the structure of a Numeric data type conversion device in an embodiment of the present application.

[0048] Figure 6 Schematic diagram of the structure of an acceleration card in one embodiment of the present application.

[0049] Figure 7 This is a schematic diagram of the communication connection relationship between the acceleration card and the server in an application example of the present application.

[0050] Figure 8 A schematic diagram of the relationship between data input and output in an application example of the present application.

[0051] Fig. 9 The figure is a schematic diagram of an example process of data processing performed by an acceleration card in an application example of the present application.

[0052] Fig.10 This is a schematic diagram of examples of different data processing processes performed according to original data types and target data types in an application example of the present application. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the implementation modes and the accompanying drawings. Here, the illustrative implementation modes and descriptions of the present application are used to explain the present application, but are not intended to limit the present application.

[0054] It should also be noted here that in order to avoid obscuring the present application due to unnecessary details, only the structures and / or processing steps closely related to the scheme according to the present application are shown in the accompanying drawings, while other details that are not very relevant to the present application are omitted.

[0055] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0056] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.

[0057] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.

[0058] In view of the fact that the current data type conversion of databases can only be applied to CPU scenarios, and the problem that the data type conversion of Numeric type data can only be implemented on the CPU, the embodiments of the present application respectively provide a Numeric data type conversion method, a Numeric data type conversion device and an acceleration card for executing the Numeric data type conversion method, etc., which can be applied to scenarios of large-scale data type conversion in databases, and can offload the data type conversion work of Numeric type from the original execution on the CPU to execution on other heterogeneous systems, which can effectively expand the implementation scheme of data type conversion of Numeric type in the database, and has the following beneficial effects:

[0059] (1) Customize the data type conversion function of the Numeric type in heterogeneous systems to greatly improve the data type conversion capabilities.

[0060] (2) After the task is offloaded to the heterogeneous system, the CPU only needs to send some control instructions and no longer needs to perform heavy computing tasks. This releases the CPU occupancy rate and provides space for the CPU to process other tasks.

[0061] The details are described in detail through the following examples.

[0062] Based on this, the embodiment of the present application provides a Numeric data type conversion method that can be implemented by a Numeric data type conversion device, see Figure 1 , the Numeric data type conversion method specifically includes the following contents:

[0063] Step 100: Obtain original data of the Numeric type and corresponding type conversion configuration parameters in the host from outside the host where the CPU is located.

[0064] In one or more embodiments of the present application, the Numeric data type conversion device may be implemented using an acceleration core, which refers to a functional module having a data type conversion function for Numeric type data and may be provided in an acceleration card or other device. It is understood that the acceleration card may refer to a device for accelerating data type conversion processing for Numeric or other type data.

[0065] In step 100, Numeric type data is obtained outside the host where the CPU is located, so that the Numeric data type conversion process that originally needs to be executed by the CPU can be offloaded to a heterogeneous computing architecture for execution, which can effectively reduce the CPU occupancy rate.

[0066] In one or more embodiments of the present application, the original data is data to be converted into a data type, and the target data refers to data obtained after the data type conversion is performed on the original data. From the perspective of the Numeric data type conversion device, the original data can also be called input data, and the collection result of the target data can also be called output data. The present application does not limit this, and the specific naming can be based on actual application requirements.

[0067] It should also be noted that, although the Numeric data type conversion method provided in the embodiment of the present application is particularly intended for data type conversion processing of Numeric type data, it should be understood that other types of data with the same or similar data type conversion logic as the Numeric type structure or the same requirements are also applicable to the data type conversion method and acceleration card provided in the present application.

[0068] Step 200: Perform data type conversion on the original data according to the type conversion configuration parameters to obtain corresponding target data, and send the target data to the host.

[0069] From the above description, it can be seen that the Numeric data type conversion method provided in the embodiment of the present application can realize the type conversion of Numeric type data under the heterogeneous architecture of the CPU, and is particularly suitable for the type conversion of a large amount of Numeric type data. It can effectively improve the efficiency and reliability of the type conversion of Numeric type data, and can effectively reduce the CPU occupancy rate.

[0070] In order to further improve the effectiveness and wide applicability of Numeric data type conversion under the heterogeneous computing construction of CPU, in a Numeric data type conversion method provided in an embodiment of the present application, see Figure 2 , step 100 in the Numeric data type conversion method specifically includes the following contents:

[0071] Step 110: Read the received data to be converted and the type conversion configuration parameters from the local data storage unit, wherein the data to be converted is pre-transmitted from the CPU memory in the host to the data storage unit by the local data interface; the data to be converted includes: at least one original data of Numeric type; wherein the number of original data in each of the data to be converted is pre-determined according to the bit width and data type of the original data.

[0072] In one example, a batch of raw data in a to-be-converted data generally shares a type conversion configuration parameter. After the conversion of the batch is completed, the next batch of raw data and its corresponding type conversion configuration parameter are converted.

[0073] It is understandable that the bit width of the original data is related to the data type, the bit width of INT64 is 64 bits, the bit width of INT32 is 32 bits, etc. The bit width of the data to be converted can range from 8 bits to 1024 bits, and the data type of the original data can be INT64, INT32, DECIMAL64, DECIMAL32, etc. The specific number of original data in each of the data to be converted can be predetermined according to the bit width and data type of the original data, so as to further improve the efficiency and reliability of the conversion of the Numeric data type.

[0074] For example, if the bit width of the data to be converted is 512 bits and the data type format is INT64 or DECIMAL64, the number of original data in each of the data to be converted is 8; if the bit width of the original data is 512 bits and the data type format is INT32 or DECIMAL32, the number of original data in each of the data to be converted is 16.

[0075] In order to further improve the efficiency and effectiveness of Numeric data type conversion, in a Numeric data type conversion method provided in an embodiment of the present application, the type conversion configuration parameters include: the number of data rows of the original data, the original data and the target data respectively correspond to different data types;

[0076] For the corresponding Figure 3 An implementation of step 110 in the Numeric data type conversion method specifically includes the following contents:

[0077] Step 111: read the type conversion configuration parameters; if the number of bits of different data types corresponding to the original data and the target data in the type conversion configuration parameters are both 32 or 64, read a received data to be converted from the local data storage unit at intervals of a preset clock cycle.

[0078] Meanwhile, corresponding to step 111, an implementation of step 200 in the Numeric data type conversion method specifically includes the following contents:

[0079] Step 211: synchronously perform data type conversion on each of the original data in the data to be converted within one clock cycle, and after the conversion is completed, determine whether to continue to perform data type conversion on the next data to be converted based on the number of data rows of the original data.

[0080] In one example, if the bit width of the data to be converted is 512 bits, when the data type of the original data and the data type of the target data are different types of INT64 and DECIMAL64 respectively, then one data to be converted may include 8 original data, and it is necessary to input one data to be converted every clock cycle in step 111, and perform type conversion on the 8 original data in INT64 or DECIMAL64 format at the same time in step 211, so as to generate 8 target data of DECIMAL64 or INT64.

[0081] In another example, if the bit width of the data to be converted is 512 bits, when the data type of the original data and the data type of the target data are different types of INT32 and DECIMAL32 respectively, then one data to be converted may include 16 original data, and it is necessary to input one data to be converted every clock cycle in step 111, and perform type conversion on the 16 original data in INT32 or DECIMAL32 format at the same time in step 211, so as to generate 16 DECIMAL32 or INT32 target data.

[0082] Step 220: Send the obtained target data to the host.

[0083] That is to say, after obtaining the type conversion configuration parameters from the local data storage unit and obtaining the number of data rows of the original data, the conversion function of step 200 is executed; for example, the data bit width before and after the conversion is 32 bits, and the data to be converted is 512 bits, then each time a 512-bit data to be converted is read from the local storage unit for conversion, and each data to be converted corresponds to 16 original data, because 512 / 32=16.

[0084] Among them, the number of data rows of the original data in the type conversion configuration parameters corresponds to the number of the original data, that is, the number of 32-bit original data in the above example; each execution of 512 bits of data to be converted is equivalent to executing the conversion of 16 original data. After each conversion, it can be judged whether "the number of executions multiplied by 16" exceeds the total number of rows. If not, continue; if exceeded, end. In short, 16 original data are executed each time, and the current conversion process ends when the total execution number exceeds the number of data rows of the original data specified in the type conversion configuration parameters. The 16 here is based on the example that the bit width of the data to be converted is 512 bits and the bit width of the original data is 32 bits. The actual bit width of the data to be converted can be 32, 64, 128, etc., and the bit width of the original data is specified by the parameters. Further, in order to further improve the efficiency and effectiveness of Numeric data type conversion, see Figure 3 Another implementation of step 110 in the Numeric data type conversion method specifically includes the following contents:

[0085] Step 112: Read the type conversion configuration parameters; if the number of bits of the data type of the original data in the type conversion configuration parameters is 32 and the number of bits of the data type of the target data is 64, then read a received data to be converted from the local data storage unit at intervals of two preset clock cycles.

[0086] Meanwhile, corresponding to step 112, another implementation of step 200 in the Numeric data type conversion method specifically includes the following contents:

[0087] Step 212: synchronously perform data type conversion on half of the original data to be converted in one clock cycle, and synchronously perform data type conversion on the other half of the original data to be converted in another clock cycle, and after the conversion is completed, determine whether to continue data type conversion on the next data to be converted based on the number of data rows of the original data.

[0088] Specifically, when the data type of the original data is INT32 or DECIMAL32 and the data type of the target data is INT64 or DECIMAL64, two clock cycles are required to input one data to be converted, and each clock cycle performs type conversion on 8 INT32 or DECIMAL32 original data, and generates 8 INT64 or DECIMAL64 target data at the same time. A total of 16 INT64 or DECIMAL64 target data are generated in two clock cycles.

[0089] Step 220: Send the obtained target data to the host.

[0090] In one example, after obtaining the parameters and the number of rows from the storage unit, the conversion function is executed; for example, the data width before and after the conversion is 32 bits, and the data to be converted is 512 bits, then a 512-bit data to be converted is read from the local storage unit each time for conversion, and each data to be converted corresponds to 16 original data, because 512 / 32=16. The number of rows in the parameter corresponds to the number of original data, that is, the number of 32-bit original data in this example; each execution of 512-bit data is equivalent to executing the conversion of 16 original data. After each conversion, it is determined whether "the number of executions multiplied by 16" exceeds the total number of rows. If not, continue, otherwise end. In short, 16 are executed each time, and it ends when the total number of executions exceeds the number of rows specified in the parameter.

[0091] The 16 here is based on the example that the bit width of the data to be converted is 512 bits and the bit width of the original data is 32 bits. The actual bit width of the data to be converted can be 32, 64, 128, etc., and the bit width of the original data is specified by the parameter. In order to further improve the reliability and effectiveness of the Numeric data type conversion, in a Numeric data type conversion method provided in an embodiment of the present application, the type conversion configuration parameters also include: the data precision corresponding to the original data and the target data respectively;

[0092] For the corresponding Figure 3The steps between step 211 and step 220, and between step 212 and step 220 in the Numeric data type conversion method further specifically include the following contents:

[0093] Step 213: During the data type conversion process, the precision of each of the original data in the data to be converted is adjusted according to the data precisions corresponding to the original data and the target data, so as to obtain the corresponding target data.

[0094] Specifically, during the type conversion process, the INT32 type is treated as a DECIMAL32 type with a decimal scale (DECIMAL_SCALE) of 0. The INT64 type is treated as a DECIMAL64 type with a decimal scale (DECIMAL_SCALE) of 0. Therefore, the data type conversion of the Numeric type can be simplified to the type conversion of DECIMAL32 and DECIMAL64.

[0095] Among them, the type conversion of decimal DECIMAL is divided into increasing precision and decreasing precision. When the decimal scale (DECIMAL_SCALE) of the target data is greater than the decimal scale (DECIMAL_SCALE) of the original data, the precision is increased, otherwise it is decreased. When increasing precision, the original data needs to be multiplied by 10 for each increase in precision value, and when decreasing precision, the original data needs to be divided by 10 for each decrease in precision value. According to the difference between the decimal scale (DECIMAL_SCALE) of the target data and the decimal scale (DECIMAL_SCALE) of the original data in the type conversion configuration parameters, it can be known whether the precision is increased or decreased, and the absolute value of the difference is the precision value that needs to be increased or decreased.

[0096] In order to further improve the efficiency of precision adjustment during the conversion of Numeric data types, in a Numeric data type conversion method provided in an embodiment of the present application, see Figure 4 , step 213 in the Numeric data type conversion method further specifically includes the following contents:

[0097] Step 2131: According to the precision difference between the data precisities corresponding to the original data and the target data, a precision adjustment value corresponding to the precision difference is searched in a preset precision adjustment comparison array.

[0098] Step 2132: synchronously perform precision adjustment on each of the original data in the data to be converted according to the precision adjustment value to obtain corresponding target data.

[0099] Specifically, in order to save calculation time and reduce the number of multiplications or divisions, the values ​​to be multiplied or divided are calculated in advance and stored in the precision adjustment reference array, and the array value is {10^0, 10^1, 10^2, ..., 10^14}. The precision adjustment reference array is indexed according to the precision difference to obtain the value to be multiplied or divided as the current precision adjustment value.

[0100] The precision adjustment value obtained by multiplying or dividing the original data by the corresponding index can achieve precision increase or decrease, thereby completing the type conversion of the original data and obtaining the desired target data.

[0101] In order to further improve the reliability and transmission efficiency of Numeric data type conversion, in a Numeric data type conversion method provided in an embodiment of the present application, see Figure 4 , step 220 in the Numeric data type conversion method further specifically includes the following contents:

[0102] Step 221: reassemble the target data corresponding to the same data to be converted obtained by conversion into output data.

[0103] Step 222: Store the output data in the data storage unit, so as to transmit the output data in the data storage unit to the CPU memory in the host based on the data interface.

[0104] From the software level, the present application also provides a Numeric data type conversion device for executing all or part of the Numeric data type conversion method, see Figure 5 , the Numeric data type conversion device specifically includes the following contents:

[0105] The data acquisition module 10 is used to acquire the original data of the Numeric type and the corresponding type conversion configuration parameters in the host from outside the host where the CPU is located;

[0106] In which, the data acquisition module 10 may also be specifically provided with a local storage reading unit, which is used to read the received data to be converted and the type conversion configuration parameters from the local data storage unit, wherein the data to be converted is pre-transmitted from the CPU memory in the host to the data storage unit by the local data interface; the data to be converted includes: at least one original data of Numeric type; wherein the number of original data in each of the data to be converted is pre-determined according to the bit width and data type of the original data, so as to further improve the effectiveness and wide applicability of the Numeric data type conversion under the heterogeneous computing construction of the CPU.

[0107] The type conversion module 20 is used to perform data type conversion on the original data according to the type conversion configuration parameters to obtain corresponding target data, and send the target data to the host.

[0108] The embodiment of the Numeric data type conversion device provided in the present application can be specifically used to execute the processing flow of the embodiment of the Numeric data type conversion method in the above embodiment. Its functions are not repeated here, and reference can be made to the detailed description of the above Numeric data type conversion method embodiment.

[0109] The part of the Numeric data type conversion device that performs the Numeric data type conversion can be completed in the client device. Specifically, it can be selected according to the processing capability of the client device and the limitations of the user's usage scenario. This application does not limit this. If all operations are completed in the client device, the client device may also include a processor for specific processing of the Numeric data type conversion.

[0110] The client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.

[0111] The server and the client device may communicate with each other using any suitable network protocol, including network protocols that have not yet been developed on the date of filing this application. The network protocols may include, for example, TCP / IP, UDP / IP, HTTP, HTTPS, etc. Of course, the network protocols may also include, for example, RPC (Remote Procedure Call Protocol) and REST (Representational State Transfer) protocols used on top of the above protocols.

[0112] From the above description, it can be seen that the Numeric data type conversion device provided in the embodiment of the present application can realize the type conversion of Numeric type data under the heterogeneous architecture of the CPU, and is particularly suitable for the type conversion of a large amount of Numeric type data. It can effectively improve the efficiency and reliability of the type conversion of Numeric type data, and can effectively reduce the CPU occupancy rate.

[0113] Based on the above-mentioned embodiments of the Numeric data type conversion device and / or the Numeric data type conversion method, the present application also provides an embodiment of an accelerator card 1, see Figure 6 The acceleration card is provided with an acceleration core 11, a data storage unit 12 and a data interface 13;

[0114] The acceleration core 11 is used to execute the Numeric data type conversion method mentioned in the above embodiment;

[0115] The data interface 13 is used to transfer the data to be converted in the memory 22 corresponding to the CPU 21 in the host 2 to the data storage unit 12, and to transfer the target data in the data storage unit 12 to the memory 22;

[0116] The data storage unit 12 is used to store the data to be converted, the type conversion configuration parameters and the target data.

[0117] In order to further illustrate the above embodiments, the present application also provides a specific application example of the Numeric data type conversion method based on heterogeneous architecture implemented by the above accelerator card, acceleration core, etc. In this application example, see Figure 7 The data storage unit may use a double data rate synchronous dynamic random access memory DDR (Double Data Rate), and the data interface may use a PCIe interface. The data type conversion of the Numeric type is intended to obtain the original data type and the expected data type according to the type conversion configuration parameters, convert the original data type into the expected data type, and return it to the server. The data type conversion function of the Numeric type is executed on the accelerator card, and this functional module can be called an acceleration core.

[0118] Among them, the accelerator card has the following characteristics:

[0119] (1) The accelerator card has a standard PCIe interface and is inserted into the server where the CPU is located through the PCIe interface slot. Data is transmitted through the PCIe interface.

[0120] (2) The accelerator card includes DDR and acceleration cores for computing. Data is transferred from the CPU memory to the DDR of the accelerator card through the PCIe interface.

[0121] (3) The acceleration core reads data from the DDR of the acceleration card.

[0122] (4) After being processed by the acceleration core, the acceleration core writes its target data back to the DDR of the acceleration card.

[0123] (5) Finally, the data is transmitted back to the CPU's corresponding memory through the PCIe interface, thus completing the entire heterogeneous computing process.

[0124] And, in this application example, see Fig. 9 , taking original data A, target data B and type conversion configuration parameter C as an example for explanation, wherein the acceleration core is used to implement the function of Numeric type conversion.

[0125] See also Figure 8 The example process of data processing performed by the accelerator card based on the original data A, the target data B and the type conversion configuration parameter C specifically includes the following steps:

[0126] S1: The server sends the original data A and the type conversion configuration parameter C to the DDR of the accelerator card and starts the acceleration core execution.

[0127] Specifically, the host (such as a server) sends the data content of the original data A and the type conversion configuration parameter C to the DDR of the acceleration card through the PCIe channel and starts the execution of the acceleration core.

[0128] S2: The acceleration core reads the type conversion configuration parameter C and parses it before starting the acceleration core initialization.

[0129] The acceleration core reads the type conversion configuration parameter C data from the DDR for initialization. The content of the type conversion configuration parameter C at least includes the data type of the original data A, the data type of the target data B, the input precision, the output precision, and the number of input rows.

[0130] Data type: The acceleration core supports the INT64, INT32, DECIMAL64, and DECIMAL32 types in the Numeric data type. Before the acceleration core is executed, the data type must be determined to determine the type conversion method.

[0131] Precision: Used to determine the value that needs to be multiplied or divided when converting types.

[0132] Number of input rows: used to determine the number of conversions.

[0133] S3: The acceleration core reads the original data A and converts the original data A into target data B according to the type conversion configuration parameter C.

[0134] The original data A can be input into a data to be converted with one or two preset clock cycles as a custom interval. A data to be converted can contain one or more original data, and the specific number is determined by the original data bit width, the data type of the original data A and the data type of the target data B.

[0135] The method for determining the bit width of the original data A is as follows:

[0136] The original data is arranged in byte order. The original data bit width to the acceleration core is determined by the DDR bandwidth of the acceleration card and the main frequency of the input module. For example, if the DDR specification is DDR3 2400, that is, 2.4G main frequency, 64bit data width, the bandwidth is 2.4GHz* 64bit = 153.6Gb / s; the frequency of the read module is 300MHz, then the input / output data width is 153.6Gb / s / 300 MHz = 512bit.

[0137] See also Fig.10 The bit width of the original data A can be 512 bits. When the data type of the original data A and the data type of the target data B are INT64 or DECIMAL64 respectively, one data to be converted can include 8 original data. One clock cycle is required to input one data to be converted, and the type conversion is performed on 8 data in INT64 or DECIMAL64 format at the same time, thereby generating 8 DECIMAL64 or INT64 target data B.

[0138] If the bit width of the original data A is 512 bits, when the original data type and the target data type are INT32 or DECIMAL32 respectively, one data to be converted includes 16 original data. It takes one clock cycle to input one data to be converted and perform type conversion on 16 INT32 or DECIMAL32 at the same time to generate 16 INT32 or DECIMAL32 target data B.

[0139] If the bit width of the original data A is 512 bits, when the input type is INT32 or DECIMAL32 and the output type is INT64 or DECIMAL64, two clock cycles are required to input one data to be converted. Each clock cycle performs type conversion on 8 INT32 or DECIMAL32 data and generates 8 INT64 or DECIMAL64 target data B. A total of 16 INT64 or DECIMAL64 target data B are generated in two clock cycles.

[0140] The original data type and target data type are parsed from the type conversion configuration parameters.

[0141] During the type conversion process, the INT32 type is treated as the DECIMAL32 type with a decimal scale (DECIMAL_SCALE) of 0. The INT64 type is treated as the DECIMAL64 type with a decimal scale (DECIMAL_SCALE) of 0. Therefore, the data type conversion of the Numeric type can be simplified to the type conversion between DECIMAL32 and DECIMAL64.

[0142] The type conversion of decimal DECIMAL is divided into increasing precision and decreasing precision. When the decimal scale (DECIMAL_SCALE) of the target data is greater than the decimal scale (DECIMAL_SCALE) of the original data, the precision is increased, otherwise it is decreased. When increasing precision, the original data needs to be multiplied by 10 for each increase in precision value, and when decreasing precision, the original data needs to be divided by 10 for each decrease in precision value. According to the difference between the decimal scale (DECIMAL_SCALE) of the target data and the decimal scale (DECIMAL_SCALE) of the original data in the type conversion configuration parameters, it can be known whether the precision is increased or decreased, and the absolute value of the difference is the precision value that needs to be increased or decreased.

[0143] To save calculation time and reduce the number of multiplications or divisions, the values ​​to be multiplied or divided are calculated in advance and stored in an array with the value of {10^0, 10^1, 10^2, ..., 10^14}. The array is indexed according to the precision difference to obtain the value to be multiplied or divided.

[0144] The original data is multiplied or divided by the corresponding index to obtain the value, thus completing the precision increase or decrease, thereby completing the type conversion of the original data A and obtaining the desired target data B. Multiple target data B are reassembled into 512 bits as the final type-converted data.

[0145] S4: The acceleration core stores the target data B into DDR.

[0146] This step is to write the target data into DDR in a burst manner.

[0147] S5: The server reads back the target data B from the DDR of the acceleration card.

[0148] In addition, examples of the functions of the acceleration core are as follows:

[0149] Assuming that the value of input A is 100, when the input types are INT32, DECIMAL32, INT64, and DECIMAL64 respectively, the data type of the output target data B is traversed, and the results of the target data B are shown in Table 1.

[0150] Table 1

[0151]

[0152] To sum up, the Numeric data type conversion method provided in the application example of this application is a solution for data type conversion of the Numeric type of the database. It is implemented by a heterogeneous computing system composed of a hardware accelerator card and a traditional CPU server to replace the corresponding function of the existing database, and can realize the data type conversion function of the Numeric type under the heterogeneous computing architecture.

[0153] This application example implements the xx method specifically from the following two aspects:

[0154] (1) Solution for data type conversion of database Numeric type.

[0155] (2) The heterogeneous architecture on which the acceleration core relies is used to realize data interaction between the CPU and the acceleration card.

[0156] The embodiment of the present application also provides an electronic device, which may include a processor, a memory, a receiver and a transmitter, wherein the processor is used to execute the Numeric data type conversion method mentioned in the above embodiment, wherein the processor and the memory may be connected via a bus or other means, such as by bus connection. The receiver may be connected to the processor and the memory via wired or wireless means.

[0157] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0158] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the Numeric data type conversion method in the embodiment of the present application. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory, that is, implementing the Numeric data type conversion method in the above method embodiment.

[0159] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0160] The one or more modules are stored in the memory, and when executed by the processor, perform the Numeric data type conversion method in the embodiment.

[0161] In some embodiments of the present application, the user equipment may include a processor, a memory, and a transceiver unit, which may include a receiver and a transmitter. The processor, memory, receiver, and transmitter may be connected through a bus system. The memory is used to store computer instructions, and the processor is used to execute the computer instructions stored in the memory to control the transceiver unit to send and receive signals.

[0162] As an implementation method, the functions of the receiver and the transmitter in the present application can be considered to be implemented through a transceiver circuit or a dedicated chip for transceiver, and the processor can be considered to be implemented through a dedicated processing chip, a processing circuit or a general chip.

[0163] As another implementation method, it is possible to use a general-purpose computer to implement the server provided in the embodiment of the present application, that is, to store the program code for implementing the functions of the processor, receiver, and transmitter in a memory, and the general-purpose processor implements the functions of the processor, receiver, and transmitter by executing the code in the memory.

[0164] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned Numeric data type conversion method are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0165] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.

[0166] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0167] In this application, the features described and / or illustrated for one embodiment may be used in the same manner or in a similar manner in one or more other embodiments, and / or combined with or replace the features of other embodiments.

[0168] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for converting a Numeric data type, characterized in that: include: Obtain the original data of the Numeric type and the corresponding type conversion configuration parameters in the host from outside the host where the CPU is located; Performing data type conversion on the original data according to the type conversion configuration parameters to obtain corresponding target data, and sending the target data to the host; The method of obtaining the original data of the Numeric type and the corresponding type conversion configuration parameters in the host from outside the host where the CPU is located includes: The received data to be converted and the type conversion configuration parameters are read from a local data storage unit, wherein the data to be converted is transmitted from a CPU memory in a host computer to the data storage unit in advance by a local data interface; the data to be converted includes: at least one original data of Numeric type; wherein the number of original data in each of the data to be converted is determined in advance according to the bit width and data type of the original data; the type conversion configuration parameters include: the number of data rows of the original data, and the original data and the target data correspond to different data types respectively; Correspondingly, the local data storage unit reads the received data to be converted and the type conversion configuration parameter, including: Read the type conversion configuration parameter; if the number of bits of different data types corresponding to the original data and the target data in the type conversion configuration parameter is 32 or 64, read a received data to be converted from the local data storage unit at intervals of a preset clock cycle; Correspondingly, performing data type conversion on the original data according to the type conversion configuration parameter to obtain corresponding target data includes: The data type conversion is synchronously performed on each of the original data in the data to be converted within one clock cycle to obtain the corresponding target data, and after the conversion is completed, it is determined whether to continue to perform data type conversion on the next data to be converted based on the number of data rows of the original data.

2. The Numeric data type conversion method according to claim 1, characterized in that: The type conversion configuration parameters also include: data precisions corresponding to the original data and the target data respectively; Correspondingly, before sending the target data to the host, the method further includes: During the data type conversion process, the precision of each of the original data in the data to be converted is adjusted according to the data precisions corresponding to the original data and the target data, so as to obtain the corresponding target data.

3. The Numeric data type conversion method according to claim 2, characterized in that: The step of adjusting the precision of each of the original data in the data to be converted according to the data precisions respectively corresponding to the original data and the target data includes: According to the precision difference between the data precisions corresponding to the original data and the target data, searching for the precision adjustment value corresponding to the precision difference in a preset precision adjustment comparison array; The precision of each of the original data in the to-be-converted data is synchronously adjusted according to the precision adjustment value.

4. The Numeric data type conversion method according to claim 1, characterized in that: Sending the target data to the host comprises: Rejoining the target data corresponding to the same data to be converted obtained by conversion into output data; The output data is stored in the data storage unit, so as to transmit the output data in the data storage unit to the CPU memory in the host based on the data interface.

5. A method for converting a Numeric data type, characterized in that: include: Obtain the original data of the Numeric type and the corresponding type conversion configuration parameters in the host from outside the host where the CPU is located; Performing data type conversion on the original data according to the type conversion configuration parameters to obtain corresponding target data, and sending the target data to the host; The method of obtaining the original data of the Numeric type and the corresponding type conversion configuration parameters in the host from outside the host where the CPU is located includes: The received data to be converted and the type conversion configuration parameters are read from a local data storage unit, wherein the data to be converted is transmitted from a CPU memory in a host to the data storage unit in advance by a local data interface; the data to be converted includes: at least one original data of Numeric type; wherein the number of original data in each of the data to be converted is determined in advance according to the bit width and data type of the original data; The type conversion configuration parameters include: the number of data rows of the original data, and the original data and the target data correspond to different data types respectively; Correspondingly, the local data storage unit reads the received data to be converted and the type conversion configuration parameter, including: Read the type conversion configuration parameter; if the number of bits of the data type of the original data in the type conversion configuration parameter is 32 and the number of bits of the data type of the target data is 64, read a received data to be converted from the local data storage unit at intervals of two preset clock cycles; Correspondingly, performing data type conversion on the original data according to the type conversion configuration parameter to obtain corresponding target data includes: Data type conversion is synchronously performed on half of the original data to be converted in one clock cycle, and data type conversion is synchronously performed on the other half of the original data to be converted in another clock cycle to obtain corresponding target data. After the conversion is completed, it is determined whether to continue data type conversion on the next data to be converted based on the number of data rows of the original data.

6. The Numeric data type conversion method according to claim 5, characterized in that: The type conversion configuration parameters also include: data precisions corresponding to the original data and the target data respectively; Correspondingly, before sending the target data to the host, the method further includes: During the data type conversion process, the precision of each of the original data in the data to be converted is adjusted according to the data precisions corresponding to the original data and the target data, so as to obtain the corresponding target data.

7. The Numeric data type conversion method according to claim 6, characterized in that: The step of adjusting the precision of each of the original data in the data to be converted according to the data precisions respectively corresponding to the original data and the target data includes: According to the precision difference between the data precisions corresponding to the original data and the target data, searching for the precision adjustment value corresponding to the precision difference in a preset precision adjustment comparison array; The precision of each of the original data in the to-be-converted data is synchronously adjusted according to the precision adjustment value.

8. The Numeric data type conversion method according to claim 5, characterized in that: Sending the target data to the host comprises: Rejoining the target data corresponding to the same data to be converted obtained by conversion into output data; The output data is stored in the data storage unit, so as to transmit the output data in the data storage unit to the CPU memory in the host based on the data interface.

9. A Numeric data type conversion device, characterized in that: include: The data acquisition module is used to obtain the original data of the Numeric type and the corresponding type conversion configuration parameters in the host from outside the host where the CPU is located; A type conversion module, used for performing data type conversion on the original data according to the type conversion configuration parameters to obtain corresponding target data, and sending the target data to the host; The data acquisition module comprises: A local storage reading unit is used to read the received data to be converted and the type conversion configuration parameters from the local data storage unit, wherein the data to be converted is transmitted from the CPU memory in the host to the data storage unit in advance by the local data interface; the data to be converted includes: at least one original data of Numeric type; wherein the number of original data in each of the data to be converted is determined in advance according to the bit width and data type of the original data; The type conversion configuration parameters include: the number of data rows of the original data, and the original data and the target data correspond to different data types respectively; Correspondingly, the reading of the received data to be converted from the local data storage unit includes: Read the type conversion configuration parameter; if the number of bits of different data types corresponding to the original data and the target data in the type conversion configuration parameter is 32 or 64, read a received data to be converted from the local data storage unit at intervals of a preset clock cycle; Correspondingly, performing data type conversion on the original data according to the type conversion configuration parameter to obtain corresponding target data includes: The data type conversion is synchronously performed on each of the original data in the data to be converted within one clock cycle to obtain corresponding target data, and after the conversion is completed, it is determined whether to continue to perform data type conversion on the next data to be converted based on the number of data rows of the original data.

10. An accelerator card, characterized in that: include: Acceleration core, data storage unit and data interface; The acceleration core is used to execute the Numeric data type conversion method described in any one of claims 1 to 4, or is used to execute the Numeric data type conversion method described in any one of claims 5 to 8; The data interface is used to transfer the data to be converted in the CPU memory in the host to the data storage unit, and to transfer the target data in the data storage unit to the memory; The data storage unit is used to store the data to be converted, the type conversion configuration parameters and the target data.