(19)
(11) EP 1 556 801 B1

(12) EUROPEAN PATENT SPECIFICATION

(45) Mention of the grant of the patent:
15.11.2017 Bulletin 2017/46

(21) Application number: 03749789.8

(22) Date of filing: 22.09.2003
(51) International Patent Classification (IPC): 
G06F 15/78(2006.01)
G06F 17/50(2006.01)
(86) International application number:
PCT/US2003/029860
(87) International publication number:
WO 2004/042497 (21.05.2004 Gazette 2004/21)

(54)

TECHNIQUE FOR IMPROVING THE EFFICIENCY OF RECONFIGURABLE HARDWARE

TECHNIK ZUR VERBESSERUNG DER WIRKSAMKEIT UMKONFIGURIERBARER HARDWARE

TECHNIQUE PERMETTANT D'AMELIORER L'EFFICACITE D'UN MATERIEL RECONFIGURABLE


(84) Designated Contracting States:
AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HU IE IT LI LU MC NL PT RO SE SI SK TR

(30) Priority: 31.10.2002 US 285401

(43) Date of publication of application:
27.07.2005 Bulletin 2005/30

(73) Proprietor: SRC Labs, LLC
Chaska, MN 55318 (US)

(72) Inventor:
  • HAMMES, Jeffrey
    Colorado Springs, CO 80922 (US)

(74) Representative: Hanna Moore + Curley 
Garryard House 25/26 Earlsfort Terrace
Dublin 2, D02 PX51
Dublin 2, D02 PX51 (IE)


(56) References cited: : 
US-A- 5 732 246
US-B1- 6 668 237
US-B2- 6 839 889
US-A- 6 021 513
US-B1- 6 832 310
   
  • ROBERT RINKER ET AL: "An Automated Process for Compiling Dataflow Graphs into Reconfigurable Hardware" IEEE TRANSACTIONS ON VERY LARGE SCALE INTEGRATION (VLSI) SYSTEMS, IEEE SERVICE CENTER, PISCATAWAY, NJ, US, vol. 9, no. 1, 1 February 2001 (2001-02-01), XP011063138 ISSN: 1063-8210
  • RINKER R ET AL: "Compiling image processing applications to reconfigurable hardware" APPLICATION-SPECIFIC SYSTEMS, ARCHITECTURES, AND PROCESSORS, 2000. PRO CEEDINGS. IEEE INTERNATIONAL CONFERENCE ON JULY 10-12, 2000, PISCATAWAY, NJ, USA,IEEE, 10 July 2000 (2000-07-10), pages 56-65, XP010507737 ISBN: 978-0-7695-0716-3
  • KANG S.M ET AL: 'iiQueue, A QoS-Oriented Module for Input-Buffered ATM Switches' PROCEEDINGS OF 1997 IEEE INTERNATIONAL SYMPOSIUM ON CIRCUITS AND SYSTEMS vol. 3, 09 June 1997, pages 2144 - 2147, XP010236663
  • KUNG H.T. ET AL: 'Deadlock Avoidance for Systolic Communication' CONFERENCE PROCEEDING OF 15TH ANNUAL INTERNATIONAL SYMPOSIUM ON COMPUTER ARCHITECTURE 30 May 1998, pages 252 - 260, XP000011529
  • RINKER R ET AL: "An automated process for compiling dataflow graphs into reconfigurable hardware", IEEE TRANSACTIONS ON VERY LARGE SCALE INTEGRATION (VLSI) SYSTEMS, IEEE SERVICE CENTER, PISCATAWAY, NJ, USA, vol. 9, no. 1, 1 February 2001 (2001-02-01), pages 130-139, XP011325619, ISSN: 1063-8210, DOI: 10.1109/92.920828
   
Note: Within nine months from the publication of the mention of the grant of the European patent, any person may give notice to the European Patent Office of opposition to the European patent granted. Notice of opposition shall be filed in a written reasoned statement. It shall not be deemed to have been filed until the opposition fee has been paid. (Art. 99(1) European Patent Convention).


