Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
TECHNIQUE FOR IMPROVING THE EFFICIENCY OF RECONFIGURABLE HARDWARE
Document Type and Number:
WIPO Patent Application WO/2004/042497
Kind Code:
A2
Abstract:
The present invention includes a method of computing a function array in reconfigurable hardware (310) that includes forming in the reconfigurable hardware (310), a first delay queue (306) and a second delay queue (308), inputting from a source array (304) outside the reconfigurable hardware (310), a first value (312) into the first delay queue (306) and a second value (316) into the second delay queue (308); defining in the reconfigurable hardware (310), a window array (302) comprising a first cell and a second cell, inputting the first value (312) from the first delay queue (306) into the first cell and the second value (312) from the second delay queue (308) into the second cell; and calculating an output value for the function array based on the window array. The present invention also includes a method of loop stripmining (400) and a method of calculating output values in a fused producer/consumer loop structure (510).

Inventors:
HAMMES JEFFREY
Application Number:
PCT/US2003/029860
Publication Date:
May 21, 2004
Filing Date:
September 22, 2003
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
SRC COMPUTERS INC (US)
International Classes:
G06F9/00; G06F9/445; G06F15/00; G06F15/177; G06F15/78; G06F17/50; G06F19/00; G06K9/40; G06F; (IPC1-7): G06F/
Foreign References:
US5732246A1998-03-24
US6021513A2000-02-01
US6832310B12004-12-14
US6839889B22005-01-04
US6668237B12003-12-23
Other References:
None
See also references of EP 1556801A4
Attorney, Agent or Firm:
Burton, Carol W. (LLP 1200 17th Street, Suite 150, Denver CO, US)
Download PDF:
Claims:
CLAIMS WE CLAIM:
1. A method of computing a function array in reconfigurable hardware comprising: forming in the reconfigurable hardware a first delay queue and a second delay queue; inputting from a source array outside the reconfigurable hardware a first value into the first delay queue and a second value into the second delay queue; defining in the reconfigurable hardware a window array comprising a first cell and a second cell ; inputting the first value from the first delay queue into the first cell and the second value from the second delay queue into the second cell ; and calculating an output value for the function array based on the window array.
2. The method of claim 1, wherein the first value and the second value of the source array are input into the reconfigurable hardware just once to compute the function array.
3. The method of clam 1, wherein the reconfigurable hardware comprises a field programmable gate array (FPGA).
4. The method of claim 1, wherein the source array is a two dimensional array.
5. The method of claim 1, wherein the function array is a two dimensional array.
6. The method of claim 5, wherein the function array is a median filter output array for image processing.
7. The method of claim 1, wherein the function array describes hydrodymamic behavior in a fluid system.
8. The method of claim 1, wherein the window array is a two dimensional array.
9. The method of claim 8, wherein the window array has dimensions of equal length.
10. The method of claim 1, wherein the first delay queue and the second delay queue comprise FIFO buffers.
11. The method of claim 1, wherein said method comprises: determining whether the output value is a junk value, wherein the output value is stored in a result array unless it is the junk value.
12. A method of loop stripmining comprising: forming in reconfigurable hardware a first delay queue with a first length equal to a maximum number of values stored in the delay queue; forming a subarray from a first portion of a source array, wherein at least one dimension the subarray has a size equal to the first length of the first delay queue; loading values from the first subarray into the first delay queue; and stepping the subarray to a second portion of the source array.
13. The method of claim 12, wherein the reconfigurable hardware comprises a field programmable gate array (FPGA).
14. The method of claim 12, wherein the source array is a two dimensional array having a depth and a width.
15. The method of claim 14, wherein the subarray spans the width of the source array.
16. The method of claim 12, wherein the first portion and the second portion of the source array overlap by at least one row of the source array.
17. The method of claim 12, wherein said method comprises forming in the reconfigurable hardware a second delay queue with a second length equal to the first length of the first delay queue.
18. The method of claim 17, wherein said method comprises loading the values from the first delay queue into the second delay queue.
19. A method of calculating output values in a fused producer/consumer loop structure comprising: forming in a reconfigurable hardware a first delay queue and a second delay queue; loading a first output value from a producer function into the first delay queue; loading a second output value from the producer function and loading into the first delay queue, wherein the first output value is loaded into the second delay queue; and inputting the first output value from the second delay queue, the second output value from the first delay queue, and a third output value from the producer function into a consumer function to calculate a consumer output value.
20. The method of claim 19, wherein the reconfigurable hardware comprises a field programmable gate array (FPGA).
Description:
TECHNIQUE FOR IMPROVING THE EFFICIENCY OF RECONFIGURABLE HARDWARE BACKGROUND OF THE INVENTION Field of the Invention The present invention relates, in general, to improving processing efficiency in reconfigurable hardware. More specifically, the invention relates to optimizing the compilation of algorithms on reconfigurable hardware to reduce the time required to execute a program on the hardware.

