Method and device for calculation based on data flow graph
By creating multiple instruction cells for each operator in data flow graphs, the method enables loop and recursion, addressing the limitations of existing dataflow architectures and enhancing computational efficiency.
Patent Information
- Application Number
- PCT/RU2023/000094
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2024-10-03
AI Technical Summary
Existing dataflow architectures are not suitable for loop or recursion due to their one-to-one relationship between operators and instruction cells, where each instruction cell can only store a single data value, limiting their ability to handle complex computations.
The method creates multiple instruction cells for each operator, allowing for the storage of multiple data values and enabling loop or recursion in data flow graphs, with the option to create or destroy these cells based on the presence of recursive or circular calculations, and utilizing different memory types for operators and instruction cells for efficient performance.
This approach allows for the execution of loops and recursions in data flow graphs, reducing hardware complexity, increasing CPU data bandwidth, and enabling unrestricted use of loops and recursions without limitations.
Smart Images

Figure RU2023000094_03102024_PF_FP_ABST
Abstract
Description
METHOD AND DEVICE FOR CALCULATION BASED ON DATA FLOW GRAPHTECHNICAL FIELD
[0001] Embodiments of the present application relate to the field of data processing, and more particularly, to a method for calculation based on a data flow graph (DFG), and a related device.BACKGROUND
[0002] Dataflow architecture is a computer architecture that directly contrasts with the traditional von Neumann architecture or control flow architecture. The latter executes instructions sequentially, while the former doesn’t have a program counter. A dataflow architecture represents a program as a dataflow graph (DFG), where nodes are “operators” and directed edges between them are the “channels” through which immutable data values travel. An operator is evaluated when data are present on all input channels. The completion of evaluation makes the resulting data available to the operators at the ends of output channels.
[0003] To our best knowledge, all existing dataflow architectures maintain one-to-one relationship between operators and instruction cells: a program as a DFG loads into a memory, each operator is mapped to an instruction cell, and the execution of them produces operation packets. Instruction cell, being an atomic container for input and output data, cannot store multiple data values. Thus, all existing dataflow architectures are not suitable for loop or recursion.
[0004] Therefore, how to do loop or recursion in the DFG is a challenge.SUMMARY
[0005] Embodiments of the present application provide a method for calculation based on a data flow graph (DFG) and a related device. The technical solution may do loop or recursion inthe DFG.
[0006] According to a first aspect, an embodiment of this application provides a method for calculation based on a DFG, where the method includes:
[0007] obtaining, by a first operator, the data flow graph comprises the first operator and the second operator, more than one data value from a second operator, wherein the more than one data value is stored in more than one instruction cell corresponding to the second operator in the DFG respectively; and
[0008] calculating, by the first operator, according to the more than one data value from the second operator, an output result of the first operator, wherein the more than one data value from the second operator is an input to the first operator.
[0009] According to the method above, more than one instruction cell is created for an operator so that each instruction cell can be used to store an operation packet during each recursion or each loop.
[0010] In a possible design, before the obtaining, by a first operator, more than one data value from a second operator, the method further includes: creating, according to whether there is recursive calculation or circular calculation in the DFG, the more than one instruction cell corresponding to the second operator in the DFG.
[0011] In a possible design, the method further includes: destroying, when the calculation corresponding to the second operator is complete, the more than one instruction cell.
[0012] In a possible design, the second operator is stored in a first memory, and the more than one instruction cell is stored in a second memory, and the first memory is different from the second memory.
[0013] In a possible design, the first memory is a fast-read / slow- write memory, and the second memory has a balanced speed of read and write operations.
[0014] In a possible design, a peek capacity of the second memory is determined by the number of operators in the DFG and the number of instruction cells corresponding to each operator.
[0015] In a possible design, the DFG is applied to calculate an n-th Fibonacci number.
[0016] According to a second aspect, an embodiment of this application provides a computing device, and the computing device has function of implementing the method in the first aspect.The function may be implemented by hardware, or may be implemented by hardware executing corresponding software. The hardware or the software includes one or more modules corresponding to the function.
[0017] According to a third aspect, an embodiment of this application provides a computer readable storage medium including instructions. When the instructions are run on a computer, the computer is enabled to perform the method in the first aspect or any possible design of the first aspect.
[0018] According to a fourth aspect, an embodiment of this application provides a computing device, including a processor, a memory, and a communications interface. The processor is connected to the memory and the communications interface. The memory is configured to store instructions, the processor is configured to execute the instructions, and the communications interface is configured to communicate with another network element under control of the processor. When the processor executes the instructions stored in the memory, the processor is enabled to perform the method in the first aspect or any possible design of the first aspect.
[0019] According to a fifth aspect, an embodiment of this application provides a computing device cluster, comprising at least one computing device, wherein the computing device comprising a processor and a memory coupled with the processor, wherein the memory is configured to store a computer program, and the processor is configured to invoke and run the computer program stored in the memory, so that the computing device executes the method in the first aspect or any possible design of the first aspect.
[0020] According to a sixth aspect, a chip system is provided, where the chip system includes a memory and a processor, the memory is configured to store a computer program, and the processor is configured to invoke the computer program from the memory and run the computer program, so that a server on which a chip is disposed performs the method in the first aspect or any possible design of the first aspect.
[0021] According to a seventh aspect, a computer program product is provided, where when the computer program product is run on a server, the server is enabled to perform the method in the first aspect or any possible design of the first aspect.DESCRIPTION OF DRAWINGS
[0022] One or more embodiments are exemplarily illustrated by corresponding accompanying drawings, and these exemplary illustrations and accompanying drawings constitute no limitation on the embodiments. Elements with the same reference numerals in the accompanying drawings are illustrated as similar elements, and the drawings are not limited to scale, in which:
[0023] FIG. 1 is a schematic diagram of a method for calculation based on a data flow graph (DFG) according to an embodiment of this application.
[0024] FIG. 2 shows a sample DFG for a dataflow program that calculates a Factorial.
[0025] FIG. 3 shows a schematic diagram that resembles the original architecture of a dataflow machine.
[0026] FIG. 4 shows a schematic diagram of evaluation of a dataflow Factorial algorithm.
[0027] FIG. 5 shows a schematic diagram of calculating an n-th Fibonacci number.
[0028] FIG. 6 is a schematic block diagram of a computing device according to an embodiment of this application.
[0029] FIG. 7 is a schematic block diagram of a computing device according to an embodiment of this application.DESCRIPTION OF EMBODIMENTS
[0030] The following clearly and completely describes the technical solutions in the embodiments of the present application with reference to the accompanying drawings. Apparently, the described embodiments are merely some but not all of the embodiments of the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0031] In the specification, claims, and accompanying drawings of the present application, the term “include” and any other variants of the term mean to cover the non-exclusive inclusion. For example, a process, a method, a system, a product, or a device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes an unlisted stepor unit, or optionally further includes another inherent step or unit of the process, the method, the system, the product, or the device.
[0032] This application will present various aspects, embodiments or features in the context of a system including a plurality of devices, components, modules, and the like. It is to be understood and appreciated that various systems may include additional devices, components, modules, etc., and / or may not include all of the devices, components, modules, etc. discussed in connection with the figures. In addition, combinations of these schemes can also be used.
[0033] In addition, in the embodiments of the present application, words such as “exemplary” and “for example” are used to represent examples or illustrations. Any embodiment or design described in this application as “exemplary” should not be construed as preferred or advantageous embodiment over other embodiments or designs. Rather, the use of the word example is intended to present a concept in a concrete way.
[0034] In this application, “relevant” and “corresponding” can sometimes be used interchangeably, and it should be noted that, when the difference is not emphasized, the meanings to be expressed are the same.
[0035] The service scenarios described in the embodiments of the present application are for the purpose of illustrating the technical solutions of the embodiments of the present application more clearly, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. In spite of the evolution of an architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to solving similar technical problems.
[0036] For the convenience of description, the following will explain several concepts involved in the embodiment of the application.
[0037] Arithmetic logic unit (ALU), is a combinational digital circuit that performs arithmetic and bitwise operations on integer binary numbers.
[0038] Central processing unit (CPU), also called a microprocessor or just processor, is the electronic circuitry that executes instructions comprising a computer program.
[0039] Data flow graph (DFG) is a graph which represents data dependencies between a number of operations.
[0040] Microarchitecture, is the way a given instruction set architecture is implemented in aparticular processor.
[0041] Random access memory (RAM), is a form of computer memory that can be read and changed in any order, typically used to store working data and machine code.
[0042] Recursion, is a method of solving a computational problem where the solution depends on solutions to smaller instances of the same problem.
[0043] Garbage collection (GC), is a form of automatic memory management; a garbage collector attempts to reclaim memory which was allocated by a program, but is no longer referenced; such memory is called garbage.
[0044] Dataflow architecture is a computer architecture that directly contrasts with the traditional von Neumann architecture or control flow architecture. The latter executes instructions sequentially, while the former doesn’t have a program counter. A dataflow architecture represents a program as a dataflow graph (DFG), where nodes are “operators” and directed edges between them are the “channels” through which immutable data values travel. An operator is evaluated when data are present on all input channels. The completion of evaluation makes the resulting data available to the operators at the ends of output channels.
[0045] To our best knowledge, all existing dataflow architectures maintain one-to-one relationship between operators and instruction cells: a program as a DFG loads into a memory, each operator is mapped to an instruction cell, and the execution of them produces operation packets. Instruction cell, being an atomic container for input and output data, cannot store multiple data values. Thus, instruction cells are not suitable for loop or recursion.
[0046] To solve the problem above, embodiments of the present application provide a method and device for calculation based on a data flow graph (DFG), which may do loop or recursion in the DFG.
[0047] FIG. 1 is a schematic diagram of a method for calculation based on a data flow graph (DFG). The method may be performed by a device for calculation based on a DFG, or by a module or a unit in the device for calculation based on the DFG. The method specifically includes the following steps.
[0048] Step 110: a first operator obtain more than one data value from a second operator.
[0049] As an example, the data flow graph comprises the first operator and the second operator.
[0050] In this application embodiment, the first operator obtain more than one data value froma second operator, wherein the more than one data value is stored in more than one instruction cell corresponding to the second operator in the DFG respectively. That is, the second operator corresponds to more than one instruction cell, one data value is stored in one instruction cell, the first operator obtain more than one data value from more than one instruction cell corresponding to the second operator respectively.
[0051] In some embodiments, before the first operator obtain more than one data value from the second operator, the first operator create the more than one instruction cell corresponding to the second operator according to whether there is recursive calculation or circular calculation in the DFG.
[0052] In some embodiments, after the first operator create the more than one instruction cell corresponding to the second operator in the DFG, the first operator destroy the more than one instruction cell when the calculation corresponding to the second operator is complete.
[0053] The best way to demonstrate our solution is by using an example, FIG. 2 shows a sample DFG for a dataflow program that calculates a Factorial. Nodes are operators, while arcs between them are channels by which data tokens may travel. Each arc has a direction which denotes dependencies between operators: an arriving node is an operator that expects data.
[0054] FIG. 2 presents this code as a DFG, where nodes are atoms and directed edges are channels for data traveling between them. Atom “eq” depends on “x”, that’s why the arrow points to “eq”. Dotted lines depict recursion. Atom “mul” depends on “if’, while, at the same time, atom “if’ depends on “mul”. Each node is a potential source of data, which other nodes may depend on. When all data are available for a node, the operator inside the node starts calculating new data. The operator “if’ is a control-flow operator — it doesn’t calculate new data, but only uses the data available on its input arcs to copy one of them as an output.
[0055] Therefore, in the case of recursion or loop in DFG shown in FIG. 2, it can be understood that the operator “mul” has been executed at least twice.
[0056] In one possible implementation, the following is a recursive dataflow algorithm for calculating Factorial 3, in EO, an object-oriented dataflow programming language (assuming atoms “if’, “eq”, “dec”, and “mul” are defined):
[0057] if > f
[0058] eq x 1
[0059] 1
[0060] mul x (f (dec x))
[0061] Here, the first line creates a copy (may also be called an instance) of the “if’ object and names it as “f “, expecting the following three lines to contain three arguments to the copy of the “if’ object being created. The second line creates the first argument for the “if’ object, a copy of the “eq” object with two arguments: input object “x” and an integer “1”. The third line creates the second argument for the copy of the “if’ object, an integer “1 The forth line creates the third argument for the copy of the “if’ object, which itself is a copy of the “mul” object with two arguments: “x” and “(f (dec x))”.
[0062] In another possible implementation, an identical algorithm may be written in Lisp, which is a functional dataflow programming language:
[0063] (defun f (x)
[0064] (if (eq x l)
[0065] 1
[0066] (mul x (f (dec x)))))
[0067] Here, in the first line, the function “f ’ is defined with one parameter “x”. The following three lines define the body of the f function.
[0068] In another possible implementation, an imperative equivalent of this recursive algorithm may be written in C programming language:
[0069] int f(int x) {
[0070] if(x == l) {
[0071] return 1 ;
[0072] } else {
[0073] return x * f(x - 1);
[0074] }
[0075] }
[0076] In this application embodiment, for example, in FIG. 2, the first operator is the operator “if’, the second operator is the operator “mul”. The operator “mul” corresponds to more than one instruction cell, one data value is stored in one instruction cell, the operator “if’ obtain more than one data value from more than one instruction cell corresponding to the operator“mul” respectively.
[0077] In one possible implementation, FIG. 3 creates more than one instruction cell corresponding to the operator in the DFG. As shown in FIG. 3, this diagram resembles the original architecture of a dataflow machine, with one extension: a pool of instruction cells stays between the DFG and an arbitration network. Thanks to this pool, it’s possible to have more than one instruction cell per one operator in the DFG, thus enabling recursion in dataflow programs.
[0078] As shown in FIG. 3, the dataflow machine is designed as 1) a set of “instruction cells” in a memory, one for each node of the DFG, 2) an “arbitration network” that receives “operation packets” from fulfilled instruction cells, 3) a set of “operation units” that turn operation packets into “data packets”, and 4) a “distribution network” that places data (or references to data) into instruction cells.
[0079] In one possible implementation, operators in the DFG will sit in the memory and never change, while instruction cells will stay in a memory pool, where they are created when data is available in an input channel and destroyed when evaluation of its operation is complete. The memory storage operators are different from the memory pool storage instruction cells, the memory pool of instruction cells and the DFG operators may be placed in different types of memories inside the CPU, they are keeping both memory stored on chip, for higher performance, this separation may lead to additional performance benefits.
[0080] In one possible implementation, because operators in the DFG is only loaded into the memory once, while instruction cells are created and destroyed during the entire lifecycle of a program, the memory pool is better suited for a memory with a balanced speed of read and write operations, while the operators in the DFG may use a fast-read / slow- write memory.
[0081] At the start of a program and at the end of it, the DFG is full, and the pool is empty. Somewhere in the middle of a program evaluation, the pool may reach its peek capacity. In one possible implementation, the peek capacity of the second memory is determined by the number of operators in the DFG and the number of instruction cells corresponding to each operator.
[0082] Step 120: the first operator calculates an output result of the first operator according to the more than one data value from the second operator.
[0083] In one possible implementation, the more than one data value from the second operatoris an input to the first operator.
[0084] FIG. 4, using a sequence diagram, illustrates a process of evaluation of a dataflow Factorial algorithm. There are five operators in a DFG and 15 instruction cells with different lifetimes (they are presented as solid black vertical bars on the diagram).
[0085] For example, as shown in FIG. 4, evaluation starts with data available in an “x” node: it is a positive integer of value “3”, we create a first instruction cell for “x”, the first instruction cell for “x” is used to store the value of “3”. The presence of data at “x” triggers three operators at the same time (a dataflow evaluation model is implicitly parallel): “eq”, “dec”, and “mul”. Then, we create a first instruction cell for “eq”, the first instruction cell for “eq” is used to store the value of “3”, “eq” compares “3” with “1”, because they are not equal, “eq” puts FALSE to its output arc, which goes to “if’. We create a first instruction cell for “if’, the first instruction cell for “if’ is used to store the “FALSE”. Then, “eq” sends the value of “3” to “dec”, we create a first instruction cell for “dec”, and the first instruction cell for “dec” is used to store the value of “3”. At the same time, “dec” turns “3” into “2” and sends this new data to “x”. Then, “dec” sends the value of “3” to “mul”, we create a first instruction cell for “mul”, and the first instruction cell for “mul” is used to store the value of “3”.
[0086] As shown in FIG. 4, because “dec” sends the value of “2” to “x”, evaluation starts with new data available in the “x” node: it is a positive integer of value “2”, we create a second instruction cell for “x”, which is used to store the value of “2”. The presence of data at “x” triggers three operators at the same time (a dataflow evaluation model is implicitly parallel): “eq”, “dec”, and “mul”. Then, we create a second instruction cell for “eq”, the second instruction cell for “eq” is used to store the value of “2”, “eq” compares “2” with “1”, because they are not equal, “eq” puts FALSE to its output arc, which goes to “if’. We create a second instruction cell for “if’, and the second instruction cell for “if’ is used to store the “FALSE”. Then, “eq” sends the value of “2” to “dec”, we create a second instruction cell for “dec”, and the second instruction cell for “dec” is used to store the value of “2”. At the same time, “dec” turns “2” into “1” and sends this new data to “x”. Then, “dec” sends the value of “2” to “mul”, we create a second instruction cell for “mul”, and the second instruction cell for “mul” is used to store the value of “2”.
[0087] As shown in FIG. 4, because “dec” sends the value of “1” to “x”, evaluation starts withnew data available in the “x” node: it is a positive integer of value “1”, we create a third instruction cell for “x”, which is used to store the value of “1”. The presence of data at “x” triggers three operators at the same time (a dataflow evaluation model is implicitly parallel): “eq”, “dec”, and “mul”. Then, we create a third instruction cell for “eq”, the third instruction cell for “eq” is used to store the value of “1”, and “eq” compares “1” with “1”, because they are equal, “eq” puts TURE to its output arc, which goes to “if’. We create a third instruction cell for “if’, and the third instruction cell for “if’ is used to store the “TURE”. Then, “eq” sends the value of “1” to “dec”, we create a third instruction cell for “dec”, and the third instruction cell for “dec” is used to store the value of “1”. At the same time, “dec” turns “1” into “0” and sends this new data to “x”. Then, “dec” sends the value of “1” to “mul”, we create a third instruction cell for “mul”, and the third instruction cell for “mul” is used to store the value of “1”. “mul” obtains the value of “1”, “2”, and “3” from the three instruction cells created, and multiplies “1”, «2”and “3”,and result of multiplication is 6. The algorithm with 3 as an input produces 6 as a result for factorial 3.
[0088] In the sequence diagram at FIG. 4, there are three types of situations, which happen when new data is available and must travel through the edge to a receiving node: 1) a receiving node already has an open instruction cell — the data lands to the cell; 2) a receiving node doesn’t have a cell — a new cell is bom; 3) a receiving node already has a cell, but the edge is of an orange color (it’s a recursive edge) — a new cell is bom.
[0089] This example demonstrates how the ability to create multiple cells for a single operator enables recursion. During the evaluation of Factorial of 3, three cells were created for “x”, “eq”, “dec”, “mul” and “if’ operators respectively.
[0090] In one possible implementation, the DFG is applied to calculate an n-th Fibonacci number. A simple recursive algorithm to calculate the n-th Fibonacci number may be implemented as a dataflow program.
[0091] FIG. 5 presents an algorithm as a set of Φ -calculus expressions. We implemented the algorithm and evaluated it on Phie, a simulator of Φ PU dataflow architecture. The goal of the experiment was to measure the performance of a pool of instruction cells and its peek required capacity.
[0092] The notation used in FIG. 5 consists of object definitions, which are operators in adataflow graph. An expression “vi(π ) |→ [. . .]” denotes a vertex “vi” in the graph with a number of slots (edges) linking the vertex with other vertices. The slots may either represent direct links, like “α0|— > V6(π )” or dynamically dispatched links, like“p|—> ξξ .α0”. There are also slots that point to data, like “Δ|— > 0x01”, and to imperative ALU instructions, like “λ |→ int-add”.
[0093] In one possible implementation, this < Φ> -calculus set of expressions represent the following recursive Fibonacci algorithm in EO language:
[0094] [x] > fibo
[0095] if. > @
[0096] x.lt 2
[0097] 1
[0098] plus.
[0099] fibo (x.minus 1)
[0100] fibo (x.minus 2)
[0101] Here, the first line declares an abstract object “fibo” with a single parameter “x” (similar to how functions are declared in functional programming languages). Then, the following lines declare the body of the object. It is similar to the Factorial program demonstrated earlier. The objects “plus” and “minus” are attributes of an integer object (all scalar numbers in EO are also objects).
[0102] In another possible implementation, a functional version of the algorithm may be rewritten in C programming language:
[0103] int fibo(int x) {
[0104] if (x < 2) {
[0105] return 1;
[0106] } else {
[0107] return fibo(x - 1) + fibo(x - 2);
[0108] }
[0109] }
[0110] The following positive effect may be achieved due to the use of our solution in a dataflow microprocessor architecture:
[0111] 1. The complexity of hardware architecture may be reduced, thanks to the eliminationof data tagging;
[0112] 2. The data bandwidth of a CPU may be increased by a relatively simple use of RAM for the pool of instruction cells;
[0113] 3. Loop and recursion may be used without any limitations.
[0114] FIG. 6 is a schematic block diagram of a computing device 600 according to an embodiment of this application. As shown in FIG. 6, the computing device 600 includes: an obtaining unit 601 and a calculating unit 602.
[0115] The obtaining unit 601 is configured to obtain, by a first operator, more than one data value from a second operator, wherein the data flow graph comprises the first operator and the second operator, the more than one data value is stored in more than one instruction cell corresponding to the second operator in the DFG respectively.
[0116] The calculating unit 602 is configured to calculate, by the first operator, according to the more than one data value from the second operator, an output result of the first operator, wherein the more than one data value from the second operator is an input to the first operator.
[0117] In some embodiments, the computing device 600 further includes: a creating unit, configured to create, according to whether there is recursive calculation or circular calculation in the DFG, the more than one instruction cell corresponding to the second operator in the DFG, before the obtaining unit obtains the more than one data value from the second operator.
[0118] In some embodiments, the computing device 600 further includes: a destroying unit, configured to destroy, when the calculation corresponding to the second operator is complete, the more than one instruction cell.
[0119] In some embodiments, the second operator is stored in a first memory, and the more than one instruction cell is stored in a second memory, and the first memory is different from the second memory.
[0120] In some embodiments, the first memory is a fast-read / slow-write memory, and the second memory has a balanced speed of read and write operations.
[0121] In some embodiments, a peek capacity of the second memory is determined by the number of operators in the DFG and the number of instruction cells corresponding to each operator.
[0122] In some embodiments, the DFG is applied to calculate an n-th Fibonacci number.
[0123] It should be understood that the computing device 600 in this embodiment of this application may correspond to the computing device in the above-mentioned embodiments, and the foregoing and other management operations and / or functions of the units in the computing device are separately used to implement corresponding steps of the foregoing methods. For brevity, details are not described herein again.
[0124] As shown in FIG.7, a computing device 700 may include a transceiver 701 , a processor 702, and a memory 703. The memory 703 may be configured to store code, instructions, and the like executed by the processor 702.
[0125] It should be understood that the processor 702 may be an integrated circuit chip and has a signal processing capability. In an implementation process, steps of the foregoing method embodiments may be completed by using a hardware integrated logic circuit in the processor, or by using instructions in a form of software. The processor may be a general purpose processor, a central processing unit (CPU), a graphics processing unit (GPU), a neural processing unit (NPU), a system on chip (SoC) or another programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The processor may implement or perform the methods, the steps, and the logical block diagrams that are disclosed in the embodiments of the present application. The general purpose processor may be a microprocessor, or the processor may be any conventional processor or the like. The steps of the methods disclosed with reference to the embodiments of the present application may be directly performed and completed by a hardware decoding processor, or may be performed and completed by using a combination of hardware in the decoding processor and a software module. The software module may be located in a mature storage medium in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, or a register. The storage medium is located in the memory, and the processor reads information in the memory and completes the steps of the foregoing methods in combination with hardware in the processor.
[0126] It may be understood that the memory 703 in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. The non-volatile memory may be a read-only memory (Read-Only Memory, ROM), a programmable read-only memory (Programmable ROM,PROM), an erasable programmable read-only memory (Erasable PROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), or a flash memory. The volatile memory may be a random access memory (Random Access Memory, RAM) and is used as an external cache. By way of example rather than limitation, many forms of RAMs may be used, and are, for example, a static random access memory (Static RAM, SRAM), a dynamic random access memory (Dynamic RAM, DRAM), a synchronous dynamic random access memory (Synchronous DRAM, SDRAM), a double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), an enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), a synchronous link dynamic random access memory (Synchronous link DRAM, SLDRAM), and a direct rambus random access memory (Direct Rambus RAM, DR RAM).
[0127] It should be noted that the memory in the systems and the methods described in this specification includes but is not limited to these memories and a memory of any other appropriate type.
[0128] An embodiment of this application further provides a system chip, where the system chip includes an input / output interface, at least one processor, at least one memory, and a bus. The at least one memory is configured to store instructions, and the at least one processor is configured to invoke the instructions of the at least one memory to perform operations in the methods in the foregoing embodiments.
[0129] An embodiment of this application further provides a computer storage medium, where the computer storage medium may store a program instruction for performing any of the foregoing methods.
[0130] Optionally, the storage medium may be specifically the memory 703.
[0131] A person of ordinary skill in the art may be aware that, in combination with the examples described in the embodiments disclosed in this specification, units and algorithm steps can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed by hardware or software depends on particular applications and design constraints of the technical solutions. A person skilled in the art may use different methods to implement the described functions for each particular application, but it should not be considered that the implementation goes beyond the scope ofthis application.
[0132] It may be clearly understood by a person skilled in the art that, for the purpose of convenient and brief description, for a detailed working process of the foregoing system, apparatus, and unit, refer to a corresponding process in the foregoing method embodiment. Details are not described herein again.
[0133] In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the described apparatus embodiment is merely an example. For example, the unit division is merely logical function division and may be other division in actual implementation. For example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces. The indirect couplings or communication connections between the apparatuses or units may be implemented in electronic, mechanical, or other forms.
[0134] The units described as separate parts may be or may not be physically separate, and parts displayed as units may be or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units may be selected based on actual requirements to achieve the objectives of the solutions of the embodiments.
[0135] In addition, functional units in the embodiments of this application may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units are integrated into one unit.
[0136] When the functions are implemented in a form of a software functional unit and sold or used as an independent product, the functions may be stored in a computer readable storage medium. Based on such an understanding, the technical solutions in this application essentially, or the part contributing to the prior art, or some of the technical solutions may be implemented in a form of a software product. The computer software product is stored in a storage medium, and includes several instructions for instructing a computer device (which may be a personal computer, a server, a network device, or the like) to perform all or some of the steps of the methods described in the embodiments of this application. The foregoing storage medium includes: any medium that can store program code, such as a USB flash drive, a removable harddisk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk, or an optical disc.
[0137] The foregoing descriptions are merely specific implementations of this application, but are not intended to limit the protection scope of this application. Any variation or replacement readily figured out by a person skilled in the art within the technical scope disclosed in this application shall fall within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.
Claims
CLAIMSWhat is claimed is:
1. A method for calculation based on a data flow graph (DFG), comprising: obtaining, by a first operator, more than one data value from a second operator, wherein the data flow graph comprises the first operator and the second operator, the more than one data value is stored in more than one instruction cell corresponding to the second operator in the DFG respectively; and calculating, by the first operator, according to the more than one data value from the second operator, an output result of the first operator, wherein the more than one data value from the second operator is an input to the first operator.
2. The method according to claim 1 , wherein before the obtaining, by a first operator, more than one data value from a second operator, the method further comprises: creating, according to whether there is recursive calculation or circular calculation in the DFG, the more than one instruction cell corresponding to the second operator in the DFG.
3. The method according to claim 1 or 2, wherein the method further comprises: destroying, when the calculation corresponding to the second operator is complete, the more than one instruction cell.
4. The method according to any one of claims 1-4, wherein the second operator is stored in a first memory, and the more than one instruction cell is stored in a second memory, and the first memory is different from the second memory.
5. The method according to claim 4, wherein the first memory is a fast-read / slow- write memory, and the second memory has a balanced speed of read and write operations.
6. The method according to claim 4 or 5, wherein a peek capacity of the second memory is determined by the number of operators in the DFG and the number of instruction cells corresponding to each operator.
7. The method according to any one of claims 1-6, wherein the DFG is applied to calculate an n-th Fibonacci number.
8. A computing device, comprising:an obtaining unit, configured to obtain, by a first operator, more than one data value from a second operator, wherein the data flow graph comprises the first operator and the second operator, the more than one data value is stored in more than one instruction cell corresponding to the second operator in the DFG respectively; and a calculating unit, configured to calculate, by the first operator, according to the more than one data value from the second operator, an output result of the first operator, wherein the more than one data value from the second operator is an input to the first operator.
9. The computing device according to claim 8, wherein the computing device further comprises: a creating unit, configured to create, according to whether there is recursive calculation or circular calculation in the DFG, the more than one instruction cell corresponding to the second operator in the DFG, before the obtaining unit obtains the more than one data value from the second operator.
10. The computing device according to claim 8 or 9, wherein the computing device further comprises: a destroying unit, configured to destroy, when the calculation corresponding to the second operator is complete, the more than one instruction cell.
11. The computing device according to any one of claims 8-10, wherein the second operator is stored in a first memory, and the more than one instruction cell is stored in a second memory, and the first memory is different from the second memory.
12. The computing device according to claim 11, wherein the first memory is a fast- read / slow-write memory, and the second memory has a balanced speed of read and write operations.
13. The computing device according to claim 11 or 12, wherein a peek capacity of the second memory is determined by the number of operators in the DFG and the number of instruction cells corresponding to each operator.
14. The computing device according to any one of claims 8-13, wherein the DFG is applied to calculate an n-th Fibonacci number.
15. A computer readable storage medium storing instructions that, when run on a server, enable the server to perform the method according to any one of claims 1 to 7.
16. A computing device cluster, comprising at least one computing device, wherein the computing device comprising a processor and a memory coupled with the processor, wherein the memory is configured to store a computer program, and the processor is configured to invoke and run the computer program stored in the memory, so that the computing device executes the method according to any one of claims 1 to 7.
17. A computer program product, wherein when the computer program product is run on a server, the server is enabled to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Embedded system development
US20120144376A1
Graph computing apparatus, processing method, and related device
WO2022036690A1
