JP2007334563A - Vector processing device with mask - Google Patents

Vector processing device with mask Download PDF

Info

Publication number
JP2007334563A
JP2007334563A JP2006164610A JP2006164610A JP2007334563A JP 2007334563 A JP2007334563 A JP 2007334563A JP 2006164610 A JP2006164610 A JP 2006164610A JP 2006164610 A JP2006164610 A JP 2006164610A JP 2007334563 A JP2007334563 A JP 2007334563A
Authority
JP
Japan
Prior art keywords
vector
mask
unit
register
data
Prior art date
Legal status (The legal status 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 status listed.)
Withdrawn
Application number
JP2006164610A
Other languages
Japanese (ja)
Inventor
Satoshi Nakazato
聡 中里
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP2006164610A priority Critical patent/JP2007334563A/en
Publication of JP2007334563A publication Critical patent/JP2007334563A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Complex Calculations (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a vector processing device with a mask which can improve performance by shortening the TAT of executing a vector processing with a mask. <P>SOLUTION: The vector processing device with the mask comprises a vector register 100, vector processor 110, vector mask register 140, position calculator 4, and address converter 3. The vector register 100 stores vector data. The vector mask register 140 stores vector mask data which have mask bits for controlling processing by every element of the vector data. The position calculator 4 sequentially calculates positions where the effective mask bits appear. The address converter 3 converts the positions of the effective mask bits obtained by the position calculator 4 to the address of the vector register 100. The vector processor 110 executes processing of only the elements of the vector data corresponding to the effective mask bits. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、ベクトル演算処理装置に関し、特にマスク付きベクトル演算処理装置に関する。   The present invention relates to a vector arithmetic processing device, and more particularly to a vector arithmetic processing device with a mask.

ベクトルプロセッサでは、アプリケーションプログラムの実効性能を向上させるために、コンパイル時に出来る限りベクトル命令を使用できるようにする必要がある。通常のループ処理では、このようなベクトル化が比較的容易である。しかし、IF文付きのループ処理ではIF文処理の結果によって実行する処理内容が変わるため、通常のベクトル命令に変換することができない。そこで、このようなIF文付きループ処理をベクトル化するために、マスク付きベクトル演算命令が存在する。   In a vector processor, in order to improve the effective performance of an application program, it is necessary to use vector instructions as much as possible during compilation. Such vectorization is relatively easy in normal loop processing. However, in the loop processing with an IF statement, the processing content to be executed changes depending on the result of the IF statement processing, and therefore cannot be converted into a normal vector instruction. Therefore, in order to vectorize such a loop process with an IF statement, a vector operation instruction with a mask exists.

IF文付きループ処理に一例を以下に示す。このようなループ文の処理では、“A(I).LT.0”の実行結果をベクトルマスクとして設定して、“U(I)=X(I)−Y(I)”のマスク付きベクトル演算を実行した後に、ベクトルマスクを反転して、“U(I)=X(I)+Y(I)”のマスク付きベクトル演算を実行することで、ベクトル化することが可能になる。
DO I=1,N
IF (A(I).LT.0) THEN
U(I)=X(I)−Y(I)
ELSE
U(I)=X(I)+Y(I)
CONTINUE
An example of the loop processing with IF statement is shown below. In such a loop statement processing, the execution result of “A (I) .LT.0” is set as a vector mask, and a vector with a mask of “U (I) = X (I) −Y (I)” After executing the operation, the vector mask is inverted, and a vector operation with a mask of “U (I) = X (I) + Y (I)” is executed, thereby enabling vectorization.
DO I = 1, N
IF (A (I) .LT.0) THEN
U (I) = X (I) -Y (I)
ELSE
U (I) = X (I) + Y (I)
CONTINUE

図1は、マスク付きベクトル演算命令を実行する構成を示すブロック図である。マスク付きベクトル演算命令は、一般的に、このような構成で実行処理される。ベクトル演算器710は、2つのソースオペランドが格納されているベクトルレジスタVR#0_700、VR#1_701からソースオペランドを読み出す。そして、演算結果をディスティネーションオペランドを格納するベクトルレジスタVR#2_702に書き戻す。このとき、ベクトルレジスタVR#0_700、VR#1_701の読み出しアドレスは、アドレスレジスタ720の値によって指定される。アドレスレジスタ720の値はインクリメンタ730によってクロックサイクル毎にカウントアップされる。また、演算結果が格納されるベクトルレジスタVR#2_702の書き込みアドレスは、アドレスレジスタ722の値によって指定される。アドレスレジスタ722の値はインクリメンタ732によってクロックサイクル毎にカウントアップされる。以上により、ベクトルレジスタ(VR#0_700、VR#1_701)に格納された複数要素のベクトルデータを順次読み出して要素毎に演算処理を行い、その演算結果を別のベクトルレジスタ(VR#2_702)に要素毎に書き戻すことができる。   FIG. 1 is a block diagram showing a configuration for executing a masked vector operation instruction. A vector operation instruction with a mask is generally executed and processed in such a configuration. The vector computing unit 710 reads the source operand from the vector registers VR # 0_700 and VR # 1_701 in which two source operands are stored. Then, the operation result is written back to the vector register VR # 2_702 that stores the destination operand. At this time, the read addresses of the vector registers VR # 0_700 and VR # 1_701 are specified by the value of the address register 720. The value of the address register 720 is counted up by the incrementer 730 every clock cycle. The write address of the vector register VR # 2_702 in which the operation result is stored is specified by the value of the address register 722. The value in the address register 722 is counted up by the incrementer 732 every clock cycle. As described above, the vector data of a plurality of elements stored in the vector registers (VR # 0_700, VR # 1_701) are sequentially read out to perform arithmetic processing for each element, and the operation result is stored in another vector register (VR # 2_702). You can write back every time.

ベクトルマスクレジスタ740は、ベクトル演算処理実行時の要素毎の有効/無効を識別するビット列であるベクトルマスクを格納している。ベクトルマスクのビット長はベクトル演算処理におけるベクトルデータの要素数と等しい。ベクトルマスクレジスタ740に格納されたベクトルマスクは、ベクトル演算器710の演算結果がベクトルレジスタVR#2_702に格納されるのに同期して、パラレル−シリアル変換器760によって先頭ビットから順に1ビットづつ取り出され、そのビットがベクトルレジスタVR#2_702の書き込み制御入力(WE:Write Enable)に与えられる。ベクトルマスクが無効を表すビット値であった場合、そのエントリに対応するベクトル要素の演算結果を書き戻すアドレスをアドレスレジスタ722が指定した際、ベクトルレジスタVR#2_702の書き込み制御入力は書き込み無効を指定する。その結果、このベクトル要素の演算結果はベクトルレジスタVR#2_702に書き込みが行われない。このようにして、ベクトルマスクが有効を表すビット値のベクトル要素のみがベクトルレジスタVR#2_702に書き込まれ、その他のベクトル要素はベクトルレジスタVR#2_702の元の値が保存されることで、マスク付きベクトル演算命令が実行される。   The vector mask register 740 stores a vector mask that is a bit string for identifying validity / invalidity for each element at the time of executing a vector operation process. The bit length of the vector mask is equal to the number of vector data elements in the vector operation process. The vector mask stored in the vector mask register 740 is taken out one bit at a time in order from the first bit by the parallel-serial converter 760 in synchronization with the calculation result of the vector calculator 710 being stored in the vector register VR # 2_702. The bit is supplied to a write control input (WE: Write Enable) of the vector register VR # 2_702. When the vector mask is a bit value indicating invalidity, when the address register 722 designates an address for writing back the operation result of the vector element corresponding to the entry, the write control input of the vector register VR # 2_702 designates write invalidity. To do. As a result, the calculation result of this vector element is not written into the vector register VR # 2_702. In this way, only the vector element of the bit value indicating that the vector mask is valid is written to the vector register VR # 2_702, and the other vector elements are masked by storing the original value of the vector register VR # 2_702. A vector operation instruction is executed.

図2、図3は、通常及びマスク付きベクトル演算処理の演算TAT(Turn Around Time)を示す。図2は通常のベクトル演算(ベクトルマスクが全ビット有効であることに相当する)の場合、図3はマスク付きベクトル演算の場合、をそれぞれ示している。図3では、ベクトルマスクの値が“0”の場合を無効要素として、その要素に対する演算を図中では網掛けで表している。図2のベクトル演算のTATは、演算器単体のTATと要素数の和になる。一方、図3のマスク付きベクトル演算のTATは、図2の場合と同じく、演算器単体のTATと要素数の和となる。ベクトルマスクが無効要素を表すビット値の場合でも演算自体は実行しており、演算結果がベクトルレジスタに書き込まれないだけだからである。従って、ベクトル要素数が等しければ、ベクトルマスクの有無、ベクトルマスクの値の相違に関わらず、ベクトル演算のTATは等しくなる。   2 and 3 show a calculation TAT (Turn Around Time) for normal and masked vector calculation processing. FIG. 2 shows a case of a normal vector operation (corresponding to a vector mask being valid for all bits), and FIG. 3 shows a case of a vector operation with a mask. In FIG. 3, the case where the value of the vector mask is “0” is regarded as an invalid element, and the calculation for the element is represented by shading in the drawing. The TAT of the vector operation in FIG. 2 is the sum of the TAT of the arithmetic unit alone and the number of elements. On the other hand, the TAT of the masked vector operation of FIG. 3 is the sum of the TAT of the arithmetic unit alone and the number of elements, as in the case of FIG. This is because the operation itself is executed even when the vector mask is a bit value representing an invalid element, and the operation result is not written into the vector register. Therefore, if the number of vector elements is equal, the TAT of the vector operation becomes equal regardless of the presence or absence of the vector mask and the difference in the value of the vector mask.

ところで、最近ではソースプログラムにおいて、以下に示すようなループ記述が増えてきている。このようなループ処理をマスク付きベクトル演算で実行する場合、“A(I).LT.0”の実行結果から条件が成立する要素までの要素数をカウントして、先頭ビットからカウントされた要素数だけを有効とするベクトルマスクを生成する。そして、“U(I)=X(I)+Y(I)”のマスク付きベクトル演算を実行することになる。このとき、ベクトルマスクにおいて先頭ビットからの有効要素数が非常に少ない場合(最も極端な場合は、最初の要素で条件が成立してループ外にジャンプするケースもあり得る)でも、マスク付きベクトル演算のTATは、全要素が有効な場合のベクトル演算のTATと等しいことになる。
DO I=1,N
IF (A(I).LT.0) THEN
GOTO <ループ外>
ELSE
U(I)=X(I)+Y(I)
CONTINUE
By the way, recently, the loop description as shown below is increasing in the source program. When such a loop process is executed by a masked vector operation, the number of elements from the execution result of “A (I) .LT.0” to the element that satisfies the condition is counted, and the elements counted from the first bit are counted. Generate a vector mask that only makes the number valid. Then, a masked vector operation of “U (I) = X (I) + Y (I)” is executed. At this time, even if the number of valid elements from the first bit in the vector mask is very small (in the most extreme case, the condition may be satisfied at the first element and jump out of the loop may occur). Is equal to the TAT of the vector operation when all elements are valid.
DO I = 1, N
IF (A (I) .LT.0) THEN
GOTO <outside loop>
ELSE
U (I) = X (I) + Y (I)
CONTINUE

従って、このようなループ処理に対するマスク付きベクトル演算処理に対しては、以下に示すような問題がある。第1の課題は、これまでのマスク付きベクトル演算処理装置では、マスクビット上で有効な要素データが少ない場合でも全要素に対する演算処理を実行するため、演算TATが短縮できず、性能向上が困難なことである。第2の課題は、マスクビット上で無効な要素データに対しても演算処理を実行するため、本来は必要のない演算処理に対する電力消費が発生することである。マスク付きベクトル演算処理における演算実行TATを短縮して性能を向上させることが可能な技術が望まれる。無効な要素データに対する演算処理を実行しないことで不必要な電力消費を回避して低消費電力化を実現する技術が望まれる。   Therefore, the masked vector calculation process for such a loop process has the following problems. The first problem is that conventional vector arithmetic processing devices with masks perform arithmetic processing on all elements even when there is little effective element data on the mask bits, so the arithmetic TAT cannot be shortened and it is difficult to improve performance. It is a thing. The second problem is that the arithmetic processing is performed even on the element data that is invalid on the mask bit, so that the power consumption for the arithmetic processing which is not originally necessary occurs. A technique capable of improving the performance by shortening the operation execution TAT in the vector operation processing with mask is desired. There is a demand for a technology that realizes low power consumption by avoiding unnecessary power consumption by not performing arithmetic processing on invalid element data.

関連する技術として特開昭62−276668号公報にベクトルマスク演算制御ユニットが開示されている。このベクトルマスク演算制御ユニットは、先行制御装置により解読されたマスク付ベクトル命令処理を実行するデータ処理システムにおいて、カウント手段と、発生手段と、アドレス生成手段とを含む。カウント手段は、ベクトルオペランドを1対1でそれぞれマスクする複数ビット中の連続する演算抑止ビットの個数をカウントする。発生手段は、このカウント手段でカウントされた値を用いて2のべき乗倍されたアドレスインクリメント値を1値又は2値発生する。アドレス生成手段は、この発生手段から発生された2のべき乗されたアドレスインクリメント値とベクトルアドレスとを加算しオペランドアドレスを求める。   As a related technique, a vector mask calculation control unit is disclosed in Japanese Patent Application Laid-Open No. 62-276668. The vector mask arithmetic control unit includes a counting means, a generating means, and an address generating means in a data processing system that executes a masked vector instruction process decoded by a preceding control device. The counting means counts the number of consecutive operation suppression bits in the plurality of bits masking the vector operands one to one. The generating means generates one or two values of the address increment value multiplied by 2 using the value counted by the counting means. The address generating means adds the power-increment value of 2 raised from the generating means and the vector address to obtain the operand address.

特開昭58−22446号公報にベクトル・マスク演算制御方式が開示されている。このベクトル・マスク演算制御方法は、アレイ・オペランド及びマスク・ベクトルを順次読み出し、該マスク・ベクトルのビット値に従い、対応するオペランドの演算を制御する。該マスク・ベクトル中に、一定個数の演算抑止ビットが連続していることを検出する手段と、該個数分のオペランド及びマスク・ビットを飛び越すような記憶アドレスの更新手段とを設ける。該抑止ビットを検出したとき、対応するオペランドの読み出しと無効な演算を飛ばすように制御する。   Japanese Patent Laid-Open No. 58-22446 discloses a vector mask arithmetic control system. This vector mask operation control method sequentially reads array operands and mask vectors, and controls the operation of corresponding operands according to the bit values of the mask vectors. Means for detecting that a certain number of operation suppression bits are continuous in the mask vector and means for updating storage addresses so as to skip over the operands and mask bits for the number are provided. When the suppression bit is detected, control is performed so as to skip reading of the corresponding operand and invalid operation.

特開平7−219928号公報に、ベクトルデータ処理装置が開示されている。このベクトルデータ処理装置は、ベクトルレジスタと、前記ベクトルレジスタに格納されるベクトルデータの要素毎に対応するマスクビットを有するマスクレジスタを持つ。インターバルカウンタと、インターバルバッファと、書込みアドレスレジスタと、マスク読みだしレジスタと、インターバルバッファ読みだしカウンタと、累積加算器とを有する。インターバルカウンタは、マスク付き演算を行う場合、マスク付き演算実行前に、マスクレジスタより1ビットずつマスクビットを読みだし、有効マスクビット間のビット間隔をカウントする。インターバルバッファは、有効マスクビット出現時に前記インターバルカウンタの値を格納する。書込みアドレスレジスタは、有効マスクビット出現数をカウントし前記インターバルバッファの書込みアドレスを生成する。マスク読みだしレジスタは、前記マスクレジスタを読みだしてインターバルバッファ書込み有効信号及びインターバルカウンタ制御信号およびインターバルバッファ書込みアドレス制御信号を生成する。インターバルバッファ読みだしカウンタは、マスク付き演算における前記ベクトルレジスタ読みだし時に前記インターバルバッファの読みだしアドレスを生成する。累積加算器は、前記インターバルバッファより読み出されたマスク有効ビット間隔を順次累積加算し前記ベクトルレジスタに格納されるベクトルデータの内マスクビット有効なベクトルデータのみの読みだしアドレスを生成する。   Japanese Patent Application Laid-Open No. 7-219928 discloses a vector data processing apparatus. This vector data processing apparatus has a vector register and a mask register having a mask bit corresponding to each element of vector data stored in the vector register. It has an interval counter, an interval buffer, a write address register, a mask read register, an interval buffer read counter, and a cumulative adder. When performing an operation with a mask, the interval counter reads a mask bit bit by bit from the mask register before executing the operation with a mask, and counts the bit interval between effective mask bits. The interval buffer stores the value of the interval counter when a valid mask bit appears. The write address register counts the number of valid mask bits and generates a write address for the interval buffer. The mask read register reads the mask register and generates an interval buffer write enable signal, an interval counter control signal, and an interval buffer write address control signal. The interval buffer read counter generates a read address of the interval buffer when the vector register is read in the masked operation. The cumulative adder sequentially accumulates and adds the mask effective bit intervals read from the interval buffer, and generates a read address of only vector data having mask bits valid among the vector data stored in the vector register.

特開昭62−276668号公報JP-A-62-276668 特開昭58−22446号公報JP 58-22446 A 特開平7−219928号公報JP-A-7-219928

本発明の目的は、マスク付きベクトル演算処理における演算実行TATを短縮して性能を向上させることが可能なマスク付きベクトル演算処理装置を提供することにある。   An object of the present invention is to provide a masked vector arithmetic processing apparatus capable of improving the performance by shortening the arithmetic execution TAT in the masked vector arithmetic processing.

本発明の他の目的は、マスク付きベクトル演算処理における無効な要素データに対する演算処理を実行しないことで不必要な電力消費を回避して低消費電力化を実現することが可能なマスク付きベクトル演算処理装置を提供することにある。   Another object of the present invention is to perform a masked vector operation capable of reducing power consumption by avoiding unnecessary power consumption by not performing an operation process on invalid element data in a masked vector operation process. It is to provide a processing apparatus.

以下に、発明を実施するための最良の形態で使用される番号・符号を用いて、課題を解決するための手段を説明する。これらの番号・符号は、特許請求の範囲の記載と発明を実施するための最良の形態との対応関係を明らかにするために括弧付きで付加されたものである。ただし、それらの番号・符号を、特許請求の範囲に記載されている発明の技術的範囲の解釈に用いてはならない。   Hereinafter, means for solving the problem will be described using the numbers and symbols used in the best mode for carrying out the invention. These numbers and symbols are added with parentheses to clarify the correspondence between the description of the claims and the best mode for carrying out the invention. However, these numbers and symbols should not be used for interpreting the technical scope of the invention described in the claims.

上記課題を解決するために、本発明のマスク付きベクトル演算処理装置は、ベクトルレジスタ(100、101、102)と、ベクトル演算器(110)と、ベクトルマスクレジスタ(140)と、位置算出部(4)と、アドレス変換部(3)とを具備する。ベクトルレジスタ(100、101、102)は、ベクトルデータを格納する。ベクトルマスクレジスタ(140)は、ベクトルデータの要素毎の演算実行を制御するマスクビットを有するベクトルマスクデータを格納する。位置算出部(4)は、ベクトル演算実行時に、ベクトルマスクデータの有効マスクビットの出現する位置を順次算出する。アドレス変換部(3)は、位置算出部(4)によって得られた有効マスクビット位置をベクトルレジスタ(100)のアドレスに変換する。ベクトル演算器(110)は、ベクトルマスクデータの有効マスクビットに対するベクトルデータの要素についてのみベクトル演算を実行する。   In order to solve the above problems, a vector operation processing apparatus with a mask according to the present invention includes a vector register (100, 101, 102), a vector operation unit (110), a vector mask register (140), a position calculation unit ( 4) and an address conversion unit (3). The vector registers (100, 101, 102) store vector data. The vector mask register (140) stores vector mask data having mask bits for controlling the execution of each element of vector data. The position calculation unit (4) sequentially calculates the positions where the effective mask bits of the vector mask data appear when performing the vector operation. The address conversion unit (3) converts the effective mask bit position obtained by the position calculation unit (4) into the address of the vector register (100). The vector computing unit (110) performs vector computation only on the elements of the vector data for the effective mask bits of the vector mask data.

上記のマスク付きベクトル演算処理装置において、
位置算出部(4)は、ゼロカウント部(160)と、左シフト部(170)と、ベクトルマスクレジスタ出力部(150)とを備える。ゼロカウント部(160)は、ベクトルマスクデータの先頭ビットから連続するゼロ値をカウントする。左シフト部(170)は、ゼロカウント部(160)の結果に基づいて、ベクトルマスクデータのビット列を左側に所定ビット数シフトする。ベクトルマスクレジスタ出力部(150)は、ベクトルマスクデータの値を左シフト部(170)の結果に置き換えてゼロカウント部(160)へ出力する。
In the above-described vector arithmetic processing apparatus with a mask,
The position calculation unit (4) includes a zero count unit (160), a left shift unit (170), and a vector mask register output unit (150). The zero count unit (160) counts consecutive zero values from the first bit of the vector mask data. The left shift unit (170) shifts the bit string of the vector mask data to the left by a predetermined number of bits based on the result of the zero count unit (160). The vector mask register output unit (150) replaces the value of the vector mask data with the result of the left shift unit (170) and outputs the result to the zero count unit (160).

上記のマスク付きベクトル演算処理装置において、位置算出部(4)は、ゼロカウント部(160)、左シフト部(170)及びベクトルマスクレジスタ出力部(150)の行う処理を所定回数繰り返して実行する。   In the above-described vector calculation processing apparatus with mask, the position calculation unit (4) repeatedly executes the processes performed by the zero count unit (160), the left shift unit (170), and the vector mask register output unit (150) a predetermined number of times. .

上記のマスク付きベクトル演算処理装置において、ゼロカウント部(160)の結果が、ベクトルデータの要素数と一致したことを検出する一致検出部(190)を更に具備する。一致検出部(190)が一致を検出したとき、繰り返しを終了してベクトル演算の実行完了とする。   The vector processing apparatus with a mask described above further includes a coincidence detection unit (190) that detects that the result of the zero count unit (160) matches the number of elements of the vector data. When the coincidence detection unit (190) detects a coincidence, the repetition is finished and the execution of the vector operation is completed.

上記のマスク付きベクトル演算処理装置において、アドレス変換部(3)は、現在のアドレス値と、ゼロカウント部(160)の結果とを加算する加算器(130、132)を備える。   In the masked vector arithmetic processing apparatus, the address conversion unit (3) includes adders (130, 132) for adding the current address value and the result of the zero count unit (160).

上記のマスク付きベクトル演算処理装置において、ベクトルマスクデータの有効マスクビット数のカウント結果に基づいて、予めベクトル演算の実行完了タイミングを出力する完了タイミング出力部(2)とを更に具備する。   The masked vector operation processing apparatus further includes a completion timing output unit (2) that outputs a vector operation execution completion timing in advance based on a count result of the number of effective mask bits of the vector mask data.

上記のマスク付きベクトル演算処理装置において、
完了タイミング出力部(2)は、カウントするカウント部(570)と、カウント値保持部(580)と、完了判定部(590)とを備える。カウント部(570)は、ベクトルマスクデータの有効マスクビット数をカウントする。カウント値保持部(580)は、カウント部(570)のカウント結果を保持する。完了判定部(590)は、ベクトル演算実行時に有効マスクビット数のカウント結果を読み出して予めベクトル演算の実行完了タイミングを出力する。
In the above-described vector arithmetic processing apparatus with a mask,
The completion timing output unit (2) includes a counting unit (570) for counting, a count value holding unit (580), and a completion determining unit (590). The count unit (570) counts the number of effective mask bits of the vector mask data. The count value holding unit (580) holds the count result of the count unit (570). The completion determination unit (590) reads the count result of the number of valid mask bits when executing the vector operation and outputs the execution completion timing of the vector operation in advance.

上記課題を解決するために、本発明は以下のマスク付きベクトル演算処理装置の動作方法である。ここで、マスク付ベクトル演算処理装置は、ベクトルデータを格納するベクトルレジスタ(100、101、102)と、ベクトル演算器(110)と、ベクトルデータの要素毎の演算実行を制御するマスクビットを有するベクトルマスクデータを格納するベクトルマスクレジスタ(140)と、位置算出部(4)と、アドレス変換部(3)とを具備する。マスク付きベクトル演算処理装置の動作方法は、ベクトル演算実行時に、(a)ベクトルマスクレジスタ(140)が、ベクトルデータの要素毎に対応するマスクビットを有するベクトルマスクデータを格納するステップと、(b)位置算出部(4)が、ベクトルマスクデータの有効マスクビットの出現する位置を順次算出するステップと、(c)アドレス変換部(3)が、位置算出部(4)によって得られた有効マスクビット位置をベクトルレジスタ(100)のアドレスに変換するステップと、(d)ベクトル演算器(110)が、ベクトルマスクデータの有効マスクビットに対するベクトルデータの要素についてのみベクトル演算を実行するステップとを具備する。   In order to solve the above-described problems, the present invention is an operation method of the following vector arithmetic processing apparatus with a mask. Here, the masked vector operation processing apparatus has a vector register (100, 101, 102) for storing vector data, a vector operation unit (110), and a mask bit for controlling the execution of each element of the vector data. A vector mask register (140) for storing vector mask data, a position calculation unit (4), and an address conversion unit (3) are provided. The operation method of the vector operation processing apparatus with a mask includes the steps of: (a) a vector mask register (140) storing vector mask data having a mask bit corresponding to each element of vector data when executing a vector operation; ) A step in which the position calculation unit (4) sequentially calculates the positions where the effective mask bits of the vector mask data appear; and (c) the effective mask obtained by the address conversion unit (3) by the position calculation unit (4). Converting a bit position into an address of the vector register (100); and (d) a vector operator (110) performing a vector operation only on an element of the vector data with respect to an effective mask bit of the vector mask data. To do.