Description

BACKGROUND OF THE INVENTION


Field of the Invention



[0001] 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



[0002] 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.

[0003] 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.

[0004] 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.

[0005] 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.

[0006] 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.

[0007] The document "An Automated Process for Compiling Dataflow Graphs into Reconfigurable Hardware", Robert Rinker et al, illustrates such a compilation technology. 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.

[0008] 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:

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



[0009] Accordingly, a first embodiment provides a method as detailed in claim 1. Advantageous embodiments are provided in the dependent claims.

BRIEF DESCRIPTION OF THE DRAWINGS



[0010] 

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



[0011] 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 Sij 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 S00.

[0012] 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).

[0013] 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.

[0014] 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.

[0015] 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=0; j<Sj-Dj; j++) for (i=0; i<Si-Di; i++) { a00 = A[i] [j] ; a01 = A[i] [j+1]; a02 = A[i] [j+2] a10 = A[i+1] [j]; a11 = A[i+1] [j+1]; a12 = A[i+1] [j+2] a20 = A[i+2] [j]; a21 = A[i+2] [j+1]; a22 = A[i+2] [j+2] rval = F (a00, a01, a02, a10, a11, a12, 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.

[0016] 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.

[0017] 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.

[0018] 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.

[0019] 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.

[0020] 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.

[0021] 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.

[0022] 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.

[0023] 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.

[0024] 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=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] a00 = a01; a01 = a11; a02 = a12 a10 = a20; a11 = a21; a12 = a22 a22 = aval; a21 = delay (&dly2, a22); a20 = delay (&dly1, a21); rval = F (a00, a01, a02, a10, a11, a12, a20, a21, a22); if ((i >= st) && (j >=0) B [i] [j] = rval; } }

[0025] 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.

[0026] 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.

[0027] 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.

[0028] 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.

[0029] 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.

[0030] 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.

[0031] 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.

[0032] 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.

[0033] 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.

[0034] 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.

[0035] 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.

[0036] 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.

[0037] 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.

[0038] 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.

[0039] 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.

[0040] 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=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] a00 = a01; a01 = a11; a02 = a12 a10 = a20; a11 = a21; a12 = a22 a22 = aval; a21 = delay (&dly2, a22); a20 = delay (&dly1, a21); rval = F1 (a00, a01, a02, a10, a11, a12, 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] b00 = b01; b01 = b11; b02 = b12 b10 = b20; b11 = b21; b12 = b22 b22 = bval; b21 = delay (&dly2, b22); b20 = delay (&dly1, b21); rval = F2 (b00, b01, b02, b10, b11, b12, b20, b21, b22); if ((i >= st) && (j >=0) C[i] [j] = rival; } }

[0041] 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.

[0042] 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]; a00 = a01; a01=a11; a02 = a12 a10 = a20; a11 = a21; a12 = a22 a22 = aval; a21 = delay (&dly2, a22); a20 = delay (&dly1, a21); bval = F1 (a00, a01, a02, a10, a11, a12, a20, a21, a22); b00 = b01; b01 = b11; b02 = b12 b10 = b20; b11 = b21; b12 = b22 b22 = bval; b21 = delay (&dly4, b22); b20 = delay (&dly3, b21); rval = F2 (b00, b01, b02, b10, b11, b12, b20, b21, b22); if ((i >= st) && (j >=0) B[i][j] = rval; } }

[0043] In another embodiment, this technique may be extended to fuse any number of loop nests.

