WO2010087144A1 - 並列比較選択演算装置、プロセッサ及び並列比較選択演算方法 - Google Patents

並列比較選択演算装置、プロセッサ及び並列比較選択演算方法 Download PDF

Info

Publication number
WO2010087144A1
WO2010087144A1 PCT/JP2010/000398 JP2010000398W WO2010087144A1 WO 2010087144 A1 WO2010087144 A1 WO 2010087144A1 JP 2010000398 W JP2010000398 W JP 2010000398W WO 2010087144 A1 WO2010087144 A1 WO 2010087144A1
Authority
WO
WIPO (PCT)
Prior art keywords
vector
index
comparison
selection
data
Prior art date
Application number
PCT/JP2010/000398
Other languages
English (en)
French (fr)
Inventor
久村孝寛
松山英樹
Original Assignee
日本電気株式会社
ルネサスエレクトロニクス株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電気株式会社, ルネサスエレクトロニクス株式会社 filed Critical 日本電気株式会社
Priority to US13/147,157 priority Critical patent/US20120023308A1/en
Priority to JP2010548410A priority patent/JP5500652B2/ja
Publication of WO2010087144A1 publication Critical patent/WO2010087144A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/544Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2207/00Indexing scheme relating to methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F2207/38Indexing scheme relating to groups G06F7/38 - G06F7/575
    • G06F2207/3804Details
    • G06F2207/3808Details concerning the type of numbers or the way they are handled
    • G06F2207/3828Multigauge devices, i.e. capable of handling packed numbers without unpacking them