上記のマスク付きベクトル演算処理装置の動作方法において、位置算出部(4)は、ゼロカウント部(160)と、左シフト部(170)と、ベクトルマスクレジスタ出力部(150)とを備える。(b)ステップは、(b1)ゼロカウント部(160)が、ベクトルマスクデータの先頭ビットから連続するゼロ値をカウントするステップと、(b2)左シフト部(170)が、ゼロカウント部(160)の結果に基づいて、ベクトルマスクデータのビット列を左側に所定ビット数シフトするステップと、(b3)ベクトルマスクレジスタ出力部(150)が、ベクトルマスクデータの値を左シフト部(170)の結果に置き換えてゼロカウント部(160)へ出力するステップとを備える。   In the operation method of the vector arithmetic processing apparatus with a mask, the position calculation unit (4) includes a zero count unit (160), a left shift unit (170), and a vector mask register output unit (150). The (b) step includes (b1) a step in which the zero count unit (160) counts a continuous zero value from the first bit of the vector mask data, and (b2) the left shift unit (170) performs a zero count unit (160 And (b3) the vector mask register output unit (150) converts the value of the vector mask data to the result of the left shift unit (170) based on the result of And outputting to the zero count unit (160).

上記のマスク付きベクトル演算処理装置の動作方法において、マスク付ベクトル演算処理装置は、一致検出部(190)を更に具備する。(e)一致検出部(190)が、ゼロカウント部(160)の結果とベクトルデータの要素数との一致を検出するステップと、(f)一致検出部(190)が一致を検出したとき、繰り返しを終了してベクトル演算の実行完了とするステップとを更に具備する。   In the above-described operation method of the vector arithmetic processing apparatus with a mask, the vector arithmetic processing apparatus with a mask further includes a coincidence detection unit (190). (E) a step in which the match detection unit (190) detects a match between the result of the zero count unit (160) and the number of elements of the vector data; and (f) when the match detection unit (190) detects a match, And a step of ending the iteration and completing the execution of the vector operation.

本発明により、マスク付きベクトル演算処理における演算実行TATを短縮して性能を向上させることが可能となる。加えて、無効な要素データに対する演算処理を実行しないことで不必要な電力消費を回避して低消費電力化を実現することが可能となる。   According to the present invention, it is possible to improve the performance by shortening the operation execution TAT in the masked vector operation processing. In addition, by not performing arithmetic processing on invalid element data, unnecessary power consumption can be avoided and low power consumption can be realized.

(第1の実施の形態)
以下、本発明のマスク付きベクトル演算処理装置の第1の実施の形態に関して、添付図面を参照して説明する。図4は、本発明のマスク付きベクトル演算処理装置の第1の実施の形態の構成の一例を示すブロック図である。マスク付きベクトル演算処理装置1は、ベクトル演算器110、ベクトルレジスタVR#0_100、VR#1_101、ベクトルレジスタVR#2_102、アドレスレジスタ120、アドレス加算器130、アドレスレジスタ122、書き込みアドレス加算器132、ベクトルマスクレジスタ140、選択回路150、Leading Zero回路160(以下、「LDZ回路160」と略称する)、左シフト回路170、一時退避レジスタ180、及び比較器190を具備する。
(First embodiment)
A first embodiment of a vector arithmetic processing apparatus with a mask according to the present invention will be described below with reference to the accompanying drawings. FIG. 4 is a block diagram showing an example of the configuration of the first embodiment of the vector arithmetic processing apparatus with mask according to the present invention. The vector operation processing apparatus 1 with mask includes a vector operation unit 110, vector registers VR # 0_100, VR # 1_101, vector register VR # 2_102, address register 120, address adder 130, address register 122, write address adder 132, vector A mask register 140, a selection circuit 150, a Leading Zero circuit 160 (hereinafter abbreviated as “LDZ circuit 160”), a left shift circuit 170, a temporary save register 180, and a comparator 190 are provided.

ベクトルレジスタVR#0_100、VR#1_101は、それぞれソースオペランドが格納されている。ベクトルレジスタVR#2_102は、ディスティネーションオペランドを格納する。ベクトル演算器110は、ベクトルレジスタVR#0_100、VR#1_101から2つのソースオペランドを読み出す。そして、演算結果をベクトルレジスタVR#2_102に書き戻す。アドレスレジスタ120は、ベクトル演算器110が2つのソースオペランドを読み出すとき、ベクトルレジスタVR#0_100、VR#1_101の読み出しアドレスを指定する値を格納する。読み出しアドレス加算器130は、アドレスレジスタ120の値をクロックサイクル毎に更新する。アドレスレジスタ122は、演算結果が格納されるベクトルレジスタVR#2_102の書き込みアドレスを指定する値を格納する。書き込みアドレス加算器132は、アドレスレジスタ122の値をクロックサイクル毎に更新する。 The vector registers VR # 0_100 and VR # 1_101 store source operands, respectively. The vector register VR # 2_102 stores the destination operand. The vector calculator 110 reads two source operands from the vector registers VR # 0_100 and VR # 1_101. Then, the operation result is written back to the vector register VR # 2_102. The address register 120 stores a value for designating read addresses of the vector registers VR # 0_100 and VR # 1_101 when the vector computing unit 110 reads two source operands. The read address adder 130 updates the value of the address register 120 every clock cycle. The address register 122 stores a value that specifies the write address of the vector register VR # 2_102 in which the operation result is stored. The write address adder 132 updates the value of the address register 122 every clock cycle.

ベクトルマスクレジスタ140は、ベクトル演算処理実行時の要素毎の有効/無効を識別するビット列であるベクトルマスクを格納している。ベクトルマスクのビット長はベクトル演算処理におけるベクトルデータの要素数と等しい。ベクトルマスクレジスタ140は、ベクトルマスクレジスタ140の値(ベクトルマスク)を選択回路150へ出力する。選択回路150は、演算開始直後はベクトルマスクレジスタ140の出力を選択し、それ以降は一時退避レジスタ180の出力を選択して、LDZ回路160及び左シフト回路170へ出力する。LDZ回路160は、入力ビット列の先頭から論理値ゼロが連続するビット数(以下、「ゼロ値連続数値」と略称する)を算出する。LDZ回路160は、そのゼロ値連続数値を前述した読み出しアドレス加算器130、及び書き込みアドレス加算器132に出力する。   The vector mask register 140 stores a vector mask that is a bit string for identifying validity / invalidity for each element at the time of vector operation processing. The bit length of the vector mask is equal to the number of vector data elements in the vector operation process. The vector mask register 140 outputs the value (vector mask) of the vector mask register 140 to the selection circuit 150. The selection circuit 150 selects the output of the vector mask register 140 immediately after the start of the operation, selects the output of the temporary save register 180 thereafter, and outputs it to the LDZ circuit 160 and the left shift circuit 170. The LDZ circuit 160 calculates the number of bits in which the logical value zero continues from the beginning of the input bit string (hereinafter abbreviated as “zero value continuous numerical value”). The LDZ circuit 160 outputs the zero value continuous numerical value to the read address adder 130 and the write address adder 132 described above.

読み出しアドレス加算器130は、一方の入力としてのLDZ回路160のゼロ値連続数値と、他方の入力としての現在の読み出しアドレスレジスタ120の値とを供給される。読み出しアドレス加算器130は、桁上げ入力を必ず「+1」として加算を行う。これにより、LDZ回路160の出力がゼロ値であった場合、読み出しアドレス加算器130はインクリメンタとして動作する。すなわち、読み出しアドレス加算器130は、クロックサイクル毎に読み出しアドレスレジスタ120をカウントアップする。LDZ回路160の出力がゼロ値以外の場合、読み出しアドレス加算器130は、LDZ回路160の入力ビット列における先頭からのゼロ値連続数+1の値を、現在の読み出しアドレスレジスタ120に加算する。   The read address adder 130 is supplied with the continuous zero value of the LDZ circuit 160 as one input and the value of the current read address register 120 as the other input. The read address adder 130 always adds the carry input as “+1”. Thereby, when the output of the LDZ circuit 160 has a zero value, the read address adder 130 operates as an incrementer. That is, the read address adder 130 counts up the read address register 120 every clock cycle. When the output of the LDZ circuit 160 is other than a zero value, the read address adder 130 adds the value of the continuous zero value + 1 from the head in the input bit string of the LDZ circuit 160 to the current read address register 120.

同じく、書き込みアドレス加算器132は、一方の入力としてのLDZ回路160のゼロ値連続数値と、他方の入力としての現在の書き込みアドレスレジスタ122の値とを供給される。書き込みアドレス加算器132は、桁上げ入力を必ず「+1」として加算を行う。これにより、LDZ回路160の出力がゼロ値であった場合、書き込みアドレス加算器132はインクリメンタとして動作する。すなわち、クロックサイクル毎に書き込みアドレスレジスタ122をカウントアップする。LDZ回路160の出力がゼロ値以外の場合、書き込みアドレス加算器132は、LDZ回路160の入力ビット列における先頭からのゼロ値連続数+1の値を、現在の書き込みアドレスレジスタ122に加算する。   Similarly, the write address adder 132 is supplied with the continuous zero value of the LDZ circuit 160 as one input and the value of the current write address register 122 as the other input. The write address adder 132 always adds the carry input as “+1”. Thereby, when the output of the LDZ circuit 160 has a zero value, the write address adder 132 operates as an incrementer. That is, the write address register 122 is counted up every clock cycle. When the output of the LDZ circuit 160 is other than a zero value, the write address adder 132 adds the value of the zero value continuation number + 1 from the head in the input bit string of the LDZ circuit 160 to the current write address register 122.

一方、LDZ回路160は、更に、ゼロ値連続数値を左シフト回路170に出力する。左シフト回路170は、選択回路150から出力された入力データを、LDZ回路160の出力値(ゼロ値連続数値)+1だけ左シフトする。このとき、左シフト回路170は、これにより、LDZ回路160の出力がゼロ値であった場合にも必ず1ビット左シフトすることになる。左シフト回路170は、左シフトした値を一時退避レジスタ180へ出力する。一時退避レジスタ180は、その値を選択回路150にフィードバックする。   On the other hand, the LDZ circuit 160 further outputs a zero value continuous numerical value to the left shift circuit 170. The left shift circuit 170 shifts the input data output from the selection circuit 150 to the left by the output value (zero value continuous numerical value) +1 of the LDZ circuit 160. At this time, the left shift circuit 170 always shifts one bit to the left even when the output of the LDZ circuit 160 has a zero value. The left shift circuit 170 outputs the left shifted value to the temporary save register 180. The temporary save register 180 feeds back the value to the selection circuit 150.

LDZ回路160は、更に、ゼロ値連続数値を比較器190に出力する。比較器190は、ゼロ値連続数値と、ベクトルマスクレジスタ140のビット長(VL)、すなわち、ベクトル演算の演算要素数とを比較する。ここで、LDZ回路160の出力であるゼロ値連続数値をがベクトル演算要素数と一致した場合とは、LDZ回路160への入力となるビット列が全てゼロ値となったことを表す。これは、有効な要素データがなくなったことを意味する。したがって、比較器190が一致出力となった時点で、マスク付きベクトル演算の実行終了となる。その場合、ベクトル演算命令制御部(図示されず)に演算実行終了を通知する。   The LDZ circuit 160 further outputs a zero value continuous numerical value to the comparator 190. The comparator 190 compares the continuous zero value with the bit length (VL) of the vector mask register 140, that is, the number of operation elements of the vector operation. Here, the case where the zero value continuous numerical value that is the output of the LDZ circuit 160 matches the number of vector operation elements indicates that all the bit strings that are input to the LDZ circuit 160 have zero values. This means that there is no valid element data. Therefore, execution of the masked vector operation is finished when the comparator 190 outputs a coincidence. In this case, the completion of the operation execution is notified to a vector operation instruction control unit (not shown).

このようなマスク付きベクトル演算処理装置1により、ベクトルマスクのビット列において、ビット値“1”を有効な要素を表すビット値であるとした場合、そのエントリに対応するベクトル要素のソースオペランドが格納されたベクトルレジスタVR#0_100、VR#1_101の読み出しアドレスのみをクロックサイクル毎に連続して指定することができる。また、そのエントリに対応するベクトル要素のディスティネーションオペランドを格納するベクトルレジスタVR#2_102の書き込みアドレスのみをクロックサイクル毎に連続して指定することができる。これにより、ベクトルマスクの有効な要素のみについてベクトル演算を実行するという所望の論理機能を実現することができる。   When the bit value “1” is a bit value representing a valid element in the vector mask bit string, the vector element processing operand with mask 1 stores the source operand of the vector element corresponding to the entry. Only the read addresses of the vector registers VR # 0_100 and VR # 1_101 can be designated continuously every clock cycle. In addition, only the write address of the vector register VR # 2_102 that stores the destination operand of the vector element corresponding to the entry can be continuously specified every clock cycle. As a result, it is possible to realize a desired logical function of executing a vector operation only for effective elements of the vector mask.

なお、本発明は、読み出しアドレス加算器130、書き込みアドレス加算器132、LDZ回路160、左シフト回路170、比較器190は、図4に示す構成に限定されるものではない。すなわち、それらの構成の組み合わせと同等の機能を実現する構成であればよい。   In the present invention, the read address adder 130, the write address adder 132, the LDZ circuit 160, the left shift circuit 170, and the comparator 190 are not limited to the configuration shown in FIG. That is, any configuration that realizes a function equivalent to a combination of these configurations may be used.

例えば、図4において、読み出しアドレスレジスタ120、書き込みアドレスレジスタ122、読み出しアドレス加算器130及び書き込みアドレス加算器132はそれぞれ独立して設けている。ここで、書き込みアドレスレジスタ122の値は、読み出しアドレスレジスタ120の値が求まってから、ベクトル演算器110において演算に必要なクロックサイクル数が経過した後に、読み出しアドレスレジスタ120の値と同じ値になる。したがって、書き込みアドレス加算器132は設けずに、読み出しアドレスレジスタ120を複数クロック遅らせた後に書き込みアドレスレジスタ122に入力するような構成でも良い。   For example, in FIG. 4, the read address register 120, the write address register 122, the read address adder 130, and the write address adder 132 are provided independently. Here, the value of the write address register 122 becomes the same value as the value of the read address register 120 after the number of clock cycles necessary for the operation has elapsed in the vector computing unit 110 after the value of the read address register 120 is obtained. . Accordingly, the write address adder 132 may not be provided, and the read address register 120 may be input to the write address register 122 after being delayed by a plurality of clocks.

次に、図4のマスク付きベクトル演算処理装置の第1の実施の形態の動作について説明する。図5は、マスク付きベクトル演算処理装置の第1の実施の形態の動作を示すタイミングチャートである。左端の縦の列は、サイクル(時刻)を示す。中央の縦の列は、読み出しアドレスレジスタ120及び書き込みアドレスレジスタ122のアドレス値を示す。右端の縦の列は、選択回路150の出力を示す。   Next, the operation of the first embodiment of the masked vector arithmetic processing apparatus will be described. FIG. 5 is a timing chart showing the operation of the first embodiment of the masked vector operation processing apparatus. The leftmost vertical column indicates the cycle (time). The central vertical column shows the address values of the read address register 120 and the write address register 122. The rightmost vertical column shows the output of the selection circuit 150.

ここでは、「実行開始時」として記述した“1100111000001101”をベクトルマスク値の例とし、このようなベクトルマスク値が設定された場合の動作について説明する。ここで、ベクトルマスク値は16ビット幅である。このビット数が1回のベクトル演算における要素数(ベクトル要素数)に相当する。すなわち、この例におけるベクトル演算の要素数は「16」ということになる。ベクトルマスク値においてビット値“1”を有効なベクトル要素とすると、図5に示すベクトルマスク値の例では、有効なベクトル要素数は8となる。なお、読み出しアドレスレジスタ120及び書き込みアドレスレジスタ122の初期値は、いずれも「−1」としておく。   Here, “1100111000001101” described as “at the start of execution” is taken as an example of a vector mask value, and an operation when such a vector mask value is set will be described. Here, the vector mask value is 16 bits wide. This number of bits corresponds to the number of elements (number of vector elements) in one vector operation. That is, the number of elements of the vector operation in this example is “16”. If the bit value “1” is a valid vector element in the vector mask value, the number of valid vector elements is 8 in the example of the vector mask value shown in FIG. The initial values of the read address register 120 and the write address register 122 are both “−1”.

「実行開始時」のベクトルマスク値から、LDZ回路160は、ベクトルマスク値の先頭ビットがビット値“1”であり、“0”の数がゼロであるから、ゼロ値「0」を出力する。加算器130、132は、アドレス初期値「−1」に、このゼロ値「0」と「+1」とを加算した値(=「−1」+「0」+「+1」=「0」)を、次のサイクルのアドレス値として出力する。従って、次のサイクル「1T」におけるベクトルレジスタ(VR#0_100、VR#1_101、VR#2_102)のアドレス値は「0」となる。また、LDZ回路160の出力値+1ビット分(=「0」+1=1ビット分)だけ、ベクトルマスク値は左シフト回路170により左シフトされて、次のサイクルにおけるLDZ回路160への入力となる。従って、選択回路150は、サイクル「1T」におけるLDZ回路160へ、ビット列“1001110000011010”を出力する。   The LDZ circuit 160 outputs a zero value “0” from the vector mask value “at the start of execution” because the first bit of the vector mask value is the bit value “1” and the number of “0” is zero. . The adders 130 and 132 add the zero value “0” and “+1” to the initial address value “−1” (= “− 1” + “0” + “+ 1” = “0”). Is output as the address value of the next cycle. Therefore, the address value of the vector register (VR # 0_100, VR # 1_101, VR # 2_102) in the next cycle “1T” is “0”. Also, the vector mask value is shifted to the left by the left shift circuit 170 by the output value of the LDZ circuit 160 plus one bit (= “0” + 1 = 1 bit), and becomes the input to the LDZ circuit 160 in the next cycle. . Accordingly, the selection circuit 150 outputs the bit string “1001110000011010” to the LDZ circuit 160 in the cycle “1T”.

サイクル「1T」のベクトルマスク値から、LDZ回路160は、先頭ビットがビット値“1”であるからゼロ値「0」を出力する。加算器130、132は、前のサイクルにおけるアドレス値「0」に、このゼロ値「0」と「+1」とを加算した値(=「0」+「0」+「+1」=「1」)を、次のサイクルのアドレス値として出力する。従って、次のサイクル「2T」におけるベクトルレジスタのアドレス値は「1」となる。また、LDZ回路160の出力値+1ビット分(=「0」+1=1ビット分)だけ、ベクトルマスク値は左シフト回路170により左シフトされて、次のサイクルにおけるLDZ回路160への入力となる。従って、選択回路150は、サイクル「2T」におけるLDZ回路160へ、ビット列“0011100000110100”を出力する。   From the vector mask value of the cycle “1T”, the LDZ circuit 160 outputs a zero value “0” because the first bit is the bit value “1”. The adders 130 and 132 add the zero value “0” and “+1” to the address value “0” in the previous cycle (= “0” + “0” + “+ 1” = “1”). ) Is output as the address value of the next cycle. Therefore, the address value of the vector register in the next cycle “2T” is “1”. Also, the vector mask value is shifted to the left by the left shift circuit 170 by the output value of the LDZ circuit 160 plus one bit (= “0” + 1 = 1 bit), and becomes the input to the LDZ circuit 160 in the next cycle. . Therefore, the selection circuit 150 outputs the bit string “0011100000110100” to the LDZ circuit 160 in the cycle “2T”.

サイクル「2T」のベクトルマスク値から、LDZ回路160は、先頭ビットからビット値“0”が2ビット連続することから「2」を出力する。加算器130、132は、前のサイクルにおけるアドレス値「1」に、この値「2」と「+1」とを加算した値(=「1」+「2」+「+1」=「4」)を、次のサイクルのアドレス値として出力する。従って、次のサイクル「3T」におけるベクトルレジスタのアドレス値は「4」となる。また、LDZ回路160の出力値+1ビット分(=「2」+1=3ビット分)、ベクトルマスク値は左シフトされて、次のサイクルにおけるLDZ回路160への入力となる。従って、選択回路150は、サイクル「3T」におけるLDZ回路160へ、ビット列“1100000110100000”となる。   From the vector mask value of the cycle “2T”, the LDZ circuit 160 outputs “2” because the bit value “0” continues for 2 bits from the first bit. The adders 130 and 132 add the values “2” and “+1” to the address value “1” in the previous cycle (= “1” + “2” + “+ 1” = “4”). Is output as the address value of the next cycle. Accordingly, the address value of the vector register in the next cycle “3T” is “4”. Also, the vector mask value is shifted to the left by the output value + 1 bit (= “2” + 1 = 3 bits) of the LDZ circuit 160 and becomes an input to the LDZ circuit 160 in the next cycle. Therefore, the selection circuit 150 becomes the bit string “110000010100000” to the LDZ circuit 160 in the cycle “3T”.

サイクル「3T」のベクトルマスク値から、LDZ回路160は、先頭ビットがビット値“1”であるからゼロ値「0」を出力する。加算器130、132は、前のサイクルにおけるアドレス値「4」に、この値「0」と「+1」とを加算した値(=「4」+「0」+「+1」=「5」)を、次のサイクルのアドレス値として出力する。従って、次のサイクル「4T」におけるベクトルレジスタのアドレス値は「5」となる。また、LDZ回路160の出力値+1ビット分(=「0」+1=1ビット分)、ベクトルマスク値は左シフト回路170により左シフトされて、次のサイクルにおけるLDZ回路160への入力となる。従って、選択回路150は、サイクル「4T」におけるLDZ回路160へ、ビット列“1000001101000000”を出力する。   From the vector mask value of the cycle “3T”, the LDZ circuit 160 outputs a zero value “0” because the first bit is the bit value “1”. The adders 130 and 132 add the values “0” and “+1” to the address value “4” in the previous cycle (= “4” + “0” + “+ 1” = “5”) Is output as the address value of the next cycle. Therefore, the address value of the vector register in the next cycle “4T” is “5”. Also, the output value of the LDZ circuit 160 plus one bit (= “0” + 1 = 1 bit), the vector mask value is shifted left by the left shift circuit 170 and becomes the input to the LDZ circuit 160 in the next cycle. Therefore, the selection circuit 150 outputs the bit string “1000001101000000” to the LDZ circuit 160 in the cycle “4T”.

サイクル「4T」のベクトルマスク値から、LDZ回路160は、先頭ビットがビット値“1”であることからゼロ値「0」を出力する。加算器130、132は、前のサイクルにおけるアドレス値「5」に、この値「0」と「+1」とを加算した値(=「5」+「0」+「+1」=「6」)を、次のサイクルのアドレス値として出力する。従って、次のサイクル「5T」におけるベクトルレジスタのアドレス値は「6」となる。また、LDZ回路160の出力値+1ビット分(=「0」+1=1ビット分)、ベクトルマスク値は左シフト回路170により左シフトされて、次のサイクルにおけるLDZ回路160への入力となる。従って、選択回路150は、サイクル「5T」におけるLDZ回路160へ、ビット列“0000011010000000”を出力する。   From the vector mask value of cycle “4T”, the LDZ circuit 160 outputs a zero value “0” because the first bit is the bit value “1”. The adders 130 and 132 add the values “0” and “+1” to the address value “5” in the previous cycle (= “5” + “0” + “+ 1” = “6”) Is output as the address value of the next cycle. Accordingly, the address value of the vector register in the next cycle “5T” is “6”. Also, the output value of the LDZ circuit 160 plus one bit (= “0” + 1 = 1 bit), the vector mask value is shifted left by the left shift circuit 170 and becomes the input to the LDZ circuit 160 in the next cycle. Therefore, the selection circuit 150 outputs the bit string “0000011010000000000” to the LDZ circuit 160 in the cycle “5T”.

サイクル「5T」のベクトルマスク値から、LDZ回路160は、先頭ビットからビット値“0”が5ビット連続することから「5」を出力する。加算器130、132は、前のサイクルにおけるアドレス値「6」に、この値「5」と「+1」とを加算した値(=「6」+「5」+「+1」=「12」)を、次のサイクルのアドレス値として出力する。従って、次のサイクル「6T」におけるベクトルレジスタのアドレス値は「12」となる。また、LDZ回路160の出力値+1ビット分(=「5」+1=6ビット分)、ベクトルマスク値は左シフト回路170により左シフトされて、次のサイクルにおけるLDZ回路160への入力となる。従って、選択回路150は、サイクル「6T」におけるLDZ回路160へ、ビット列“1010000000000000”を出力する。   From the vector mask value of the cycle “5T”, the LDZ circuit 160 outputs “5” because the bit value “0” continues for 5 bits from the first bit. The adders 130 and 132 add the value “5” and “+1” to the address value “6” in the previous cycle (= “6” + “5” + “+ 1” = “12”) Is output as the address value of the next cycle. Therefore, the address value of the vector register in the next cycle “6T” is “12”. Further, the output value of the LDZ circuit 160 plus one bit (= “5” + 1 = 6 bits) is shifted to the left by the left shift circuit 170 and becomes the input to the LDZ circuit 160 in the next cycle. Therefore, the selection circuit 150 outputs the bit string “1010000000000000” to the LDZ circuit 160 in the cycle “6T”.

サイクル「6T」のベクトルマスク値から、LDZ回路160は、先頭ビットがビット値“1”であることからゼロ値「0」を出力する。加算器130、132は、前のサイクルにおけるアドレス値「12」に、この値「0」と「+1」とを加算した値(=「12」+「0」+「+1」=「13」)を、次のサイクルのアドレス値として出力する。従って、次のサイクル「7T」におけるベクトルレジスタのアドレス値は「13」となる。また、LDZ回路160の出力値+1ビット分(=「0」+1=1ビット分)、ベクトルマスク値は左シフト回路170により左シフトされて、次のサイクルにおけるLDZ回路160への入力となる。従って、選択回路150は、サイクル「7T」におけるLDZ回路160へ、ビット列“0100000000000000”を出力する。   From the vector mask value of the cycle “6T”, the LDZ circuit 160 outputs a zero value “0” because the first bit is the bit value “1”. The adders 130 and 132 add the values “0” and “+1” to the address value “12” in the previous cycle (= “12” + “0” + “+ 1” = “13”) Is output as the address value of the next cycle. Accordingly, the address value of the vector register in the next cycle “7T” is “13”. Also, the output value of the LDZ circuit 160 plus one bit (= “0” + 1 = 1 bit), the vector mask value is shifted left by the left shift circuit 170 and becomes the input to the LDZ circuit 160 in the next cycle. Accordingly, the selection circuit 150 outputs the bit string “0100000000000000000” to the LDZ circuit 160 in the cycle “7T”.

サイクル「7T」のベクトルマスク値から、LDZ回路160は、先頭ビットからビット値“0”が1ビット連続することから「1」を出力する。加算器130、132は、前のサイクルにおけるアドレス値「13」に、この値「1」と「+1」を加算した値(=「13」+「1」+「+1」=「15」)を、次のサイクルのアドレス値として出力する。従って、次のサイクル「8T」におけるベクトルレジスタのアドレス値は「15」となる。また、LDZ回路160の出力値+1ビット分(=「1」+1=2ビット分)、ベクトルマスク値は左シフト回路170により左シフトされて、次のサイクルにおけるLDZ回路160への入力となる。従って、選択回路150は、サイクル「8T」におけるLDZ回路160へ、ビット列“0000000000000000”を出力する。   From the vector mask value of the cycle “7T”, the LDZ circuit 160 outputs “1” because the bit value “0” continues for one bit from the first bit. The adders 130 and 132 add a value (= “13” + “1” + “+ 1” = “15”) obtained by adding the values “1” and “+1” to the address value “13” in the previous cycle. And output as the address value of the next cycle. Therefore, the address value of the vector register in the next cycle “8T” is “15”. Also, the output value of the LDZ circuit 160 plus one bit (= “1” + 1 = 2 bits), the vector mask value is left-shifted by the left shift circuit 170 and becomes an input to the LDZ circuit 160 in the next cycle. Therefore, the selection circuit 150 outputs the bit string “0000000000000000000” to the LDZ circuit 160 in the cycle “8T”.

サイクル「8T」のベクトルマスク値から、LDZ回路160は、先頭ビットからビット値“0”が16ビット連続することから「16」を出力する。この時、LDZ回路160の出力「16」と、ベクトル演算の要素数「16」とが一致するため、比較器190は、両者が一致したことを示す信号をベクトル演算命令制御部(図示されず)へ出力する。これにより、ベクトル演算命令制御部は、マスク付きベクトル演算の演算実行を終了する。   From the vector mask value of the cycle “8T”, the LDZ circuit 160 outputs “16” because the bit value “0” continues for 16 bits from the first bit. At this time, since the output “16” of the LDZ circuit 160 and the number of elements of vector calculation “16” match, the comparator 190 sends a signal indicating that both match to a vector calculation command controller (not shown). ). Thereby, the vector operation instruction control unit ends the execution of the masked vector operation.