Relevant Background As microprocessors continue to increase rapidly in processing power, they are used more often to do computationally intensive calculations that were once exclusively done by supercomputers. However, there are still computationally intensive tasks, including compute-intensive image processing and hydrodynamic simulations that can take significant amounts of time to execute on modern microprocessors.

Paralleling the progress of microprocessors, reconfigurable hardware such as field programmable gate arrays (FPGAs) has made advances both in terms of increased circuit density as well as ease of reprogramming, among other areas.

Originally developed as simple logic for interconnecting components on digital systems, reconfigurable hardware has become so easy to reprogram that it can be used today as reconfigurable logic for executing a program.

A number of advantages may be realized when the reconfigurable hardware can be reprogrammed to meet the needs of individual programs. For example, the reconfigurable hardware may be programmed with a logic configuration that has more parallelism and pipelining characteristics than a conventional microprocessor. Also, the reconfigurable hardware may be programmed with a custom logic configuration that is very efficient for executing the tasks assigned by the program. Furthermore, dividing a program's processing requirements between the microprocessor and the reconfigurable hardware may increase the overall processing power of the computer.

Unfortunately, an important stumbling block for users who may wish to take advantage of reconfigurable hardware is the difficulty of programming the hardware. Conventional methods of programming reconfigurable hardware included the use of hardware description languages (HDLs); low-level languages that require digital circuit expertise as well as explicit handling of timing.

Progress has been made in the development of technology for compiling conventional high-level languages to reconfigurable hardware. However, existing compilers that compile the algorithms written in these high-level languages still benefit from optimization to get the reconfigurable hardware to process data in the most efficient way possible.

One performance limit comes from the time required when reconfigurable hardware reads data elements from a source array in memory located outside the hardware. This limit is observed when, for example, a compute-intensive algorithm consists of loops that operate over a multi-dimensional source array located outside the reconfigurable hardware, where each iteration of a loop computes on a rectangular sub-array or stencil of the source array.

For example, in a conventional windowed loop the elements of the source array are stored in a memory external to the reconfigurable hardware and are accessed by the hardware at a rate of one cell value per clock cycle.

Thus, when the windowed array is a 3x3, two-dimensional array, nine clock cycles are needed to read the nine values of the array into the reconfigurable hardware. If the source array is a two-dimensional array of size Si x Sj, and the windowed array is size Wi x Wj, then the number of clock cycles needed to run the loop may be represented as: (Si- (wus-1)) x (Sj- (Wj-1)) x (WixWj) +L where L is the pipeline depth of the loop. Accordingly, significant efficiencies can be realized by reducing the number of times that a data element from outside the reconfigurable hardware has to be reread into the hardware.

Moreover, efficiencies can be realized by eliminating intermediate steps in processing the data that involve writing data to memory outside the reconfigurable processor and later reading the data back into the hardware.

SUMMARY OF THE INVENTION Accordingly, an embodiment of the invention includes a method of computing a function array in reconfigurable hardware comprising forming in the reconfigurable hardware a first delay queue and a second delay queue, inputting from a source array outside the reconfigurable hardware a first value into the first delay queue and a second value into the second delay queue, defining in the reconfigurable hardware a window array comprising a first cell and a second cell, inputting the first value from the first delay queue into the first cell and the second value from the second delay queue into the second cell, and calculating an output value for the function array based on the window array.

Another embodiment of the invention includes A method of loop stripmining comprising forming in reconfigurable hardware a first delay queue with a first length equal to a maximum number of values stored in the delay queue, forming a sub-array from a first portion of a source array, wherein at least one dimension the sub-array has a size equal to the first length of the first delay queue, loading values from the first sub-array into the first delay queue; and stepping the sub-array to a second portion of the source array.

