Skip to content

Commit f05b1a2

Browse files
authored
[mlir][arith][nfc] Cleanup whitespace in td files (#155109)
1 parent 9fbf752 commit f05b1a2

File tree

2 files changed

+76
-76
lines changed

2 files changed

+76
-76
lines changed

mlir/include/mlir/Dialect/Arith/IR/ArithBase.td

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def Arith_Dialect : Dialect {
2020
mathematical operations. This includes unary, binary, and ternary arithmetic
2121
ops, bitwise and shift ops, cast ops, and compare ops. Operations in this
2222
dialect also accept vectors and tensors of integers or floats. The dialect
23-
assumes integers are represented by bitvectors with a two's complement
24-
representation. Unless otherwise stated, the operations within this dialect
25-
propagate poison values, i.e., if any of its inputs are poison, then the
26-
output is poison. Unless otherwise stated, operations applied to `vector`
23+
assumes integers are represented by bitvectors with a two's complement
24+
representation. Unless otherwise stated, the operations within this dialect
25+
propagate poison values, i.e., if any of its inputs are poison, then the
26+
output is poison. Unless otherwise stated, operations applied to `vector`
2727
and `tensor` values propagates poison elementwise.
2828
}];
2929

@@ -93,9 +93,9 @@ def ATOMIC_RMW_KIND_XORI : I64EnumAttrCase<"xori", 15>;
9393