以上のタイミングチャートに関する説明から、本発明のマスク付きベクトル演算装置は、ベクトルマスクのビット列において有効なベクトル要素のみに対して、連続して演算を実行出来ることが判る。例として示した図5のベクトルマスク値では、ベクトル演算の要素数は「16」、有効なベクトル要素の数は「8」であった。このとき、本発明のマスク付きベクトル演算装置では実行開始時を含めて7クロックサイクル後まででマスク付きベクトル演算処理を実行して、8クロックサイクル後にはマスク付きベクトル演算の実行終了を判定することができる。   From the above description regarding the timing chart, it can be seen that the vector operation apparatus with mask of the present invention can continuously execute operations only on valid vector elements in the bit string of the vector mask. In the vector mask value of FIG. 5 shown as an example, the number of elements of the vector operation is “16”, and the number of valid vector elements is “8”. At this time, the vector operation apparatus with mask of the present invention executes the vector operation processing with mask until 7 clock cycles after the start of execution, and determines the end of execution of the vector operation with mask after 8 clock cycles. Can do.

図6、図7は、本発明のマスク付きベクトル演算装置を用いた通常及びマスク付きベクトル演算処理の演算TATを示す。図6は通常のベクトル演算処理のTATであり、図7はマスク付きベクトル演算処理のTATである。図6の通常のベクトル演算処理では、ベクトルマスク値が全要素に対して有効であることを示す全ビットがビット値“1”であることと同義である。従って、演算処理TATは、演算器単体のTATと要素数の和になる。一方、図7のマスク付きベクトル演算処理では、ベクトルマスクが有効なベクトル要素のみに対して演算が実行される。そのため、短縮された演算処理TATは、演算器単体のTATとベクトルマスクの有効要素数の和になる。ベクトルマスクにおいて有効なベクトル要素の数が少ないほど、本発明におけるマスク付きベクトル演算処理の演算処理TATは短縮されることになる。   6 and 7 show calculation TATs for normal and masked vector calculation processing using the masked vector calculation apparatus of the present invention. FIG. 6 shows a TAT for a normal vector calculation process, and FIG. 7 shows a TAT for a vector calculation process with a mask. In the normal vector operation processing of FIG. 6, all bits indicating that the vector mask value is valid for all elements are synonymous with the bit value “1”. Therefore, the arithmetic processing TAT is the sum of the TAT of the arithmetic unit alone and the number of elements. On the other hand, in the vector calculation process with a mask in FIG. Therefore, the shortened arithmetic processing TAT is the sum of the TAT of the arithmetic unit alone and the number of effective elements of the vector mask. The smaller the number of effective vector elements in the vector mask, the shorter the calculation processing TAT of the vector calculation processing with mask in the present invention.

