WO2023029464A1 - 数据处理装置、方法、芯片、计算机设备及存储介质 - Google Patents

数据处理装置、方法、芯片、计算机设备及存储介质 Download PDF

Info

Publication number
WO2023029464A1
WO2023029464A1 PCT/CN2022/084040 CN2022084040W WO2023029464A1 WO 2023029464 A1 WO2023029464 A1 WO 2023029464A1 CN 2022084040 W CN2022084040 W CN 2022084040W WO 2023029464 A1 WO2023029464 A1 WO 2023029464A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
processed
bit width
format
target
Prior art date
Application number
PCT/CN2022/084040
Other languages
English (en)
French (fr)
Inventor
霍冠廷
王文强
孙海涛
徐宁仪
Original Assignee
上海商汤智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海商汤智能科技有限公司 filed Critical 上海商汤智能科技有限公司
Publication of WO2023029464A1 publication Critical patent/WO2023029464A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30007Arrangements for executing specific machine instructions to perform operations on data operands
    • G06F9/30025Format conversion instructions, e.g. Floating-Point to Integer, decimal conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/3243Power saving in microcontroller unit
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present disclosure relates to the technical field of computer applications, and in particular, to a data processing device, method, chip, computer equipment, and storage medium.
  • the current data processing method has a problem of high power consumption.
  • Embodiments of the present disclosure at least provide a data processing device, method, chip, computer equipment, and storage medium.
  • an embodiment of the present disclosure provides a data processing device, including: a data conversion unit, and an operation unit; the data conversion unit is connected to the operation unit; the data conversion unit is configured to respond to receiving One or more data sets to be processed, based on the data formats corresponding to the data sets to be processed, determine the target data format, and convert the data set to be processed into a converted data set in the target data format; convert the converted data The set is transmitted to the operation unit; the operation unit is configured to perform preset operation processing on the converted data set in response to receiving the converted data set transmitted by the data conversion unit to obtain a data processing result.
  • the target data format is determined, and the data sets to be processed are converted into the target data format to obtain the converted data set, and then the converted data set is subjected to preset operation processing,
  • the target data format is determined by the data format of the data set to be processed, and its data bit width is smaller than that of a full-precision fixed-point number. Lower consumption, reducing the consumption of computing resources.
  • the data format of the data set to be processed includes: a first bit width corresponding to the target data bits in the data set to be processed.
  • the data set to be processed includes: floating-point number data; the target data bits include at least one of the following: a sign bit, an exponent bit, and a mantissa bit.
  • the computing power for floating-point numbers usually directly represents the computing power of computing resources. This type of computing usually brings relatively large resource consumption.
  • the data processing device provided by the embodiments of the present disclosure can convert floating-point data into target data
  • the default operation processing in the format can greatly reduce the power consumption required for floating-point number processing.
  • the data conversion unit when determining the target data format based on the data formats corresponding to the data sets to be processed, is configured to: based on at least The second bit width is determined based on the first bit width of the target data bits respectively included in the two data sets to be processed; and the target data format is determined based on the second bit width.
  • the data conversion unit determines the second bit width based on the first bit width of the target data bits respectively included in the at least two data sets to be processed, it is configured to: The first bit width of the target data bits included in the at least two data sets to be processed respectively, determining the maximum bit width corresponding to the target data bits; determining the maximum bit width as the second bit width .
  • the data conversion unit includes: a target data format determination circuit, and a first format conversion circuit; wherein the target data format determination circuit is configured to respond to receiving at least two For a data set, determine a second bit width based on the first bit width of the target data bits respectively included in at least two of the data sets to be processed; send the second bit width to the first format conversion circuit; the second A format conversion circuit, configured to generate a target data format based on the second bit width in response to receiving the second bit width and the data set to be processed, and convert the data set to be processed into the The target data format is used to obtain the converted data set.
  • the target data format determination circuit includes: a bit width counter and a comparator; the bit width counter is connected to the comparator; wherein the bit width counter is used to respond Upon receiving the data set to be processed, count the bit width of the target data bits in the data set to be processed, obtain the first bit width of the target data bits included in the data set to be processed, and send to the comparator sending the first bit width; the comparator is configured to, in response to receiving the first bit width corresponding to the at least two data sets to be processed sent by the bit width counter, combine at least two of the data sets to be processed Comparing the first bit widths respectively corresponding to the processing data sets, determining the second bit width based on the comparison result, and sending the second bit width to the first format conversion circuit.
  • the data conversion unit when determining the target data format based on the data formats respectively corresponding to the data sets to be processed, is configured to: based on the target data bits in the data set to be processed The second bit width is determined based on the first bit width and the preset data bit width; and the target data format is determined based on the second bit width.
  • the operation unit when performing preset operation processing on the converted data set to obtain a data processing result, is configured to: perform preset operation processing on the converted data set to obtain an intermediate result data; converting the intermediate result data from the target data format to a preset data format to obtain the data processing result.
  • the operation unit includes: an operation circuit, and a second format conversion circuit; the operation circuit is configured to, in response to receiving the conversion data set transmitted by the data conversion unit, convert the The data set is subjected to preset operation processing to obtain the intermediate result data, and transmit the intermediate result data to the second format conversion circuit; the second format conversion circuit is configured to respond to receiving the transmission from the operation circuit The intermediate result data is converted into a preset data format to obtain the data processing result.
  • an embodiment of the present disclosure further provides a data processing method, including: acquiring one or more data sets to be processed; determining the target data format based on the data formats corresponding to the data sets to be processed; Converting the processed data set into a converted data set in a target data format; performing preset calculation processing on the converted data set to obtain a data processing result.
  • the data format of the data set to be processed includes: a first bit width corresponding to the target data bits in the data set to be processed.
  • the data set to be processed includes: floating-point number data; the target data bits include at least one of the following: a sign bit, an exponent bit, and a mantissa bit.
  • determining the target data format based on the data formats respectively corresponding to the data sets to be processed includes: based on at least two data sets to be processed determining a second bit width based on the first bit width of the target data bits respectively included in the sets; and determining the target data format based on the second bit width.
  • the determining the second bit width based on the first bit width of the target data bits respectively included in at least two of the data sets to be processed includes: based on at least two of the data sets to be processed The first bit width of the target data bits respectively included in the data sets, determining a maximum bit width corresponding to the target data bits; determining the maximum bit width as the second bit width.
  • the performing preset calculation processing on the converted data set to obtain a data processing result includes: performing preset calculation processing on the converted data set to obtain intermediate result data;
  • the result data is converted from the target data format into a preset data format to obtain the data processing result.
  • an embodiment of the present disclosure further provides a data processing chip, including: the data processing device according to the first aspect, or any one of the first aspect.
  • an optional implementation manner of the present disclosure further provides a computer device, a processor, and a memory, where the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the instructions stored in the memory.
  • machine-readable instructions when the machine-readable instructions are executed by the processor, when the machine-readable instructions are executed by the processor, the above-mentioned second aspect is executed, or any possible implementation of the second aspect.
  • an optional implementation mode of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the above-mentioned second aspect, or any of the second aspects may be executed. Steps in one possible implementation.
  • FIG. 1 shows a schematic diagram of a data processing device provided by an embodiment of the present disclosure
  • FIG. 2 shows a schematic diagram of a specific structure of a data conversion unit in a data processing device provided by an embodiment of the present disclosure
  • FIG. 3 shows a schematic structural diagram of a target data format determining circuit in a data processing device provided by an embodiment of the present disclosure
  • FIG. 4 shows a specific structural example of a data conversion unit provided by an embodiment of the present disclosure
  • FIG. 5 shows a flowchart of a data processing method provided by an embodiment of the present disclosure
  • Fig. 6 shows a schematic diagram of a computer device provided by an embodiment of the present disclosure.
  • the present disclosure provides a data processing device, which determines the target data format according to the data formats corresponding to one or more data sets to be processed, and converts the data sets to be processed into the target data format to obtain the converted data set , and then perform preset calculation processing on the converted data set.
  • the target data format is determined by using the data format of the data set to be processed, and its data bit width is smaller than that of a full-precision fixed-point number.
  • the set performs preset calculation processing, it needs to consume lower power consumption and reduce the consumption of computing resources.
  • the device has a hardware structure compatible with multiple floating-point number operations, so that the device can multiplex the calculation unit logic when inputting floating-point numbers in different formats, thereby reducing chip area, that is, reducing resources consumption.
  • the data processing device provided in the embodiment of the present disclosure can be used to process floating-point data, and can also be used to process Other types of data are processed.
  • the data processing device includes: a data conversion unit 10 and an operation unit 20; the data conversion unit 10 is connected to the operation unit 20; The data conversion unit 10 is configured to, in response to receiving one or more data sets to be processed, determine a target data format based on data formats respectively corresponding to the data sets to be processed, and convert the data sets to be processed into The target data format is to obtain a converted data set; the converted data set is transmitted to the operation unit 20; the operation unit 20 is configured to respond to the conversion data set transmitted by the data conversion unit 10, and to Convert the data set to perform preset calculation processing to obtain the data processing results.
  • the data set to be processed includes, for example, floating point data.
  • Floating-point data usually includes the following three data bits: sign bit, exponent bit, and mantissa bit;
  • the data set to be processed includes half-precision floating-point numbers (Floating Point 16, FP16) and sixteen-bit brain floating-point numbers (Brain Float 16, BF16) as an example, wherein, the bit width of the sign bit of FP16 is 1 bit, the bit width of the exponent bit is 5 bits, and the bit width of the mantissa bit is 10 bits;
  • the bit width is 1 bit, the bit width of the exponent bit is 8 bits, and the bit width of the mantissa bit is 7 bits.
  • the data converting unit 10 and the computing unit 20 will be described separately below.
  • the data converting unit 10 includes a data receiving end, which is used for receiving the data set to be processed.
  • the target data format is determined based on data formats respectively corresponding to the one or more data sets to be processed.
  • the data format of the data set to be processed includes: the first bit width corresponding to the target data bits in the data set to be processed.
  • the target data bits of the floating point data include at least one of the following: a sign bit, an exponent bit, and a mantissa bit.
  • the data conversion unit 10 determines the target data format based on the data formats corresponding to the data sets to be processed, for example, it can be used to:
  • the second bit width is determined based on the first bit width of the target data bits respectively included in the data sets to be processed; and the target data format is determined based on the second bit width.
  • the second bit width when determining the second bit width based on the first bit width of the target data bits respectively included in at least two said data sets to be processed, it may be based on the said target data bits respectively included in at least two said data sets to be processed For the first bit width of the target data bits, determine a maximum bit width corresponding to the target data bits; determine the maximum bit width as the second bit width.
  • the data set to be processed including floating point data FP16 and BF16 as an example, wherein the target data bits include: exponent bits and mantissa bits.
  • the first bit width of the exponent of FP16 is: 5 bits; the first bit width of the exponent of BF16 is: 8 bits, and the larger one is determined as the second bit width of the exponent : That is, 8 bits.
  • the first bit width of the mantissa bits of FP16 is: 10 bits; the first bit width of the mantissa bits of BF16 is: 7 bits, then the larger one is determined as the second bit width of the mantissa bits, also That is 10 bits.
  • the bit width of the sign bit 1 bit
  • the second bit width of the exponent bit 8 bits
  • the second bit width of the mantissa bit 10 bits
  • the embodiment of the present disclosure provides a structure of a data conversion unit 10, including a target data format determination circuit 11 and a first format conversion circuit 12; wherein, the target data format determination circuit 11 is used to respond to Upon receiving at least two data sets to be processed, determine a second bit width based on the first bit widths of the target data bits respectively included in the at least two data sets to be processed; The second bit width; the first format conversion circuit 12 is configured to generate a target data format based on the second bit width in response to receiving the second bit width and the data set to be processed, and The data set to be processed is converted into the target data format to obtain the converted data set.
  • the data set to be processed may be received from the outside by the first format conversion circuit 12, or may be sent by the target data format determination circuit 11, which is not specifically limited in this embodiment of the present disclosure.
  • the target data format determination circuit 11 includes a bit width counter 111 and a comparator 112; the bit width counter 111 is connected to the comparator 112; wherein, the bit width counter 111, In response to receiving the data set to be processed, count the bit width of the target data bits in the data set to be processed, obtain the first bit width of the target data bits included in the data set to be processed, and send to the The comparator 112 sends the first bit width; the comparator 112 is configured to respond to receiving the first bit width sent by the bit width counter 111 and corresponding to at least two data sets to be processed respectively, Comparing the first bit widths corresponding to at least two of the data sets to be processed respectively, and determining the second bit width based on the comparison result, and sending the second bit width to the first format conversion circuit 12 .
  • the number of bit width counters 111 is related to the maximum number of data sets to be processed that can be processed by the data processing device; for example, if the maximum number of data sets to be processed that can be processed by the data processing device is n, then The number of bit width counters 111 is also n; wherein, different data sets to be processed are transmitted to different bit width counters 111 .
  • the n bit width counters 111 After receiving the corresponding data set to be processed, count the target data bits in the received data set to be processed, and obtain the target data set included in the data set to be processed The first bit width of the data bits is then transmitted to the comparator 112 .
  • the number of bit width counters 111 can also be one, and the bit width counters 111 can sequentially determine the first bit widths corresponding to at least two data sets to be processed respectively, and then use the determined first bit widths
  • the bit width is sent to the comparator 112, which is not specifically limited in this embodiment of the present disclosure.
  • the input port of the comparator 112 is connected to the output ports of n bit width counters 111 .
  • the number of comparators 112 may be one, for example.
  • the comparator 112 can receive the first bit widths respectively transmitted by the n bit width counters 111, and compare the first bit widths respectively transmitted by the n bit width counters 111 Yes, the largest one among them is transmitted to the first format conversion circuit 12 as the second bit width.
  • the comparator 112 can receive the first bit width transmitted by the m bit width counters 111 respectively; in addition, in order to ensure the normal operation of the circuit, other ( n-m) bit width counters 111 transmit preset values to the comparator 112 respectively, the preset value is, for example, 0; the comparator 112 transmits the first bit width and other (n-m) bits of the m bit width counters 111 respectively The preset values transmitted by the width counters 111 are compared. At this time, since the preset values are 0, the first bit width transmitted by each bit width counter 111 is an integer greater than or equal to 0. Then, the comparator 112 can The largest of the first bit widths is sent to the first format conversion circuit 12 as the second bit width.
  • the first format conversion circuit 12 can determine the target data format according to the second bit width, and then convert the data set to be processed into the target data format to obtain the converted data set.
  • the quantity of the first format conversion circuit 12 is also related to the maximum number of data sets to be processed that the data processing device can handle; if the maximum number of data sets to be processed that the data processing device can handle is n, then The number of first format conversion circuits 12 is also n.
  • the input terminals of the n first format conversion circuits 12 are connected to the output terminals of the comparator 112 .
  • the comparator 112 can transmit the second bit width to the n first format conversion circuits 12 respectively.
  • the input terminals of the n first format conversion circuits 12 are also used to receive different data sets to be processed.
  • the i-th first format conversion circuit 12 receives the second bit width through the input terminal, and the i-th data set to be processed, determines the target data format according to the second bit width, and converts the i-th data to be processed The set is converted to the target data format, and the i-th converted data set is obtained.
  • the embodiment of the present disclosure provides a structural example of a data conversion unit 10.
  • the data conversion unit 10 includes two bit width counters M1 and M2, which are connected to the output terminals of the two bit width counters.
  • the data set a1 to be processed is transmitted to the bit width counter M1, and the bit width counter M1 counts the target data bits in the data set a1 to be processed, and the first bit width s1 of the target data bits included in the data set a1 to be processed is obtained, and compared to M3 sends the first bit width s1.
  • the data set a2 to be processed is transmitted to the bit width counter M2, and the bit width counter M2 counts the target data bits in the data set a2 to be processed, and the first bit width s2 of the target data bits included in the data set a2 to be processed is obtained, and compared to The device M3 sends the first bit width s2.
  • the comparator M3 After the comparator M3 receives the first bit width s1 and the first bit width s2, it compares the two, and outputs the larger one as the second bit width, and sends them to the first format converting circuit M4 and the first bit width respectively.
  • the first format conversion circuit M4 receives the second bit width transmitted by the comparator M3, and determines the target data format according to the second bit width. Receive the to-be-processed data set a1 transmitted from the outside, and then convert the to-be-processed data set a1 into data in the target data format to obtain the converted data set f1 corresponding to the to-be-processed data set a1.
  • the first format conversion circuit M5 receives the second bit width transmitted by the comparator M3, and determines the target data format according to the second bit width. Receive the to-be-processed data set a2 transmitted from the outside, and then convert the to-be-processed data set a2 into data in the target data format to obtain the converted data set f2 corresponding to the to-be-processed data set a2.
  • the computing unit 20 is configured to perform preset computing processing on the converted data set after receiving the converted data set transmitted by the data converting unit 10 to obtain a data processing result.
  • the preset arithmetic processing includes, for example, addition processing, multiplication processing, and the like.
  • specific functions of the computing unit 20 can be set according to actual computing needs.
  • the computing unit 20 is configured to: perform preset computing processing on the converted data set to obtain intermediate result data when performing preset computing processing on the converted data set to obtain data processing results;
  • the target data format is converted into a preset data format to obtain the data processing result.
  • the preset data format can be set according to the actual needs of data processing.
  • the second bit width of the sign bit 1 bit; the second bit width of the exponent bit: 8 bits; the second bit width of the mantissa bit: 10 bits bit.
  • the target bit width of the sign bit 1 bit; the target bit width of the exponent bit: 5 bits; the target bit width of the mantissa bit: 10 bits, then the exponent bit of the intermediate result data Convert from 8 bits to 5 bits to obtain the data processing result.
  • the embodiment of the present disclosure provides a specific structure of an operation unit 20, including an operation circuit 21 and a second format conversion circuit 22; the operation circuit 21 is used to respond to receiving the data conversion unit 10 transmits the converted data set, performs preset calculation processing on the converted data set, obtains the intermediate result data, and transmits the intermediate result data to the second format conversion circuit 22; the second format conversion circuit 22. Converting the intermediate result data into a preset data format in response to receiving the intermediate result data transmitted by the operation circuit 21 to obtain the data processing result.
  • the number of data sets to be processed may also be one; when the data conversion unit determines the target data format based on the data format corresponding to the data set to be processed, for example, the following method may be adopted: based on The first bit width of the target data bits included in the data set to be processed and the preset data bit width are used to determine a second bit width; based on the second bit width, the target data format is determined.
  • the first bit width and the preset data bit width can be The larger of , is determined to be the second bit width.
  • the comparator is also provided with a preset data bit width input port for inputting the preset data bit width.
  • the preset data bit width for example, may be a preset data bit width, or may be a data bit width determined during the process of processing the historical data set to be processed.
  • the data conversion unit receives one or more data sets to be processed, and based on the data formats corresponding to the data sets to be processed, determines the target data format, and converts the data to be processed
  • the data set is converted into the target data format to obtain the converted data set, and then the converted data set is transmitted to the operation unit.
  • the computing unit After receiving the converted data set, the computing unit performs preset calculation processing on the converted data set to obtain the data processing result.
  • the target data format is determined by the data format of the data set to be processed, and its data bit width is relatively large. The full-precision fixed-point number is smaller, so when performing preset calculation processing on the converted data set, it needs to consume less power consumption and reduce the consumption of computing resources.
  • the embodiment of the present disclosure also provides a data processing method corresponding to the data processing device. Since the problem-solving principle of the method in the embodiment of the present disclosure is similar to that of the above-mentioned data processing device in the embodiment of the present disclosure, the implementation of the device Reference can be made to the implementation of the device, and repeated descriptions will not be repeated.
  • FIG. 5 it is a flow chart of a data processing method provided by an embodiment of the present disclosure, including:
  • S501 Obtain one or more data sets to be processed
  • S502 Determine the target data format based on the data formats respectively corresponding to the data sets to be processed
  • S504 Perform preset calculation processing on the converted data set to obtain a data processing result.
  • the data format of the data set to be processed includes: a first bit width corresponding to the target data bits in the data set to be processed.
  • the data set to be processed includes: floating-point number data; the target data bits include at least one of the following: a sign bit, an exponent bit, and a mantissa bit.
  • determining the target data format based on the data formats respectively corresponding to the data sets to be processed includes: based on at least two data sets to be processed determining a second bit width based on the first bit width of the target data bits respectively included in the sets; and determining the target data format based on the second bit width.
  • the determining the second bit width based on the first bit width of the target data bits respectively included in at least two of the data sets to be processed includes: based on at least two of the data sets to be processed The first bit width of the target data bits respectively included in the data sets, determining a maximum bit width corresponding to the target data bits; determining the maximum bit width as the second bit width.
  • the performing preset calculation processing on the converted data set to obtain a data processing result includes: performing preset calculation processing on the converted data set to obtain intermediate result data;
  • the result data is converted from the target data format into a preset data format to obtain the data processing result.
  • the writing order of each step does not mean a strict execution order and constitutes any limitation on the implementation process.
  • the specific execution order of each step should be based on its function and possible
  • the inner logic is OK.
  • An embodiment of the present disclosure further provides a data processing chip, including: the data processing device according to any one of the embodiments of the present disclosure.
  • the embodiment of the present disclosure also provides a computer device, as shown in FIG. 6 , which is a schematic structural diagram of the computer device provided by the embodiment of the present disclosure, including: a processor 61 and a memory 62;
  • the processor 61 is used to execute the machine-readable instructions stored in the memory 62.
  • the processor 61 performs the following steps: obtain one or more to-be-processed data set; based on the data formats corresponding to the data sets to be processed, determine the target data format; convert the data set to be processed into a converted data set in the target data format; perform preset calculation processing on the converted data set, Get the result of data processing.
  • memory 62 comprises memory 621 and external memory 622;
  • Memory 621 here is also called internal memory, is used for temporarily storing the operation data in processor 61, and the data exchanged with external memory 622 such as hard disk, processor 61 communicates with memory 621 through memory 621.
  • the external memory 622 performs data exchange.
  • Embodiments of the present disclosure further provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is run by a processor, the steps of the data processing method described in the foregoing method embodiments are executed.
  • the storage medium may be a volatile or non-volatile computer-readable storage medium.
  • the embodiment of the present disclosure also provides a computer program product, the computer program product carries a program code, and the instructions included in the program code can be used to execute the steps of the data processing method described in the above method embodiment, for details, please refer to the above method The embodiment will not be repeated here.
  • the above-mentioned computer program product may be specifically implemented by means of hardware, software or a combination thereof.
  • the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK) etc. wait.
  • a software development kit Software Development Kit, SDK
  • 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 may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium executable by a processor.
  • the technical solution of the present disclosure is essentially 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, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present disclosure.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

