Skip to content

Commit bb082c2

Browse files
committed
[mlir] regenerate linalg named ops yaml
The Linalg named ops specification went out of sync with the OpDSL description, presumably due to direct manual modifications of the yaml file. Additionally, the unsigned division has been generating the signed scalar instruction, which is now fixed.
1 parent d297399 commit bb082c2

File tree

2 files changed

+47
-52
lines changed

2 files changed

+47
-52
lines changed

mlir/include/mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yaml

Lines changed: 46 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ structured_op: !LinalgStructuredOpConfig
156156
assignments:
157157
- !ScalarAssign
158158
arg: O
159-
value: !Scalarlogression
159+
value: !ScalarExpression
160160
scalar_fn:
161161
kind: unary
162162
fn_name: log
163163
operands:
164-
- !Scalarlogression
164+
- !ScalarExpression
165165
scalar_arg: I
166166
--- !LinalgOpConfig
167167
metadata: !LinalgOpMetadata
@@ -191,7 +191,7 @@ structured_op: !LinalgStructuredOpConfig
191191
assignments:
192192
- !ScalarAssign
193193
arg: O
194-
value: !Scalarabsression
194+
value: !ScalarExpression
195195
scalar_fn:
196196
kind: unary
197197
fn_name: abs
@@ -226,12 +226,12 @@ structured_op: !LinalgStructuredOpConfig
226226
assignments:
227227
- !ScalarAssign
228228
arg: O
229-
value: !Scalarceilression
229+
value: !ScalarExpression
230230
scalar_fn:
231231
kind: unary
232232
fn_name: ceil
233233
operands:
234-
- !Scalarceilression
234+
- !ScalarExpression
235235
scalar_arg: I
236236
--- !LinalgOpConfig
237237
metadata: !LinalgOpMetadata
@@ -261,17 +261,17 @@ structured_op: !LinalgStructuredOpConfig
261261
assignments:
262262
- !ScalarAssign
263263
arg: O
264-
value: !Scalarfloorression
264+
value: !ScalarExpression
265265
scalar_fn:
266266
kind: unary
267267
fn_name: floor
268268
operands:
269-
- !Scalarfloorression
269+
- !ScalarExpression
270270
scalar_arg: I
271271
--- !LinalgOpConfig
272272
metadata: !LinalgOpMetadata
273273
name: negf
274-
cpp_class_name: NegFOp
274+
cpp_class_name: NegfOp
275275
doc: |-
276276
Applies negf(x) elementwise.
277277
@@ -296,7 +296,7 @@ structured_op: !LinalgStructuredOpConfig
296296
assignments:
297297
- !ScalarAssign
298298
arg: O
299-
value: !Scalarnegfression
299+
value: !ScalarExpression
300300
scalar_fn:
301301
kind: unary
302302
fn_name: negf
@@ -386,17 +386,17 @@ structured_op: !LinalgStructuredOpConfig
386386
- !LinalgOperandDefConfig
387387
name: lhs
388388
kind: input_tensor
389-
type_var: T
389+
type_var: T1
390390
shape_map: affine_map<() -> ()>
391391
- !LinalgOperandDefConfig
392392
name: rhs
393393
kind: input_tensor
394-
type_var: T
394+
type_var: T1
395395
shape_map: affine_map<() -> ()>
396396
- !LinalgOperandDefConfig
397-
name: out
397+
name: O
398398
kind: output_tensor
399-
type_var: T
399+
type_var: T1
400400
shape_map: affine_map<() -> ()>
401401
indexing_maps: !LinalgIndexingMapsConfig
402402
static_indexing_maps:
@@ -406,7 +406,7 @@ structured_op: !LinalgStructuredOpConfig
406406
iterator_types: []
407407
assignments:
408408
- !ScalarAssign
409-
arg: out
409+
arg: O
410410
value: !ScalarExpression
411411
scalar_fn:
412412
kind: binary
@@ -435,17 +435,17 @@ structured_op: !LinalgStructuredOpConfig
435435
- !LinalgOperandDefConfig
436436
name: lhs
437437
kind: input_tensor
438-
type_var: T
438+
type_var: T1
439439
shape_map: affine_map<() -> ()>
440440
- !LinalgOperandDefConfig
441441
name: rhs
442442
kind: input_tensor
443-
type_var: T
443+
type_var: T1
444444
shape_map: affine_map<() -> ()>
445445
- !LinalgOperandDefConfig
446-
name: out
446+
name: O
447447
kind: output_tensor
448-
type_var: T
448+
type_var: T1
449449
shape_map: affine_map<() -> ()>
450450
indexing_maps: !LinalgIndexingMapsConfig
451451
static_indexing_maps:
@@ -455,7 +455,7 @@ structured_op: !LinalgStructuredOpConfig
455455
iterator_types: []
456456
assignments:
457457
- !ScalarAssign
458-
arg: out
458+
arg: O
459459
value: !ScalarExpression
460460
scalar_fn:
461461
kind: binary
@@ -470,7 +470,7 @@ metadata: !LinalgOpMetadata
470470
name: mul
471471
cpp_class_name: MulOp
472472
doc: |-
473-
Multiply two tensors elementwise.
473+
Multiplies two tensors elementwise.
474474
475475
The shapes and element types must be identical. The appropriate casts,
476476
broadcasts and reductions should be done previously to calling this op.
@@ -484,17 +484,17 @@ structured_op: !LinalgStructuredOpConfig
484484
- !LinalgOperandDefConfig
485485
name: lhs
486486
kind: input_tensor
487-
type_var: T
487+
type_var: T1
488488
shape_map: affine_map<() -> ()>
489489
- !LinalgOperandDefConfig
490490
name: rhs
491491
kind: input_tensor
492-
type_var: T
492+
type_var: T1
493493
shape_map: affine_map<() -> ()>
494494
- !LinalgOperandDefConfig
495-
name: out
495+
name: O
496496
kind: output_tensor
497-
type_var: T
497+
type_var: T1
498498
shape_map: affine_map<() -> ()>
499499
indexing_maps: !LinalgIndexingMapsConfig
500500
static_indexing_maps:
@@ -504,7 +504,7 @@ structured_op: !LinalgStructuredOpConfig
504504
iterator_types: []
505505
assignments:
506506
- !ScalarAssign
507-
arg: out
507+
arg: O
508508
value: !ScalarExpression
509509
scalar_fn:
510510
kind: binary
@@ -519,8 +519,7 @@ metadata: !LinalgOpMetadata
519519
name: div
520520
cpp_class_name: DivOp
521521
doc: |-
522-
Divides the first tensor by the second tensor, elementwise. For integer
523-
types, performs a signed division.
522+
Divides the first tensor by the second tensor, elementwise.
524523
525524
The shapes and element types must be identical. The appropriate casts,
526525
broadcasts and reductions should be done previously to calling this op.
@@ -534,17 +533,17 @@ structured_op: !LinalgStructuredOpConfig
534533
- !LinalgOperandDefConfig
535534
name: lhs
536535
kind: input_tensor
537-
type_var: T
536+
type_var: T1
538537
shape_map: affine_map<() -> ()>
539538
- !LinalgOperandDefConfig
540539
name: rhs
541540
kind: input_tensor
542-
type_var: T
541+
type_var: T1
543542
shape_map: affine_map<() -> ()>
544543
- !LinalgOperandDefConfig
545-
name: out
544+
name: O
546545
kind: output_tensor
547-
type_var: T
546+
type_var: T1
548547
shape_map: affine_map<() -> ()>
549548
indexing_maps: !LinalgIndexingMapsConfig
550549
static_indexing_maps:
@@ -554,7 +553,7 @@ structured_op: !LinalgStructuredOpConfig
554553
iterator_types: []
555554
assignments:
556555
- !ScalarAssign
557-
arg: out
556+
arg: O
558557
value: !ScalarExpression
559558
scalar_fn:
560559
kind: binary
@@ -567,7 +566,7 @@ structured_op: !LinalgStructuredOpConfig
567566
--- !LinalgOpConfig
568567
metadata: !LinalgOpMetadata
569568
name: div_unsigned
570-
cpp_class_name: DivUOp
569+
cpp_class_name: DivUnsignedOp
571570
doc: |-
572571
Divides the first tensor by the second tensor, elementwise. For integer
573572
types, performs an unsigned division.
@@ -584,17 +583,17 @@ structured_op: !LinalgStructuredOpConfig
584583
- !LinalgOperandDefConfig
585584
name: lhs
586585
kind: input_tensor
587-
type_var: T
586+
type_var: T1
588587
shape_map: affine_map<() -> ()>
589588
- !LinalgOperandDefConfig
590589
name: rhs
591590
kind: input_tensor
592-
type_var: T
591+
type_var: T1
593592
shape_map: affine_map<() -> ()>
594593
- !LinalgOperandDefConfig
595-
name: out
594+
name: O
596595
kind: output_tensor
597-
type_var: T
596+
type_var: T1
598597
shape_map: affine_map<() -> ()>
599598
indexing_maps: !LinalgIndexingMapsConfig
600599
static_indexing_maps:
@@ -604,7 +603,7 @@ structured_op: !LinalgStructuredOpConfig
604603
iterator_types: []
605604
assignments:
606605
- !ScalarAssign
607-
arg: out
606+
arg: O
608607
value: !ScalarExpression
609608
scalar_fn:
610609
kind: binary
@@ -619,7 +618,7 @@ metadata: !LinalgOpMetadata
619618
name: max
620619
cpp_class_name: MaxOp
621620
doc: |-
622-
Takes the max (signed) between the input and a constant.
621+
Takes the max (signed) between two inputs, elementwise.
623622
624623
The shapes and element types must be identical. The appropriate casts,
625624
broadcasts and reductions should be done previously to calling this op.
@@ -633,17 +632,17 @@ structured_op: !LinalgStructuredOpConfig
633632
- !LinalgOperandDefConfig
634633
name: lhs
635634
kind: input_tensor
636-
type_var: T
635+
type_var: T1
637636
shape_map: affine_map<() -> ()>
638637
- !LinalgOperandDefConfig
639638
name: rhs
640639
kind: input_tensor
641-
type_var: T
640+
type_var: T1
642641
shape_map: affine_map<() -> ()>
643642
- !LinalgOperandDefConfig
644-
name: out
643+
name: O
645644
kind: output_tensor
646-
type_var: T
645+
type_var: T1
647646
shape_map: affine_map<() -> ()>
648647
indexing_maps: !LinalgIndexingMapsConfig
649648
static_indexing_maps:
@@ -653,7 +652,7 @@ structured_op: !LinalgStructuredOpConfig
653652
iterator_types: []
654653
assignments:
655654
- !ScalarAssign
656-
arg: out
655+
arg: O
657656
value: !ScalarExpression
658657
scalar_fn:
659658
kind: binary
@@ -668,14 +667,10 @@ metadata: !LinalgOpMetadata
668667
name: matmul
669668
cpp_class_name: MatmulOp
670669
doc: |-
671-
Performs an accumulative (C += A*B) matrix multiplication of two 2D inputs.
670+
Performs a matrix multiplication of two 2D inputs.
672671
673672
Numeric casting is performed on the operands to the inner multiply, promoting
674673
them to the same data type as the accumulator/output.
675-
676-
Note this operation represents an accumulative matrix multiplication, `C +=
677-
A*B` (as opposed to `C = A*B`). The appropriate initialisation of the output
678-
matrix should be done prior to calling this Op.
679674
implements:
680675
- LinalgContractionOpInterface
681676
structured_op: !LinalgStructuredOpConfig
@@ -1141,8 +1136,8 @@ metadata: !LinalgOpMetadata
11411136
name: batch_mmt4d
11421137
cpp_class_name: BatchMmt4DOp
11431138
doc: |-
1144-
Performs a batched matrix-matrix-transpose multiplication of two batched-4D
1145-
(5D) inputs.
1139+
Performs a batched matrix-matrix-transpose multiplication of two
1140+
batched-4D (5D) inputs.
11461141
11471142
Besides the outermost batch dimension has the same semantic as
11481143
linalg.batch_matmul, the differences from linalg.batch_matmul in the

mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def div_unsigned(
217217
a `linalg.broadcast` + `linalg.div` sequence can be lowered to a
218218
`linalg.generic` with different affine maps for the two operands.
219219
"""
220-
O[None] = lhs[None] / rhs[None]
220+
O[None] = BinaryFn.div_unsigned(lhs[None], rhs[None])
221221

222222

223223
@linalg_structured_op

0 commit comments

Comments
 (0)