以上説明したように、本発明は、マスク付きベクトル演算の実行において、マスクレジスタ140に対するLeading ZERO回路160(ビット列の先頭から連続する0の数を出力する回路)と、ソース/ディスティネーションの各レジスタに対する読み出し/書き込みアドレスを計算する加算器130、132を持ち、Leading ZERO回路160の出力値を加算器130、132で累算して、ソース/ディスティネーションの各ベクトルレジスタ(VR#0_100、VR#1_101、VR#2_102)に対する読み出し/書き込みアドレスを毎サイクル更新していく。それと共に、マスクレジスタ値(ベクトルマスク)は、Leading ZERO回路160の出力結果に応じて左シフト回路170により自らを左シフトすることで、毎サイクル更新されるようにしている。これによりマスクレジスタ値の有効ビットに該当する要素データが存在するソース/ディスティネーションの各レジスタに対する読み出し/書き込みアドレスを連続してアクセスできるようになっている。この結果、マスクレジスタ値のLeading ZERO回路160の出力結果がベクトル長と一致(マスクレジスタ値がAll“0”データとなる)した時点でベクトル演算命令の実行終了となる。   As described above, according to the present invention, in execution of a masked vector operation, a leading ZERO circuit 160 (a circuit that outputs the number of consecutive 0s from the beginning of a bit string) to the mask register 140 and each source / destination register Adders 130 and 132 for calculating read / write addresses for the ZERO, the output values of the Leading ZERO circuit 160 are accumulated by the adders 130 and 132, and the source / destination vector registers (VR # 0_100, VR # 1_101, VR # 2_102) is updated every cycle. At the same time, the mask register value (vector mask) is updated every cycle by shifting itself to the left by the left shift circuit 170 according to the output result of the Leading ZERO circuit 160. As a result, the read / write addresses for the source / destination registers where the element data corresponding to the valid bits of the mask register value exist can be accessed continuously. As a result, when the output result of the leading ZERO circuit 160 for the mask register value matches the vector length (the mask register value becomes All “0” data), the execution of the vector operation instruction is completed.

すなわち、本発明では、以下に記載するような効果を奏する。第1の効果は、マスク付きベクトル演算処理において、マスクビット上で有効な要素データに対する演算のみを連続して実行することで、マスク付きベクトル演算処理のTATを短縮して性能向上を実現できることである。   That is, the present invention has the following effects. The first effect is that, in the vector calculation process with mask, only the operation for the element data effective on the mask bit is continuously executed, so that the TAT of the vector calculation process with mask can be shortened and the performance improvement can be realized. is there.

第2の効果は、マスク付きベクトル演算処理において、マスクビット上で無効な要素データに対する演算を実行しないことで、不必要な電力消費を回避してマスク付きベクトル演算処理装置の低消費電力化を実現できることである。   The second effect is that, in the masked vector operation processing, the operation for the invalid element data on the mask bit is not executed, thereby avoiding unnecessary power consumption and reducing the power consumption of the masked vector operation processing device. It can be realized.

(第2の実施の形態)
以下、本発明のマスク付きベクトル演算処理装置の第2の実施の形態に関して、添付図面を参照して説明する。
(Second Embodiment)
Hereinafter, a second embodiment of the masked vector arithmetic processing apparatus of the present invention will be described with reference to the accompanying drawings.

第2の実施の形態におけるマスク付きベクトル演算処理装置1は、図4で示したマスク付きベクトル演算処理装置1に、更に、後述する新たな構成要素(演算器Busy時間通知部2)を付加している点で第1の実施の形態と異なる。   The masked vector arithmetic processing apparatus 1 according to the second embodiment adds a new component (arithmetic unit busy time notifying unit 2) to be described later to the masked vector arithmetic processing apparatus 1 shown in FIG. This is different from the first embodiment.

図8、図9は、従来のマスク付きベクトル演算処理装置と、本発明のマスク付きベクトル演算処理装置1のそれぞれの演算TATを示す。図8は、従来のマスク付きベクトル演算処理装置において、1度マスク付きベクトル演算命令を実行した後に、続けて同じベクトル演算器を使用したベクトル演算命令を実行する場合のTATを示している。図9は、本発明におけるマスク付きベクトル演算処理装置1において、1度マスク付きベクトル演算命令を実行した後に、続けて同じベクトル演算器を使用したベクトル演算命令を実行する場合のTATを示している。図8において、従来のマスク付きベクトル演算処理装置では、ベクトルマスクの値によらず演算器単体のTATと要素数の和が実行に必要な演算TATであることが判っている。この期間は、該当するベクトル演算器が演算命令実行を処理している期間である。そのため、同一のベクトル演算器を使用する他の演算命令を処理することはできない。従って、この演算TATをベクトル演算器のBusy時間と呼ぶ。このベクトル演算器のBusy時間が予め判っていれば、続けて同じベクトル演算器を使用したベクトル演算命令を実行する際に、いつ実行を開始すればよいかを容易に判定することが可能である。従来のマスク付きベクトル演算処理装置における、ベクトル演算命令の発行制御部では、先行するマスク付きベクトル演算命令を実行開始した時点でベクトル演算器のBusy時間が判明する。そのため、後続のベクトル演算命令を、間を置かずに連続して実行する制御が容易に実現可能である。一方、図9の本発明のマスク付きベクトル演算処理装置では、ベクトル演算器のBusy時間は先行するマスク付きベクトル演算命令を実行して、ベクトルマスクの最後の有効なベクトル要素の演算処理が完了しないと判明しない。そのため、後続のベクトル演算命令を、間を置かずに連続して実行する制御は非常に困難である。   FIG. 8 and FIG. 9 show the respective computation TATs of the conventional masked vector arithmetic processing apparatus and the masked vector arithmetic processing apparatus 1 of the present invention. FIG. 8 shows a TAT in the case of executing a vector operation instruction using the same vector operation unit after executing a masked vector operation instruction once in the conventional masked vector operation processing apparatus. FIG. 9 shows a TAT in the case of executing a vector operation instruction using the same vector operation unit after executing a masked vector operation instruction once in the masked vector operation processing apparatus 1 according to the present invention. . In FIG. 8, in the conventional masked vector arithmetic processing apparatus, it is known that the sum of the TAT of the arithmetic unit alone and the number of elements is the arithmetic TAT necessary for execution regardless of the value of the vector mask. This period is a period during which the corresponding vector calculator is processing execution of an operation instruction. Therefore, it is not possible to process other arithmetic instructions that use the same vector arithmetic unit. Therefore, this operation TAT is called the busy time of the vector operation unit. If the Busy time of this vector calculator is known in advance, it is possible to easily determine when to start execution when executing a vector calculation instruction using the same vector calculator. . In the conventional vector arithmetic processing unit with mask, the issuance control unit of the vector arithmetic instruction determines the busy time of the vector arithmetic unit when the execution of the preceding masked vector arithmetic instruction is started. For this reason, it is possible to easily realize control for executing subsequent vector operation instructions continuously without any gaps. On the other hand, in the masked vector operation processing apparatus of the present invention shown in FIG. 9, the vector operation unit does not complete the operation processing of the last valid vector element of the vector mask by executing the preceding masked vector operation instruction during the busy time. Not known. For this reason, it is very difficult to control the subsequent vector operation instructions to be executed continuously without a gap.

そこで、本実施の形態では、第1の実施の形態で説明したマスク付きベクトル演算処理装置1(図4)に新たな構成要素を付加する。それにより、新たな構成要素は、本発明におけるマスク付きベクトル演算処理装置のベクトル演算Busy時間を予め判定可能な機能を有する。そのような新たな構成要素を追加することで、ベクトル演算命令制御部(図示されず)におけるベクトル演算命令の発行制御部(図示されず)において、後続のベクトル演算命令を、間を置かずに連続して実行する制御を容易に実現可能にする。   Therefore, in this embodiment, a new component is added to the masked vector arithmetic processing apparatus 1 (FIG. 4) described in the first embodiment. Thereby, the new component has a function capable of determining in advance the vector calculation busy time of the masked vector calculation processing apparatus according to the present invention. By adding such a new component, in the vector operation instruction issuance control unit (not shown) in the vector operation instruction control unit (not shown), subsequent vector operation instructions can be sent without any gaps. It is possible to easily realize control that is continuously executed.

図4は、本発明のマスク付きベクトル演算処理装置の第2の実施の形態の構成を示すブロック図であるが、第1の実施の形態と同様であるのでその説明を省略する。   FIG. 4 is a block diagram showing the configuration of the second embodiment of the vector arithmetic processing apparatus with a mask according to the present invention, but since it is the same as that of the first embodiment, its description is omitted.

図10は、マスク付きベクトル演算処理装置におけるベクトルマスクレジスタに関わる構成の一例を示すブロック図である。ここで、ベクトルマスクレジスタに関わる構成は、演算器Busy時間通知部2である。すなわち、マスク付きベクトル演算処理装置1は、図4の構成に加えて、図10に示す演算器Busy時間通知部2を具備する。   FIG. 10 is a block diagram illustrating an example of a configuration related to a vector mask register in the vector arithmetic processing apparatus with a mask. Here, the configuration related to the vector mask register is the arithmetic unit busy time notification unit 2. That is, the masked vector calculation processing apparatus 1 includes a calculator busy time notification unit 2 shown in FIG. 10 in addition to the configuration of FIG.

演算器Busy時間通知部2は、第1選択回路520、第2選択回路530、一時退避用レジスタファイル500、ベクトルマスク演算器511、ベクトルマスク生成演算器510、第3選択回路550、バッファ580、第4選択回路560、ポピュレーションカウンタ570(以下、POPカウンタと称す)、及び第5選択回路590を具備する。ただし、本図において、ベクトルマスクレジスタ540は、図4におけるベクトルマスクレジスタ140と同一である。   The arithmetic unit Busy time notification unit 2 includes a first selection circuit 520, a second selection circuit 530, a temporary save register file 500, a vector mask calculation unit 511, a vector mask generation calculation unit 510, a third selection circuit 550, a buffer 580, A fourth selection circuit 560, a population counter 570 (hereinafter referred to as a POP counter), and a fifth selection circuit 590 are provided. However, in this figure, the vector mask register 540 is the same as the vector mask register 140 in FIG.

第3選択回路550は、ベクトルマスクレジスタ540の出力、第1選択回路520の出力である新たに生成されたベクトルマスク、及び図10の外部に存在するスカラレジスタから転送されたビット列、のいずれかを選択して、複数のエントリからなるベクトルマスクとして一時退避用レジスタファイル500へ出力する。一時退避用レジスタファイル500は、複数のエントリからなるベクトルマスクを一時退避する。そして、ベクトルマスク演算器511及び第2選択回路530へ出力する。ベクトルマスク生成演算器510は、ベクトルレジスタ(VR#0_100、VR#1_101、VR#2_102)の値に応じて条件判定処理によりベクトルマスクを生成する。そして、第1選択回路520へ出力する。ベクトルマスク演算器511は、一時退避用レジスタファイル(ベクトルマスク)の任意の2つのエントリに対する論理演算を行い、新たなベクトルマスクを生成する。そして、第1選択回路520へ出力する。第1選択回路520は、ベクトルマスク演算器511の出力及びベクトルマスク生成演算器510の出力のいずれか一方を新たに生成されたベクトルマスクとして選択する。そして、第2選択回路530へ出力する。第2選択回路530は、第1選択回路520の出力及びベクトルマスクレジスタ540の出力のいずれか一方を選択する。そして、ベクトルマスクレジスタ540へ出力する。   The third selection circuit 550 is one of an output of the vector mask register 540, a newly generated vector mask which is an output of the first selection circuit 520, and a bit string transferred from the scalar register existing outside FIG. Is output to the temporary save register file 500 as a vector mask composed of a plurality of entries. The temporary save register file 500 temporarily saves a vector mask composed of a plurality of entries. Then, the data is output to the vector mask calculator 511 and the second selection circuit 530. The vector mask generation calculator 510 generates a vector mask by condition determination processing according to the values of the vector registers (VR # 0_100, VR # 1_101, VR # 2_102). Then, the data is output to the first selection circuit 520. The vector mask calculator 511 performs a logical operation on any two entries of the temporary save register file (vector mask) to generate a new vector mask. Then, the data is output to the first selection circuit 520. The first selection circuit 520 selects one of the output of the vector mask calculator 511 and the output of the vector mask generation calculator 510 as a newly generated vector mask. Then, the data is output to the second selection circuit 530. The second selection circuit 530 selects one of the output of the first selection circuit 520 and the output of the vector mask register 540. Then, the data is output to the vector mask register 540.

すなわち、ベクトルマスクレジスタ540は、一時退避用レジスタファイル500に格納されたベクトルマスク、ベクトルマスク演算器511が新たに生成したベクトルマスク、及びベクトルマスク生成演算器510が新たに生成したベクトルマスクのうちの一つが選択されて設定される。   That is, the vector mask register 540 includes a vector mask stored in the temporary save register file 500, a vector mask newly generated by the vector mask calculator 511, and a vector mask newly generated by the vector mask generation calculator 510. Is selected and set.

一時退避用レジスタファイル500は、好適には16以上のエントリ数(ワード数)を有することが望ましい。また、一時退避用レジスタファイル500の出力は、図10の外部に存在するスカラレジスタに対して転送されることもある。   The temporary save register file 500 preferably has an entry number (word number) of 16 or more. Further, the output of the temporary save register file 500 may be transferred to a scalar register existing outside of FIG.

以上が、ベクトルマスクレジスタ540周辺の一般的な構成例である。しかし、本発明では、この他に新たな構成要素として、バッファ580、第4選択回路560、POPカウンタ570、及び第5選択回路590を更に具備している。   The above is a general configuration example around the vector mask register 540. However, the present invention further includes a buffer 580, a fourth selection circuit 560, a POP counter 570, and a fifth selection circuit 590 as other new components.

第4選択回路560は、第2選択回路530と並列し、第1選択回路520の出力及びベクトルマスクレジスタ540の出力のいずれか一方を選択する。そして、POPカウンタ570へ出力する。POPカウンタ570は、第4選択回路560の出力を受けて、そのビット列に含まれるビット値“1”のビット数をカウントする。そして、バッファ580及び第5選択回路590へ出力する。バッファ580は、一時退避用レジスタファイル500の各エントリ毎に対応して情報を格納する。POPカウンタ570の出力結果を格納する。第5選択回路590は、バッファ580の出力及びPOPカウンタ570の出力のいずれか一方を選択する。そして、ベクトル演算命令制御部へ出力する。   The fourth selection circuit 560 selects one of the output of the first selection circuit 520 and the output of the vector mask register 540 in parallel with the second selection circuit 530. Then, the data is output to the POP counter 570. The POP counter 570 receives the output of the fourth selection circuit 560 and counts the number of bits having the bit value “1” included in the bit string. Then, the data is output to the buffer 580 and the fifth selection circuit 590. The buffer 580 stores information corresponding to each entry of the temporary save register file 500. The output result of the POP counter 570 is stored. The fifth selection circuit 590 selects either the output of the buffer 580 or the output of the POP counter 570. And it outputs to a vector operation command control part.

本実施の形態では、新たに追加された構成要素(バッファ580、第4選択回路560、POPカウンタ570、及び第5選択回路590)により、ベクトルマスク演算器511やベクトルマスク生成演算器510によって、新たなベクトルマスクが生成されて一時退避用レジスタファイル500の特定のエントリに格納される場合、POPカウンタ570で生成されたベクトルマスクのビット値“1”の数、すなわち有効要素数をカウントして、バッファ580の同一エントリに格納される。そして、前述した新たに生成されたベクトルマスクがそのままベクトルマスクレジスタ540に設定される場合、POPカウンタ570の出力結果を、そのまま、第5選択回路590介して、図10の外部に存在するベクトル演算命令のベクトル演算命令制御部に通知する。又は、一時退避用レジスタファイル500から読み出された値がベクトルマスクレジスタ540に設定される場合、バッファ580の該当エントリにPOPカウント値が存在する場合、その値を、第5選択回路590介して、図10の外部に存在するベクトル演算命令のベクトル演算命令制御部に通知する。あるいは、一時退避用レジスタファイル500から読み出された値がベクトルマスクレジスタ540に設定される場合、バッファ580の該当エントリにPOPカウント値が存在しない場合、第4の選択回路560により、一時退避用レジスタファイル500からベクトルマスクレジスタ540に転送されるベクトルマスクをPOPカウンタ570に入力し、その出力結果を、第5選択回路590介して、図10の外部に存在するベクトル演算命令のベクトル演算命令制御部に通知する。これにより、ベクトル演算命令制御部は、ベクトルマスクレジスタ540を使用したマスク付きベクトル演算に対するベクトル演算器のBusy時間を、「実行開始時」に判別することが可能になる。それいにより、同一ベクトル演算器を使用する後続のベクトル演算命令が存在する場合に、間を置かずに連続して実行する制御が実現可能になる。   In the present embodiment, by the newly added components (buffer 580, fourth selection circuit 560, POP counter 570, and fifth selection circuit 590), the vector mask calculator 511 and the vector mask generation calculator 510 When a new vector mask is generated and stored in a specific entry of the temporary save register file 500, the number of bit values “1” of the vector mask generated by the POP counter 570, that is, the number of valid elements is counted. , Stored in the same entry of the buffer 580. When the newly generated vector mask described above is set in the vector mask register 540 as it is, the output result of the POP counter 570 is directly used as a vector operation existing outside of FIG. 10 via the fifth selection circuit 590. Notify the instruction vector operation instruction control unit. Alternatively, when the value read from the temporary save register file 500 is set in the vector mask register 540, if the POP count value exists in the corresponding entry of the buffer 580, the value is sent via the fifth selection circuit 590. , Notify the vector operation instruction control unit of the vector operation instruction existing outside of FIG. Alternatively, when the value read from the temporary save register file 500 is set in the vector mask register 540, if there is no POP count value in the corresponding entry of the buffer 580, the fourth selection circuit 560 causes the temporary save register The vector mask transferred from the register file 500 to the vector mask register 540 is input to the POP counter 570, and the output result is controlled via the fifth selection circuit 590 to the vector operation instruction of the vector operation instruction existing outside FIG. Notify the department. Thus, the vector operation instruction control unit can determine the busy time of the vector operation unit for the masked vector operation using the vector mask register 540 at the “start of execution”. As a result, when there is a subsequent vector operation instruction using the same vector operation unit, it is possible to realize control that is executed continuously without a gap.

なお、図4におけるマスク付きベクトル演算処理装置1の本体側の動作については、第1の実施の形態と同様であるのでその説明を省略する。   The operation on the main body side of the masked vector arithmetic processing apparatus 1 in FIG. 4 is the same as that in the first embodiment, and a description thereof will be omitted.

本実施の形態においても、第1の実施の形態と同様の効果を得ることができる。加えて、後続のベクトル演算命令を、間を置かずに連続して実行する制御が可能となる。   Also in this embodiment, the same effect as that of the first embodiment can be obtained. In addition, it is possible to perform control such that subsequent vector operation instructions are continuously executed without a gap.

上記第1、2の実施の形態では、単一のベクトル演算処理パイプライン構成の場合について説明している。しかし、本発明は、ベクトル要素を複数のベクトル演算処理パイプラインでインタリーブして並列実行処理を行うマルチベクトルパイプラインの場合についても同様に実行可能である。以下、それについて説明する。   In the first and second embodiments, the case of a single vector operation processing pipeline configuration has been described. However, the present invention can be similarly executed in the case of a multi-vector pipeline in which vector elements are interleaved by a plurality of vector arithmetic processing pipelines to perform parallel execution processing. This will be described below.

図11は、本発明のマスク付きベクトル演算処理をマルチベクトルパイプライン構成としたときの動作を示す。ここではベクトルパイプラインを4並列とした場合を例示している。マルチベクトルパイプライン構成では、ベクトル要素がインタリーブされて各ベクトルパイプラインに割り当てられるため、ベクトルマスクの有効要素のビット並びにより、各ベクトルパイプライン毎にベクトル演算器のBusy時間がばらつくことになる。従って、各ベクトルパイプライン毎に、図10に示した演算器Busy時間通知部2を設けただけの場合、後続のベクトル演算命令が、ベクトルパイプライン毎にバラバラに実行開始されることになる。マルチベクトルパイプライン構成では、1つのベクトル演算命令の実行開始タイミングを、ベクトルパイプライン毎に独立して制御することは非常に困難である。したがって、このような場合、各ベクトルパイプライン毎の演算器Busy時間を集めてその最大値を求め、その値を該当するマスク付きベクトル演算命令に対する演算器Busy時間とする機能を有する第2演算器Busy時間通知部を追加で備えればよい。ベクトル演算命令制御部は、第2演算器Busy時間通知部の出力に基づいて、後続のベクトル演算命令の実行開始タイミングを制御するようにすることで、本発明をマルチベクトルパイプライン構成にも適用することができる。   FIG. 11 shows an operation when the vector operation processing with mask of the present invention has a multi-vector pipeline configuration. Here, a case where four vector pipelines are arranged in parallel is illustrated. In the multi-vector pipeline configuration, since vector elements are interleaved and assigned to each vector pipeline, the busy time of the vector calculator varies for each vector pipeline due to the bits of the effective elements of the vector mask. Therefore, when only the arithmetic unit busy time notification unit 2 shown in FIG. 10 is provided for each vector pipeline, subsequent vector operation instructions are started to be executed separately for each vector pipeline. In the multi-vector pipeline configuration, it is very difficult to control the execution start timing of one vector operation instruction independently for each vector pipeline. Therefore, in such a case, the second arithmetic unit having a function of collecting the arithmetic unit busy time for each vector pipeline, obtaining the maximum value thereof, and setting the value as the arithmetic unit busy time for the corresponding masked vector arithmetic instruction. A Busy time notification unit may be additionally provided. The vector operation instruction control unit controls the execution start timing of the subsequent vector operation instruction based on the output of the second arithmetic unit Busy time notification unit, thereby applying the present invention to the multi-vector pipeline configuration. can do.

本発明では、マスク付きベクトル演算の実行に関して、演算実行TATの短縮による性能向上と、無効要素データに対する演算実行処理を回避することで低消費電力化を実現することができる。   In the present invention, regarding execution of a vector operation with a mask, it is possible to realize a performance improvement by shortening the operation execution TAT and a reduction in power consumption by avoiding an operation execution process for invalid element data.

図1は、マスク付きベクトル演算命令を実行する構成を示すブロック図である。FIG. 1 is a block diagram showing a configuration for executing a masked vector operation instruction. 図2は、通常ベクトル演算処理の演算TATを示す。FIG. 2 shows an operation TAT of normal vector operation processing. 図3は、マスク付きベクトル演算処理の演算TATを示す。FIG. 3 shows an operation TAT of the masked vector operation process. 図4は、本発明のマスク付きベクトル演算処理装置の第1の実施の形態の構成の一例を示すブロック図である。FIG. 4 is a block diagram showing an example of the configuration of the first embodiment of the vector arithmetic processing apparatus with mask according to the present invention. 図5は、本発明のマスク付きベクトル演算処理装置の第1の実施の形態の動作を示すタイミングチャートである。FIG. 5 is a timing chart showing the operation of the first embodiment of the masked vector operation processing apparatus of the present invention. 図6は、本発明のマスク付きベクトル演算装置を用いた通常ベクトル演算処理の演算TATを示す。FIG. 6 shows an operation TAT of normal vector operation processing using the masked vector operation device of the present invention. 図7は、本発明のマスク付きベクトル演算装置を用いたマスク付きベクトル演算処理の演算TATを示す。FIG. 7 shows a calculation TAT of a masked vector calculation process using the masked vector calculation apparatus of the present invention. 図8は、従来のマスク付きベクトル演算処理装置の演算TATを示す。FIG. 8 shows a calculation TAT of a conventional vector calculation processing apparatus with a mask. 図9は、本発明のマスク付きベクトル演算処理装置の演算TATを示す。FIG. 9 shows an operation TAT of the vector operation processing apparatus with mask of the present invention. 図10は、マスク付きベクトル演算処理装置におけるベクトルマスクレジスタに関わる構成の一例を示すブロック図である。FIG. 10 is a block diagram illustrating an example of a configuration related to a vector mask register in the vector arithmetic processing apparatus with a mask. 図11は、本発明のマスク付きベクトル演算処理をマルチベクトルパイプライン構成としたときの動作を示す。FIG. 11 shows an operation when the vector operation processing with mask of the present invention has a multi-vector pipeline configuration.

符号の説明Explanation of symbols

1 マスク付きベクトル演算処理装置
2 演算器Busy時間通知部
110 ベクトル演算器
100 ベクトルレジスタVR#0
101 ベクトルレジスタVR#1
102 ベクトルレジスタVR#2
120 アドレスレジスタ
130 アドレス加算器
122 アドレスレジスタ
132 書き込みアドレス加算器
140 ベクトルマスクレジスタ
150 選択回路
160 Leading Zero回路(LDZ回路)
170 左シフト回路
180 一時退避レジスタ
190 比較器
520 第1選択回路
500 一時退避用レジスタファイル
510 ベクトルマスク生成演算器
511 ベクトルマスク演算器
530 第2選択回路
540 ベクトルマスクレジスタ
550 第3選択回路
560 第4選択回路
570 ポピュレーションカウンタ(POPカウンタ)
580 バッファ
590 第5選択回路
710 ベクトル演算器
700 ベクトルレジスタVR#0
701 ベクトルレジスタVR#1
702 ベクトルレジスタVR#2
710 ベクトル演算器
720 アドレスレジスタ
722 アドレスレジスタ
730 インクリメンタ
732 インクリメンタ
740 ベクトルマスクレジスタ
760 パラレル−シリアル変換器
DESCRIPTION OF SYMBOLS 1 Vector operation processing apparatus with a mask 2 Operation unit Busy time notification part 110 Vector operation unit 100 Vector register VR # 0
101 Vector register VR # 1
102 Vector register VR # 2
DESCRIPTION OF SYMBOLS 120 Address register 130 Address adder 122 Address register 132 Write address adder 140 Vector mask register 150 Selection circuit 160 Leading Zero circuit (LDZ circuit)
170 Left shift circuit 180 Temporary save register 190 Comparator 520 First selection circuit 500 Temporary save register file 510 Vector mask generation calculator 511 Vector mask calculator 530 Second selection circuit 540 Vector mask register 550 Third selection circuit 560 Fourth Selection circuit 570 Population counter (POP counter)
580 Buffer 590 Fifth selection circuit 710 Vector computing unit 700 Vector register VR # 0
701 Vector register VR # 1
702 Vector register VR # 2
710 Vector calculator 720 Address register 722 Address register 730 Incrementer 732 Incrementer 740 Vector mask register 760 Parallel-serial converter

Claims (10)

ベクトルデータを格納するベクトルレジスタと、
ベクトル演算器と、
前記ベクトルデータの要素毎の演算実行を制御するマスクビットを有するベクトルマスクデータを格納するベクトルマスクレジスタと、
ベクトル演算実行時に、前記ベクトルマスクデータの有効マスクビットの出現する位置を順次算出する位置算出部と、
前記位置算出部によって得られた有効マスクビット位置を前記ベクトルレジスタのアドレスに変換するアドレス変換部と
を具備し、
前記ベクトル演算器は、前記ベクトルマスクデータの有効マスクビットに対する前記ベクトルデータの要素についてのみベクトル演算を実行する
マスク付きベクトル演算処理装置。
A vector register for storing vector data;
A vector operator,
A vector mask register for storing vector mask data having a mask bit for controlling execution of each element of the vector data;
A position calculation unit that sequentially calculates the position where the effective mask bits of the vector mask data appear when performing a vector operation;
An address conversion unit that converts an effective mask bit position obtained by the position calculation unit into an address of the vector register; and
The vector computing unit performs a vector computation only on an element of the vector data with respect to an effective mask bit of the vector mask data.
請求項1に記載のマスク付きベクトル演算処理装置において、
前記位置算出部は、
前記ベクトルマスクデータの先頭ビットから連続するゼロ値をカウントするゼロカウント部と、
前記ゼロカウント部の結果に基づいて、前記ベクトルマスクデータのビット列を左側に所定ビット数シフトする左シフト部と、
前記ベクトルマスクデータの値を前記左シフト部の結果に置き換えて前記ゼロカウント部へ出力するベクトルマスクレジスタ出力部と
を備える
マスク付きベクトル演算処理装置。
In the vector arithmetic processing apparatus with a mask according to claim 1,
The position calculation unit
A zero count unit that counts consecutive zero values from the first bit of the vector mask data;
A left shift unit that shifts the bit string of the vector mask data to the left by a predetermined number of bits based on the result of the zero count unit;
A vector arithmetic processing apparatus with a mask, comprising: a vector mask register output unit that replaces the value of the vector mask data with the result of the left shift unit and outputs the result to the zero count unit.
請求項2に記載のマスク付きベクトル演算処理装置において、
前記位置算出部は、前記ゼロカウント部、前記左シフト部及び前記ベクトルマスクレジスタ出力部の行う処理を所定回数繰り返して実行する
マスク付きベクトル演算処理装置。
In the vector arithmetic processing apparatus with a mask according to claim 2,
The position calculation unit repeats a process performed by the zero count unit, the left shift unit, and the vector mask register output unit a predetermined number of times.
請求項3に記載のマスク付きベクトル演算処理装置において、
前記ゼロカウント部の結果が、前記ベクトルデータの要素数と一致したことを検出する一致検出部を更に具備し、
前記一致検出部が一致を検出したとき、前記繰り返しを終了して前記ベクトル演算の実行完了とする
マスク付きベクトル演算処理装置。
In the vector arithmetic processing apparatus with a mask according to claim 3,
Further comprising a coincidence detection unit for detecting that the result of the zero count unit coincides with the number of elements of the vector data;
A masked vector operation processing apparatus that ends the repetition and completes the execution of the vector operation when the match detection unit detects a match.
請求項2に記載のマスク付きベクトル演算処理装置において、
前記アドレス変換部は、現在のアドレス値と、前記ゼロカウント部の結果とを加算する加算器を備える
マスク付きベクトル演算処理装置。
In the vector arithmetic processing apparatus with a mask according to claim 2,
The said address conversion part is provided with the adder which adds the present address value and the result of the said zero count part, The vector arithmetic processing apparatus with a mask.
請求項1乃至5のいずれか一項に記載のマスク付きベクトル演算処理装置において、
前記ベクトルマスクデータの有効マスクビット数のカウント結果に基づいて、予め前記ベクトル演算の実行完了タイミングを出力する完了タイミング出力部と
を更に具備する
マスク付きベクトル演算処理装置。
In the vector arithmetic processing unit with a mask according to any one of claims 1 to 5,
A masked vector operation processing apparatus, further comprising: a completion timing output unit that outputs the execution timing of the vector operation in advance based on a count result of the number of effective mask bits of the vector mask data.
請求項6に記載のマスク付きベクトル演算処理装置において、
前記完了タイミング出力部は、
前記ベクトルマスクデータの有効マスクビット数をカウントするカウント部と、
前記カウント部の前記カウント結果を保持するカウント値保持部と、
前記ベクトル演算実行時に前記有効マスクビット数のカウント結果を読み出して予め前記ベクトル演算の実行完了タイミングを出力する完了判定部と
を備える
マスク付きベクトル演算処理装置。
In the vector arithmetic processing apparatus with a mask according to claim 6,
The completion timing output unit
A count unit that counts the number of effective mask bits of the vector mask data;
A count value holding unit for holding the count result of the counting unit;
A masked vector operation processing apparatus, comprising: a completion determination unit that reads out the count result of the number of effective mask bits when executing the vector operation and outputs the execution completion timing of the vector operation in advance.
マスク付きベクトル演算処理装置の動作方法であって、
ここで、前記マスク付ベクトル演算処理装置は、
ベクトルデータを格納するベクトルレジスタと、
ベクトル演算器と、
前記ベクトルデータの要素毎に対応するマスクビットを有するベクトルマスクデータを格納するベクトルマスクレジスタと、
位置算出部と、
アドレス変換部と
を具備し、
前記マスク付きベクトル演算処理装置の動作方法は、ベクトル演算実行時に、
(a)前記ベクトルマスクレジスタが、前記ベクトルデータの要素毎の演算実行を制御するマスクビットを有するベクトルマスクデータを格納するステップと、
(b)前記位置算出部が、前記ベクトルマスクデータの有効マスクビットの出現する位置を順次算出するステップと、
(c)前記アドレス変換部が、前記位置算出部によって得られた有効マスクビット位置を前記ベクトルレジスタのアドレスに変換するステップと、
(d)前記ベクトル演算器が、前記ベクトルマスクデータの有効マスクビットに対する前記ベクトルデータの要素についてのみベクトル演算を実行するステップと
を具備する
マスク付きベクトル演算処理装置の動作方法。
An operation method of a vector arithmetic processing apparatus with a mask,
Here, the vector arithmetic processing apparatus with mask is
A vector register for storing vector data;
A vector operator,
A vector mask register for storing vector mask data having a mask bit corresponding to each element of the vector data;
A position calculation unit;
An address translation unit, and
The operation method of the vector arithmetic processing apparatus with a mask is as follows.
(A) the vector mask register storing vector mask data having a mask bit for controlling execution of an operation for each element of the vector data;
(B) the position calculating unit sequentially calculating the position where the effective mask bit of the vector mask data appears;
(C) the address conversion unit converting the effective mask bit position obtained by the position calculation unit into an address of the vector register;
(D) The vector computing unit includes a step of executing a vector computation only on an element of the vector data with respect to an effective mask bit of the vector mask data.
請求項8に記載のマスク付きベクトル演算処理装置の動作方法において、
前記位置算出部は、
ゼロカウント部と、
左シフト部と、
ベクトルマスクレジスタ出力部と
を備え、
前記(b)ステップは、
(b1)前記ゼロカウント部が、前記ベクトルマスクデータの先頭ビットから連続するゼロ値をカウントするステップと、
(b2)前記左シフト部が、前記ゼロカウント部の結果に基づいて、前記ベクトルマスクデータのビット列を左側に所定ビット数シフトするステップと、
(b3)前記ベクトルマスクレジスタ出力部が、前記ベクトルマスクデータの値を前記左シフト部の結果に置き換えて前記ゼロカウント部へ出力するステップと
を備える
マスク付きベクトル演算処理装置の動作方法。
In the operation method of the vector arithmetic processing unit with a mask according to claim 8,
The position calculation unit
A zero count section;
A left shift part,
A vector mask register output section, and
The step (b)
(B1) the zero counting unit counting consecutive zero values from the first bit of the vector mask data;
(B2) the left shift unit shifts the bit string of the vector mask data to the left by a predetermined number of bits based on the result of the zero count unit;
(B3) The vector mask register output unit includes a step of replacing the value of the vector mask data with the result of the left shift unit and outputting the result to the zero count unit.
請求項9に記載のマスク付きベクトル演算処理装置の動作方法において、
前記マスク付ベクトル演算処理装置は、一致検出部を更に具備し、
(e)一致検出部が、前記ゼロカウント部の結果と前記ベクトルデータの要素数との一致を検出するステップと、
(f)前記一致検出部が一致を検出したとき、前記繰り返しを終了して前記ベクトル演算の実行完了とするステップと
を更に具備する
マスク付きベクトル演算処理装置の動作方法。
In the operation method of the vector arithmetic processing unit with a mask according to claim 9,
The vector calculation processing apparatus with a mask further includes a coincidence detection unit,
(E) a coincidence detection unit detecting a coincidence between the result of the zero count unit and the number of elements of the vector data;
(F) A method of operating a masked vector operation processing device, further comprising: when the match detection unit detects a match, ending the repetition and completing the execution of the vector operation.
JP2006164610A 2006-06-14 2006-06-14 Vector processing device with mask Withdrawn JP2007334563A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006164610A JP2007334563A (en) 2006-06-14 2006-06-14 Vector processing device with mask

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006164610A JP2007334563A (en) 2006-06-14 2006-06-14 Vector processing device with mask

Publications (1)

Publication Number Publication Date
JP2007334563A true JP2007334563A (en) 2007-12-27

Family

ID=38934000

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006164610A Withdrawn JP2007334563A (en) 2006-06-14 2006-06-14 Vector processing device with mask

Country Status (1)

Country Link
JP (1) JP2007334563A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009120981A3 (en) * 2008-03-28 2009-12-17 Intel Corporation Vector instructions to enable efficient synchronization and parallel reduction operations
US8688957B2 (en) 2010-12-21 2014-04-01 Intel Corporation Mechanism for conflict detection using SIMD
US9411584B2 (en) 2012-12-29 2016-08-09 Intel Corporation Methods, apparatus, instructions, and logic to provide vector address conflict detection functionality
US9411592B2 (en) 2012-12-29 2016-08-09 Intel Corporation Vector address conflict resolution with vector population count functionality
JP2022535982A (en) * 2019-06-13 2022-08-10 フアシア ジェネラル プロセッサー テクノロジーズ インコーポレイテッド Explicit Discrete Mask Register Mask Manipulation Method in GPU
GB2644001A (en) * 2024-09-09 2026-03-18 Imagination Tech Ltd Processing vector instructions

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009120981A3 (en) * 2008-03-28 2009-12-17 Intel Corporation Vector instructions to enable efficient synchronization and parallel reduction operations
CN101978350A (en) * 2008-03-28 2011-02-16 英特尔公司 Vector instructions for efficient synchronization and parallel reduction operations
CN101978350B (en) * 2008-03-28 2014-06-11 英特尔公司 Vector instructions for efficient synchronization and parallel reduction operations
US9513905B2 (en) 2008-03-28 2016-12-06 Intel Corporation Vector instructions to enable efficient synchronization and parallel reduction operations
US9678750B2 (en) 2008-03-28 2017-06-13 Intel Corporation Vector instructions to enable efficient synchronization and parallel reduction operations
US8688957B2 (en) 2010-12-21 2014-04-01 Intel Corporation Mechanism for conflict detection using SIMD
US9411584B2 (en) 2012-12-29 2016-08-09 Intel Corporation Methods, apparatus, instructions, and logic to provide vector address conflict detection functionality
US9411592B2 (en) 2012-12-29 2016-08-09 Intel Corporation Vector address conflict resolution with vector population count functionality
JP2022535982A (en) * 2019-06-13 2022-08-10 フアシア ジェネラル プロセッサー テクノロジーズ インコーポレイテッド Explicit Discrete Mask Register Mask Manipulation Method in GPU
JP7410186B2 (en) 2019-06-13 2024-01-09 フアシア ジェネラル プロセッサー テクノロジーズ インコーポレイテッド Explicit individual mask register mask operation method in GPU
GB2644001A (en) * 2024-09-09 2026-03-18 Imagination Tech Ltd Processing vector instructions

Similar Documents

Publication Publication Date Title
KR102413832B1 (en) vector multiply add instruction
JP5889986B2 (en) System and method for selectively committing the results of executed instructions
US7386844B2 (en) Compiler apparatus and method of optimizing a source program by reducing a hamming distance between two instructions
JP7048612B2 (en) Vector generation instruction
JP4484925B2 (en) Method and apparatus for control flow management in SIMD devices
JP2015201119A (en) Compilation program, compilation method, and compilation apparatus
KR100316710B1 (en) Method and Apparatus for Instruction issuing in Out-of-Order for Parallel Processor
JP3212213B2 (en) Data processing device
CN114035848A (en) A method, device and processor for branch prediction
JP2007334563A (en) Vector processing device with mask
JPH1185513A (en) Processor
JP4770657B2 (en) Pipeline synthesis system, method and program
JP4771079B2 (en) VLIW processor
JP4063182B2 (en) Processor and interrupt control method thereof
JP4873546B2 (en) Data processing apparatus and data processing method
JP2503223B2 (en) Prior control method
JP4006887B2 (en) Compiler, processor and recording medium
JP4502983B2 (en) Vector control circuit, vector processing device, vector control method, and vector control program
JP2005149297A (en) Processor and assembler thereof
JP3743155B2 (en) Pipeline controlled computer
JP6107904B2 (en) Processor and store instruction conversion method
JPH04252336A (en) Program optimization processor
JP2010204913A (en) Vector processor
JP2000187591A (en) Loop processing system
JPH0222417B2 (en)

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20090901