本公开提供了一种数据处理装置、方法、芯片、计算机设备及存储介质,其中,该数据处理装置包括:数据转换单元、以及运算单元;所述数据转换单元与所述运算单元连接;所述数据转换单元,用于响应于接收到一个或多个待处理数据集,基于所述待处理数据集分别对应的数据格式,确定目标数据格式,并将所述待处理数据集转换为目标数据格式的转换数据集;将所述转换数据集向所述运算单元传输;所述运算单元,用于响应于接收到所述数据转换单元传输的转换数据集,对所述转换数据集进行预设运算处理,得到数据处理结果。本公开能够减少数据处理时的功耗。

Description

数据处理装置、方法、芯片、计算机设备及存储介质
相关申请的交叉引用
本公开要求于2021年8月31日提交的、申请号为202111016072.1的中国专利公开的优先权,该中国专利公开的全部内容以引用的方式并入本文中。
技术领域
本公开涉及计算机应用技术领域,具体而言,涉及一种数据处理装置、方法、芯片、计算机设备及存储介质。
背景技术
随着云计算、大数据和人工智能技术发展,也带来了不断增长的算力需求。当前对数据的处理方式存在功耗较大的问题。
发明内容
本公开实施例至少提供一种数据处理装置、方法、芯片、计算机设备及存储介质。
第一方面,本公开实施例提供了一种数据处理装置,包括:数据转换单元、以及运算单元;所述数据转换单元与所述运算单元连接;所述数据转换单元,用于响应于接收到一个或多个待处理数据集,基于所述待处理数据集分别对应的数据格式,确定目标数据格式,并将所述待处理数据集转换为目标数据格式的转换数据集;将所述转换数据集向所述运算单元传输;所述运算单元,用于响应于接收到所述数据转换单元传输的转换数据集,对所述转换数据集进行预设运算处理,得到数据处理结果。
这样,根据一个或多个待处理数据集分别对应的数据格式,确定目标数据格式,并将待处理数据集转换为目标数据格式,得到转换数据集,然后对转换数据集进行预设运算处理,在该装置中,目标数据格式是利用待处理数据集的数据格式确定的,其数据位宽较之全精度定点数更小,因此在对转换数据集进行预设运算处理时,需要消耗的功耗更低,减少计算资源的消耗。
一种可能的实施方式中,所述待处理数据集的数据格式包括:所述待处理数据集中的目标数据位对应的第一位宽。
一种可能的实施方式中,所述待处理数据集包括:浮点数数据;所述目标数据位包括下述至少一项:符号位、指数位以及尾数位。
针对浮点数的运算能力通常直接代表着计算资源的算力,这一类型的运算通常会带来比较大的资源消耗,利用本公开实施例提供的数据处理装置可以将浮点数数据转换至目标数据格式下进行预设运算处理,能够大量减少对浮点数处理时所需功耗。
一种可能的实施方式中,所述待处理数据集有至少两个;所述数据转换单元,在基于所述待处理数据集分别对应的数据格式,确定目标数据格式时,用于:基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定第二位宽;基于所述第二位宽,确定所述目标数据格式。
一种可能的实施方式中,所述数据转换单元,在基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定第二位宽时,用于:基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定与所述目标数据位对应的最大位宽;将所述最大位宽确定为所述第二位宽。
一种可能的实施方式中,所述数据转换单元,包括:目标数据格式确定电路、以及第一格式转换电路;其中,所述目标数据格式确定电路,用于响应于接收到至少两个待处理数据集,基于至少两个所述待处理数据集分别包括的目标数据位的第一位宽,确定第二位宽;向所述第一格式转换电路发送所述第二位宽;所述第一格式转换电路,用于响应于接收到所述第二位宽、以及所述待处理数据集,基于所述第二位宽生成目标数据格式,并将所述待处理数据集转换为所述目标数据格式,得到所述转换数据集。
一种可能的实施方式中,所述目标数据格式确定电路,包括:位宽计数器、以及比较器;所述位宽计数器、与所述比较器连接;其中,所述位宽计数器,用于响应于接收到所述待处理数据集,对所述待处理数据集中的目标数据位的位宽进行计数,得到所述待处理数据集包括的目标数据位的第一位宽,向所述比较器发送所述第一位宽;所述比较器,用于响应于接收到所述位宽计数器发送的至少两个所述待处理数据集分别对应的第一位宽,将至少两个所述待处理数据集分别对应的第一位宽进行比对,并基于比对结果确定所述第二位宽,向所述第一格式转换电路发送所述第二位宽。
一种可能的实施方式中,所述数据转换单元,在基于所述待处理数据集分别对应的数据格式,确定目标数据格式时,用于:基于所述待处理数据集中的所述目标数据位的第一位宽、预设数据位宽,确定第二位宽;基于所述第二位宽,确定所述目标数据格式。
一种可能的实施方式中,所述运算单元,在对所述转换数据集进行预设运算处理,得到数据处理结果时,用于:对所述转换数据集进行预设运算处理,得到中间结果数据; 将所述中间结果数据由目标数据格式转换为预设数据格式,得到所述数据处理结果。
一种可能的实施方式中,所述运算单元包括:运算电路、以及第二格式转换电路;所述运算电路,用于响应于接收到所述数据转换单元传输的转换数据集,对所述转换数据集进行预设运算处理,得到所述中间结果数据,并向所述第二格式转换电路传输所述中间结果数据;所述第二格式转换电路,用于响应于接收到所述运算电路传输的中间结果数据,将所述中间结果数据转换为预设数据格式,得到所述数据处理结果。
第二方面,本公开实施例还提供一种数据处理方法,包括:获取一个或多个待处理数据集;基于所述待处理数据集分别对应的数据格式,确定目标数据格式;将所述待处理数据集转换为目标数据格式的转换数据集;对所述转换数据集进行预设运算处理,得到数据处理结果。
一种可能的实施方式中,所述待处理数据集的数据格式包括:所述待处理数据集中的目标数据位对应的第一位宽。
一种可能的实施方式中,所述待处理数据集包括:浮点数数据;所述目标数据位包括下述至少一项:符号位、指数位以及尾数位。
一种可能的实施方式中,所述待处理数据集有至少两个;所述基于所述待处理数据集分别对应的数据格式,确定目标数据格式,包括:基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定第二位宽;基于所述第二位宽,确定所述目标数据格式。
一种可能的实施方式中,所述基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定第二位宽,包括:基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定与所述目标数据位对应的最大位宽;将所述最大位宽确定为所述第二位宽。
一种可能的实施方式中,所述对所述转换数据集进行预设运算处理,得到数据处理结果,包括:对所述转换数据集进行预设运算处理,得到中间结果数据;将所述中间结果数据由目标数据格式转换为预设数据格式,得到所述数据处理结果。
第三方面,本公开实施例还提供一种数据处理芯片,包括:如第一方面、或第一方面任一项所述的数据处理装置。
第四方面,本公开可选实现方式还提供一种计算机设备,处理器、存储器,所述存储器存储有所述处理器可执行的机器可读指令,所述处理器用于执行所述存储器中存储 的机器可读指令,所述机器可读指令被所述处理器执行时,所述机器可读指令被所述处理器执行时执行上述第二方面,或第二方面中任一种可能的实施方式中的步骤,或者包括如第三方面公开的芯片。
第五方面,本公开可选实现方式还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被运行时执行上述第二方面,或第二方面中任一种可能的实施方式中的步骤。
关于上述数据处理方法、芯片、计算机设备、及计算机可读存储介质的效果描述参见上述数据处理装置的说明,这里不再赘述。
为使本公开的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。
附图说明
为了更清楚地说明本公开实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍。这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。应当理解,以下附图仅示出了本公开的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。
图1示出了本公开实施例所提供的一种数据处理装置的示意图;
图2示出了本公开实施例所提供的数据处理装置中数据转换单元具体结构的示意图;
图3示出了本公开实施例所提供的数据处理装置中,目标数据格式确定电路的具体结构示意图;
图4示出了本公开实施例所提供的一种数据转换单元的具体结构示例;
图5示出了本公开实施例所提供的一种数据处理方法的流程图;
图6示出了本公开实施例所提供的一种计算机设备的示意图。
具体实施方式
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例中附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅 仅是本公开一部分实施例,而不是全部的实施例。通常在此处描述和示出的本公开实施例的组件可以以各种不同的配置来布置和设计。因此,以下对本公开的实施例的详细描述并非旨在限制要求保护的本公开的范围,而是仅仅表示本公开的选定实施例。基于本公开的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。
经研究发现,当前在对数据进行处理时,以对浮点数数据进行处理为例,通常会将不同格式的浮点数数据转换至为全精度定点数后进行后续计算。全精度定点数需要更大的数据位宽,约(2 n+尾数宽度)的定点数才能完整表示,其中,n表示指数宽度。如此大的数据位宽,导致了数据输入到后续计算单元中将带来大量寄存器的翻转进而引入大量的功耗。
基于上述研究,本公开提供了一种数据处理装置,根据一个或多个待处理数据集分别对应的数据格式,确定目标数据格式,并将待处理数据集转换为目标数据格式,得到转换数据集,然后对转换数据集进行预设运算处理,在该装置中,目标数据格式是利用待处理数据集的数据格式确定的,其数据位宽较之全精度定点数更小,因此在对转换数据集进行预设运算处理时,需要消耗的功耗更低,减少计算资源的消耗。同时,该装置具有能够兼容多种浮点数数制运算的硬件结构,由此,该装置可以在输入不同格式的浮点数时对计算单元逻辑进行复用,从而可以减少芯片面积,即,减少资源的消耗。
以上均是发明人在经过实践并仔细研究后得出的结果,因此,上述问题的发现过程以及下文中本公开针对上述问题所提出的解决方案,都应该是发明人在本公开过程中对本公开做出的贡献。
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。
为便于对本实施例进行理解,首先对本公开实施例所公开的一种数据处理装置进行详细介绍,本公开实施例所提供的数据处理装置可以用于对浮点数数据进行处理,也可以用于对其他类型的数据进行处理。
参见图1所示,为本公开实施例提供的数据处理装置的示意图,所述数据处理装置包括:数据转换单元10、以及运算单元20;所述数据转换单元10与所述运算单元20连接;所述数据转换单元10,用于响应于接收到一个或多个待处理数据集,基于所述待处理数据集分别对应的数据格式,确定目标数据格式,并将所述待处理数据集转换为目 标数据格式,得到转换数据集;将所述转换数据集向所述运算单元20传输;所述运算单元20,用于响应于接收到所述数据转换单元10传输的转换数据集,对所述转换数据集进行预设运算处理,得到数据处理结果。
在具体实施中,待处理数据集,例如包括:浮点数数据。浮点数数据中通常包括下述三种数据位:符号位、指数位以及尾数位;以输入的待处理数据集包括半精度浮点数(Floating Point 16,FP16)和十六位脑浮点数(Brain Float 16,BF16)为例,其中,FP16的符号位的位宽为1个比特位,指数位的位宽为5个比特位,尾数位的位宽为10个比特位;BF16的符号位的位宽为1个比特位,指数位的位宽为8个比特位,尾数位的位宽为7个比特位。
下面对数据转换单元10和运算单元20分别加以说明。
数据转换单元10包括数据接收端,数据接收端用于接收待处理数据集。响应于接收到一个或多个待处理数据集,基于一个或多个待处理数据集分别对应的数据格式,确定目标数据格式。其中,待处理数据集的数据格式包括:所述待处理数据集中的目标数据位对应的第一位宽。
以待处理数据集包括浮点数数据为例,浮点数数据的目标数据位包括下述至少一项:符号位、指数位以及尾数位。
在一种可能的实施方式中,待处理数据集至少有两个;数据转换单元10在基于待处理数据集分别对应的数据格式,确定目标数据格式的时候,例如可以用于:基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定第二位宽;基于所述第二位宽,确定所述目标数据格式。
其中,在基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定第二位宽时,可以基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定与所述目标数据位对应的最大位宽;将所述最大位宽确定为所述第二位宽。
以待处理数据集包括浮点数数据FP16、和BF16为例,其中,目标数据位包括:指数位以及尾数位。
其中,FP16的指数位的第一位宽为:5个比特位;BF16的指数位的第一位宽为:8个比特位,则将其中的较大者确定为指数位的第二位宽:也即8个比特位。
FP16的尾数位的第一位宽为:10个比特位;BF16的尾数位的第一位宽为:7个比特位,则将其中的较大者确定为尾数位的第二位宽,也即10个比特位。
进而,基于第二位宽确定的目标数据格式中,符号位的位宽:1个比特位;指数位的第二位宽:8个比特位;尾数位的第二位宽:10个比特位。其中,针对不属于目标数据位的数据位,在确定目标数据格式中该数据位的位宽时可以基于至少两个所述待处理数据集中相应数据位的位宽来确定;例如,可以将任一待处理数据集中相应数据位的位宽作为该数据位的位宽;或者,将至少两个所述待处理数据集中相应数据位的较大位宽,作为该数据位的位宽。
如图2所示,本公开实施例提供一种数据转换单元10的结构,包括目标数据格式确定电路11、以及第一格式转换电路12;其中,所述目标数据格式确定电路11,用于响应于接收到至少两个待处理数据集,基于至少两个所述待处理数据集分别包括的目标数据位的第一位宽,确定第二位宽;向所述第一格式转换电路12发送所述第二位宽;所述第一格式转换电路12,用于响应于接收到所述第二位宽、以及所述待处理数据集,基于所述第二位宽生成目标数据格式,并将所述待处理数据集转换为所述目标数据格式,得到所述转换数据集。所述待处理数据集可以是由所述第一格式转换电路12从外界接收到的,也可以是由所述目标数据格式确定电路11发送的,本公开实施例不做具体限定。
其中,如图3所示,目标数据格式确定电路11,包括位宽计数器111、以及比较器112;所述位宽计数器111、与所述比较器112连接;其中,所述位宽计数器111,用于响应于接收到所述待处理数据集,对所述待处理数据集中的目标数据位的位宽进行计数,得到所述待处理数据集包括的目标数据位的第一位宽,向所述比较器112发送所述第一位宽;所述比较器112,用于响应于接收到所述位宽计数器111发送的、至少两个所述待处理数据集分别对应的第一位宽,将至少两个所述待处理数据集分别对应的第一位宽进行比对,并基于比对结果确定所述第二位宽,向所述第一格式转换电路12发送所述第二位宽。
在具体实施中,位宽计数器111的数量,与数据处理装置能够处理的待处理数据集的最大数量相关;示例性的,若数据处理装置能够处理的待处理数据集的最大数量为n,则位宽计数器111的数量也为n;其中,不同的待处理数据集传输至不同的位宽计数器111。针对n个位宽计数器111中的任一位宽计数器111,在接收到对应的待处理数据集后,对接收到的待处理数据集中的目标数据位进行计数,得到待处理数据集包括的目标数据位的第一位宽,然后将第一位宽传输给比较器112。在一种实施例中,位宽计数器111的数量也可以为1个,位宽计数器111可以依次确定出至少两个待处理数据集分别 对应的第一位宽,再将确定出的各第一位宽发送至比较器112,本公开实施例不做具体限定。
比较器112的输入端口、与n个位宽计数器111的输出端口连接。其中,比较器112的数量例如可以为1个。
在待处理数据集的数量为n的情况下,比较器112能够接收到n个位宽计数器111分别传输的第一位宽,其将n个位宽计数器111分别传输的第一位宽进行比对,将其中的最大者作为第二位宽传输给第一格式转换电路12。
在待处理数据集的数量为m,且m小于n的情况下,比较器112能够接收到m个位宽计数器111分别传输的第一位宽;另外,为了保证电路的正常工作,其他的(n-m)个位宽计数器111分别向比较器112传输预设数值,该预设数值例如为0;比较器112将m个位宽计数器111分别传输的第一位宽、以及其他(n-m)个位宽计数器111分别传输的预设数值进行比对,此时,由于预设数值为0,因此,各位宽计数器111传输的第一位宽为大于或者等于0的整数,然后,比较器112可以将各第一位宽中的最大者作为第二位宽,传输给第一格式转换电路12。
第一格式转换电路12在接收到第二位宽后,能够根据该第二位宽,确定目标数据格式,然后将待处理数据集转换为目标数据格式,得到转换数据集。
在一种实施例中,第一格式转换电路12的数量也与数据处理装置能够处理的待处理数据集的最大数量相关;若数据处理装置能够处理的待处理数据集的最大数量为n,则第一格式转换电路12的数量也为n。
n个第一格式转换电路12的输入端、与比较器112的输出端连接。
比较器112能够将第二位宽分别传输给n个第一格式转换电路12。
n个第一格式转换电路12的输入端,还用于接收不同的待处理数据集。
针对其中的第i个第一格式转换电路12,其通过输入端接收第二位宽,以及第i个待处理数据集,根据第二位宽确定目标数据格式,并将第i个待处理数据集转换为目标数据格式,得到第i个转换数据集。
如图4所示,本公开实施例提供一种数据转换单元10的结构示例,在该示例中,数据转换单元10包括两个位宽计数器M1和M2,与两个位宽计数器的输出端连接的比较器M3;与比较器M3的输出端连接的两个第一格式转换电路M4和M5;待处理数据 集包括a1和a2。
待处理数据集a1传输给位宽计数器M1,位宽计数器M1对待处理数据集a1中的目标数据位进行计数,得到待处理数据集a1中包括的目标数据位的第一位宽s1,向比较器M3发送第一位宽s1。
待处理数据集a2传输给位宽计数器M2,位宽计数器M2对待处理数据集a2中的目标数据位进行计数,得到待处理数据集a2中包括的目标数据位的第一位宽s2,向比较器M3发送第一位宽s2。
比较器M3在接收到第一位宽s1和第一位宽s2后,将两者进行比对,并将其中的较大者作为第二位宽输出,分别发送给第一格式转换电路M4和第一格式转换电路M5。
第一格式转换电路M4接收比较器M3传输的第二位宽,根据第二位宽确定目标数据格式。接收外界传输的待处理数据集a1,然后将待处理数据集a1转换为目标数据格式的数据,得到与待处理数据集a1对应的转换数据集f1。
第一格式转换电路M5接收比较器M3传输的第二位宽,根据第二位宽确定目标数据格式。接收外界传输的待处理数据集a2,然后将待处理数据集a2转换为目标数据格式的数据,得到与待处理数据集a2对应的转换数据集f2。
运算单元20用于在接收到数据转换单元10传输的转换数据集后,对转换数据集进行预设运算处理,得到数据处理结果。此处,预设运算处理例如包括:加处理、乘处理等。具体可以根据实际的运算需要设置运算单元20的具体功能。
运算单元20,在对所述转换数据集进行预设运算处理,得到数据处理结果时,用于:对所述转换数据集进行预设运算处理,得到中间结果数据;将所述中间结果数据由目标数据格式转换为预设数据格式,得到所述数据处理结果。
此处,预设数据格式可以根据数据处理的实际需要进行设定。示例性的,转换数据集的目标数据格式中,符号位的第二位宽:1个比特位;指数位的第二位宽:8个比特位;尾数位的第二位宽:10个比特位。预设数据格式中,符号位的目标位宽:1个比特位;指数位的目标位宽:5个比特位;尾数位的目标位宽:10个比特位,则将中间结果数据的指数位由8个比特位转换为5个比特位,从而得到数据处理结果。
参见图2所示,本公开实施例提供一种运算单元20的具体结构,包括运算电路21、以及第二格式转换电路22;所述运算电路21,用于响应于接收到所述数据转换单元10传输的转换数据集,对所述转换数据集进行预设运算处理,得到所述中间结果数据,并 向所述第二格式转换电路22传输所述中间结果数据;所述第二格式转换电路22,用于响应于接收到所述运算电路21传输的中间结果数据,将所述中间结果数据转换为预设数据格式,得到所述数据处理结果。
在本公开另一实施例中待处理数据集的数量还可以是一个;数据转换单元,在基于所述待处理数据集对应的数据格式,确定目标数据格式时,例如可以采用下述方式:基于所述待处理数据集包括的目标数据位的第一位宽、以及预设数据位宽,确定第二位宽;基于所述第二位宽,确定目标数据格式。
此处,在基于所述待处理数据集包括的目标数据位的第一位宽、以及预设数据位宽,确定第二位宽时,例如可以将第一位宽、以及预设数据位宽中的较大者,确定为第二位宽。
在该种情况下,比较器例如还设置有预设数据位宽输入端口,用于输入预设数据位宽。该预设数据位宽,例如可以是预先设置好的数据位宽,也可以在对历史待处理数据集进行处理过程中,所确定的数据位宽。
本公开实施例提供的数据处理装置中,通过数据转换单元接收一个或多个待处理数据集,并基于所述待处理数据集分别对应的数据格式,确定目标数据格式,并将所述待处理数据集转换为目标数据格式,得到转换数据集,然后将转换数据集传输给运算单元。运算单元在接收到转换数据集后,对转换数据集进行预设运算处理,得到数据处理结果,在该装置中,目标数据格式是利用待处理数据集的数据格式确定的,其数据位宽较之全精度定点数更小,因此在对转换数据集进行预设运算处理时,需要消耗的功耗更低,减少计算资源的消耗。
基于同一发明构思,本公开实施例中还提供了与数据处理装置对应的数据处理方法,由于本公开实施例中的方法解决问题的原理与本公开实施例上述数据处理装置相似,因此装置的实施可以参见装置的实施,重复之处不再赘述。
参照图5所示,为本公开实施例提供的一种数据处理方法的流程图,包括:
S501:获取一个或多个待处理数据集;
S502:基于所述待处理数据集分别对应的数据格式,确定目标数据格式;
S503:将所述待处理数据集转换为目标数据格式的转换数据集;
S504:对所述转换数据集进行预设运算处理,得到数据处理结果。
一种可能的实施方式中,所述待处理数据集的数据格式包括:所述待处理数据集中的目标数据位对应的第一位宽。
一种可能的实施方式中,所述待处理数据集包括:浮点数数据;所述目标数据位包括下述至少一项:符号位、指数位以及尾数位。
一种可能的实施方式中,所述待处理数据集有至少两个;所述基于所述待处理数据集分别对应的数据格式,确定目标数据格式,包括:基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定第二位宽;基于所述第二位宽,确定所述目标数据格式。
一种可能的实施方式中,所述基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定第二位宽,包括:基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定与所述目标数据位对应的最大位宽;将所述最大位宽确定为所述第二位宽。
一种可能的实施方式中,所述对所述转换数据集进行预设运算处理,得到数据处理结果,包括:对所述转换数据集进行预设运算处理,得到中间结果数据;将所述中间结果数据由目标数据格式转换为预设数据格式,得到所述数据处理结果。
关于方法中的各步骤的具体实现过程可以参照上述装置实施例中的相关说明,这里不再详述。
本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。
本公开实施例还提供一种数据处理芯片,包括:如本公开实施例任一项所述的数据处理装置。
本公开实施例还提供了一种计算机设备,如图6所示,为本公开实施例提供的计算机设备结构示意图,包括:处理器61和存储器62;所述存储器62存储有处理器61可执行的机器可读指令,处理器61用于执行存储器62中存储的机器可读指令,所述机器可读指令被处理器61执行时,处理器61执行下述步骤:获取一个或多个待处理数据集;基于所述待处理数据集分别对应的数据格式,确定目标数据格式;将所述待处理数据集转换为目标数据格式的转换数据集;对所述转换数据集进行预设运算处理,得到数据处理结果。
上述存储器62包括内存621和外部存储器622;这里的内存621也称内存储器,用于暂时存放处理器61中的运算数据,以及与硬盘等外部存储器622交换的数据,处理器61通过内存621与外部存储器622进行数据交换。
上述指令的具体执行过程可以参考本公开实施例中所述的数据处理方法的步骤,此处不再赘述。
本公开实施例还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行上述方法实施例中所述的数据处理方法的步骤。其中,该存储介质可以是易失性或非易失的计算机可读取存储介质。
本公开实施例还提供一种计算机程序产品,该计算机程序产品承载有程序代码,所述程序代码包括的指令可用于执行上述方法实施例中所述的数据处理方法的步骤,具体可参见上述方法实施例,在此不再赘述。
其中,上述计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一个可选实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统和装置的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。在本公开所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本公开各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个处理器可执行的非易失的计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上所述实施例,仅为本公开的具体实施方式,用以说明本公开的技术方案,而非对其限制,本公开的保护范围并不局限于此,尽管参照前述实施例对本公开进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本公开实施例技术方案的精神和范围,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应所述以权利要求的保护范围为准。