9494
def AtomicRMWKindAttr : I64EnumAttr<
9595
"AtomicRMWKind", "",
96-
[ATOMIC_RMW_KIND_ADDF, ATOMIC_RMW_KIND_ADDI, ATOMIC_RMW_KIND_ANDI,
96+
[ATOMIC_RMW_KIND_ADDF, ATOMIC_RMW_KIND_ADDI, ATOMIC_RMW_KIND_ANDI,
9797
ATOMIC_RMW_KIND_ASSIGN, ATOMIC_RMW_KIND_MAXIMUMF, ATOMIC_RMW_KIND_MAXNUMF,
98-
ATOMIC_RMW_KIND_MAXS, ATOMIC_RMW_KIND_MAXU, ATOMIC_RMW_KIND_MINIMUMF,
98+
ATOMIC_RMW_KIND_MAXS, ATOMIC_RMW_KIND_MAXU, ATOMIC_RMW_KIND_MINIMUMF,
9999
ATOMIC_RMW_KIND_MINNUMF, ATOMIC_RMW_KIND_MINS, ATOMIC_RMW_KIND_MINU,
100100
ATOMIC_RMW_KIND_MULF, ATOMIC_RMW_KIND_MULI, ATOMIC_RMW_KIND_ORI,
101101
ATOMIC_RMW_KIND_XORI]> {

mlir/include/mlir/Dialect/Arith/IR/ArithOps.td

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ def Arith_ConstantOp : Op<Arith_Dialect, "constant",
216216
def Arith_AddIOp : Arith_IntBinaryOpWithOverflowFlags<"addi", [Commutative]> {
217217
let summary = "integer addition operation";
218218
let description = [{
219-
Performs N-bit addition on the operands. The operands are interpreted as
220-
unsigned bitvectors. The result is represented by a bitvector containing the
221-
mathematical value of the addition modulo 2^n, where `n` is the bitwidth.
222-
Because `arith` integers use a two's complement representation, this operation
219+
Performs N-bit addition on the operands. The operands are interpreted as
220+
unsigned bitvectors. The result is represented by a bitvector containing the
221+
mathematical value of the addition modulo 2^n, where `n` is the bitwidth.
222+
Because `arith` integers use a two's complement representation, this operation
223223
is applicable on both signed and unsigned integer operands.
224224

225225
The `addi` operation takes two operands and returns one result, each of
226-
these is required to be the same type. This type may be an integer scalar type,
226+
these is required to be the same type. This type may be an integer scalar type,
227227
a vector whose element type is integer, or a tensor of integers.
228228

229229
This op supports `nuw`/`nsw` overflow flags which stands for
@@ -489,8 +489,8 @@ def Arith_DivUIOp : Arith_IntBinaryOp<"divui", [ConditionallySpeculatable]> {
489489
the most significant, i.e. for `i16` given two's complement representation,
490490
`6 / -2 = 6 / (2^16 - 2) = 0`.
491491

492-
Division by zero is undefined behavior. When applied to `vector` and
493-
`tensor` values, the behavior is undefined if _any_ elements are divided by
492+
Division by zero is undefined behavior. When applied to `vector` and
493+
`tensor` values, the behavior is undefined if _any_ elements are divided by
494494
zero.
495495

496496
Example:
@@ -525,9 +525,9 @@ def Arith_DivSIOp : Arith_IntBinaryOp<"divsi", [ConditionallySpeculatable]> {
525525
Signed integer division. Rounds towards zero. Treats the leading bit as
526526
sign, i.e. `6 / -2 = -3`.
527527

528-
Divison by zero, or signed division overflow (minimum value divided by -1)
529-
is undefined behavior. When applied to `vector` and `tensor` values, the
530-
behavior is undefined if _any_ of its elements are divided by zero or has a
528+
Divison by zero, or signed division overflow (minimum value divided by -1)
529+
is undefined behavior. When applied to `vector` and `tensor` values, the
530+
behavior is undefined if _any_ of its elements are divided by zero or has a
531531
signed division overflow.
532532

533533
Example:
@@ -562,10 +562,10 @@ def Arith_CeilDivUIOp : Arith_IntBinaryOp<"ceildivui",
562562
let description = [{
563563
Unsigned integer division. Rounds towards positive infinity. Treats the
564564
leading bit as the most significant, i.e. for `i16` given two's complement
565-
representation, `6 / -2 = 6 / (2^16 - 2) = 1`.
565+
representation, `6 / -2 = 6 / (2^16 - 2) = 1`.
566566

567-
Division by zero is undefined behavior. When applied to `vector` and
568-
`tensor` values, the behavior is undefined if _any_ elements are divided by
567+
Division by zero is undefined behavior. When applied to `vector` and
568+
`tensor` values, the behavior is undefined if _any_ elements are divided by
569569
zero.
570570

571571
Example:
@@ -594,9 +594,9 @@ def Arith_CeilDivSIOp : Arith_IntBinaryOp<"ceildivsi",
594594
let description = [{
595595
Signed integer division. Rounds towards positive infinity, i.e. `7 / -2 = -3`.
596596

597-
Divison by zero, or signed division overflow (minimum value divided by -1)
598-
is undefined behavior. When applied to `vector` and `tensor` values, the
599-
behavior is undefined if _any_ of its elements are divided by zero or has a
597+
Divison by zero, or signed division overflow (minimum value divided by -1)
598+
is undefined behavior. When applied to `vector` and `tensor` values, the
599+
behavior is undefined if _any_ of its elements are divided by zero or has a
600600
signed division overflow.
601601

602602
Example:
@@ -624,9 +624,9 @@ def Arith_FloorDivSIOp : Arith_TotalIntBinaryOp<"floordivsi"> {
624624
let description = [{
625625
Signed integer division. Rounds towards negative infinity, i.e. `5 / -2 = -3`.
626626

627-
Divison by zero, or signed division overflow (minimum value divided by -1)
628-
is undefined behavior. When applied to `vector` and `tensor` values, the
629-
behavior is undefined if _any_ of its elements are divided by zero or has a
627+
Divison by zero, or signed division overflow (minimum value divided by -1)
628+
is undefined behavior. When applied to `vector` and `tensor` values, the
629+
behavior is undefined if _any_ of its elements are divided by zero or has a
630630
signed division overflow.
631631

632632
Example:
@@ -650,8 +650,8 @@ def Arith_RemUIOp : Arith_TotalIntBinaryOp<"remui"> {
650650
Unsigned integer division remainder. Treats the leading bit as the most
651651
significant, i.e. for `i16`, `6 % -2 = 6 % (2^16 - 2) = 6`.
652652

653-
Division by zero is undefined behavior. When applied to `vector` and
654-
`tensor` values, the behavior is undefined if _any_ elements are divided by
653+
Division by zero is undefined behavior. When applied to `vector` and
654+
`tensor` values, the behavior is undefined if _any_ elements are divided by
655655
zero.
656656

657657
Example:
@@ -680,8 +680,8 @@ def Arith_RemSIOp : Arith_TotalIntBinaryOp<"remsi"> {
680680
Signed integer division remainder. Treats the leading bit as sign, i.e. `6 %
681681
-2 = 0`.
682682

683-
Division by zero is undefined behavior. When applied to `vector` and
684-
`tensor` values, the behavior is undefined if _any_ elements are divided by
683+
Division by zero is undefined behavior. When applied to `vector` and
684+
`tensor` values, the behavior is undefined if _any_ elements are divided by
685685
zero.
686686

687687
Example:
@@ -794,9 +794,9 @@ def Arith_XOrIOp : Arith_TotalIntBinaryOp<"xori", [Commutative]> {
794794
def Arith_ShLIOp : Arith_IntBinaryOpWithOverflowFlags<"shli"> {
795795
let summary = "integer left-shift";
796796
let description = [{
797-
The `shli` operation shifts the integer value of the first operand to the left
798-
by the integer value of the second operand. The second operand is interpreted as
799-
unsigned. The low order bits are filled with zeros. If the value of the second
797+
The `shli` operation shifts the integer value of the first operand to the left
798+
by the integer value of the second operand. The second operand is interpreted as
799+
unsigned. The low order bits are filled with zeros. If the value of the second
800800
operand is greater or equal than the bitwidth of the first operand, then the
801801
operation returns poison.
802802

@@ -811,7 +811,7 @@ def Arith_ShLIOp : Arith_IntBinaryOpWithOverflowFlags<"shli"> {
811811
%1 = arith.constant 5 : i8 // %1 is 0b00000101
812812
%2 = arith.constant 3 : i8
813813
%3 = arith.shli %1, %2 : i8 // %3 is 0b00101000
814-
%4 = arith.shli %1, %2 overflow<nsw, nuw> : i8
814+
%4 = arith.shli %1, %2 overflow<nsw, nuw> : i8
815815
```
816816
}];
817817
let hasFolder = 1;
@@ -824,9 +824,9 @@ def Arith_ShLIOp : Arith_IntBinaryOpWithOverflowFlags<"shli"> {
824824
def Arith_ShRUIOp : Arith_TotalIntBinaryOp<"shrui"> {
825825
let summary = "unsigned integer right-shift";
826826
let description = [{
827-
The `shrui` operation shifts an integer value of the first operand to the right
827+
The `shrui` operation shifts an integer value of the first operand to the right
828828
by the value of the second operand. The first operand is interpreted as unsigned,
829-
and the second operand is interpreted as unsigned. The high order bits are always
829+
and the second operand is interpreted as unsigned. The high order bits are always
830830
filled with zeros. If the value of the second operand is greater or equal than the
831831
bitwidth of the first operand, then the operation returns poison.
832832

@@ -848,11 +848,11 @@ def Arith_ShRUIOp : Arith_TotalIntBinaryOp<"shrui"> {
848848
def Arith_ShRSIOp : Arith_TotalIntBinaryOp<"shrsi"> {
849849
let summary = "signed integer right-shift";
850850
let description = [{
851-
The `shrsi` operation shifts an integer value of the first operand to the right
852-
by the value of the second operand. The first operand is interpreted as signed,
853-
and the second operand is interpreter as unsigned. The high order bits in the
854-
output are filled with copies of the most-significant bit of the shifted value
855-
(which means that the sign of the value is preserved). If the value of the second
851+
The `shrsi` operation shifts an integer value of the first operand to the right
852+
by the value of the second operand. The first operand is interpreted as signed,
853+
and the second operand is interpreter as unsigned. The high order bits in the
854+
output are filled with copies of the most-significant bit of the shifted value
855+
(which means that the sign of the value is preserved). If the value of the second
856856
operand is greater or equal than bitwidth of the first operand, then the operation
857857
returns poison.
858858

@@ -1229,41 +1229,41 @@ def Arith_ScalingExtFOp
12291229
let summary = "Upcasts input floats using provided scales values following "
12301230
"OCP MXFP Spec";
12311231
let description = [{
1232-
This operation upcasts input floating-point values using provided scale
1233-
values. It expects both scales and the input operand to be of the same shape,
1234-
making the operation elementwise. Scales are usually calculated per block
1232+
This operation upcasts input floating-point values using provided scale
1233+
values. It expects both scales and the input operand to be of the same shape,
1234+
making the operation elementwise. Scales are usually calculated per block
12351235
following the OCP MXFP spec as described in https://arxiv.org/abs/2310.10537.
12361236

1237-
If scales are calculated per block where blockSize != 1, then scales may
1238-
require broadcasting to make this operation elementwise. For example, let's
1239-
say the input is of shape `<dim1 x dim2 x ... dimN>`. Given blockSize != 1 and
1240-
assuming quantization happens on the last axis, the input can be reshaped to
1241-
`<dim1 x dim2 x ... (dimN/blockSize) x blockSize>`. Scales will be calculated
1242-
per block on the last axis. Therefore, scales will be of shape
1243-
`<dim1 x dim2 x ... (dimN/blockSize) x 1>`. Scales could also be of some other
1244-
shape as long as it is broadcast compatible with the input, e.g.,
1237+
If scales are calculated per block where blockSize != 1, then scales may
1238+
require broadcasting to make this operation elementwise. For example, let's
1239+
say the input is of shape `<dim1 x dim2 x ... dimN>`. Given blockSize != 1 and
1240+
assuming quantization happens on the last axis, the input can be reshaped to
1241+
`<dim1 x dim2 x ... (dimN/blockSize) x blockSize>`. Scales will be calculated
1242+
per block on the last axis. Therefore, scales will be of shape
1243+
`<dim1 x dim2 x ... (dimN/blockSize) x 1>`. Scales could also be of some other
1244+
shape as long as it is broadcast compatible with the input, e.g.,
12451245
`<1 x 1 x ... (dimN/blockSize) x 1>`.
12461246

1247-
In this example, before calling into `arith.scaling_extf`, scales must be
1248-
broadcasted to `<dim1 x dim2 x dim3 ... (dimN/blockSize) x blockSize>`. Note
1249-
that there could be multiple quantization axes. Internally,
1247+
In this example, before calling into `arith.scaling_extf`, scales must be
1248+
broadcasted to `<dim1 x dim2 x dim3 ... (dimN/blockSize) x blockSize>`. Note
1249+
that there could be multiple quantization axes. Internally,
12501250
`arith.scaling_extf` would perform the following:
1251-
1251+
12521252
```
1253-
resultTy = get_type(result)
1253+
resultTy = get_type(result)
12541254
scaleTy = get_type(scale)
12551255
inputTy = get_type(input)
12561256
scale.exponent = arith.truncf(scale) : scaleTy to f8E8M0
12571257
scale.extf = arith.extf(scale.exponent) : f8E8M0 to resultTy
12581258
input.extf = arith.extf(input) : inputTy to resultTy
12591259
result = arith.mulf(scale.extf, input.extf)
12601260
```
1261-
It propagates NaN values. Therefore, if either scale or the input element
1261+
It propagates NaN values. Therefore, if either scale or the input element
12621262
contains NaN, then the output element value will also be a NaN.
12631263
}];
12641264
let hasVerifier = 1;
12651265
let assemblyFormat =
1266-
[{ $in `,` $scale (`fastmath` `` $fastmath^)? attr-dict `:`
1266+
[{ $in `,` $scale (`fastmath` `` $fastmath^)? attr-dict `:`
12671267
type($in) `,` type($scale) `to` type($out)}];
12681268
}
12691269

@@ -1373,28 +1373,28 @@ def Arith_ScalingTruncFOp
13731373
let summary = "Downcasts input floating point values using provided scales "
13741374
"values following OCP MXFP Spec";
13751375
let description = [{
1376-
This operation downcasts input using the provided scale values. It expects
1377-
both scales and the input operand to be of the same shape and, therefore,
1378-
makes the operation elementwise. Scales are usually calculated per block
1376+
This operation downcasts input using the provided scale values. It expects
1377+
both scales and the input operand to be of the same shape and, therefore,
1378+
makes the operation elementwise. Scales are usually calculated per block
13791379
following the OCP MXFP spec as described in https://arxiv.org/abs/2310.10537.
13801380
Users are required to normalize and clamp the scales as necessary before calling
13811381
passing them to this operation. OCP MXFP spec also does the flushing of denorms
1382-
on the input operand, which should be handled during lowering by passing appropriate
1383-
fastMath flag to this operation.
1384-
1385-
If scales are calculated per block where blockSize != 1, scales may require
1386-
broadcasting to make this operation elementwise. For example, let's say the
1387-
input is of shape `<dim1 x dim2 x ... dimN>`. Given blockSize != 1 and
1388-
assuming quantization happens on the last axis, the input can be reshaped to
1389-
`<dim1 x dim2 x ... (dimN/blockSize) x blockSize>`. Scales will be calculated
1390-
per block on the last axis. Therefore, scales will be of shape
1391-
`<dim1 x dim2 x ... (dimN/blockSize) x 1>`. Scales could also be of some other
1392-
shape as long as it is broadcast compatible with the input, e.g.,
1382+
on the input operand, which should be handled during lowering by passing appropriate
1383+
fastMath flag to this operation.
1384+
1385+
If scales are calculated per block where blockSize != 1, scales may require
1386+
broadcasting to make this operation elementwise. For example, let's say the
1387+
input is of shape `<dim1 x dim2 x ... dimN>`. Given blockSize != 1 and
1388+
assuming quantization happens on the last axis, the input can be reshaped to
1389+
`<dim1 x dim2 x ... (dimN/blockSize) x blockSize>`. Scales will be calculated
1390+
per block on the last axis. Therefore, scales will be of shape
1391+
`<dim1 x dim2 x ... (dimN/blockSize) x 1>`. Scales could also be of some other
1392+
shape as long as it is broadcast compatible with the input, e.g.,
13931393
`<1 x 1 x ... (dimN/blockSize) x 1>`.
13941394

1395-
In this example, before calling into `arith.scaling_truncf`, scales must be
1396-
broadcasted to `<dim1 x dim2 x dim3 ... (dimN/blockSize) x blockSize>`. Note
1397-
that there could be multiple quantization axes. Internally,
1395+
In this example, before calling into `arith.scaling_truncf`, scales must be
1396+
broadcasted to `<dim1 x dim2 x dim3 ... (dimN/blockSize) x blockSize>`. Note
1397+
that there could be multiple quantization axes. Internally,
13981398
`arith.scaling_truncf` would perform the following:
13991399

14001400
```
@@ -1409,7 +1409,7 @@ def Arith_ScalingTruncFOp
14091409
}];
14101410
let hasVerifier = 1;
14111411
let assemblyFormat =
1412-
[{ $in `,` $scale ($roundingmode^)? (`fastmath` `` $fastmath^)? attr-dict `:`
1412+
[{ $in `,` $scale ($roundingmode^)? (`fastmath` `` $fastmath^)? attr-dict `:`
14131413
type($in) `,` type($scale) `to` type($out)}];
14141414
}
14151415

0 commit comments

Comments
 (0)