Another embodiment of the invention includes a method of calculating output values in a fused producer/consumer loop structure comprising forming in a reconfigurable hardware a first delay queue and a second delay queue, loading a first output value from a producer function into the first delay queue, loading a second output value from the producer function and loading into the first delay queue, wherein the first output value is loaded into the second delay queue, and inputting the first output value from the second delay queue, the second output value from the first delay queue, and a third output value from the producer function into a consumer function to calculate a consumer output value.

BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 shows an example of a two-dimensional source array that may be used with the present invention; Figure 2 shows iterations of a window array across a portion of a source array according to an example of the present invention;

Figures 3A-F show values from a source array loaded into delay queues and a windowed array in reconfigurable hardware according to an embodiment of the invention; Figure 4 shows an example of loop stripmining in a source array according to an example of the present invention; and Figure 5 shows an example of data flow in reconfigurable hardware where loop fusion couples output data between a producer loop and a consumer loop.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Fig. 1 shows an example of a two-dimensional source array 100 that may be used with the present invention. In one embodiment, the size of source array 100 may be represented as Si x Sj, where Si represents the number of rows in the two-dimensional array and Sj represents the number of columns.

An address for each cell 102 of source array 100 may be represented by S where i represents a row number and j represents a column number. For example, the upper-leftmost corner cell 102 of source array 100 may be represented by Soo.

While source array 100, a small two-dimensional array, is described here for the sake of simplicity, embodiments of the invention also include more complex arrays having three or more dimensions. In addition, embodiments of the invention also include two-dimensional source arrays with a greater number of cells 102 and where the number of columns and rows may or may not be equal (i. e., the width and depth of the source array may or may not have equal lengths).

Referring now to Fig. 2, iterations of a window array 202 across a portion of a source array 204 according to an example of the present invention is shown.

A two-dimensional window array 202 with dimensions Wi x Wj (3x3 in the example shown) may overlap a portion of source array 204. The window array 202 defines a portion of source array 204 that may be operated upon by the reconfigurable hardware. For example, window array 202 may select a portion of

source array 204 that is processed by a median filter function that calculates a median value of the elements in window array 202. In another example, an average value of the elements in window array 202 may be calculated.

As shown in Fig. 2, successive iterations of a windowed loop may step window array 202 down the columns of source array 204. In this example, the window array 202 may move vertically down the rows of the source array 204, stepping one row per iteration. When the window array 202 reaches the last row of the source array 204 the window array 202 may move horizontally by one column and back up to the top row of the source array 204. The loop may repeat this down row/across column pattern for the entire source array 204.

An example of a windowed loop nest that makes use of a window array 202 that overlaps a source array 204 may be represented in computer code by: Dj = Wj-1 ;//Wj is the window width Di = Wi-1 ;//Wi is the window height for (j=O ; j<Sj-Dj ; j++) for (i=0 ; i<Si-Di ; i++) { aOO = A [i] [j] ; aOl = A [i] [j+1] ; a02 = A [i] [j+2] alO = A [i+l] [j] ; all = A [i+l] [j+l] ; al2 = A [i+l] [j+2] a20 = A [i+2] [j] ; a21 = A [i+2] [j+1] ; a22 = A [i+2] [j+2] rval F (aOO, aOl, a02, alO, all, al2, a20, a21, a22) ; B [i] [j] = rval ;} In the example computer code shown above, F represents a computation using the nine values from the nine cells of the window array 202 (referred to as"A" in the computer code) and may be implemented as a function call. The definition of function F may be specific to the algorithm being implemented.

For example, F may represent a function for image processing including, but not limited to, edge detection, median filter, erode and dilate. The resultant calculations of F may be stored in a result array, B (not shown). As shown in this example, the vertical iterations of window array 202 may span the full depth of the source array 204.

While Fig. 2 and the example computer code shows window array 202, as a 3x3 array, the size of the window array may vary in both dimensions and

may not be square. In some instances, the size of the window array may be fixed by the algorithm that is executed on the reconfigurable hardware. For example, the function F above may fix the size of window array 202 to a 3x3 array. Also, while this example shows all nine cells of window array 202 being used by the function, F, there is also contemplated loop stenciling of source array 204 where fewer than all the window array cells are used by a function.