Claims (14)

  1. 一种数据处理装置,其特征在于,包括:
    数据转换单元,用于响应于接收到一个或多个待处理数据集,基于所述待处理数据集分别对应的数据格式,确定目标数据格式,并将所述待处理数据集转换为所述目标数据格式的转换数据集;
    运算单元,与所述数据转换单元连接,用于响应于接收到所述数据转换单元传输的所述转换数据集,对所述转换数据集进行预设运算处理,得到数据处理结果。
  2. 根据权利要求1所述的数据处理装置,其特征在于,所述待处理数据集的数据格式包括:所述待处理数据集中的目标数据位对应的第一位宽。
  3. 根据权利要求2所述的数据处理装置,其特征在于,
    所述待处理数据集包括:浮点数数据;
    所述目标数据位包括下述至少一项:符号位、指数位以及尾数位。
  4. 根据权利要求2或3所述的数据处理装置,其特征在于,所述数据转换单元,在基于所述待处理数据集分别对应的数据格式,确定目标数据格式时,用于:
    基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定第二位宽;
    基于所述第二位宽,确定所述目标数据格式。
  5. 根据权利要求4所述的数据处理装置,其特征在于,所述数据转换单元,在基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定第二位宽时,用于:
    基于至少两个所述待处理数据集分别包括的所述目标数据位的第一位宽,确定与所述目标数据位对应的最大位宽;
    将所述最大位宽确定为所述第二位宽。
  6. 根据权利要求4或5所述的数据处理装置,其特征在于,所述数据转换单元,包括:
    目标数据格式确定电路,用于响应于接收到至少两个所述待处理数据集,基于至少两个所述待处理数据集中分别包括的所述目标数据位的第一位宽,确定第二位宽;
    第一格式转换电路,用于响应于接收到所述目标数据格式确定电路发送的所述第二位宽、以及所述待处理数据集,基于所述第二位宽生成目标数据格式,并将所述待处理数据集转换为所述目标数据格式,得到所述转换数据集。
  7. 根据权利要求6所述的数据处理装置,其特征在于,所述目标数据格式确定电路,包括:
    位宽计数器,用于响应于接收到所述待处理数据集,对所述待处理数据集中的目标数据位的位宽进行计数,得到所述待处理数据集包括的目标数据位的第一位宽;
    比较器,与所述位宽计数器连接,用于响应于接收到所述位宽计数器发送的至少两个所述待处理数据集分别对应的第一位宽,将至少两个所述待处理数据集分别对应的第一位宽进行比对,并基于比对结果确定所述第二位宽。
  8. 根据权利要求2或3所述的数据处理装置,其特征在于,所述数据转换单元,在基于所述待处理数据集分别对应的数据格式,确定目标数据格式时,用于:
    基于所述待处理数据集中的所述目标数据位的第一位宽、预设数据位宽,确定第二位宽;
    基于所述第二位宽,确定所述目标数据格式。
  9. 根据权利要求1至8任一项所述的数据处理装置,其特征在于,所述运算单元,在对所述转换数据集进行预设运算处理,得到数据处理结果时,用于:
    对所述转换数据集进行预设运算处理,得到中间结果数据;
    将所述中间结果数据由所述目标数据格式转换为预设数据格式,得到所述数据处理结果。
  10. 根据权利要求9所述的数据处理装置,其特征在于,所述运算单元包括:
    运算电路,用于响应于接收到所述数据转换单元传输的所述转换数据集,对所述转换数据集进行预设运算处理,得到所述中间结果数据;
    第二格式转换电路,用于响应于接收到所述运算电路传输的所述中间结果数据,将 所述中间结果数据转换为预设数据格式,得到所述数据处理结果。
  11. 一种数据处理方法,其特征在于,包括:
    获取一个或多个待处理数据集;
    基于所述待处理数据集分别对应的数据格式,确定目标数据格式;
    将所述待处理数据集转换为所述目标数据格式的转换数据集;
    对所述转换数据集进行预设运算处理,得到数据处理结果。
  12. 一种数据处理芯片,其特征在于,包括:如权利要求1至10任一项所述的数据处理装置。
  13. 一种计算机设备,其特征在于,包括处理器、存储器,所述存储器存储有所述处理器可执行的机器可读指令,所述处理器用于执行所述存储器中存储的机器可读指令,所述机器可读指令被所述处理器执行时,所述处理器执行如权利要求11所述的数据处理方法的步骤;或者包括如权利要求12所述的芯片。
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被计算机设备运行时,所述计算机设备执行如权利要求11所述的数据处理方法的步骤。
PCT/CN2022/084040 2021-08-31 2022-03-30 数据处理装置、方法、芯片、计算机设备及存储介质 WO2023029464A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111016072.1A CN113703840A (zh) 2021-08-31 2021-08-31 数据处理装置、方法、芯片、计算机设备及存储介质
CN202111016072.1 2021-08-31