[0044] 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=0; k<Sj-Dj; k+=DEPTH-Di) { st = k; if (st + DEPTH > Si) st = Si - DEPTH; for (xs=0; xs<Sj*DEPTH; xs++) { j = xs/DEPTH - Dj; I = xs%DEPTH + st - Di; aval = A[i+Dj] [j+Dj]; a00 = a01; a01 = a11; a02 = a12 a10 = a20; a11 = a21; a12 = a22 a22 = aval; a21 = delay (&dly2, a22); a20 = delay (&dly1, a21); bval = F1 (a00, a01, a02, a10, a11, a12, a20, a21, a22); b00 = b01; b01 = b11; b02 = b12 b10 = b20; b11 = b21; b12 = b22 b22 = bval; b21 = delay (&dly4, b22); b20 = delay (&dly3, b21); rval = F2 (b00, b01, b02, b10, b11, b12, b20, b21, b22); if ((i >= st) && (j >=0) B[i] [j] = rval; } }

[0045] In an embodiment, the loop combing method above may be pipelined in the reconfigurable hardware to reduce the start-up overhead in the inner loop.

[0046] 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 scope of the invention, as hereinafter claimed.

[0047] 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.


Claims

1. A method of computing a two-dimensional function array for an image processing function selected from one of an edge detection, median filter, erode or dilate, the method being executed in reconfigurable hardware (310) and comprising:

storing a plurality of data values in a two-dimensional source array (304) comprising cells arranged in rows and columns, the source array (304) being stored in a memory outside the reconfigurable hardware (310);

defining in the reconfigurable hardware (310) a 3x3 two-dimensional window array (302) having rows and columns, the window array (302) comprising a first cell (322) at the third row of the middle column, a second cell (328) at the third row of the first column and a third cell (314) at the third row of the right column, wherein inputting a value into the first (322), second (328) and third (314) cells effects a movement within the window array (302) of previous values occupying the respective first (322), second (328) and third (314) cells up the respective columns within the window array (302), such that the previous values occupying the first (322), second (328) and third (314) cells are input into cells of the window array (302) above the first (322), second (328) and third (314) cells;

forming in the reconfigurable hardware (310) a first delay queue (306) and a second delay queue (308), the first delay queue (306) and the second delay queue (308) comprising FIFO buffers and the first (306) and second (308) delay queues having a length equal to the number of rows of the source array (304);

connecting the output of the first delay queue (306) to the input of the second delay queue (308) and to the first cell (322) of the window array (302) wherein inputting a value to the first delay queue (306) results in the output value of the first delay queue (306) being input to the second delay queue (308) and to the first cell (322) of the window array (302);

connecting the output of the second delay queue (308) to the second cell (328) of the window array (302) wherein inputting a value to the second delay queue (308) results in the output value of the second delay queue being input to the second cell (328) of the window array (302);

loading the first delay queue (306), the second delay queue (308) and the window array (302) with junk values;

iteratively reading all the values of the source array (304) column by column, starting from the upper-leftmost corner cell wherein each reading iteration comprises:

inputting the value, read from the two-dimensional source array (304) into the first delay queue (306) and into the third cell (314) of the window array (302);

calculating an output value for the function array for one of the edge detection, median filter, erode or dilate image processing functions based on values of the cells of the window array (302);

wherein the calculating comprises determining whether a value is a junk value and wherein

the output value is stored in a result array unless it is a junk value.


 
2. The method of clam 1, wherein the reconfigurable hardware (310) comprises a field programmable gate array (FPGA).
 


Ansprüche

1. Ein Verfahren des Berechnens einer zweidimensionalen Funktionsmatrix für eine Bildverarbeitungsfunktion, die von einer von Kantendetektion, Medianfilter, Erodieren oder Weiten ausgewählt ist, wobei das Verfahren in umkonfigurierbarer Hardware (310) ausgeführt wird und umfasst:

Speichern einer Vielzahl von Datenwerten in einer zweidimensionalen Quellenmatrix (304), die in Reihen und Spalten angeordnete Zellen umfasst, wobei die Quellenmatrix (304) in einem Speicher außerhalb der umkonfigurierbaren Hardware (310) gespeichert wird;

Definieren einer 3x3 zweidimensionalen Fenstermatrix (302) mit Reihen und Spalten in der umkonfigurierbaren Hardware (310), wobei die Fenstermatrix (302) eine erste Zelle (322) in der dritten Reihe der mittleren Spalte, eine zweite Zelle (328) in der dritten Reihe der ersten Spalte und eine dritte Zelle (314) in der dritten Reihe der rechten Spalte umfasst, wobei Eingeben eines Wertes in die ersten (322), zweiten (328) und dritten (314) Zellen eine Bewegung innerhalb der Fenstermatrix (302) von bisherigen Werten, die die jeweiligen ersten (322), zweiten (328) und dritten (314) Zellen belegen, aufwärts in den jeweiligen Spalten innerhalb der Fenstermatrix (302) derart bewirkt, dass die bisherigen Werte, die die jeweiligen ersten (322), zweiten (328) und dritten (314) Zellen belegen, in Zellen der Fenstermatrix (302) oberhalb der ersten (322), zweiten (328) und dritten (314) Zellen eingegeben werden;

Bilden einer ersten Verzögerungswarteschlange (306) und einer zweiten Verzögerungswarteschlange (308) in der umkonfigurierbaren Hardware (310), wobei die erste Verzögerungswarteschlange (306) und die zweite Verzögerungswarteschlange (308) FIFO-Puffer umfassen und die ersten (306) und zweiten (308) Verzögerungswarteschlangen eine Länge gleich der Anzahl von Reihen und Spalten der Quellenmatrix (304) aufweisen;

Verbinden des Ausgangs der ersten Verzögerungswarteschlange (306) mit dem Eingang der zweiten Verzögerungswarteschlange (308) und mit der ersten Zelle (322) der Fenstermatrix (302), wobei Eingeben eines Wertes in die erste Verzögerungswarteschlange (306) in dem Ausgangswert der ersten Verzögerungswarteschlange (306) resultiert, der in die zweite Verzögerungswarteschlange (308) und in die erste Zelle (322) der Fenstermatrix (302) eingegeben wird;

Verbinden des Ausgangs der zweiten Verzögerungswarteschlange (308) mit der zweiten Zelle (328) der Fenstermatrix (302), wobei Eingeben eines Wertes in die zweite Verzögerungswarteschlange (308) in dem Ausgangswert der zweiten Verzögerungswarteschlange resultiert, der in die zweite Zelle (328) der Fenstermatrix (302) eingegeben wird;

Laden der ersten Verzögerungswarteschlange (306), der zweiten Verzögerungswarteschlange (308) und der Fenstermatrix (302) mit Schrottwerten;

iteratives Lesen aller der Werte der Quellenmatrix (304) Spalte für Spalte, beginnend von der oberen ganz linken Eckzelle, wobei jede Leseiteration umfasst:

Eingeben des Wertes, der von der zweidimensionalen Quellenmatrix (304) in die erste Verzögerungswarteschlange (306) und in die dritte Zelle (314) der Fenstermatrix (302) eingelesen ist;

Berechnen des Ausgangswertes für die Funktionsmatrix für eine der Bildverarbeitungsfunktionen Kantendetektion, Medianfilter, Erodieren oder Weiten basierend auf Werten der Zellen der Fenstermatrix (302);

wobei das Berechnen ein Bestimmen umfasst, ob ein Wert ein Schrottwert ist und wobei

der Ausgangswert in einer Ergebnismatrix gespeichert wird, es sei denn, es ist ein Schrottwert.


 
2. Das Verfahren nach Anspruch 1, wobei die umkonfigurierbare Hardware (310) einen Universalschaltkreis (FPGA) umfasst.
 


Revendications

1. Procédé de calcul d'un réseau fonctionnel en deux dimensions destiné à une fonction de traitement d'image choisie parmi l'un d'une détection de bord, d'un filtre médian, d'une érosion ou d'une dilatation, le procédé étant exécuté dans un matériel reconfigurable (310) et comprenant :

le stockage d'une pluralité de valeurs de données dans un réseau de source en deux dimensions (304) comprenant des cellules disposées en rangées et en colonnes, le réseau de source (304) étant stocké dans une mémoire à l'extérieur du matériel reconfigurable (310) ;

la définition, dans le matériel reconfigurable (310), d'un réseau de fenêtres en deux dimensions 3x3 (302) ayant des rangées et des colonnes, le réseau de fenêtres (302) comprenant une première cellule (322) au niveau de la troisième rangée de la colonne centrale, une seconde cellule (328) au niveau de la troisième rangée de la première colonne, et une troisième cellule (314) au niveau de la troisième rangée de la colonne de droite, dans lequel la saisie d'une valeur dans la première (322), la seconde (328) et la troisième (314) cellules crée un mouvement dans le réseau de fenêtres (302) des valeurs précédentes qui occupent la première (322), la seconde (328) et la troisième (314) cellules respectives, jusqu'aux colonnes respectives dans le réseau de fenêtres (302), de sorte que les valeurs précédentes qui occupent la première (322), la seconde (328) et la troisième (314) cellules soient transmises aux cellules du réseau de fenêtres (302) au-dessus de la première (322), de la seconde (328) et de la troisième (314) cellules ;

la formation, dans le matériel reconfigurable (310), d'une première file d'attente de retard (306) et d'une seconde file d'attente de retard (308), la première file d'attente de retard (306) et la seconde file d'attente de retard (308) comprenant des mémoires tampon FIFO, et la première (306) et la seconde (308) files d'attente de retard ayant une longueur égale au nombre de rangées du réseau de source (304) ;

le raccordement de la sortie de la première file d'attente de retard (306) à l'entrée de la seconde file d'attente de retard (308) et à la première cellule (322) du réseau de fenêtres (302), dans lequel la transmission d'une valeur à la première file d'attente de retard (306) entraîne la transmission de la valeur de sortie de la première file d'attente de retard (306) à la seconde file d'attente de retard (308) et à la première cellule (322) du réseau de fenêtres (302) ;

le raccordement de la sortie de la seconde file d'attente de retard (308) à la seconde cellule (328) du réseau de fenêtres (302), dans lequel la transmission d'une valeur à la seconde file d'attente de retard (308) entraîne la transmission de la valeur de sortie de la seconde file d'attente de retard à la seconde cellule (328) du réseau de fenêtres (302) ;

le chargement de la première file d'attente de retard (306), de la seconde file d'attente de retard (308) et du réseau de fenêtres (302) avec des valeurs indésirables ;

la lecture itérative des toutes les valeurs du réseau de source (304) colonne par colonne, en commençant par la cellule la plus en haut à gauche, dans lequel chaque itération de lecture comprend :

la transmission de la valeur, lue depuis le réseau de source en deux dimensions (304), à la première file d'attente de retard (306) et à la troisième cellule (314) du réseau de fenêtres (302) ;

le calcul d'une valeur de sortie pour le réseau fonctionnel, pour l'une des fonctions de traitement d'image d'une détection de bord, d'un filtre médian, d'une érosion ou d'une dilatation sur la base des valeurs des cellules du réseau de fenêtres (302) ;

dans lequel le calcul comprend la détermination du fait qu'une valeur soit une valeur indésirable ou non, et dans lequel

la valeur de sortie est stockée dans un réseau de résultats, à moins qu'il s'agisse d'une valeur indésirable.


 
2. Procédé selon la revendication 1, dans lequel le matériel reconfigurable (310) comprend un réseau de portes programmables sur site (FPGA).
 




Drawing



































Cited references

REFERENCES CITED IN THE DESCRIPTION



This list of references cited by the applicant is for the reader's convenience only. It does not form part of the European patent document. Even though great care has been taken in compiling the references, errors or omissions cannot be excluded and the EPO disclaims all liability in this regard.

Non-patent literature cited in the description