Referring now to Fig. 3A, an output value from a source array 304 loaded into a first delay queue 306 and a 3x3 window array 302 in reconfigurable hardware 310 according to an embodiment of the invention is shown. In an embodiment, the memory of the reconfigurable hardware 310 comprises first delay queue 306, a second delay queue 308. The two delay queues 306 and 308 may be the same length (i. e., hold the same number of data values) and may comprise First In First Out (FIFO) buffers. In this embodiment, data values from source array 304 may be read from outside memory of the reconfigurable hardware 310 and stored in the delay queues 306 and 308 in order to reduce the number of times that each value of source array 304 needs to be reread into the reconfigurable hardware.

As shown in Fig. 3A, a first value 312 of source array 304 may be read into array cell 314 of window array 302 and first delay queue 306. In the next iteration that is illustrated by Fig. 3B, two more values 316 from the first column of source array 304 are read into window array 302 and first delay'queue 306.

When each of the values 314 are read into array cell 320, the previous value occupying the cell may be pushed up the column of window array 302.

As illustrated by Fig. 3C, the first delay queue 306 may fill to capacity when the last value in the left column 318 of source array 304 is read into the delay queue 306 and the window array 302. In an embodiment, the oldest value 320 may also be read into array cell 322 of the middle column of window array 302 when a new value is read into first delay queue 306. In another embodiment, the oldest value 320 of first delay queue 306 may be transferred to the second delay queue 308 when a new value is read into first delay queue 306.

Referring now to Fig. 3D, a second column 324 from source array 304 has been read into reconfigurable hardware 310. In an embodiment, the oldest value from first delay queue 306 may be read into window array 302 and second delay queue 308 for each new value read into first delay queue 306 from source array 304. In this embodiment, when the values from the second column of source array 304 fills into first delay queue 306, second delay queue 308 may fill with the values from the first column of source array 304. Also, as the values are transferred from first delay queue 306 to second delay queue 308, they may also be written to array cell 322. Also, the newest values read from source array 304 may be input into array cell 314 of window array 302 as they are input into first delay queue 306.

Referring now to Fig. 3E three values 326 from the third column of source array 304 are input into reconfigurable hardware 310. As each of these values 326 are input into first delay queue 306, the oldest values 320 from the first delay queue are input into second delay queue 308, which in turn may push the oldest values from the second delay queue 308 into array cell 328 of the left column of window array 302. The net effect of these transfers after all three values 326 are input into the reconfigurable hardware 310 may be that the nine values in window array 302 may match the nine values in the 3x3 sub- array of source array 304.

As the next value is read from the third column of source array 304, as shown in Fig. 3F, this value replaces element 314 of the window array 302. In addition, the oldest value in first delay queue 306 and the oldest value in second delay queue 308 replace elements 322 and 328, respectively, of the window array 302. The values in window array 302 may now be the same as sub-array 330 of source array 304, which is similar to incrementing a window array vertically down the rows of source array 304.

As noted above, delay queues 306 and 308 may eliminate the need to reread values into the reconfigurable hardware as window array 302 moves vertically down the rows of source array 304. When window array 302 starts a new cycle at the top row of source array 304, first delay queue 306 may be empty or loaded with"junk"values. As shown in Figs. 3A-C,"dummy

iterations"may be needed to load first delay queue 306 with correct values. In one embodiment, the dummy iterations may be accounted for in the computer code by starting the inner loop induction value (represented by i in the code above) at-2 instead of 0. In this embodiment, the first two iterations may compute nonsense values for the function F, and these may be discarded by placing a conditional on writes to the results array, B.