Publications (1)

Publication Number Publication Date
WO2023029464A1 true WO2023029464A1 (zh) 2023-03-09

Family

ID=78658308

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/084040 WO2023029464A1 (zh) 2021-08-31 2022-03-30 数据处理装置、方法、芯片、计算机设备及存储介质

Country Status (2)

Country Link
CN (1) CN113703840A (zh)
WO (1) WO2023029464A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117687598A (zh) * 2023-12-19 2024-03-12 上海合芯数字科技有限公司 多项式乘加处理电路和芯片

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113703840A (zh) * 2021-08-31 2021-11-26 上海阵量智能科技有限公司 数据处理装置、方法、芯片、计算机设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160293137A1 (en) * 2015-04-01 2016-10-06 Apple Inc. Source pixel component passthrough
CN106294234A (zh) * 2016-08-01 2017-01-04 深圳云天励飞技术有限公司 一种数据传输方法及装置
CN106990937A (zh) * 2016-01-20 2017-07-28 南京艾溪信息科技有限公司 一种浮点数处理装置
CN113138750A (zh) * 2020-01-20 2021-07-20 华为技术有限公司 算数逻辑单元、浮点数乘法计算的方法及设备
CN113703840A (zh) * 2021-08-31 2021-11-26 上海阵量智能科技有限公司 数据处理装置、方法、芯片、计算机设备及存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4943941A (en) * 1989-01-13 1990-07-24 Bolt Beranek And Newman Inc. Floating point processor employing counter controlled shifting
CN111381875B (zh) * 2018-12-28 2022-12-09 上海寒武纪信息科技有限公司 数据比较器、数据处理方法、芯片及电子设备
US11275560B2 (en) * 2020-02-19 2022-03-15 Meta Platforms, Inc. Hardware for floating-point arithmetic in multiple formats
CN112836806B (zh) * 2021-02-26 2023-12-22 上海阵量智能科技有限公司 一种数据格式调整方法、装置、计算机设备和存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160293137A1 (en) * 2015-04-01 2016-10-06 Apple Inc. Source pixel component passthrough
CN106990937A (zh) * 2016-01-20 2017-07-28 南京艾溪信息科技有限公司 一种浮点数处理装置
CN106294234A (zh) * 2016-08-01 2017-01-04 深圳云天励飞技术有限公司 一种数据传输方法及装置
CN113138750A (zh) * 2020-01-20 2021-07-20 华为技术有限公司 算数逻辑单元、浮点数乘法计算的方法及设备
CN113703840A (zh) * 2021-08-31 2021-11-26 上海阵量智能科技有限公司 数据处理装置、方法、芯片、计算机设备及存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117687598A (zh) * 2023-12-19 2024-03-12 上海合芯数字科技有限公司 多项式乘加处理电路和芯片