Definitions

  • the present invention relates to a SIMD (Single Instruction Multiple Multiple Data) type parallel comparison / selection operation apparatus or processor capable of searching a maximum value or minimum value and its index at high speed.
  • SIMD Single Instruction Multiple Multiple Data
  • the SIMD instruction is an instruction for executing the same operation on a plurality of data in parallel.
  • a plurality of data used for calculation is stored in one register.
  • Each of the plurality of data stored in the register is called a sub word.
  • the general number of subwords stored in one register is 2N .
  • an SIMD instruction that performs an addition operation using four subwords stored in a register can be considered.
  • the SIMD instruction is suitable for applications such as image processing that can process a large amount of data in parallel.
  • Non-Patent Documents 1 and 2 introduce processors equipped with SIMD instructions suitable for search processing for the maximum value or minimum value.
  • the PowerPC (registered trademark) command VMAXSW in Non-Patent Document 2 compares elements at corresponding positions of two input vector data, selects the larger one, and outputs vector data composed of the selected elements.
  • An instruction such as VMAXSW is convenient when searching for only the maximum value, but is not useful when searching for the maximum value and its index.
  • a processor called PowerPC uses an instruction VCMPGTSW (see Non-Patent Document 2) for process (1), and uses an instruction VSEL for processes (2) and (3).
  • VCMPGTSW is an instruction for comparing two vector data and outputting 0 or ⁇ 1 according to the comparison result.
  • VSEL is an instruction for selecting one of two vector data for each bit based on control information.
  • processing equivalent to VSEL is performed using logical product operation and logical sum operation.
  • Japanese Patent Laid-Open No. 2004-228561 receives vector data that is ordered, and searches for and outputs the maximum or minimum value and the element number corresponding to the maximum or minimum value in the vector data.
  • a search device is disclosed.
  • the technique disclosed in Patent Document 1 uses an arithmetic unit that simultaneously compares a plurality of elements, and requires an arithmetic unit corresponding to the number of inputs. For this reason, when there are three or more inputs, it is necessary to use a multi-input comparison arithmetic unit corresponding to the number of inputs.
  • three or more multi-input comparison calculators have a processing delay compared to the case of using a two-input comparison calculator.
  • FreescaleTM semiconductor "AltiVecTM Technology Programming Environments Manual”, AltiVec Instructions, ALTIVECPEM, Rev.3, April, 2006, Page index 6-61 (173rd page from the top) of Chapter 6
  • FreescaleTM semiconductor "AltiVecTM Technology Programming Environments Manual”
  • AltiVec Instructions, ALTIVECPEM Rev.3, April, 2006
  • Page index 6-75 (187th page from the top) of Chapter 6
  • an object of the present invention is to provide a parallel comparison / selection operation apparatus and method for efficiently executing a maximum value search or a minimum value search with an index.
  • One aspect of the parallel comparison / selection operation device uses the first vector data including a plurality of elements and the second vector data including the same number of elements as the first vector data, Each element included in the vector data and the second vector data is compared for each corresponding element, and based on the comparison result, one element of the first vector data and the second vector data is selected and selected.
  • a vector comparison / selection unit that generates third vector data composed of the elements, a first index vector including an index corresponding to each element included in the first vector data, and the second vector data Based on the comparison result using a second index vector including an index corresponding to each element and the comparison result, Selecting one of the elements of serial said the first index vector second index vector comprises a index vector selection unit for generating a third index vector composed of the selected element, the.
  • an aspect of the processor according to the present invention includes the above-described parallel comparison / selection operation device.
  • one aspect of the parallel comparison / selection calculation method is the first vector data including a plurality of elements, the second vector data including the same number of elements as the first vector data, and the first vector data.
  • the first vector data and the second vector data Each included element is compared for each corresponding element, and based on the comparison result, one element of the first vector data and the second vector data is selected, and third vector data composed of the selected elements And generating the third index based on the comparison result, the first index information, and the second index vector.
  • Select the index corresponding to each element in Kutorudeta generating a third index vector composed of a plurality of selected index, and wherein.
  • the maximum value search or the minimum value search with an index can be executed efficiently.
  • FIG. 1 shows the structure of the processor in exemplary embodiment of this invention. It is a figure which shows the structural example of the parallel comparison selection arithmetic unit in 1st embodiment of a processor. It is a figure which shows the structural example of the vector comparison selection unit of the parallel comparison selection calculation unit of FIG. It is a figure which shows the structural example of the division
  • FIG. 16 is a diagram illustrating a configuration example of an index / vector selection unit used in the parallel comparison / selection operation unit of FIG. 2 or the parallel comparison / selection operation unit of FIG. 15. It is a figure showing the concept of the search process of the maximum value or the minimum value in exemplary embodiment of this invention. It is a figure showing the flowchart for performing the search process of the maximum value or the minimum value in exemplary embodiment of this invention based on the concept of FIG. It is a figure showing the specific processing content of step1 of the flowchart of FIG. 9 in 1st embodiment. It is a figure showing the specific processing content of step5 of the flowchart of FIG.
  • FIG. 3 is a diagram illustrating an instruction that can be used as an instruction for operating the parallel comparison / selection operation unit of FIG. 2 in the first embodiment.
  • the processor represents a maximum value or a minimum value and its index from 16 pieces of 16-bit data.
  • FIG. 10 is a diagram illustrating a specific processing example of step 6 in the flowchart of FIG. 9. It is a figure which shows the structural example of the parallel comparison arithmetic unit in 2nd embodiment of a processor. It is a figure which shows the structural example of the index vector generation unit used with the parallel comparison selection calculation unit of FIG. It is a figure which shows the meaning of the control signal of the index vector generation unit of FIG. 16A.
  • FIG. 16 is a diagram illustrating an instruction that can be used as an instruction for operating the parallel comparison / selection operation unit of FIG. 15 in the second embodiment. In 2nd Embodiment, it is a figure showing how a processor calculates
  • vector data is a set of a plurality of elements (data).
  • the index vector is a set of element numbers (element numbers) included in the vector data.
  • the number of the element (data) in the vector data is called an index.
  • an exemplary embodiment of the present invention includes a processor 200 and a memory (storage unit) 100.
  • the processor 200 includes an instruction decoder 210, an instruction execution unit 220, a register bank (temporary storage unit) 230, and a parallel comparison / selection operation unit (parallel comparison / selection operation device) 240.
  • the memory 100 stores programs and data for the processor 200.
  • the program is composed of a plurality of instructions.
  • the register bank 230 has a plurality of registers.
  • a program counter for storing an instruction read address in the memory 100 is also included in the register bank 230.
  • the instruction decoder 210 reads an instruction from the memory 100 using an address indicated by the program counter existing in the register bank 230 in synchronization with the clock signal, decodes the instruction, and executes the instruction execution unit 220 or the parallel comparison / selection operation unit 240. Information such as the instruction code of the instruction, input operand, and output is transmitted to. Which unit the instruction decoder 210 transmits information to depends on the instruction code. If the instruction code represents an operation executed by the parallel comparison / selection operation unit 240, information such as the instruction code is transmitted to the parallel comparison / selection operation unit 240. Further, the instruction decoder 210 adds the word length of the instruction to the program counter existing in the register bank 230.
  • the instruction execution unit 220 Based on the information such as the instruction code and operand given from the instruction decoder 210, the instruction execution unit 220 reads the contents of the input operand from the register bank 230 or the memory 100, executes the operation corresponding to the instruction code, and executes the operation result. Write to the register bank 230 or the memory 100 as an output operand.
  • the parallel comparison / selection operation unit 240 performs comparison and selection related to vector data and the corresponding index vector.
  • the parallel comparison / selection operation unit 240 reads input vector data and index vectors from the register bank 230.
  • the output data of the parallel comparison / selection operation unit 240 is vector data and an index vector, and the parallel comparison / selection operation unit 240 writes them into the register bank 230.
  • the parallel comparison / selection operation unit 240 according to the first embodiment will be described with reference to FIG.
  • the parallel comparison / selection operation unit 240 according to the first embodiment includes a vector comparison / selection unit 242 and an index / vector selection unit 243.
  • the input signals of the parallel comparison / selection operation unit 240 in the first embodiment are a control signal input from the instruction decoder 210 and four data input from the register bank 230. These four data are vector data 1 (first vector data), vector data 2 (second vector data), index vector 1 (first index vector), and index vector 2 (second index vector). .
  • the output signals of the parallel comparison / selection operation unit 240 in the first embodiment are vector data 3 (third vector data) and an index vector 3 (third index vector).
  • the vector comparison / selection unit 242 compares the vector data 1 and the vector data 2 and outputs the comparison result to the index / vector selection unit 243 as a comparison result vector, and the vector data 1 and the vector data 2 based on the comparison result. An appropriate element is selected from the above, and the selected element is output as vector data 3.
  • the index vector selection unit 243 selects an appropriate element from the index vector 1 and the index vector 2 based on the comparison vector given from the vector comparison selection unit 242, and outputs the selected element as the index vector 3. To do.
  • the vector comparison / selection unit 242 will be described with reference to FIG.
  • the vector comparison / selection unit 242 includes two division units 10 and 11, two combination units 20 and 21, and a plurality of comparison / selection units 30 to 33.
  • FIG. 3 shows a case where the number of comparison / selection units is four.
  • the input signals of the vector comparison / selection unit 242 are a control signal from the instruction decoder 210 and vector data 1 and vector data 2 from the register bank 230.
  • the output signals of the vector comparison / selection unit 242 are the comparison result vector and the vector data 3.
  • One division unit (first vector division unit) 10 receives vector data 1, divides vector data 1 into several elements based on a control signal, and outputs them one by one to comparison / selection units 30-33. To do.
  • the control signal to the division unit 10 represents the number of divisions.
  • the other division unit (second vector division unit) 11 receives the vector data 2, divides the vector data 2 into several elements based on the control signal, and divides them one by one into the comparison / selection unit 30. Output to ⁇ 33.
  • the dividing unit 10 divides each of the vector data 1 and the vector data 2 into four elements, and sends each element to the comparison / selection units 30 to 33.
  • the comparison / selection units 30 to 33 based on the control signal, the element a given from one division unit 10 and the element b given from the other division unit 11, are compared with the comparison result c and the selection element. x is output. That is, each of the comparison / selection units 30 to 33 compares two P-th elements (P is an integer of 0 or more) of the vector data 1 and the vector data 2 based on the control signal. In FIG. 3, P matches the numerical values 0 to 3 added to the element a (a0 to a3) and the element b (b0 to b3).
  • One combining unit (vector combining unit) 21 combines a plurality of selection elements x given from the comparison / selection units 30 to 33 and outputs them as vector data 3.
  • the other combination unit (comparison result combination unit) 20 combines a plurality of comparison results c given from the plurality of comparison selection units 30 to 33 and outputs them as comparison result vectors.
  • one combining unit 20 combines elements x0, x1, x1, x2, and x3 given from the four comparison / selection units 30 to 33, and outputs them as vector data 3, and the other combining unit.
  • 21 combines the comparison results c0, c1, c2, and c3 given from the four comparison selection units 30 to 33, and outputs them as comparison result vectors.
  • components having the same name with different reference numerals for example, a plurality of divided units indicated by divided units 10 to 14 have the same function.
  • the components having the same name also have the same functions in the coupling units 20 to 23 and the comparison selection units 30 to 33. The same applies to selection units 40 to 44 and comparison unit 50 described later.
  • each component may be described using a single reference (for example, the division unit 10 in FIG. 4).
  • the division unit 10 will be described with reference to FIG.
  • the division unit 10 divides m (m> 0 integer) -bit input data into dnum (m / dnum) -bit data based on the control signal dnum (integer of dnum> 0).
  • the control signal dnum represents the number of data after division. In FIG. 4, the control signal dnum is 4, indicating that the division unit 10 divides m-bit input data into four (m / 4) -bit data.
  • the coupling unit 20 will be described with reference to FIG. Based on the control signal dnum, the combining unit 20 combines dnum n (n> 0 integer) bit input data into (dnum * n) bit data.
  • the control signal dnum represents the number of data before combining. In FIG. 5, the control signal dnum is 4, and the combining unit 20 combines four n-bit input data into one (4 * n) bit data.
  • the comparison / selection unit 30 will be described with reference to FIGS. 6A, 6B, and 6C.
  • the comparison / selection unit 30 includes a selection unit 40 and a comparison unit 50.
  • Input signals of the comparison / selection unit 30 are a control signal cmode, data a, and data b.
  • Output signals of the comparison / selection unit 30 are selection data x and a comparison result c.
  • the comparison unit 50 compares the data a and the data b based on the control signal cmode, and outputs a comparison result c.
  • the relationship between the control signal cmode, the comparison formula, and the comparison result is as shown in the table of FIG. 6B.
  • the control signal to the comparison unit 50 represents a comparison formula.
  • the comparison unit 50 compares the data a and the data b using a comparison formula corresponding to the control signal.
  • the operation of the comparison unit 50 can be expressed using the function compare ().
  • the selection unit 40 uses the comparison result c given from the comparison unit 50 as a selection signal, selects either data a or data b, and outputs it as selection data x.
  • the relationship between the selection signal (comparison result c) and the selection data x is as shown in the table of FIG. 6C.
  • the selection unit 40 selects and outputs either the input signal a or b according to the selection signal. Specifically, if the selection signal c is 0, the data a is selected, otherwise the data b is selected, and the selected data becomes the selection data x.
  • the index vector selection unit 243 will be described with reference to FIG.
  • the index / vector selection unit 243 includes three division units 12 to 14, a plurality of selection units 41 to 44, and one combination unit 22.
  • FIG. 7 shows the case where the number of selected units is four.
  • the input signals of the index vector selection unit 243 are a control signal, an index vector 1, an index vector 2, and a comparison result vector.
  • the output signal of the index vector selection unit 243 is the index vector 3.
  • the division unit (first index division unit) 12 in FIG. 7 divides the index vector 1 into a plurality of elements based on the control signal.
  • the division unit (second index division unit) 13 in FIG. 7 uses the index vector 2 and the division unit (comparison result division unit) 14 in FIG.
  • Divide into The selection units 41 to 44 use either the element g given from the division unit 12 or the element h given from the division unit 13 by using the element c (comparison result c) given from the division unit 14 as a selection signal. Is selected and output as element z.
  • the combining unit 22 combines the element z given from the plurality of selection units 41 to 44 into one vector based on the control signal, and outputs it as an index vector 3.
  • FIG. 8 shows the concept of search processing for the maximum value or the minimum value.
  • N N> 0 integer
  • the N data is divided into dnum groups. The N pieces of data are divided so that the remainder obtained by dividing the data index by dnum is equal.
  • dnum is an arbitrary positive integer, but dnum is preferably a power of 2 for ease of implementation.
  • dnum search processes can be executed in parallel in (3).
  • the embodiment of the present invention executes a search process for the maximum value or the minimum value based on the concept of FIG.
  • FIG. 9 is a flowchart for executing search processing for a maximum value or a minimum value based on the concept of FIG. 8 in an exemplary embodiment of the present invention.
  • This flowchart represents the processing contents of the program for the processor 200 of FIG.
  • the program is stored in the memory 100 of FIG.
  • the processor 200 searches the maximum value or the minimum value and its index from a plurality of data by executing the program.
  • a plurality of data is stored in the memory 100.
  • the search process for the maximum value or the minimum value in the first embodiment is composed of six steps.
  • Step 1 is a step for initializing the search process.
  • Step 2 is a step for checking whether or not unprocessed data remains.
  • Step 3 is a step of reading data.
  • Step 4 is a step of updating the data index.
  • Step 5 is a step of comparing the two vectors for each corresponding element and selecting the larger or smaller element. When an element is selected, the index corresponding to that element is also selected.
  • Step 2 to step 5 are repeated until there is no unprocessed data. The repetition of step 2 to step 5 corresponds to (2) and (3) in FIG.
  • step 5 The vectors to be compared in step 5 are grouped at the position of each element in the register, and comparison and selection are performed for each group. The selected element is stored again in the register and used in the next step 5.
  • step 2 to step 5 the maximum value or the minimum value of each group selected by step 5 is combined as one vector, and the vector is stored in the register.
  • Step 6 to be executed last is a step of selecting the maximum value or the minimum value from all the elements of one vector.
  • an index corresponding to the value is also selected.
  • Step 6 corresponds to (4) in FIG.
  • step 1 to step 6 correspond to the process of the same step number shown in FIG.
  • Step 1 in the first embodiment will be described with reference to FIG.
  • the processor 200 stores dnum initial selection values (initial values of selection values) in the register Rc of the register bank 230, and dnum indexes corresponding thereto in the register Rd.
  • dnum initial selection values are s0, s1, s2, and s3 stored in the memory 100, and their indexes are 0, 1, 2, and 3, respectively.
  • step 2 in the first embodiment the processor 200 calculates the number of unprocessed data. If it is larger than 0, the processor 200 moves to step 3, and if not, it moves to step 6.
  • step 3 in the first embodiment the processor 200 reads the next dnum pieces of data from the memory 100 and stores them in the register Ra.
  • the next dnum pieces of data are s4, s5, s6, and s7.
  • step 4 in the first embodiment the processor 200 stores the index of the next dnum pieces of data in the register Rb.
  • the next dnum pieces of data are s4, s5, s6, and s7, their indexes are 4, 5, 6, and 7, respectively.
  • Step 5 in the first embodiment will be described with reference to FIG.
  • the processor 200 operates the parallel comparison / selection operation unit 240 of FIG. 2 to perform inter-vector comparison / selection processing.
  • the inter-vector comparison and selection process is a process of comparing two vector data for each corresponding element, selecting a larger or smaller element, and further selecting an index corresponding to the selected element.
  • Two vector data are set as vector data 1 and vector data 2, and index vectors corresponding to them are set as index vector 1 and index vector 2.
  • the vector data 1 is stored in the register Ra
  • the index vector 1 is stored in the register Rb
  • the vector data 2 is stored in the register Rc
  • the index vector 2 is stored in the register Rd.
  • step 5 the processor 200 reads an instruction for operating the parallel comparison / selection operation unit 240 from the memory 100. Then, the instruction decoder 210 decodes the instruction and sends the instruction code and operand information of the instruction to the parallel comparison / selection operation unit 240 as a control signal. In response to the control signal from the instruction decoder 210, the parallel comparison / selection operation unit 240 reads the vector data 1, the index vector 1, the vector data 2, and the index vector 2 from the registers Ra, Rb, Rc, and Rd, and performs the vector comparison. The selection unit 242 and the index vector selection unit 243 are operated to output the vector data 3 and the index vector 3 to the registers Rc and Rd, respectively.
  • the division units 10 and 12 divide the vector data 1 and the vector data 2 for each element.
  • the dividing unit 10 divides the vector data 1 into the elements s4 to s7
  • the dividing unit 11 divides the vector data 2 into the elements s0 to s3.
  • the plurality of comparison / selection units 30 to 33 (FIG. 3) perform comparison / selection processing for each element.
  • the comparison unit 50 (FIG.
  • cmode represents a control signal to the comparison selection units 30 to 33.
  • c0 compare (cmode, s0, s4)
  • c1 compare (cmode, s1, s5)
  • c2 compare (cmode, s2, s6)
  • c3 compare (cmode, s3, s7)
  • c0 to c3 and x0 to x3 correspond to data having the same code in FIG.
  • the combining unit 20 combines x0 to x3 and generates vector data 3.
  • the combining unit 21 combines c0 to c3, generates a comparison result vector, and outputs it to the index vector selection unit 243.
  • the division units 12 and 13 divide the index vector 1 and the index vector 2 for each element (for each index).
  • the dividing unit 12 divides the vector data 1 into each element i4 to i7
  • the dividing unit 13 divides the vector data 2 into each element i0 to i3.
  • the dividing unit 14 divides the comparison result vector into each element of c0 to c3.
  • the selection units 41 to 44 select appropriate data from the registers Rb and Rd in the same manner as the selection unit 40 (FIG. 6A) of the vector comparison / selection unit 242. Specifically, the selection units 41 to 44 select using the following functions.
  • z0 select (c0, i0, i4)
  • z1 select (c1, i1, i5)
  • z2 select (c2, i2, i6)
  • z3 select (c3, i3, i7)
  • z0 to z3 correspond to the data of the same code in FIG.
  • the combining unit 22 combines z0 to z3 and generates an index vector 3.
  • the vector data 3 generated by the vector comparison / selection unit 242 is stored in the register Rc.
  • the index vector 3 generated by the index vector selection unit 243 is stored in the register Rd.
  • the vector data 3 and the index vector 3 are stored in the register Rc and the register Rd. Therefore, as shown in FIG. 11, the vector data read into the register Ra is called comparison target data, and the data set in the register Rc is called a current selection value.
  • FIG. 12 shows instructions that can be used as instructions for operating the parallel comparison / selection operation unit 240 in step 5.
  • FIG. 12 shows the syntax of eight instructions, two control signals that the instruction decoder 210 sends to the parallel comparison / selection operation unit 240 according to the instructions, and an explanation of the instructions.
  • the two control signals are a control signal cmode sent to the comparison selection units 30 to 33 in the parallel comparison / selection operation unit 240 and a control signal sent to the dividing unit 10 and the combination unit 20 in the parallel comparison / selection operation unit 240.
  • dnum For example, MAX.
  • the instruction H is an instruction that compares 16-bit values using a comparison expression (Ra ⁇ Rc) and selects the larger value. MAX.
  • cmode 0 means a comparison operation ⁇ .
  • MAX means a comparison operation ⁇ .
  • dnum means the number of data after division or before combination.
  • FIG. 13 shows how the maximum value or minimum value and its index are obtained from 16 pieces of 16-bit data. Processing starts from the upper right of FIG. In step 1, the processor 200 stores the vector data of the initial selection value and the corresponding index vector (initial index) in the registers Rc and Rd, respectively. At step 2 (not shown in FIG. 13), the processor 200 moves to step 3 because 12 unprocessed data remain. In step 3, the processor 200 reads four pieces of data to be compared into the register Ra. In step 4, the processor 200 stores four indexes of data to be compared in the register Rb. In step 5, the processor 200 executes the first inter-register comparison / selection process using the registers Ra, Rb, Rc, and Rd. The data and index selected by the first inter-register comparison / selection process are stored in the registers Rc and Rd, respectively. The first register comparison / selection process is numbered (1).
  • step 2 Data read second time (3)
  • step 4 Index update (4)
  • step 5 Inter-register comparison selection processing second time (5)
  • step 3 Data read third time (6)
  • step 4 Index update (7)
  • step 5 Register 3rd comparison selection process
  • step 3 of (2) the processor 200 reads four new data into the register Ra.
  • step 4 of (3) the processor 200 calculates an index of four new data using the index of the register Rb, and stores it in the register Rb.
  • the index update calculation method is to add 4 to each element of the register Rb.
  • step 5 of (4) the processor 200 executes the second inter-register comparison / selection process. Similarly, (5), (6), and (7) are executed.
  • Step 6 is a step of searching for the maximum value or the minimum value among all the elements of the vector stored in one register, and taking out the index corresponding to the value from the other register. In step 6, whether the processor 200 searches for the maximum value or the minimum value is determined by a program stored in the memory 100.
  • the selection values selected from the four groups are stored in the register Rc, and the indexes of the selection values selected from the four groups are stored in the register Rd.
  • the processor 200 determines that the four selection values x0 ′′, x1 ′′, x2 ′′, x3 ′′ stored in the register Rc and the four indexes z0 ′′, z1 ′′, z2 ′′, z3 ′′ stored in the register Rd. Are stored in separate registers one by one.
  • the processor 200 performs comparison / selection processing three times to further select one value from the four selection values.
  • the processor 200 compares x0 ′′ with x1 ′′ and selects the value that satisfies the comparison condition.
  • the processor 200 selects either the index z0 ′′ or z1 ′′. For example, if x0 " ⁇ x1" is true, z0 "is selected, otherwise z1" is selected.
  • step 6 there are three comparison selection processes, but the same comparison condition is used for all comparison selection processes.
  • the processor 200 compares x2 ′′ and x3 ′′ and selects a value that satisfies the comparison condition. Based on the comparison result of x2 ′′ and x3 ′′, the processor 200 selects either the index z2 ′′ or z3 ′′.
  • the values selected by the first and second comparison / selection processes are set to x0 ′ ′′ and x1 ′ ′′, and their indices are set to z0 ′ ′′ and z1 ′ ′′.
  • the processor 200 performs a third comparison / selection process.
  • the processor 200 compares x0 ′ ′′ and x1 ′ ′′ and selects the value that satisfies the comparison condition. Based on the comparison result between x0 ′ ′′ and x1 ′ ′′, the processor 200 selects either the index of z0 ′ ′′ or z1 ′ ′′. It is assumed that the value and index selected in the third comparison / selection process are x0 "" and z0 "".
  • x0 "" is the maximum value or the minimum value selected from x0 ", x1", x2 ", x3" by the processor 200 in step 6, and is the maximum value among all data.
  • Z0 "" is an index of x0 "".
  • the parallel comparison / selection operation unit of the first embodiment includes the vector data 1, the vector data 2, the index vector 1 composed of the indices of the elements of the vector data 1, and the vector data 2 And an index vector 2 composed of indices of the respective elements are used as input signals.
  • the parallel comparison / selection operation unit compares each element of the vector data 1 and the vector data 2 and generates vector data 3 in which one of the vector data 1 and the vector data 2 is selected for each element based on the comparison result.
  • the parallel comparison / selection operation unit selects either the index vector 1 or the index vector 2 for each element (for each index) based on the comparison result, and sets the selected plurality of elements as the index vector 3. Generate. Then, the parallel comparison / selection operation unit outputs the vector data 3 and the index vector 3.
  • the parallel comparison / selection operation unit of this embodiment two vector data can be compared for each element, one element can be selected based on the comparison result, and an index corresponding to the selected element can be selected.
  • a processor including the parallel comparison / selection operation unit of the present embodiment can efficiently execute a maximum value search or a minimum value search with an index.
  • the processor efficiently performs the inter-vector comparison / selection process and obtains the maximum value or the minimum value using the result of the vector relation comparison / selection process. Is possible.
  • the comparison results output from the comparison selection units 30 to 31 in the vector comparison / selection unit 242 are output to the index / vector selection unit 243 as comparison result vectors that are sets of a plurality of comparison results.
  • the case has been described (FIGS. 2, 3, 7).
  • the configuration is not limited to this, and a configuration in which a plurality of comparison results are output as a plurality of selection signals from the vector comparison selection unit 242 to the index / vector selection unit 243 may be used.
  • the coupling unit 21 (FIG. 3) and the dividing unit 14 (FIG. 7) may not be provided.
  • the comparison result vector there is an advantage that it is easy to cope with a case where the number of elements included in the vector changes.
  • the data width of each element of the vector data can be made variable by using the division unit and the combination unit. For example, vector data composed of elements having a data width of 16 bits can be processed, or vector data composed of elements having a data width of 8 bits can be processed. However, the data widths of all elements in one vector data must be the same. On the other hand, when no division unit or combination unit is used, only vector data composed of elements having a predetermined data width can be processed. Vector data composed of elements with other data widths cannot be processed.
  • the parallel comparison / selection operation unit 240a in the second embodiment will be described with reference to FIG.
  • the processor 200 shown in FIG. 1 uses a parallel comparison / selection operation unit 240a shown in FIG. 15 instead of the parallel comparison / selection operation unit 240.
  • first index information information about the index of the vector data 1
  • the index of the first element (0th element) of the vector data 1 is used as the first index information
  • the index of the first element is referred to as a start index 1.
  • the parallel comparison / selection operation unit 240a of the second embodiment includes a vector comparison / selection unit 242, an index / vector selection unit 243, an index / vector generation unit 241, and an update unit 244.
  • the input signals of the parallel comparison / selection operation unit 240 a in the second embodiment are a control signal from the instruction decoder 210 and four data from the register bank 230. These four data are vector data 1, vector data 2, start index 1, and index vector 2.
  • the output signals of the parallel comparison / selection operation unit 240a in the second embodiment are the vector data 3 and the start index 1.
  • the configurations and operations of the vector comparison / selection unit 242 and the index / vector selection unit 243 in the second embodiment are the same as those in the first embodiment.
  • the index vector generation unit 241 will be described with reference to FIGS. 16A and 16B. As shown in FIG. 16A, the index vector generation unit 241 includes a combining unit 23. The input signals of the index vector generation unit 241 are a control signal from the instruction decoder 210 and a start index 1 from the register bank 230. The output signal of the index vector generation unit 241 is the index vector 1.
  • the index vector generation unit 241 generates the index vector 1 from the start index 1 based on the control signal.
  • the relationship between the control signal, the start index 1, and the index vector 1 is as shown in the table of FIG. 16B.
  • the index vector generation unit 241 calculates three data of idx + 1 * s, idx + 2 * s, idx + 3 * s, and sends four data together with idx to the combining unit 20. Further, the index vector generation unit 241 sends a signal dnum to the combining unit 23 based on the control signal.
  • s integer of s> 0
  • dnum is a signal indicating the number of data to be combined by the combining unit 20. If the control signal is 0, s is 2. In FIG. 16B, if the control signal is 1, s is 4. If the control signal is 0, the combining unit 20 combines the four data, idx, idx + 2, idx + 4, idx + 6, and outputs them as an index vector 1. If the control signal is 1, the combining unit 20 combines the two data, idx and idx + 4, and outputs them as an index vector 1.
  • the update unit 244 will be described with reference to FIGS. 17A and 17B.
  • the input signals to the update unit 244 are the start index 1 and the control signal.
  • the output signal of update unit 244 is start index 1.
  • Update unit 244 increments start index 1.
  • the increment of the increment is a value called step.
  • the step is determined by the control signal. The relationship between the control signal and step is as shown in the table of FIG. 17B. If the control signal is 0, step is 2. If the control signal is 1, step is 4.
  • the parallel comparison / selection operation unit 240a of the processor 200 is configured as shown in FIG.
  • the second embodiment searches for a maximum value or a minimum value and its index from among a plurality of data based on the concept of FIG. 8 and the flowchart of FIG.
  • step 1 to step 6 correspond to the process of the same step number shown in FIG.
  • Step 1 in the second embodiment will be described with reference to FIG. Step 1 in the second embodiment is different from step 1 in the first embodiment.
  • the processor 200 stores dnum initial selection values in the register Rc of the register bank 230, and dnum indexes corresponding to them in the register Rd. Further, the index of the next dnum pieces of data stored in the register Rc is stored in the register Rb as a start index. Storing the start index in the register Rb is different from step 1 in the first embodiment.
  • dnum initial selections are s0, s1, s2, and s3 stored in the memory 100, and their indexes are 0, 1, 2, and 3, respectively. Since the next data is s4, the start index is 4.
  • Step 2 in the second embodiment is exactly the same as step 2 in the first embodiment.
  • the processor 200 calculates the number of unprocessed data. If it is greater than 0, the processor 200 moves to step 3, and if not, it moves to step 6.
  • Step 3 in the second embodiment is exactly the same as step 3 in the first embodiment.
  • the processor 200 reads the next dnum pieces of data from the memory 100 and stores them in the register Ra.
  • the next dnum pieces of data are s4, s5, s6, and s7.
  • Step 4 and step 5 in the second embodiment are executed in parallel.
  • step 4 and step 5 in the second embodiment will be described.
  • the processor 200 operates the parallel comparison / selection operation unit 240a of FIG. 15 to perform index update and inter-vector comparison / selection processing. That is, in the second embodiment, the parallel comparison / selection operation unit 240a executes step 4 and step 5 in parallel.
  • the inter-vector comparison and selection process in the second embodiment will be described.
  • the inter-vector comparison and selection process is a process of comparing two vector data for each corresponding element, selecting a larger or smaller element, and further selecting an index corresponding to the selected element. This is the same as the inter-vector comparison and selection process in the first embodiment.
  • the difference from the first embodiment is how to give one vector data index.
  • the index of the first element of one vector data is stored in the register as a start index.
  • the parallel comparison / selection operation unit 240a in FIG. 15 generates all indexes of one vector data from the start index.
  • vector data 1 is stored in register Ra
  • start index 1 is stored in register Rb
  • vector data 2 is stored in register Rc
  • index vector 2 is stored in register Rd.
  • the processor 200 reads an instruction for operating the parallel comparison / selection operation unit 240a of FIG. Then, the instruction decoder 210 decodes the instruction and sends the instruction code and operand information of the instruction to the parallel comparison / selection operation unit 240a of FIG. 15 as a control signal. In response to the control signal from the instruction decoder 210, the parallel comparison / selection operation unit 240a reads the vector data 1, the start index 1, the vector data 2, and the index vector 2 from the registers Ra, Rb, Rc, and Rd, and the index vector. The generation unit 241, the vector comparison / selection unit 242, the index / vector selection unit 243, and the update unit 244 are operated to output the vector data 3 and the start index 3 to the registers Rc and Rd, respectively.
  • step 5 of the parallel comparison / selection operation unit 240a of FIG. 15 will be specifically described using the data and the function notation shown in FIG. Since the operation of the parallel comparison / selection operation unit 240a is the same as the operation of step 5 of the first embodiment, the function notation will be mainly described, and the other operations will be omitted.
  • the plurality of comparison / selection units 30 to 33 (FIG. 3) perform a comparison / selection process for each element.
  • the comparison unit 50 (FIG. 6A) in the plurality of comparison selection units 30 to 33 compares the data stored in the registers Ra and Rc with the function compare ().
  • the comparison unit 50 in the plurality of comparison selection units 30 to 33 performs comparison using the following function.
  • “cmode” represents a control signal to the comparison selection units 30 to 33.
  • c0 compare (cmode, s0, s4)
  • c1 compare (cmode, s1, s5)
  • c2 compare (cmode, s2, s6)
  • c3 compare (cmode, s3, s7)
  • c0 to c3 and x0 to x3 correspond to data having the same code in FIG.
  • the combining unit 20 combines x0 to x3 and generates vector data 3.
  • the combining unit 21 combines c0 to c3, generates a comparison result vector, and outputs it to the index vector selection unit 243.
  • z0 to z3 correspond to the data of the same code in FIG.
  • the combining unit 22 combines z0 to z3 and generates an index vector 3.
  • the vector data 3 generated by the vector comparison / selection unit 242 is stored in the register Rc.
  • the index vector 3 generated by the index vector selection unit 243 is stored in the register Rd.
  • the contents (processing contents) of the function compare () and the function select () are the same as those in the first embodiment.
  • FIG. 20 shows instructions that can be used as instructions for operating the parallel comparison / selection operation unit 240a in steps 4 and 5.
  • FIG. 20 shows the syntax of eight instructions, three control signals that the instruction decoder 210 sends to the parallel comparison / selection operation unit 240a of FIG. 15 according to the instructions, and an explanation of the instructions.
  • the three control signals are the control signal cmode sent to the comparison / selection units 30 to 33 in the parallel comparison / selection operation unit 240a in FIG. 15, the division unit 10 and the combination unit 20 in the parallel comparison / selection operation unit 240a in FIG.
  • the instruction H is an instruction that compares 16-bit values using a comparison expression (Ra ⁇ Rc), selects the larger value based on the comparison result, and adds 4 to the start index.
  • the value of dnum in the case of the H instruction is 4. dnum represents the number of data after division or before combination.
  • the control signal to the index vector generation unit 241 in the case of the H instruction is 0. This represents adding 4 to the start index 1.
  • FIG. 21 shows how to obtain the maximum value or the minimum value and its index from 16 pieces of 16-bit data. Processing starts from the upper right of FIG. In step 1, the processor 200 stores the vector data of the initial selection value and the corresponding index vector (initial index) in the registers Rc and Rd, respectively, and stores the first start index in the register Rb. At step 2 (not shown in FIG. 21), the processor 200 moves to step 3 because 12 unprocessed data remain.
  • step 3 the processor 200 reads four pieces of data to be compared into the register Ra.
  • step 4 and step 5 the processor 200 executes the first index update and inter-register comparison / selection processing using the registers Ra, Rb, Rc, and Rd.
  • the start index updated by the first index update is stored in the register Rb.
  • the data and index selected by the first inter-register comparison / selection process are stored in the registers Rc and Rd, respectively.
  • the first index update and inter-register comparison / selection processing are numbered (1).
  • step 2 data read second time
  • step 4 and step 5 index update and inter-register comparison selection process second time
  • step 3 data read third time
  • step 4 and step 5 index update and inter-register comparison selection process 3rd
  • step 3 of (2) the processor 200 reads four new data into the register Ra.
  • step 4 and step 5 of (3) the processor 200 executes the second index update and inter-register comparison / selection processing. Similarly, (4) and (5) are executed.
  • Step 6 is executed after (5) of FIG. Step 6 in the second embodiment is exactly the same as step 6 in the first embodiment.
  • the processor 200 searches for the maximum value or the minimum value among all the elements of the vector stored in one register, and extracts the index corresponding to the value from the other register.
  • step 6 is executed, the maximum value or the minimum value of all data and its index are obtained.
  • the parallel comparison / selection operation unit of the second embodiment includes the vector data 1, the vector data 2, the start index 1 representing the index of the first element of the vector data 1, and the vector data 2 respectively.
  • An index vector 2 composed of element indices is used as an input signal.
  • the parallel comparison / selection operation unit compares each element of the vector data 1 and the vector data 2 and generates vector data 3 by selecting either the vector data 1 or the vector data 2 for each element based on the comparison result.
  • the parallel comparison / selection operation unit generates an index of another element of the vector data 1 based on the start index 1, sets the generated index and the start index 1 as the index vector 1, and sets the index based on the comparison result.
  • the parallel comparison / selection operation unit outputs vector data 3, an index vector 3, and a start index 3.
  • the parallel comparison / selection operation unit of this embodiment the following effects can be obtained in addition to the first embodiment.
  • the capacity of the register holding the index vector can be reduced. Specifically, the capacity of the register bank 230 in FIG. 1 can be reduced. This is because the index of the number of elements is held as the index of the comparison target data in the first embodiment, but can be reduced to one start index in the second embodiment.
  • the processing time can be reduced by providing the update unit. Specifically, in the first embodiment, the index is updated (step 4 in FIG. 8) when the processor 200 executes an instruction. In the second embodiment, the index is updated by the update index in the parallel comparison / selection unit. That is, it is executed by hardware. Therefore, the number of instructions executed by the processor 200 is reduced. Therefore, the entire processing time can be reduced.
  • a parallel comparison / selection operation device for maximum value search or minimum value search with an index.
  • This parallel comparison / selection operation apparatus and method compare two vector data for each element, select one of the elements based on the comparison result, and further, an index corresponding to the two vector data based on the comparison result Either can be selected for each element.
  • a processor equipped with this parallel comparison / selection operation device can efficiently execute a maximum value search or a minimum value search with an index.
  • the maximum or minimum value of a vector including a plurality of elements and the corresponding intex are efficiently searched by using a plurality of two-input comparators. be able to. Specifically, a plurality of elements are read into a register and compared. Thereby, the efficiency at the time of reading a plurality of elements of a vector from a register can be improved.
  • a plurality of comparison calculators for comparing two values are provided, and a plurality of two-input comparison calculators are used to compare the elements of the vector in parallel to search for the maximum value or minimum value of the vector.
  • Using a plurality of two-input comparators can reduce the processing delay compared to using a multi-input comparator. Also in the manufacture of a circuit, it is easier to make a plurality of two-input comparators than to make a multi-input comparator. This can also be expected to reduce costs.
  • the maximum value or the minimum value and its index can be searched efficiently from a plurality of data.
  • the process of searching for the maximum or minimum value is a basic process used in various information processing fields. Therefore, the present invention capable of efficiently searching for the maximum value or the minimum value can be widely applied in the information processing field.

Abstract

 インデックスをともなう最大値探索あるいは最小値探索を効率良く実行する並列比較選択演算装置を提供する。ベクトルデータ1とベクトルデータ2とを使用して、ベクトルデータ1及びベクトルデータ2に含まれる各要素を対応する要素ごとに比較し、その比較結果に基づいて、ベクトルデータ1とベクトルデータ2の一方の要素を選択し、選択された要素で構成されるベクトルデータ3を生成するベクトル比較選択ユニット242と、ベクトルデータ1のインデックス・ベクトル1と、ベクトルデータ2のインデックス・ベクトル2と、比較結果ベクトルとを使用して、比較結果ベクトルに基づいて、インデックス・ベクトル1とインデックス・ベクトル2の一方の要素を選択し、選択された要素で構成されるインデックス・ベクトル3を生成して出力するインデックス・ベクトル選択ユニット243と、を備える。

Description

並列比較選択演算装置、プロセッサ及び並列比較選択演算方法
 本発明は、最大値あるいは最小値とそのインデックスを高速に探索可能なSIMD(Single Instruction Multiple Data)型並列比較選択演算装置あるいはプロセッサに関する。
 SIMD命令とは複数のデータに対して同一の演算を並列に実行する命令である。一般的に、演算に使用される複数のデータは一つのレジスタに格納される。レジスタに格納された複数のデータの一つ一つはサブワードと呼ばれる。一つのレジスタに格納されるサブワードの一般的な数は2個である。代表的なSIMD命令として、レジスタに格納された4つのサブワードを使った加算演算を実行するSIMD命令が考えられる。SIMD命令は画像処理のようなたくさんのデータを並列に処理できるような性質を持つアプリケーションに適している。
 たくさんのデータの中から最も大きな値を探す処理や最も小さな値を探す処理を考える。最大値あるいは最小値の探索処理に適したSIMD命令を備えるプロセッサが非特許文献1、2に紹介されている。例えば非特許文献2のPowerPC(登録商標)のVMAXSWという命令は、二つの入力ベクトルデータの対応する位置にある要素を比較して、大きい方を選択し、選択した要素からなるベクトルデータを出力する。VMAXSWのような命令は最大値だけを探す場合には便利であるが、最大値とそのインデックスを探したい場合には役に立たない。
 たくさんのデータの中から最大値とそのインデックスとを求めるには、(1)データを現在の最大値と比較する処理と、(2)比較結果に基づいて現在の最大値を置き換える処理と、(3)比較結果に基づいて現在のインデックスを置き換える処理と、を繰返し実行する。従来のプロセッサのVMAXSWのような命令は処理(1)と(2)を実行できるが、処理(3)を実行することができない。そのため、プロセッサは、処理(1)を命令Aで、処理(2)を命令Bで、処理(3)を命令Cで、というように、処理(1)から(3)をそれぞれ別々の命令で実行する。
 例えば、PowerPCというプロセッサでは、処理(1)にはVCMPGTSW(非特許文献2参照)という命令を使用し、処理(2)と(3)にはそれぞれVSELという命令を使用する。VCMPGTSWは二つのベクトルデータを比較し、比較結果に応じて0あるいは-1を出力する命令である。VSELは制御情報に基づいて二つのベクトルデータのどちらかを1ビットごとに選択する命令である。VSELのような命令がない場合には、論理積演算と論理和演算を使ってVSELと等価な処理を行なう。PowerPCにおける処理例を示したが、他の従来のプロセッサでも同じことが言える。つまり、従来のプロセッサは処理(1)から(3)をそれぞれ個別の命令で実行するために、処理(1)から(3)を実行するためのステップ数が多くなってしまう。
 また、特許文献1には、順序づけられた一連のベクトルデータを入力として、このベクトルデータの中の最大値または最小値とこの最大値または最小値に対応した要素番号とを検索し出力するベクトルデータ検索装置が開示されている。しかしながら、特許文献1に開示された技術は、複数個の要素を同時に比較する演算器を用いるものであり、入力の数に応じた演算器を必要としていた。このため、三以上の入力がある場合、入力数に応じた多入力の比較演算器を使用する必要があった。また、三以上の多入力の比較演算器は、二入力の比較演算器を使用する場合に比べ処理遅延が生じていた。
特公平8-33810号公報
FreescaleTM semiconductor, "AltiVecTM Technology Programming Environments Manual", AltiVec Instructions, ALTIVECPEM, Rev.3, April, 2006, Page index 6-61 (173rd page from the top) of Chapter 6 FreescaleTM semiconductor, "AltiVecTM Technology Programming Environments Manual", AltiVec Instructions, ALTIVECPEM, Rev.3, April, 2006, Page index 6-75 (187th page from the top) of Chapter 6
 従来のプロセッサでは、インデックスをともなう最大値探索あるいは最小値探索を効率良く実行できないという課題があった。
 そこで、本発明は、インデックスをともなう最大値探索あるいは最小値探索を効率良く実行する並列比較選択演算装置及びその方法を提供することを目的の一つとする。
 本発明に係る並列比較選択演算装置の一態様は、複数の要素を含む第一ベクトルデータと、前記第一ベクトルデータと同じ数の要素を含む第二ベクトルデータとを使用して、前記第一ベクトルデータ及び前記第二ベクトルデータに含まれる各要素を対応する要素ごとに比較し、その比較結果に基づいて、前記第一ベクトルデータと前記第二ベクトルデータの一方の要素を選択し、選択された要素で構成される第三ベクトルデータを生成するベクトル比較選択ユニットと、前記第一ベクトルデータに含まれる各要素に対応するインデックスを含む第一インデックス・ベクトルと、前記第二ベクトルデータに含まれる各要素に対応するインデックスを含む第二インデックス・ベクトルと、前記比較結果とを使用して、前記比較結果に基づいて、前記第一インデックス・ベクトルと前記第二インデックス・ベクトルの一方の要素を選択し、選択された要素で構成される第三インデックス・ベクトルを生成するインデックス・ベクトル選択ユニットと、を備える。
 また、本発明に係るプロセッサの一態様は、上述した並列比較選択演算装置を備える。
 さらに、本発明に係る並列比較選択演算方法の一態様は、複数の要素を含む第一ベクトルデータと、前記第一ベクトルデータと同じ数の要素を含む第二ベクトルデータと、前記第一ベクトルデータのインデックスに関する第一インデックス情報と、前記第二ベクトルデータに含まれる各要素に対応するインデックスで構成された第二インデックス・ベクトルとを使用して、前記第一ベクトルデータ及び前記第二ベクトルデータに含まれる各要素を対応する要素ごとに比較し、比較結果に基づいて、前記第一ベクトルデータと前記第二ベクトルデータの一方の要素を選択し、選択された要素で構成される第三ベクトルデータを生成し、前記比較結果と、前記第一インデックス情報と、前記第二インデックス・ベクトルとに基づいて、前記第三ベクトルデータに含まれる各要素に対応するインデックスを選択し、選択された複数のインデックスで構成される第三インデックス・ベクトルを生成すること、を特徴とする。
 本発明によれば、インデックスをともなう最大値探索あるいは最小値探索を効率良く実行することができる。
本発明の模範的な実施形態におけるプロセッサの構成を示す図である。 プロセッサの第一の実施形態における並列比較選択演算ユニットの構成例を示す図である。 図2の並列比較選択演算ユニットのベクトル比較選択ユニットの構成例を示す図である。 図2の並列比較選択演算ユニットなどで使用される分割ユニットの構成例を示す図である。 図2の並列比較選択演算ユニットなどで使用される結合ユニットの構成例を示す図である。 図3のベクトル比較選択ユニットで使用される比較選択ユニットの構成例を示す図である。 図6Aの比較選択ユニットの比較ユニットの動作を示す図である。 図6Aの比較選択ユニットの選択ユニットの動作を示す図である。 図2の並列比較選択演算ユニットあるいは図15の並列比較選択演算ユニットで使用されるインデックス・ベクトル選択ユニットの構成例を示す図である。 本発明の模範的な実施形態における最大値あるいは最小値の探索処理の概念を表す図である。 図8の概念に基づいて最大値あるいは最小値の探索処理を、本発明の模範的な実施形態で実行するためのフローチャートを表す図である。 第一の実施形態における図9のフローチャートのstep1の具体的な処理内容を表す図である。 第一の実施形態における図9のフローチャートのstep5の具体的な処理内容を表す図である。 第一の実施形態において、図2の並列比較選択演算ユニットを動作させるための命令として利用可能な命令を表す図である。 第一の実施形態において、プロセッサが、16ビットの16個のデータから最大値あるいは最小値とそのインデックスを求めるようすを表す図である。 図9のフローチャートのstep6の具体的な処理例を表す図である。 プロセッサの第二の実施形態における並列比較演算ユニットの構成例を示す図である。 図15の並列比較選択演算ユニットで使用されるインデックス・ベクトル生成ユニットの構成例を示す図である。 図16Aのインデックス・ベクトル生成ユニットの制御信号の意味を示す図である。 図15の並列比較選択演算ユニットで使用される更新ユニットの構成例を示す図である。 図17Aの更新ユニットの制御信号とstepとの関係を示す図である。 第二の実施形態における図9のフローチャートのstep1の具体的な処理内容を表す図である。 第二の実施形態における図9のフローチャートのstep4とstep5の具体的な処理内容を表す図である。 第二の実施形態において、図15の並列比較選択演算ユニットを動作させるための命令として利用可能な命令を表す図である。 第二の実施形態において、プロセッサが、16ビットの16個のデータから最大値あるいは最小値とそのインデックスを求めるようすを表す図である。
 以下、本発明の実施形態について、図面を参照しながら説明する。説明の明確化のため、以下の記載及び図面は、適宜、省略、及び簡略化がなされている。各図面において同一の構成または機能を有する構成要素および相当部分には、同一の符号を付し、その説明は省略する。
 以下の説明において、ベクトルデータは、複数の要素(データ)の集合である。また、インデックス・ベクトルは、ベクトルデータに含まれる各要素の番号(要素番号)の集合である。ベクトルデータの中の要素(データ)の番号をインデックスと呼ぶことにする。
 本発明の実施の形態について図面を参照して説明する。図1を参照すると、本発明の模範的な実施形態は、プロセッサ200と、メモリ(記憶ユニット)100とを含む。プロセッサ200は、命令デコーダ210と、命令実行ユニット220と、レジスタバンク(一時記憶ユニット)230と、並列比較選択演算ユニット(並列比較選択演算装置)240と、を備える。メモリ100にはプロセッサ200のためのプログラムやデータが格納される。プログラムは複数の命令から構成される。レジスタバンク230は複数のレジスタをもつ。メモリ100における命令の読み出しアドレスを格納するためのプログラムカウンタもレジスタバンク230に含まれる。
 命令デコーダ210は、クロック信号に同期して、レジスタバンク230に存在するプログラムカウンタが示すアドレスを使ってメモリ100から命令を読み込み、その命令をデコードし、命令実行ユニット220あるいは並列比較選択演算ユニット240へ命令の命令コードや入力オペランドや出力などの情報を伝える。命令デコーダ210がどちらのユニットへ情報を伝えるかは命令コードに依存する。命令コードが並列比較選択演算ユニット240で実行される演算を表すならば、その命令コードなどの情報は並列比較選択演算ユニット240へ伝えられる。さらに、命令デコーダ210はその命令の語長をレジスタバンク230に存在するプログラムカウンタへ加算する。
 命令デコーダ210から与えられた命令コードやオペランドなどの情報に基づいて、命令実行ユニット220は入力オペランドの内容をレジスタバンク230あるいはメモリ100から読み込み、命令コードに対応する演算を実行し、演算結果を出力オペランドであるレジスタバンク230あるいはメモリ100へ書き込む。
 並列比較選択演算ユニット240を除くと、命令デコーダ210と命令実行ユニット220とレジスタバンク230とメモリ100は一般的なプロセッサシステムの構成要素である。
 並列比較選択演算ユニット240は、ベクトルデータとそれに対応するインデックス・ベクトルに関する比較と選択を実行する。並列比較選択演算ユニット240は、入力となるベクトルデータとインデックス・ベクトルをレジスタバンク230から読み込む。並列比較選択演算ユニット240の出力データはベクトルデータとインデックス・ベクトルであり、並列比較選択演算ユニット240はそれらをレジスタバンク230へ書き込む。
(第一の実施形態)
 図2を参照しながら、第一の実施形態における並列比較選択演算ユニット240を説明する。第一の実施形態の並列比較選択演算ユニット240は、ベクトル比較選択ユニット242と、インデックス・ベクトル選択ユニット243と、で構成される。第一の実施形態における並列比較選択演算ユニット240の入力信号は、命令デコーダ210から入力される制御信号と、レジスタバンク230から入力される四つのデータである。この四つのデータとは、ベクトルデータ1(第一ベクトルデータ)、ベクトルデータ2(第二ベクトルデータ)、インデックス・ベクトル1(第一インデックス・ベクトル)、インデックス・ベクトル2(第二インデックス・ベクトル)、である。第一の実施形態における並列比較選択演算ユニット240の出力信号は、ベクトルデータ3(第三ベクトルデータ)と、インデックス・ベクトル3(第三インデックス・ベクトル)と、である。
 ベクトル比較選択ユニット242は、ベクトルデータ1とベクトルデータ2とを比較し、その比較結果を比較結果ベクトルとしてインデックス・ベクトル選択ユニット243へ出力するとともに、比較結果に基づいてベクトルデータ1とベクトルデータ2とから適切な要素を選択し、選択した要素をベクトルデータ3として出力する。
 インデックス・ベクトル選択ユニット243は、ベクトル比較選択ユニット242から与えられた比較ベクトルに基づいて、インデックス・ベクトル1とインデックス・ベクトル2から適切な要素を選択し、選択した要素をインデックス・ベクトル3として出力する。
 図3を参照しながら、ベクトル比較選択ユニット242を説明する。ベクトル比較選択ユニット242は、二つの分割ユニット10、11と、二つの結合ユニット20、21と、複数の比較選択ユニット30~33と、で構成される。図3は比較選択ユニットの数が4個の場合を表している。ベクトル比較選択ユニット242の入力信号は、命令デコーダ210からの制御信号と、レジスタバンク230からのベクトルデータ1とベクトルデータ2と、である。ベクトル比較選択ユニット242の出力信号は、比較結果ベクトルと、ベクトルデータ3と、である。
 一方の分割ユニット(第一ベクトル分割ユニット)10は、ベクトルデータ1を受けとり、制御信号に基づいてベクトルデータ1をいくつかの要素に分割し、それらを一つずつ比較選択ユニット30~33へ出力する。分割ユニット10への制御信号は分割数を表す。同様に、もう一方の分割ユニット(第二ベクトル分割ユニット)11は、ベクトルデータ2を受けとり、制御信号に基づいてベクトルデータ2をいくつかの要素に分割し、それらを一つずつ比較選択ユニット30~33へ出力する。図3では、分割ユニット10は、ベクトルデータ1とベクトルデータ2のそれぞれを四つの要素に分割し、各要素を比較選択ユニット30~33へ送る。
 比較選択ユニット30~33は、制御信号と、一方の分割ユニット10から与えられた要素aと、もう一方の分割ユニット11とから与えられた要素bと、に基づいて、比較結果cと選択要素xとを出力する。すなわち、比較選択ユニット30~33それぞれは、制御信号に基づいて、ベクトルデータ1及びベクトルデータ2のP番目(Pは0以上の整数)の二つの要素を比較する。図3において、Pは、要素a(a0~a3)、要素b(b0~b3)に付加されている数値0~3と一致する。
 一方の結合ユニット(ベクトル結合ユニット)21は、比較選択ユニット30~33から与えられた選択要素xを複数個結合して、それをベクトルデータ3として出力する。もう一方の結合ユニット(比較結果結合ユニット)20は、複数の比較選択ユニット30~33から与えられた比較結果cを複数個結合して、それを比較結果ベクトルとして出力する。図3では、一方の結合ユニット20は四つの比較選択ユニット30~33から与えられた要素x0、x1、x1、x2、x3を結合し、それをベクトルデータ3として出力し、もう一方の結合ユニット21は四つの比較選択ユニット30~33から与えられた比較結果c0、c1、c2、c3を結合し、それを比較結果ベクトルとして出力している。
 本明細書では、異なる符号をつけた同じ名称の構成要素、例えば、分割ユニット10~14で示す複数の分割ユニットは、同様の機能を有する。また、結合ユニット20~23、比較選択ユニット30~33についてもそれぞれ同じ名称の構成要素は同様の機能を有する。さらに、後述する選択ユニット40~44、比較ユニット50についても同様である。以降の説明において、各構成要素を一つの符号を用いて、説明することがある(例えば、図4の分割ユニット10など)。
 図4を参照しながら、分割ユニット10を説明する。分割ユニット10は、制御信号dnum(dnum>0の整数)に基づいて、m(m>0の整数)ビットの入力データをdnum個の(m/dnum)ビットのデータへ分割する。制御信号dnumは分割後のデータの数を表す。図4では、制御信号dnumは4であり、分割ユニット10がmビットの入力データを四つの(m/4)ビットのデータへ分割する様子を表している。
 図5を参照しながら、結合ユニット20を説明する。結合ユニット20は、制御信号dnumに基づいて、dnum個のn(n>0の整数)ビットの入力データを(dnum*n)ビットのデータへ結合する。制御信号dnumは結合前のデータの数を表す。図5では、制御信号dnumは4であり、結合ユニット20がnビットの四つの入力データを一つの(4*n)ビットのデータへ結合する。
 図6A、6B、6Cを参照しながら、比較選択ユニット30を説明する。図6Aに示すように、比較選択ユニット30は、選択ユニット40と、比較ユニット50と、で構成される。比較選択ユニット30の入力信号は、制御信号cmodeと、データaと、データbと、である。比較選択ユニット30の出力信号は、選択データxと、比較結果cと、である。比較ユニット50は、制御信号cmodeに基づいてデータaとデータbとを比較し、比較結果cを出力する。
 制御信号cmodeと比較式と比較結果の関係は図6Bの表に示す通りである。比較ユニット50への制御信号は比較式を表す。比較ユニット50は、制御信号に応じた比較式を用いてデータaとデータbとを比較する。比較式は、a<b、a<=b、a>b、a>=b、の四種類である。この比較式が満たされれば比較結果cは1となり、そうでなければ比較結果cは0となる。制御信号cmodeとデータaとbと比較結果cの関係を関数compare()を使って、c=compare(cmode、a、b)というように表す。このように、比較ユニット50の動作を関数compare()を用いて表すことができる。
 選択ユニット40は、比較ユニット50から与えられた比較結果cを選択信号として使用し、データaとデータbのいずれかを選択し、選択データxとして出力する。選択信号(比較結果c)と選択データxとの関係は図6Cの表に示す通りである。選択ユニット40は選択信号に応じて入力信号aかbのどちらかを選択して出力する。具体的には、選択信号cが0ならばデータaが選択され、それ以外ならばデータbが選択され、選択されたデータが選択データxとなる。選択信号cとデータaとbとの関係を関数select()を使って、x=select(c、a、b)というように表す。このように、選択ユニット40の動作を関数select()を用いて表すことができる。
 図7を参照しながら、インデックス・ベクトル選択ユニット243を説明する。インデックス・ベクトル選択ユニット243は、三つの分割ユニット12~14と、複数の選択ユニット41~44と、一つの結合ユニット22と、で構成される。図7は選択ユニットの数が4個の場合を表している。インデックス・ベクトル選択ユニット243の入力信号は、制御信号と、インデックス・ベクトル1と、インデックス・ベクトル2と、比較結果ベクトルと、である。インデックス・ベクトル選択ユニット243の出力信号はインデックス・ベクトル3である。
 図7の分割ユニット(第一インデックス分割ユニット)12は制御信号に基づいてインデックス・ベクトル1を複数の要素へ分割する。同様に、図7の分割ユニット(第二インデックス分割ユニット)13はインデックス・ベクトル2を、図7の分割ユニット(比較結果分割ユニット)14は比較結果ベクトルを、それぞれ制御信号に基づいて複数の要素へ分割する。選択ユニット41~44は、分割ユニット14から与えられた要素c(比較結果c)を選択信号として、分割ユニット12から与えられた要素gと、分割ユニット13から与えられた要素hと、のどちらかを選択し、それを要素zとして出力する。結合ユニット22は複数の選択ユニット41~44から与えられた要素zを制御信号に基づいて一つのベクトルに結合し、それをインデックス・ベクトル3として出力する。
 続いて、第一の実施形の動作を図面を参照しながら説明する。以降では、複数個のデータの中から最大値あるいは最小値とそのインデックスを探索する処理を「最大値あるいは最小値の探索処理」と呼ぶことにする。図8は最大値あるいは最小値の探索処理の概念を表す。
 まず、(1)において、N(N>0の整数)個のデータをS0、S1、S2、・・・、SN-1とする。次に、(2)において、N個のデータをdnum個のグループに分割する。データのインデックスをdnumで割った余りが等しくなるようにN個のデータを分割する。dnumは任意の正の整数であるが、実装を容易にするためにdnumは2のべき乗であることが望ましい。
 次に、(3)において、各グループ内の最大値あるいは最小値とそのインデックスを探索する。すると、各グループで一つのデータとそのインデックスが選択される。最後に、(4)において、dnum個の選択されたデータの中から、最大値あるいは最小値とそのインデックスを探索する。図8の概念では(3)においてdnum個の探索処理を並列に実行可能である。本発明の実施形態は図8の概念に基づいて最大値あるいは最小値の探索処理を実行する。
 図9は、図8の概念に基づいて最大値あるいは最小値の探索処理を、本発明の模範的な実施形態で実行するためのフローチャートである。このフローチャートは図1のプロセッサ200のためのプログラムの処理内容を表す。そのプログラムは図1のメモリ100に格納される。プロセッサ200はそのプログラムを実行することによって、複数個のデータの中から最大値あるいは最小値とそのインデックスを探索する。複数個のデータはメモリ100に格納される。
 第一の実施形態における最大値あるいは最小値の探索処理は六つのステップで構成される。
 step1は探索処理の初期化を行なうステップである。
 step2は未処理のデータが残っているかどうかを調べるステップである。
 step3はデータを読み込むステップである。
 step4はデータのインデックスを更新するステップである。
 step5は二つのベクトルを対応する要素ごとに比較し、大きい方かもしくは小さい方の要素を選択するステップである。 要素が選択される際には、その要素に対応するインデックスも選択される。
 未処理のデータがなくなるまでstep2からstep5は繰り返される。step2からstep5の繰返しは図8の(2)と(3)に相当する。
 step5で比較されるベクトルは各要素のレジスタ内の位置でグループ分けされ、各グループ毎に比較と選択が実行される。選択された要素は再びレジスタへ格納され、次回のstep5で使用される。step2からstep5の繰返しが終了すると、step5によって選択された各グループの最大値あるいは最小値が一つのベクトルとして結合され、そのベクトルがレジスタに格納される。これは図8の(3)が終了した状態である。
 最後に実行されるstep6は一つのベクトルの全ての要素の中から最大値あるいは最小値を選択するステップである。最大値あるいは最小値が選択される際には、その値に対応するインデックスも選択される。step6は図8の(4)に相当する。
 step1からstep6までのステップによって、複数のデータの中から最大値あるいは最小値とそのインデックスを求める事ができる。
 以降の説明では、簡単のために、図9の概念におけるdnumが4で、データ数Nが16で、各データは16ビットの整数であると仮定して説明する。図1のプロセッサ200のレジスタバンク230は複数の64ビットレジスタを含むと仮定する。レジスタバンク230の四つの64ビットレジスタをレジスタRa、Rb、Rc、Rdと呼ぶことにする。レジスタに格納されたdnum個のデータをベクトルと呼ぶことにする。ベクトルの一つ一つの要素がデータである。また、以降の動作の説明及び図面(図10、11、13)において、step1~step6は、図9に示した同じステップ番号の処理と対応する。
 図10を参照しながら、第一の実施形態におけるstep1を説明する。step1において、プロセッサ200は、レジスタバンク230のレジスタRcへdnum個の初期選択値(選択値の初期値)を、レジスタRdへそれらに対応するdnum個のインデックスを、それぞれ格納する。図10では、dnum個の初期選択値はメモリ100に格納されているs0、s1、s2、s3であり、それらのインデックスは0、1、2、3である。
 第一の実施形態におけるstep2において、プロセッサ200は未処理のデータの数を計算し、それが0より大きいならばstep3へ移行し、そうでないならばstep6へ移行する。図10において、step1が終った直後の状態では、N個のデータのうちdnum個を初期選択値として使用したので、未処理のデータの数はN-dnum個である。データ数Nを16、分割数をdnum、と仮定しているので、N-dnum=16-4=12、となって、未処理データはまだ残っていることになる。
 第一の実施形態におけるstep3において、プロセッサ200は、次のdnum個のデータをメモリ100から読み込み、それらをレジスタRaへ格納する。図10では、次のdnum個のデータはs4、s5、s6、s7である。
 第一の実施形態におけるstep4において、プロセッサ200は、次のdnum個のデータのインデックスをレジスタRbへ格納する。図10では、次のdnum個のデータはs4、s5、s6、s7なので、それらのインデックスは4、5、6、7である。
 図11を参照しながら、第一の実施形態におけるstep5を説明する。step5において、プロセッサ200は、図2の並列比較選択演算ユニット240を動作させ、ベクトル間比較選択処理を行なう。ベクトル間比較選択処理は、二つのベクトルデータを対応する要素ごとに比較し、大きい方かもしくは小さい方の要素を選択し、さらに選択した要素に対応するインデックスも選択する、という処理である。二つのベクトルデータをベクトルデータ1、ベクトルデータ2として、それらに対応するインデックス・ベクトルをインデックス・ベクトル1、インデックス・ベクトル2とする。図11では、ベクトルデータ1がレジスタRaに、インデックス・ベクトル1がレジスタRbに、ベクトルデータ2がレジスタRcに、インデックス・ベクトル2がレジスタRdに、それぞれ格納されている。
 step5において、プロセッサ200は並列比較選択演算ユニット240を動作させるための命令をメモリ100から読み込む。そして、命令デコーダ210はその命令をデコードし、その命令の命令コードやオペランドの情報を制御信号として並列比較選択演算ユニット240へ送る。命令デコーダ210からの制御信号を受けて、並列比較選択演算ユニット240は、レジスタRa、Rb、Rc、Rdからベクトルデータ1、インデックス・ベクトル1、ベクトルデータ2、インデックス・ベクトル2を読み出し、ベクトル比較選択ユニット242とインデックス・ベクトル選択ユニット243を動作させて、ベクトルデータ3とインデックス・ベクトル3をレジスタRcとRdへそれぞれ出力する。
 ここで、並列比較選択演算ユニット240の動作を、図11に示したデータと関数表記とを用いて具体的に説明する。まず、ベクトル比較選択ユニット242の動作を図3、図6A、6B、6C及び図11を用いて説明する。
 分割ユニット10、12(図3)は、ベクトルデータ1、ベクトルデータ2を要素毎に分割する。図11では、分割ユニット10は、ベクトルデータ1をs4~s7の各要素に、分割ユニット11は、ベクトルデータ2をs0~s3の各要素に分割する。
 続いて、複数の比較選択ユニット30~33(図3)は、各要素について比較選択処理を実施する。複数の比較選択ユニット30~33内の比較ユニット50(図6A)は、関数compare()でレジスタRaとレジスタRcに格納されたデータを比較する。具体的には複数の比較選択ユニット30~33内の比較ユニット50は、次の関数を用いて比較する。cmodeは比較選択ユニット30~33への制御信号を表す。
c0=compare(cmode,s0,s4)
c1=compare(cmode,s1,s5)
c2=compare(cmode,s2,s6)
c3=compare(cmode,s3,s7)
 続いて、複数の比較選択ユニット30~33内の選択ユニット40は、比較ユニット50が比較した比較結果を使って関数select()でレジスタRaとRcから適切なデータを選択する。具体的には、選択ユニット40は、次の関数を用いて選択する。
x0=select(c0,s0,s4)
x1=select(c1,s1,s5)
x2=select(c2,s2,s6)
x3=select(c3,s3,s7)
 ここで、c0~c3、x0~x3は、図3の同じ符号のデータと対応する。
 結合ユニット20は、x0~x3を結合し、ベクトルデータ3を生成する。結合ユニット21は、c0~c3を結合し、比較結果ベクトルを生成し、インデックス・ベクトル選択ユニット243へ出力する。
 次に、インデックス・ベクトル選択ユニット243の動作を図7及び図11を用いて説明する。
 分割ユニット12、13(図7)は、インデックス・ベクトル1、インデックス・ベクトル2を要素毎(インデックス毎)に分割する。図11では、分割ユニット12は、ベクトルデータ1をi4~i7の各要素に、分割ユニット13は、ベクトルデータ2をi0~i3の各要素に分割する。分割ユニット14は、比較結果ベクトルをc0~c3の各要素へ分割する。
 選択ユニット41~44(図7)は、ベクトル比較選択ユニット242の選択ユニット40(図6A)と同様にレジスタRbとRdから適切なデータを選択する。具体的には、選択ユニット41~44は、次の関数を用いて選択する。
z0=select(c0,i0,i4)
z1=select(c1,i1,i5)
z2=select(c2,i2,i6)
z3=select(c3,i3,i7)
 ここで、z0~z3は、図7の同じ符号のデータと対応する。
 結合ユニット22は、z0~z3を結合し、インデックス・ベクトル3を生成する。
 上述のように、ベクトル比較選択ユニット242が生成したベクトルデータ3は、レジスタRcへ格納される。また、インデックス・ベクトル選択ユニット243が生成したインデックス・ベクトル3はレジスタRdへ格納される。
 第一の実施形態では、ベクトルデータ3とインデックス・ベクトル3をレジスタRcとレジスタRdに格納する。従って、図11に示すように、レジスタRaに読み出したベクトルデータを比較対象データ、レジスタRcに設定されたデータを現在の選択値と呼ぶ。
 step5において、並列比較選択演算ユニット240を動作させるための命令として利用可能な命令を図12に示す。図12には、8個の命令の、シンタックスと、その命令によって命令デコーダ210が並列比較選択演算ユニット240へ送る二つの制御信号と、命令の説明と、を示している。二つの制御信号は、並列比較選択演算ユニット240の中の比較選択ユニット30~33へ送られる制御信号cmodeと、並列比較選択演算ユニット240の中の分割ユニット10と結合ユニット20へ送られる制御信号dnum、である。
 例えば、MAX.Hという命令は比較式(Ra<Rc)を使って16ビットの値を比較し、大きい方の値を選択する命令である。MAX.H命令の場合のcmodeの値は0である。図6Bによると、cmode=0は比較演算<を意味する。MAX.H命令の場合のdnumの値は4である。dnumは分割後あるいは結合前のデータの数を表す。
 16ビットの16個のデータから最大値あるいは最小値とそのインデックスを求める様子を図13に示す。図13の右上から処理が始まる。
 step1において、プロセッサ200は、初期選択値のベクトルデータとそれに対応するインデックス・ベクトル(初期インデックス)をそれぞれレジスタRc、Rdへ格納する。
 step2において(図13には図示されていない)、プロセッサ200は、未処理のデータが12個残っているので、step3へ移行する。
 step3において、プロセッサ200は、比較対象のデータ4個をレジスタRaへ読み込む。
 step4において、プロセッサ200は、比較対象のデータ4個のインデックスをレジスタRbへ格納する。
 step5において、プロセッサ200は、レジスタRa、Rb、Rc、Rdを使って、1回目のレジスタ間比較選択処理を実行する。1回目のレジスタ間比較選択処理によって選択されたデータとインデックスはレジスタRcとRdへそれぞれ格納される。この1回目のレジスタ間比較選択処理に(1)という番号をつける。
 この後は、step2を省略すると、以下のように処理が進む。
(2)step3:データ読み込み2回目
(3)step4:インデックス更新
(4)step5:レジスタ間比較選択処理2回目
(5)step3:データ読み込み3回目
(6)step4:インデックス更新
(7)step5:レジスタ間比較選択処理3回目
 (2)のstep3において、プロセッサ200は、新たなデータ4個をレジスタRaへ読み込む。
 (3)のstep4において、プロセッサ200は、レジスタRbのインデックスを利用して、新たなデータ4個のインデックスを計算し、それをレジスタRbへ格納する。インデックス更新の計算方法は、レジスタRbの各要素へ4を加算する、というものである。
 (4)のstep5において、プロセッサ200は、2回目のレジスタ間比較選択処理を実行する。
 同様にして、(5)、(6)、(7)が実行される。
 図14を参照しながら、step6を説明する。step6は一つのレジスタに格納されたベクトルの全ての要素の中かから最大値あるいは最小値を探し、その値に対応するインデックスをもう一つのレジスタから取り出すステップである。
 step6において、プロセッサ200が最大値あるいは最小値のどちらを探すかは、メモリ100に格納されたプログラムによって決定される。
 図14では、四つのグループから選ばれた選択値がレジスタRcに、四つのグループから選ばれた選択値のインデックスがレジスタRdに、それぞれ格納されている。
 step6において、プロセッサ200は、レジスタRcに格納された四つの選択値x0"、x1"、x2"、x3"と、レジスタRdに格納された四つのインデックスz0"、z1"、z2"、z3"と、を一つ一つ別々のレジスタへ格納する。
 プロセッサ200は、四つの選択値の中からひとつの値をさらに選択するために,比較選択処理を3回行なう。
 1回目の比較選択処理において、プロセッサ200は、x0"とx1"とを比較し、比較条件を満たす方の値を選択する。 比較条件はstep6のプログラムの中に記述されているものとする。
 例えば、比較条件を<とすると、x0"<x1"が真ならばx1"が選択され、そうでないならばx0"が選択される。比較条件としては、<、<=、>、>=、などが利用可能である。
 x0"とx1"の比較結果に基づいて、プロセッサ200は、z0"かz1"のどちらかのインデックスを選択する。
 例えば、もしx0"<x1"が真ならばz0"が選択され、そうでないならばz1"が選択される。
 step6には3回の比較選択処理があるが、どの比較選択処理にも同じ比較条件が使われる。
 同様にして、1回目の比較選択処理において、プロセッサ200は、x2"とx3"とを比較し、比較条件を満たす方の値を選択する。
 x2"とx3"の比較結果に基づいて、プロセッサ200は、z2"かz3"のどちらかのインデックスを選択する。
 1回目と2回目の比較選択処理によって選択された値をx0'''とx1'''として、それらのインデックスをz0'''とz1'''とする。これらの値とインデックスを使って、プロセッサ200は、3回目の比較選択処理を行なう。
 プロセッサ200は、x0'''とx1'''とを比較し、比較条件を満たす方の値を選択する。
 x0'''とx1'''の比較結果に基づいて、プロセッサ200は、z0'''かz1'''のどちらかのインデックスを選択する。
 3回目の比較選択処理で選択された値とインデックスをx0""とz0""とする。
 x0""はstep6においてプロセッサ200がx0"、x1"、x2"、x3"の中から選択した最大値あるいは最小値であり、全てのデータの中の最大値である。そして、z0""はx0""のインデックスである。
 以上説明したように、第一の実施形態の並列比較選択演算ユニットは、ベクトルデータ1と、ベクトルデータ2と、ベクトルデータ1の各要素のインデックスで構成されたインデックス・ベクトル1と、ベクトルデータ2の各要素のインデックスで構成されたインデックス・ベクトル2と、を入力信号とする。並列比較選択演算ユニットは、ベクトルデータ1とベクトルデータ2の各要素を比較し、その比較結果に基づいてベクトルデータ1とベクトルデータ2のどちらかを要素毎に選択したベクトルデータ3を生成する。また、並列比較選択演算ユニットは、比較結果に基づいてインデックス・ベクトル1とインデックス・ベクトル2のどちらかを要素毎(インデックス毎)に選択し、選択された複数個の要素をインデックス・ベクトル3として生成する。そして、並列比較選択演算ユニットは、ベクトルデータ3とインデックス・ベクトル3とを出力する。
 本実施形態の並列比較選択演算ユニットによれば、二つのベクトルデータを要素毎に比較し、比較結果に基づいて一方の要素を選択するとともに、選択した要素に対応するインデックスを選択することができる。また、本実施形態の並列比較選択演算ユニットを備えるプロセッサは、インデックスをともなう最大値探索あるいは最小値探索を効率よく実行することができる。
 また、プロセッサは、本実施形態の並列比較選択演算ユニットを備えることにより、ベクトル間比較選択処理を効率よく実施し、ベクトル関比較選択処理の結果を用いて、最大値あるいは最小値を取得することが可能になる。
 なお、第一の実施形態では、ベクトル比較選択ユニット242内の比較選択ユニット30~31が出力する比較結果を、複数の比較結果の集合である比較結果ベクトルとしてインデックス・ベクトル選択ユニット243へ出力する場合を説明した(図2、3、7)。この構成に限られることはなく、複数の比較結果を複数の選択信号として、ベクトル比較選択ユニット242からインデックス・ベクトル選択ユニット243へ出力する構成であってもよい。この場合、結合ユニット21(図3)及び分割ユニット14(図7)を備えなくてもよい。
 一方で、比較結果ベクトルを用いることにより、ベクトルに含まれる要素数が変化した場合に対応しやすいという利点がある。具体的には、ベクトル比較選択ユニット242からインデックス・ベクトル選択ユニット243へ出力する選択信号(比較結果ベクトル)の数を変更する必要がない。ベクトル比較選択ユニット242内の比較選択ユニット数、インデックス・ベクトル選択ユニット243内の選択ユニットの数、並びに関係する信号線等を変更することにより、要素数の変化に対応することが可能となる。
 すなわち、分割ユニットや結合ユニットを使うと,ベクトルデータの各要素のデータ幅を可変にすることができる。例えば、16ビットのデータ幅をもつ要素で構成されるベクトルデータを処理したり、8ビットのデータ幅をもつ要素で構成されるベクトルデータを処理したり、ということが可能になる。ただし,ひとつのベクトルデータの中の全ての要素のデータ幅は同じにする必要がある。これに対して、分割ユニットや結合ユニットを使わない場合には,あらかじめ決めたデータ幅の要素で構成されるベクトルデータだけを処理することができる。それ以外のデータ幅の要素で構成されるベクトルデータを処理することはできない。
(第二の実施形態)
 図15を参照しながら、第二の実施形態における並列比較選択演算ユニット240aを説明する。第二の実施形態では、図1に示すプロセッサ200は、並列比較選択演算ユニット240に替えて図15に示す並列比較選択演算ユニット240aを用いる。本実施形態では、第一の実施形態において用いたインデックス・ベクトル1に替えて、ベクトルデータ1のインデックスに関する情報(第一インデックス情報)を用いる場合を説明する。具体的には、第一インデックス情報として、ベクトルデータ1の最初の要素(0番目の要素)のインデックスを用いる場合を説明する。以下、最初の要素のインデックスを開始インデックス1という。
 第二の実施形態の並列比較選択演算ユニット240aは、ベクトル比較選択ユニット242と、インデックス・ベクトル選択ユニット243と、インデックス・ベクトル生成ユニット241と、更新ユニット244と、で構成される。
 第二の実施形態における並列比較選択演算ユニット240aの入力信号は、命令デコーダ210からの制御信号と、レジスタバンク230からの四つのデータである。この四つのデータとは、ベクトルデータ1、ベクトルデータ2、開始インデックス1、インデックス・ベクトル2、である。第二の実施形態における並列比較選択演算ユニット240aの出力信号は、ベクトルデータ3と、開始インデックス1である。
 第一の実施形態と第二の実施形態の違いは二つある。一つは、インデックス・ベクトル生成ユニット241を使って、第二の実施形態は開始インデックス1からインデックス・ベクトル1を生成することである。もう一つは、更新ユニット244を使って開始インデックス1の値を変更し、変更した値を出力することである。
 第二の実施形態におけるベクトル比較選択ユニット242とインデックス・ベクトル選択ユニット243の構成や動作は第一の実施形態のそれと同じである。
 図16A、16Bを参照しながら、インデックス・ベクトル生成ユニット241を説明する。図16Aに示すように、インデックス・ベクトル生成ユニット241は結合ユニット23を含む。インデックス・ベクトル生成ユニット241の入力信号は、命令デコーダ210からの制御信号と、レジスタバンク230からの開始インデックス1と、である。インデックス・ベクトル生成ユニット241の出力信号はインデックス・ベクトル1である。
 インデックス・ベクトル生成ユニット241は、制御信号に基づいて、開始インデックス1からインデックス・ベクトル1を生成する。制御信号と開始インデックス1とインデックス・ベクトル1の関係は図16Bの表に示す通りである。
 開始インデックス1をidxとすると、インデックス・ベクトル生成ユニット241は、idx+1*s、idx+2*s、idx+3*s、という三つのデータを計算し、idxと合わせて四つのデータを結合ユニット20へ送る。さらに、インデックス・ベクトル生成ユニット241は、制御信号に基づいて、dnumという信号を結合ユニット23へ送る。
 ここで、s(s>0の整数)はスケールファクタであり、dnumは結合ユニット20が結合すべきデータの数を表す信号である。もし制御信号が0ならば、sは2である。図16Bにおいて、もし制御信号が1ならば、sは4である。もし制御信号が0ならば、結合ユニット20は、idx、idx+2、idx+4、idx+6、という四つのデータを結合し、それをインデックス・ベクトル1として出力する。もし制御信号が1ならば、結合ユニット20は、idx、idx+4、という二つのデータを結合し、それをインデックス・ベクトル1として出力する。
 図17A、17Bを参照しながら、更新ユニット244を説明する。更新ユニット244への入力信号は、開始インデックス1と、制御信号と、である。更新ユニット244の出力信号は開始インデックス1である。更新ユニット244は開始インデックス1をインクリメントする。インクリメントの増分はstepという値である。stepは制御信号によって決定される。制御信号とstepの関係は図17Bの表に示す通りである。もし制御信号が0ならば、stepは2である。もし制御信号が1ならば、stepは4である。
 続いて、第二の実施形態の動作を図面を参照しながら説明する。第二の実施形態では、プロセッサ200の並列比較選択演算ユニット240aが図15のように構成される。第二の実施形態は、第一の実施形態と同様に、図8の概念と図9のフローチャートとに基づいて、複数個のデータの中から最大値あるいは最小値とそのインデックスを探索する。
 以降の説明では、簡単のために、図9の概念におけるdnumが4で、データ数Nが16で、各データは16ビットの整数であると仮定して説明する。図1のプロセッサ200のレジスタバンク230は複数の64ビットレジスタを含むと仮定する。レジスタバンク230の四つの64ビットレジスタをレジスタRa、Rb、Rc、Rdと呼ぶことにする。レジスタに格納されたdnum個のデータをベクトルと呼ぶことにする。ベクトルの一つ一つの要素がデータである。また、以降の動作の説明及び図面(図18、19、21)において、step1~step6は、図9に示した同じステップ番号の処理と対応する。
 図18を参照しながら、第二の実施形態におけるstep1を説明する。
 第二の実施形態におけるstep1は第一の実施形態におけるstep1と異なる。step1において、プロセッサ200は、レジスタバンク230のレジスタRcへdnum個の初期選択値を、レジスタRdへそれらに対応するdnum個のインデックスを、それぞれ格納する。さらに、レジスタRcへ格納したdnum個の次のデータのインデックスを開始インデックスとしてレジスタRbへ格納する。開始インデックスをレジスタRbへ格納することが第一の実施形態におけるstep1とは異なる。
 図18では、dnum個の初期選択はメモリ100に格納されているs0、s1、s2、s3であり、それらのインデックスは0、1、2、3である。そして、次のデータはs4なので、開始インデックスは4である。
 第二の実施形態におけるstep2は第一の実施形態におけるstep2と全く同じである。第二の実施形態におけるstep2において、プロセッサ200は未処理のデータの数を計算し、それが0より大きいならばstep3へ移行し、そうでないならばstep6へ移行する。
 図18において、step1が終った直後の状態では、N個のデータのうちdnum個を初期選択値として使用したので、未処理のデータの数はN-dnum個である。データ数Nを16、分割数をdnum、と仮定しているので、N-dnum=16-4=12、となって、未処理データはまだ残っていることになる。
 第二の実施形態におけるstep3は第一の実施形態におけるstep3と全く同じである。第二の実施形態におけるstep3において、プロセッサ200は、次のdnum個のデータをメモリ100から読み込み、それらをレジスタRaへ格納する。
 図18では、次のdnum個のデータはs4、s5、s6、s7である。
 第二の実施形態におけるstep4とstep5は並列に実行される。図19を参照しながら、第二の実施形態におけるstep4とstep5を説明する。step4とstep5において、プロセッサ200は、図15の並列比較選択演算ユニット240aを動作させ、インデックス更新とベクトル間比較選択処理とを行なう。すなわち、第二の実施形態では、並列比較選択演算ユニット240aがstep4とstep5とを並列して実行する。
 第二の実施形態におけるベクトル間比較選択処理について説明する。ベクトル間比較選択処理は、二つのベクトルデータを対応する要素ごとに比較し、大きい方かもしくは小さい方の要素を選択し、さらに選択した要素に対応するインデックスも選択する、という処理である。これは第一の実施形態にけるベクトル間比較選択処理と同じである。第一の実施形態と異なるのは、一方のベクトルデータのインデックスの与え方である。第二の実施形態では、一方のベクトルデータの最初の要素のインデックスを開始インデックスとしてレジスタへ格納する。図15の並列比較選択演算ユニット240aは開始インデックスから一方のベクトルデータの全てのインデックスを生成する。
 二つのベクトルデータをベクトルデータ1、ベクトルデータ2として、ベクトルデータ1の最初の要素のインデックスを開始インデックス1として、ベクトルデータ2に対応するインデックス・ベクトルをインデックス・ベクトル2とする。図19では、ベクトルデータ1がレジスタRaに、開始インデックス1がレジスタRbに、ベクトルデータ2がレジスタRcに、インデックス・ベクトル2がレジスタRdに、それぞれ格納されている。
 step4とstep5において、プロセッサ200は、図15の並列比較選択演算ユニット240aを動作させるための命令をメモリ100から読み込む。そして、命令デコーダ210はその命令をデコードし、その命令の命令コードやオペランドの情報を制御信号として図15の並列比較選択演算ユニット240aへ送る。命令デコーダ210からの制御信号を受けて、並列比較選択演算ユニット240aは、レジスタRa、Rb、Rc、Rdからベクトルデータ1、開始インデックス1、ベクトルデータ2、インデックス・ベクトル2を読み出し、インデックス・ベクトル生成ユニット241と、ベクトル比較選択ユニット242と、インデックス・ベクトル選択ユニット243と、更新ユニット244と、を動作させて、ベクトルデータ3と開始インデックス3をレジスタRcとRdへそれぞれ出力する。
 ここで、図15の並列比較選択演算ユニット240aのstep5の動作を、図19に示したデータと関数表記とを用いて具体的に説明する。なお、並列比較選択演算ユニット240aの動作は第一の実施形態のstep5の動作と同様であるため、主に関数表記について説明し、他の動作については省略する。
 ベクトル比較選択ユニット242において、複数の比較選択ユニット30~33(図3)は、各要素について比較選択処理を実施する。複数の比較選択ユニット30~33内の比較ユニット50(図6A)は、関数compare()でレジスタRaとレジスタRcに格納されたデータを比較する。具体的には複数の比較選択ユニット30~33内の比較ユニット50は、次の関数を用いて比較する。cmodeは比較選択ユニット30~33への制御信号を表す。
c0=compare(cmode,s0,s4)
c1=compare(cmode,s1,s5)
c2=compare(cmode,s2,s6)
c3=compare(cmode,s3,s7)
 続いて、複数の比較選択ユニット30~33内の選択ユニット40は、比較ユニット50が比較した比較結果を使って関数select()でレジスタRaとRcから適切なデータを選択する。具体的には、選択ユニット40は、次の関数を用いて選択する。
x0=select(c0,s0,s4)
x1=select(c1,s1,s5)
x2=select(c2,s2,s6)
x3=select(c3,s3,s7)
 ここで、c0~c3、x0~x3は、図3の同じ符号のデータと対応する。
 結合ユニット20は、x0~x3を結合し、ベクトルデータ3を生成する。結合ユニット21は、c0~c3を結合し、比較結果ベクトルを生成し、インデックス・ベクトル選択ユニット243へ出力する。
 次に、インデックス・ベクトル選択ユニット243において、選択ユニット41~44(図7)は、ベクトル比較選択ユニット242の選択ユニット40(図6A)と同様にレジスタRbとRdから適切なデータを選択する。具体的には、選択ユニット41~44は、次の関数を用いて選択する。
z0=select(c0,i0,i4)
z1=select(c1,i1,i4+1)
z2=select(c2,i2,i4+2)
z3=select(c3,i3,i4+3)
 ここで、z0~z3は、図7の同じ符号のデータと対応する。
 結合ユニット22は、z0~z3を結合し、インデックス・ベクトル3を生成する。
 上述のように、ベクトル比較選択ユニット242が生成したベクトルデータ3は、レジスタRcへ格納される。また、インデックス・ベクトル選択ユニット243が生成したインデックス・ベクトル3はレジスタRdへ格納される。
 なお、関数compare()と関数select()の中身(処理内容)は第一の実施形態と同じである。
 step4とstep5において、並列比較選択演算ユニット240aを動作させるための命令として利用可能な命令を図20に示す。図20には、8個の命令の、シンタックスと、その命令によって命令デコーダ210が図15の並列比較選択演算ユニット240aへ送る三つの制御信号と、命令の説明と、を示している。三つの制御信号は、図15並列比較選択演算ユニット240aの中の比較選択ユニット30~33へ送られる制御信号cmodeと、図15の並列比較選択演算ユニット240aの中の分割ユニット10と結合ユニット20へ送られる制御信号dnumと、図15の並列比較選択演算ユニット240aのインデックス・ベクトル生成ユニット241への制御信号、である。
 例えば、図20のMAX.Hという命令は比較式(Ra<Rc)を使って16ビットの値を比較し、その比較結果に基づいて大きい方の値を選択し、開始インデックスへ4を加算する命令である。MAX.H命令の場合のcmodeの値は0である。図6Bによると、cmode=0は比較演算<を意味する。MAX.H命令の場合のdnumの値は4である。dnumは分割後あるいは結合前のデータの数を表す。MAX.H命令の場合のインデックス・ベクトル生成ユニット241への制御信号は0である。これは開始インデックス1へ4を加算する事を表す。
 16ビットの16個のデータから最大値あるいは最小値とそのインデックスを求めるようすを図21に示す。図21の右上から処理が始まる。
 step1において、プロセッサ200は、初期選択値のベクトルデータとそれに対応するインデックス・ベクトル(初期インデックス)をそれぞれレジスタRc、Rdへ格納し、1回目の開始インデックスをレジスタRbへ格納する。
 step2において(図21には図示されていない)、プロセッサ200は、未処理のデータが12個残っているので、step3へ移行する。
 step3において、プロセッサ200は、比較対象のデータ4個をレジスタRaへ読み込む。
 step4とstep5において、プロセッサ200は、レジスタRa、Rb、Rc、Rdを使って、1回目のインデックス更新とレジスタ間比較選択処理を実行する。1回目のインデックス更新によって更新された開始インデックスはレジスタRbに格納される。1回目のレジスタ間比較選択処理によって選択されたデータとインデックスはレジスタRcとRdへそれぞれ格納される。この1回目のインデックス更新とレジスタ間比較選択処理に(1)という番号をつける。
 この後は、step2を省略すると、以下のように処理が進む。
(2)step3:データ読み込み2回目
(3)step4とstep5:インデックス更新とレジスタ間比較選択処理2回目
(4)step3:データ読み込み3回目
(5)step4とstep5:インデックス更新とレジスタ間比較選択処理3回目
 (2)のstep3において、プロセッサ200は、新たなデータ4個をレジスタRaへ読み込む。
 (3)のstep4とstep5において、プロセッサ200は、2回目のインデックス更新とレジスタ間比較選択処理を実行する。
 同様にして、(4)、(5)が実行される。
 図21の(5)の後に、step6が実行される。第二の実施形態におけるstep6は第一の実施形態におけるstep6と全く同じである。
 step6において、プロセッサ200は、一つのレジスタに格納されたベクトルの全ての要素の中かから最大値あるいは最小値を探し、その値に対応するインデックスをもう一つのレジスタから取り出す。
 step6が実行されると、全てのデータの中の最大値あるいは最小値とそのインデックスが求まる。
 以上説明したように、第二の実施形態の並列比較選択演算ユニットは、ベクトルデータ1と、ベクトルデータ2と、ベクトルデータ1の最初の要素のインデックスを表す開始インデックス1と、ベクトルデータ2の各要素のインデックスで構成されたインデックス・ベクトル2と、を入力信号とする。並列比較選択演算ユニットは、ベクトルデータ1とベクトルデータ2の各要素を比較し、その比較結果に基づいてベクトルデータ1とベクトルデータ2のどちらかを要素ごとに選択したベクトルデータ3を生成する。また、並列比較選択演算ユニットは、開始インデックス1に基づいてベクトルデータ1の他の要素のインデックスを生成し、生成されたインデックスと開始インデックス1とをインデックス・ベクトル1とし、比較結果に基づいてインデックス・ベクトル1とインデックス・ベクトル2のどちらかを要素ごとに選択し、選択された複数個の要素をインデックス・ベクトル3として生成し、ベクトルデータ1の要素の数と開始インデックス1の和を開始インデックス3として算出する。そして、並列比較選択演算ユニットは、ベクトルデータ3と、インデックス・ベクトル3と、開始インデックス3と、を出力する。
 本実施形態の並列比較選択演算ユニットによれば、第一の実施形態に加え、次の効果を得ることができる。
 まず、開始インデックスを用いることにより、インデックス・ベクトルを保持するレジスタの容量を削減することができる。具体的には図1のレジスタバンク230の容量を削減することができる。これは、第一の実施形態では、比較対象データのインデックスとして、要素数のインデックスを保持していたが、第二の実施形態では、開始インデックス一つに削減できるからである。
 次に、更新ユニットを備えることにより、処理時間を削減することができる。具体的には、第一の実施形態では、プロセッサ200が命令を実行することによりインデックスの更新(図8のstep4)を実施していた。第二の実施形態では、インデックスの更新を並列比較選択ユニット内の更新インデックスによって実行させる。すなわち、ハードウェアによって実行させる。従ってプロセッサ200が実行する命令の数を削減する。従って、全体の処理時間を削減することができる。
 以上のように、本発明に係る実施形態の一態様によれば、インデックスをともなう最大値探索あるいは最小値探索のための並列比較選択演算装置を提供することができる。この並列比較選択演算装置及びその方法は、二つのベクトルデータを要素ごとに比較し、比較結果に基づいてどちらかの要素を選択するとともに、さらに比較結果に基づいて二つのベクトルデータに対応するインデックスについてもどちらかを要素毎に選択することができる。また、この並列比較選択演算装置を備えるプロセッサはインデックスをともなう最大値探索あるいは最小値探索を効率良く実行することができる。
 また、本発明に係る実施形態の一態様によれば、複数の要素を含むベクトルの最大値または最小値及び対応するインテックスを、二入力の比較演算器を複数個使用して、効率よく探索することができる。
 具体的には、複数の要素をレジスタに読み込み比較する。これにより、レジスタからベクトルの複数の要素を読み込むときの効率を向上させることができる。
 また、二つの値を比較する比較演算器を複数個備え、二入力の比較演算器を複数個使用してベクトルの各要素を並列して比較し、ベクトルの最大値または最小値を探索する。二入力の比較演算器を複数個使用することは、多入力の比較演算器を使用する場合に比べ、処理遅延を小さくすることができる。また、回路の製造においても、二入力の比較演算器を複数個作ることは、多入力の比較演算器を作ることに比べて容易である。これによりコストを削減することも期待できる。
 以上、実施の形態を参照して本願発明を説明したが、本願発明は上記によって限定されるものではない。本願発明の構成や詳細には、発明のスコープ内で当業者が理解し得る様々な変更をすることができる。
 この出願は、2009年2月2日に出願された日本出願特願2009-021199を基礎とする優先権を主張し、その開示の全てをここに取り込む。
 本発明を使用すれば、複数のデータの中から最大値あるいは最小値とそのインデックスを効率良く探す事ができる。最大値あるいは最小値を探索する処理はさまざまな情報処理分野で使われる基本的な処理である。従って、最大値あるいは最小値を効率良く探索可能な本発明は情報処理分野で幅広い応用が可能である。
100 メモリ
200 プロセッサ
210 命令デコーダ
220 命令実行ユニット
230 レジスタバンク
240、240a 並列比較選択演算ユニット
241 インデックス・ベクトル生成ユニット
242 ベクトル比較選択ユニット
243 インデックス・ベクトル選択ユニット
244 更新ユニット244
10~14 分割ユニット
20~23 結合ユニット
30~33 比較選択ユニット
40~44 選択ユニット
50 比較ユニット

Claims (12)

  1.  複数の要素を含む第一ベクトルデータと、前記第一ベクトルデータと同じ数の要素を含む第二ベクトルデータとを使用して、前記第一ベクトルデータ及び前記第二ベクトルデータに含まれる各要素を対応する要素ごとに比較し、その比較結果に基づいて、前記第一ベクトルデータと前記第二ベクトルデータの一方の要素を選択し、選択された要素で構成される第三ベクトルデータを生成するベクトル比較選択手段と、
     前記第一ベクトルデータに含まれる各要素に対応するインデックスを含む第一インデックス・ベクトルと、前記第二ベクトルデータに含まれる各要素に対応するインデックスを含む第二インデックス・ベクトルと、前記比較結果とを使用して、前記比較結果に基づいて、前記第一インデックス・ベクトルと前記第二インデックス・ベクトルの一方の要素を選択し、選択された要素で構成される第三インデックス・ベクトルを生成するインデックス・ベクトル選択手段と、を備える並列比較選択演算装置。
  2.  前記ベクトル比較選択手段は、
     前記第一ベクトルデータに含まれる一つの要素と前記第二ベクトルデータに含まれる一つの要素とを比較し、その比較結果に基づいて、二つの要素の一方を選択する複数の要素比較選択手段を備えること、
    を特徴とする請求項1記載の並列比較選択演算装置。
  3.  前記ベクトル比較選択手段は、前記第一ベクトルデータの要素の数と等しい数の要素比較選択手段を備え、
     前記ベクトル比較選択手段は、
     前記第一ベクトルデータを複数の要素に分割し、分割した複数の要素を前記複数の要素比較選択手段へ出力する第一ベクトル分割手段と、
     前記第二ベクトルデータを複数の要素に分割し、分割した複数の要素を前記複数の要素比較選択手段へ出力する第二ベクトル分割手段と、
     前記複数の要素比較選択手段が選択する要素を結合して前記第三ベクトルデータを生成するベクトル結合手段と、をさらに備えること、
    を特徴とする請求項2記載の並列比較選択演算装置。
  4.  前記インデックス・ベクトル選択手段は、
     前記第一ベクトルデータに含まれる一つの要素に対応するインデックス、及び前記第二ベクトルデータに含まれる一つの要素に対応するインデックスを使用して、前記要素比較選択手段が生成した比較結果に基づいて、二つのインデックスの一方を選択する複数の選択手段を備えること、
    を特徴とする請求項2または3記載の並列比較選択演算装置。
  5.  前記インデックス・ベクトル選択手段は、
     前記第一インデックス・ベクトルを複数のインデックスに分割し、前記複数の選択手段へ出力する第一インデックス分割手段と、
     前記第二インデックス・ベクトルを複数のインデックスに分割し、前記複数の選択手段へ出力する第二インデックス分割手段と、
     前記複数の選択手段が選択するインデックスを結合して前記第三インデックス・ベクトルを生成するインデックス結合手段と、をさらに備えること、
    を特徴とする請求項4記載の並列比較選択演算装置。
  6.  前記ベクトル比較選択手段は、前記複数の要素比較選択手段が生成した比較結果を結合し、比較結果ベクトルを生成する比較結果結合手段を備え、
     前記インデックス・ベクトル選択手段は、前記比較結果ベクトルに含まれる複数の前記要素比較結果を前記複数の選択手段に出力する比較結果分割手段を備えること、
    を特徴とする請求項2乃至5のいずれか一項に記載の並列比較選択演算装置。
  7.  前記第一ベクトルデータの最初の要素に対応する開始インデックスに基づいて、前記第一インデックス・ベクトルを生成し、前記インデックス・ベクトル選択手段へ出力するインデックス・ベクトル生成手段と、
     前記開始インデックスに基づいて、次の開始インデックスを算出する更新手段と、をさらに備えること、
    を特徴とする請求項1乃至6のいずれか一項に記載の並列比較選択演算装置。
  8.  請求項1乃至7のいずれか一項に記載の並列比較選択演算装置を備えるプロセッサ。
  9.  複数の要素を含む第一ベクトルデータと、前記第一ベクトルデータと同じ数の要素を含む第二ベクトルデータと、前記第一ベクトルデータのインデックスに関する第一インデックス情報と、前記第二ベクトルデータに含まれる各要素に対応するインデックスで構成された第二インデックス・ベクトルとを使用して、
     前記第一ベクトルデータ及び前記第二ベクトルデータに含まれる各要素を対応する要素ごとに比較し、
     比較結果に基づいて、前記第一ベクトルデータと前記第二ベクトルデータの一方の要素を選択し、
     選択された要素で構成される第三ベクトルデータを生成し、
     前記比較結果と、前記第一インデックス情報と、前記第二インデックス・ベクトルとに基づいて、前記第三ベクトルデータに含まれる各要素に対応するインデックスを選択し、
     選択された複数のインデックスで構成される第三インデックス・ベクトルを生成すること、
    を特徴とする並列比較選択演算方法。
  10.  前記第一インデックス情報は、前記第一ベクトルデータの各要素に対応するインデックスで構成された第一インデックス・ベクトルを含み、
     前記第三ベクトルデータの各要素に対応するインデックスを、前記比較結果に基づいて、前記第一インデックス・ベクトルと前記第二インデックス・ベクトルから選択すること、
    を特徴とする請求項9記載の並列比較選択演算方法。
  11.  前記第一インデックス情報は、前記第一ベクトルデータの最初の要素に対応する開始インデックスを含み、
     前記開始インデックスに基づいて、前記第一ベクトルデータの各要素に対応するインデックスで構成された第一インデックス・ベクトルを生成し、
     前記第三ベクトルデータの各要素に対応するインデックスを、前記比較結果に基づいて、前記第一インデックス・ベクトルと前記第二インデックス・ベクトルから選択すること、
    を特徴とする請求項9記載の並列比較選択演算方法。
  12.  前記開始インデックスに基づいて、次の開始インデックスを算出すること、
    を特徴とする請求項11記載の並列比較選択演算方法。
PCT/JP2010/000398 2009-02-02 2010-01-25 並列比較選択演算装置、プロセッサ及び並列比較選択演算方法 WO2010087144A1 (ja)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US13/147,157 US20120023308A1 (en) 2009-02-02 2010-01-25 Parallel comparison/selection operation apparatus, processor, and parallel comparison/selection operation method
JP2010548410A JP5500652B2 (ja) 2009-02-02 2010-01-25 並列比較選択演算装置、プロセッサ及び並列比較選択演算方法

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2009-021199 2009-02-02
JP2009021199 2009-02-02

Publications (1)

Publication Number Publication Date
WO2010087144A1 true WO2010087144A1 (ja) 2010-08-05

Family

ID=42395409

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2010/000398 WO2010087144A1 (ja) 2009-02-02 2010-01-25 並列比較選択演算装置、プロセッサ及び並列比較選択演算方法

Country Status (3)

Country Link
US (1) US20120023308A1 (ja)
JP (1) JP5500652B2 (ja)
WO (1) WO2010087144A1 (ja)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016537726A (ja) * 2013-11-15 2016-12-01 クゥアルコム・インコーポレイテッドQualcomm Incorporated 実行ユニットとベクトルデータメモリとの間のマージング回路を備えるベクトル処理エンジンおよび関連する方法
JP2020513120A (ja) * 2017-04-03 2020-04-30 グーグル エルエルシー ベクトル縮小プロセッサ

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130332701A1 (en) * 2011-12-23 2013-12-12 Jayashankar Bharadwaj Apparatus and method for selecting elements of a vector computation
US9459867B2 (en) 2012-03-15 2016-10-04 International Business Machines Corporation Instruction to load data up to a specified memory boundary indicated by the instruction
US9715383B2 (en) 2012-03-15 2017-07-25 International Business Machines Corporation Vector find element equal instruction
US9454366B2 (en) 2012-03-15 2016-09-27 International Business Machines Corporation Copying character data having a termination character from one memory location to another
US9454367B2 (en) 2012-03-15 2016-09-27 International Business Machines Corporation Finding the length of a set of character data having a termination character
US9268566B2 (en) 2012-03-15 2016-02-23 International Business Machines Corporation Character data match determination by loading registers at most up to memory block boundary and comparing
US9280347B2 (en) 2012-03-15 2016-03-08 International Business Machines Corporation Transforming non-contiguous instruction specifiers to contiguous instruction specifiers
US9459868B2 (en) 2012-03-15 2016-10-04 International Business Machines Corporation Instruction to load data up to a dynamically determined memory boundary
US9459864B2 (en) 2012-03-15 2016-10-04 International Business Machines Corporation Vector string range compare
US9710266B2 (en) 2012-03-15 2017-07-18 International Business Machines Corporation Instruction to compute the distance to a specified memory boundary
US9588762B2 (en) 2012-03-15 2017-03-07 International Business Machines Corporation Vector find element not equal instruction
US9600279B2 (en) * 2012-07-26 2017-03-21 Verisilicon Holdings Co., Ltd. Circuit and method for searching a data array and single-instruction, multiple-data processing unit incorporating the same
US9804839B2 (en) 2012-12-28 2017-10-31 Intel Corporation Instruction for determining histograms
US9098121B2 (en) * 2013-01-22 2015-08-04 Freescale Semiconductor, Inc. Vector comparator system for finding a peak number
EP3491515A4 (en) * 2016-07-27 2020-07-15 Intel Corporation VECTOR COMPARISON MULTIPLEXING SYSTEM AND METHOD
US10564964B2 (en) * 2016-08-23 2020-02-18 International Business Machines Corporation Vector cross-compare count and sequence instructions

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61138373A (ja) * 1984-12-11 1986-06-25 Nec Corp ベクトル要素間演算方式
JPH01309174A (ja) * 1988-06-07 1989-12-13 Hitachi Ltd ベクトル処理装置
JPH05165874A (ja) * 1991-12-12 1993-07-02 Hitachi Ltd ベクトル演算処理装置
JPH0877142A (ja) * 1994-08-31 1996-03-22 Fujitsu Ltd ベクトルプロセッサ

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0833810B2 (ja) * 1989-06-19 1996-03-29 甲府日本電気株式会社 ベクトルデータ検索装置
US8392692B2 (en) * 2008-08-15 2013-03-05 Lsi Corporation Determining index values for bits of binary vector by processing masked sub-vector index values

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61138373A (ja) * 1984-12-11 1986-06-25 Nec Corp ベクトル要素間演算方式
JPH01309174A (ja) * 1988-06-07 1989-12-13 Hitachi Ltd ベクトル処理装置
JPH05165874A (ja) * 1991-12-12 1993-07-02 Hitachi Ltd ベクトル演算処理装置
JPH0877142A (ja) * 1994-08-31 1996-03-22 Fujitsu Ltd ベクトルプロセッサ

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ALTIVECTM TECHNOLOGY PROGRAMMING ENVIRONMENTS MANUAL, 17 April 2006 (2006-04-17), pages 6 - 1-6-8, 6-61, 6-75, Retrieved from the Internet <URL:http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=02VS0181285Nf2> [retrieved on 20100204] *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016537726A (ja) * 2013-11-15 2016-12-01 クゥアルコム・インコーポレイテッドQualcomm Incorporated 実行ユニットとベクトルデータメモリとの間のマージング回路を備えるベクトル処理エンジンおよび関連する方法
JP2020513120A (ja) * 2017-04-03 2020-04-30 グーグル エルエルシー ベクトル縮小プロセッサ
JP7055809B2 (ja) 2017-04-03 2022-04-18 グーグル エルエルシー ベクトル縮小プロセッサ
JP2022095817A (ja) * 2017-04-03 2022-06-28 グーグル エルエルシー ベクトル縮小プロセッサ
JP7256914B2 (ja) 2017-04-03 2023-04-12 グーグル エルエルシー ベクトル縮小プロセッサ
US11940946B2 (en) 2017-04-03 2024-03-26 Google Llc Vector reduction processor

Also Published As

Publication number Publication date
JP5500652B2 (ja) 2014-05-21
JPWO2010087144A1 (ja) 2012-08-02
US20120023308A1 (en) 2012-01-26

Similar Documents

Publication Publication Date Title
JP5500652B2 (ja) 並列比較選択演算装置、プロセッサ及び並列比較選択演算方法
CN106775592B (zh) 处理器、用于计算系统的方法、机器可读介质和计算机系统
CN105278920B (zh) 用于实现具有迭代依赖条件的迭代的向量环路的指令
JP6466388B2 (ja) 方法及び装置
TWI489384B (zh) 執行置換運算的處理器與方法及具有該處理器的電腦系統
KR20110055629A (ko) 단일 명령 다중 데이터(simd)데이터 처리기에서 확장된 어드레싱 모드들의 제공
TW201640331A (zh) 用於向量索引載入和儲存之方法和設備
JP2013174961A (ja) ベクトルプロセッサ、ベクトルプロセッサの処理方法
TWI490781B (zh) 用於選擇向量運算之元素的裝置及方法
JP6773378B2 (ja) 3d座標から3dのz曲線インデックスを計算するための機械レベル命令
US20240004663A1 (en) Processing device with vector transformation execution
JP2017534982A (ja) 4d座標から4dのz曲線インデックスを計算するための機械レベル命令
US8604946B2 (en) Data processing device and data processing method
CN110914801B (zh) 在数据处理设备中的向量交叉
JP5862397B2 (ja) 演算処理装置
TWI517032B (zh) 用以執行兩向量暫存器之對應填充資料元件間絕對差計算之系統、裝置及方法
JP2020027533A (ja) 演算処理装置及び演算処理装置の制御方法
JP6237241B2 (ja) 処理装置
JP5753603B2 (ja) データ要素内のビットをゼロ化するためのシステム、装置、および方法
JP5786719B2 (ja) ベクトルプロセッサ
WO2020084694A1 (ja) 演算処理装置及び演算処理装置の制御方法
JP2013114608A (ja) Vliwプロセッサと命令構造と命令実行方法
JPH056393A (ja) 関数演算処理装置およびその演算方法
JP2010218178A (ja) ソート処理装置およびソート処理方法
JP2009193466A (ja) 半導体装置

Legal Events

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

Ref document number: 10735616

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 13147157

Country of ref document: US

WWE Wipo information: entry into national phase

Ref document number: 2010548410

Country of ref document: JP

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10735616

Country of ref document: EP

Kind code of ref document: A1