In another embodiment, the rereading of source array 304 values into the configuration hardware may be eliminated as the window array 302 moves horizontally across the columns of source array 304. As noted above, with each downward pass of the inner loop, one new column of data may be read from source array 304. The remaining columns, however, were read in previous iteration of the outer loop, and may be stored in delay queues 306 and 308 in the reconfigurable hardware to eliminate the need to reread them. In one embodiment, the windowed loop computer code may be modified to look like : Di = Wi-1 ; Dj = Wj-1 ; for (k=O ; k<Sj-Dj ; k+=DEPTH-Di) { st = k ; if (st + DEPTH > Si) st = Si-DEPTH ; for (j=-Dj ; j<Sj-Dj ; j++) for (i=st-Di ; i<st+DEPTH-Di ; i++) { aval = A [i+Dj] [j+Dj] aOO = aOl ; aOl = all ; a02 = al2 alO = a20 ; all = a21 ; al2 = a22 a22 = aval ; a21 = delay (&dly2, a22) ; a20 = delay (&dlyl, a21) ; rval F (aOO, aOl, a02, alO, all, al2, a20, a21, a22) ; if ( (i >= st) && (j >=0) B [i] [j] = rval ;}} In this embodiment of the code, the value of A [i+2] [j] may be the same value that was read as A [i+2] [j+1] in the previous iteration of the outer loop, and

A [i+2] [j+1] may be the same value that was read as A [i+2] [j+2]. The previously read values are stored in delay queues in the reconfigurable hardware.

The variable DEPTH in the above code represents the height of the portion of the source array being processed during an iteration of the outer loop. In one embodiment, the value of DEPTH may span the entire height of the source array, Sj. In another embodiment, loop stripmining may be employed to process the full source array as two or more sub-arrays or data blocks. In this embodiment, DEPTH may have a value less than the height of the height of the source array Sj. In still another embodiment, DEPTH may be made a power of two in order to simplify divide and mod operations to compute the array indices as simple shifts and masks.

FIG. 4 shows a source array 400 that is processed in sections in the reconfigurable hardware with loop stripmining. In an embodiment of this method, a first sub-array 402 may have a width equal to the width of the source array and height equal to DEPTH, where, in this embodiment, DEPTH is equal to the length of a delay queue in the reconfigurable hardware. In the first iteration of the outer loop, first sub-array 402 defines the portion of source array 400 that may be processed by successive iterations of the inner loop where a windowed array moves down the rows and across the columns of first sub- array 402. During the iterations of the inner loop, each value from the source array may be read into the reconfigurable hardware and stored in a delay queue by calling the delay function with a function call. When each new source array value is written into the delay queue the oldest value in the delay queue may be output from the tail of the delay queue and as the function call's return.

In another embodiment, the inner loops produce dummy iterations, and the write to the result array, B, may include conditional statements to ignore the results of these iterations.

In the second iteration of the outer loop, second sub-array 404 may have the same width and height as first sub-array 402, but is positioned further down on source array 400. In the embodiment shown, two rows of the first sub-array 402 overlap with two rows of second sub-array 404. In another embodiment,

one or more rows of a sub-array may overlap another sub-array. In still another embodiment, no cells of the sub-arrays overlap each other.

In the third iteration of the outer loop, the bottom of third sub-array 406 may be aligned with the bottom of source array 400. In the last iteration of the outer loop, more rows of the source array may be recalculated than for previous iterations as a result of the bottom edge of the last sub-array being aligned with the bottom of the source array.

In an embodiment, the storage array is a two-dimensional, rectangular array stored in row-major order, and stored contiguously in memory. Data movement calls to the source array may be included inside the outer loop to read data from the source array into the reconfigurable hardware, process it, and write the resultant array to outside memory. In another embodiment, data movement calls may be configured for the simultaneous moving one data set while another data set is being processed in the reconfigurable hardware.

Referring now to Fig. 5, an embodiment of the invention is shown of data flow in reconfigurable hardware 510 where loop fusion couples output data between a producer loop and a consumer loop. In an embodiment, multiple window loops may be connected in the reconfigurable hardware with producer-consumer loop fusion methods. These methods include the elimination of intermediate arrays as an output from one nested loop structure, the producer loop, is directly connected to the input of another nested loop, the consumer loop. In this embodiment, the elimination of the intermediate loop reduces the number of reads to reconfigurable hardware 510 thereby reducing processing time.

An embodiment of the invention includes a method of calculating output values with a fused producer/consumer loop structure in reconfigurable hardware 510 such as a FPGA. For example, a calculation may involve applying a first function to nine values of a source array 504, defined by window array 502, to produce a single output value, followed by a second function that may be applied to nine output values from the first function. As noted above, in a conventional loop structure where the first and second function loops are not

fused, the first function loop fills an intermediate array with the output values and the second function loop processes this intermediate array. By fusing together the first and second function loops into a producer/consumer loop structure, the intermediate array may be eliminated.

The fused producer/consumer loop structure method may start with the formation a first delay queue 506 and second delay queue 508 in the reconfigurable hardware 510. In an embodiment, the first and second delay queue 506 and 508 may be the same length and may be FIFO buffers.

In another embodiment, a producer function that is part of a producer loop may be applied to source array 504 values read into the reconfigurable hardware in order to calculate producer output values. For example, in successive loop iterations the producer function (which correspond to the row by row steps of window array 502) may be applied to successive sets of source array values and calculate successive output values. The output values may be loaded into first delay queue 506 as they are produced by the producer function. In one embodiment, when first delay queue 506 reaches the maximum number of output values it can hold, a previously loaded output value may be transferred from first delay queue 506 to second delay queue 508 for each additional output value loaded into first delay queue 506 from the producer function.

For example, a first output value may be loaded into first delay queue 506 followed by successive output values until first delay queue 506 is filled.

Then, as the next output value is loaded into first delay queue 506, the first output value may be transferred from first delay queue 506 to the second delay queue 508.

The consumer function that is part of the consumer loop 512 may be applied to the output values from the producer function to calculate a consumer output value. In one embodiment, for each iteration of the consumer loop 512 the consumer function may be applied to a first output value from second delay queue 508, a second output value from first delay queue 506, and a third

output value coming directly from a calculation by the producer function on window array 502.

In another embodiment based on the example above where the consumer function is applied to an windowed array of 9 output values, each three value row of the array may be supplied, respectively, by output values from second delay queue 508, the first delay queue 506 and directly from the producer function operating on window array 502. When three of these rows stack vertically, a 3x3 array of output values may be formed for the consumer function.

In another embodiment, the length of delay queues 506 and 508 may be equal to the depth of the source array. In another embodiment where loop stripmining may be employed, the length of a delay queue may be equal to the depth of the sub-array. In these embodiments, as the producer loop iterates down the column of source array 504 or sub-array of source array 504, the delay queues 506 and 508 filling with output values may be analogous to the columns of an intermediate array of output values. For example, when an consumer function is applied to a three-column, window array of output values from the producer function, the left column of the window array may be aligned with the first delay queue, the middle column may be aligned with the second delay queue, and the right column may be aligned with the sequence of output values produced as the first and second delay queues are being filled and/or refreshed.

In another embodiment output values from the producer function may be supplied to the consumer loop and loaded into first delay queue 506 in the same producer loop iteration. In another embodiment, an output value transferred from first delay queue 506 to second delay queue 508 may also be supplied to the consumer loop in the same producer loop iteration. In still another embodiment, an output value may be written outside reconfigurable hardware 510 from a final delay queue and supplied to the consumer in the same producer loop iteration.

An example of how loop fusion may be implemented in computer code may start with a pair of loops prior to loop fusion such as: Di = Wi-1 ; Dj = Wj-1 ; for (k=o ; k<Sj-Dj ; k+=DEPTH-Di) { st = k ; if (st + DEPTH > Si) st = Si-DEPTH ; for (j=-Dj ; j<Sj-Dj ; j++) for (i=st-Di ; i<st+DEPTH-Di ; i++) { aval = A [i+Dj] [j+Dj] aOO = aOl ; aOl = all ; a02 = al2 alO = a20 ; all = a21 ; al2 = a22 a22 = aval ; a21 = delay (&dly2, a22) ; a20 = delay (&dlyl, a21) ; rval = Fl (aOO, aOl, a02, alO, all, al2, a20, a21, a22) ; if ( (i >= st) && (j >=0) B [i] [j] =rval ;}} Ei = Vi-1 ; Ej = Vj-1 ; for (k=0 ; k< (Sj-Dj)-Ei ; k+=DEPTH-Ei) { st = k ; if (st + DEPTH > (Si-Di)) st = (Si-Di)-DEPTH ; for (j=-Ej ; j< (Sj-Dj)-Ei ; j++) for (i=st-Ei ; i<st+DEPTH-Ei ; i++) { bval = B [i+Ej] [j+Ej] bOO = bOl ; bOl = bll ; b02 = bl2 blO = b20 ; bll = b21 ; bl2 = b22 b22 = bval ; b21 = delay (&dly2, b22) ; b20 = delay (&dlyl, b21) ; rval F2 (bOO, bOl, b02, blo, bll, bl2, b20, b21, b22) ; if ( (i >= st) && (j >=O) C [i] [j] = rval ;}}

In this example, the second loop nest uses values from results array B, whose values are based on computations of function, F1. Also, the two loops in the code above reuse some previously read values which may eliminate the need to reread those values from outside the reconfigurable hardware. In one embodiment, the two nested loops may be fused together so that the second nested loop may read a stream of values from results array B in the same order that the first nested loop produced those values.

In an embodiment where loop fusion is combined with the example of loop stripmining shown in FIG. 4, there may be overlap between the sub-arrays 402. In this embodiment, the second loop nest may overlap by two rows due to the two-row overlap at the boundary of the first sub-array 402 and the second sub-array 404. This overlap may be compensated for by modifying the first nested loop such that it produces the values in the overlap rows twice which produces the values in the proper sequence in the second nested loop. Once this modification is made, the two loops may be fused by feeding the function values, F1, from the first nested loop into a delay queue that that may be read out by the second nested loop. An example of the computer code for the fused loops may be described as:

Di = (Wi-1) + (Vi-1) ; Dj = (Wj-1) + (Vj-1) ; for (k=0 ; k<Sj-Dj ; k+=DEPTH-Di) { st = k ; if (st + DEPTH > Si) st = Si-DEPTH ; for (j=-Dj ; j<Sj-Dj ; j++) for (i=st-Di ; i<st+DEPTH-Di ; i++) { aval = A [i+Dj] [j+Dj] ; aOO = aOl ; aOl = all ; a02 = al2 alO = a20 ; all = a21 ; al2 = a22 a22 = aval ; a21 = delay (&dly2, a22) ; a20 = delay (&dlyl, a21) ; bval = Fl (aOO, aOl, a02, alO, all, al2, a20, a21, a22) ; bOO = bOl ; bOl = bll ; b02 = bl2 blO = b20 ; bll = b21 ; bl2 = b22 b22 = bval ; b21 = delay (&dly4, b22) ; b20 = delay (&dly3, b21) ; rval F2 (bOO, bOl, b02, blO, bll, bl2, b20, b21, b22) ; if ( (i >= st) && (j >=O) B [i] [j] = rval ;}} In another embodiment, this technique may be extended to fuse any number of loop nests.

In still another embodiment, the individual nested loops may be combined into a single loop. Example code of the pair of nested loops above combined to form a single loop may look like :

Di = (Wi-1) + (Vi-1) ; Dj = (Wj-1) + (Vj-1) ; for (k=O ; k<Sj-Dj ; k+=DEPTH-Di) { st = k ; if (st + DEPTH > Si) st = Si-DEPTH ; for (xs=O ; xs<Sj*DEPTH ; xs++) { j = xs/DEPTH-Dj ; I = xs% DEPTH + st-Di ; aval = A [i+Dj] [j+Dj] ; aOO = aOl ; aOl = all ; a02 = al2 alO = a20 ; all = a21 ; al2 = a22 a22 = aval ; a21 = delay (&dly2, a22) ; a20 = delay (&dlyl, a21) ; bval = Fl (aOO, aOl, a02, alO, all, al2, a20, a21, a22) ; bOO = bOl ; b01= bll ; b02 = bl2 blO = b20 ; bll = b21 ; bl2 = b22 b22 = bval ; b21 = delay (&dly4, b22) ; b20 = delay (&dly3, b21) ; rval =F2 (bOO, bOl, b02, blO, bll, bl2, b20, b21, b22) ; if ( (i >= st) && (j >=0) B [i] [j] = rval ;}} In an embodiment, the loop combing method above may be pipeline in the reconfigurable hardware to reduce the start-up overhead in the inner loop.

Although the invention has been described and illustrated with a certain degree of particularity, it is understood that the present disclosure has been made only by way of example, and that numerous changes in the combination and arrangement of parts can be resorted to by those skilled in the art without departing from the spirit and scope of the invention, as hereinafter claimed.

The words"comprise,""comprising,""include,""including,"and "includes"when used in this specification and in the following claims are intended to specify the presence of stated features, integers, components, or steps, but they do not preclude the presence or addition of one or more other features, integers, components, steps, or groups.