Also Published As

Publication number Publication date
CN113703840A (zh) 2021-11-26

Similar Documents

Publication Publication Date Title
WO2023029464A1 (zh) 数据处理装置、方法、芯片、计算机设备及存储介质
US10108416B2 (en) Performing rounding operations responsive to an instruction
US11711423B2 (en) Arrangements for communicating and processing data in a computing system
US11249721B2 (en) Multiplication circuit, system on chip, and electronic device
CN112230881A (zh) 浮点数处理器
US10592208B2 (en) Very low precision floating point representation for deep learning acceleration
JP2021525403A (ja) 改良された低精度の2進浮動小数点形式設定
US9983850B2 (en) Shared hardware integer/floating point divider and square root logic unit and associated methods
CN114374440B (zh) 量子信道经典容量的估计方法及装置、电子设备和介质
US20120124116A1 (en) Apparatus and method for converting data between a floating-point number and an integer
US7991811B2 (en) Method and system for optimizing floating point conversion between different bases
WO2022247194A1 (zh) 乘法器、数据处理方法、芯片、计算机设备及存储介质
TW202115560A (zh) 用於浮點運算的乘法器、方法、積體電路晶片和計算裝置
US10747501B2 (en) Providing efficient floating-point operations using matrix processors in processor-based systems
CN112506935A (zh) 数据处理方法、装置、电子设备、存储介质及程序产品
WO2023124372A1 (zh) 浮点数处理装置、方法、电子设备、存储介质及芯片
US20210109709A1 (en) Hybrid floating point representation for deep learning acceleration
US20210064986A1 (en) Lossless exponent and lossy mantissa weight compression for training deep neural networks
US20210044303A1 (en) Neural network acceleration device and method
US9519459B2 (en) High efficiency computer floating point multiplier unit
TW202117534A (zh) 用於轉換資料類型的轉換器、晶片、電子設備及其方法
WO2023124371A1 (zh) 数据处理装置、方法、芯片、计算机设备及存储介质
WO2024082674A1 (zh) 浮点数据精度转换方法和装置
CN115827555B (zh) 数据处理方法、计算机设备、存储介质和乘法器结构
CN112711440A (zh) 用于转换数据类型的转换器、芯片、电子设备及其方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22862611

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE