[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / mlir / utils / tree-sitter-mlir / test / corpus / op.txt
blobd2914e24e65f95ee473ff7752d23770d868e706c
1 ================================================================================
2 linalg.map without ins
3 ================================================================================
4 func.func @map_no_inputs(%init: tensor<64xf32>) -> tensor<64xf32> {
5    %add = linalg.map
6       outs(%init:tensor<64xf32>)
7       () {
8         %0 = arith.constant 0.0: f32
9         linalg.yield %0: f32
10       }
11   func.return %add : tensor<64xf32>
13 --------------------------------------------------------------------------------
15 (toplevel
16   (operation
17     (custom_operation
18       (func_dialect
19         (symbol_ref_id)
20         (func_arg_list
21           (value_use)
22           (type
23             (builtin_type
24               (tensor_type
25                 (dim_list
26                   (float_type))))))
27         (func_return
28           (type_list_attr_parens
29             (type
30               (builtin_type
31                 (tensor_type
32                   (dim_list
33                     (float_type)))))))
34         (region
35           (entry_block
36             (operation
37               (op_result
38                 (value_use))
39               (custom_operation
40                 (linalg_dialect
41                   (value_use)
42                   (type
43                     (builtin_type
44                       (tensor_type
45                         (dim_list
46                           (float_type)))))
47                   (block_arg_list)
48                   (region
49                     (entry_block
50                       (operation
51                         (op_result
52                           (value_use))
53                         (custom_operation
54                           (arith_dialect
55                             (float_literal)
56                             (type
57                               (builtin_type
58                                 (float_type))))))
59                       (operation
60                         (custom_operation
61                           (linalg_dialect
62                             (value_use)
63                             (type
64                               (builtin_type
65                                 (float_type)))))))))))
66             (operation
67               (custom_operation
68                 (func_dialect
69                   (value_use)
70                   (type
71                     (builtin_type
72                       (tensor_type
73                         (dim_list
74                           (float_type))))))))))))))
76 ================================================================================
77 linalg.map with ins and outs
78 ================================================================================
79 func.func @map_binary_memref(%lhs: memref<64xf32>, %rhs: memref<64xf32>,
80                       %init: memref<64xf32>) {
81    linalg.map
82       ins(%lhs, %rhs: memref<64xf32>, memref<64xf32>)
83       outs(%init:memref<64xf32>)
84       (%lhs_elem: f32, %rhs_elem: f32) {
85         %0 = arith.addf %lhs_elem, %rhs_elem: f32
86         linalg.yield %0: f32
87       }
88   func.return
90 --------------------------------------------------------------------------------
92 (toplevel
93   (operation
94     (custom_operation
95       (func_dialect
96         (symbol_ref_id)
97         (func_arg_list
98           (value_use)
99           (type
100             (builtin_type
101               (memref_type
102                 (dim_list
103                   (float_type)))))
104           (value_use)
105           (type
106             (builtin_type
107               (memref_type
108                 (dim_list
109                   (float_type)))))
110           (value_use)
111           (type
112             (builtin_type
113               (memref_type
114                 (dim_list
115                   (float_type))))))
116         (region
117           (entry_block
118             (operation
119               (custom_operation
120                 (linalg_dialect
121                   (value_use)
122                   (value_use)
123                   (type
124                     (builtin_type
125                       (memref_type
126                         (dim_list
127                           (float_type)))))
128                   (type
129                     (builtin_type
130                       (memref_type
131                         (dim_list
132                           (float_type)))))
133                   (value_use)
134                   (type
135                     (builtin_type
136                       (memref_type
137                         (dim_list
138                           (float_type)))))
139                   (block_arg_list
140                     (value_use)
141                     (type
142                       (builtin_type
143                         (float_type)))
144                     (value_use)
145                     (type
146                       (builtin_type
147                         (float_type))))
148                   (region
149                     (entry_block
150                       (operation
151                         (op_result
152                           (value_use))
153                         (custom_operation
154                           (arith_dialect
155                             (value_use)
156                             (value_use)
157                             (type
158                               (builtin_type
159                                 (float_type))))))
160                       (operation
161                         (custom_operation
162                           (linalg_dialect
163                             (value_use)
164                             (type
165                               (builtin_type
166                                 (float_type)))))))))))
167             (operation
168               (custom_operation
169                 (func_dialect)))))))))
171 ================================================================================
172 linalg.generic with attribute dictionary
173 ================================================================================
174 func.func @gather_like(
175     %arg0 : tensor<?x?xf32> {bufferization.writable = false},
176     %arg1 : tensor<?xi32> {bufferization.writable = false},
177     %arg2 : tensor<?x?xf32> {bufferization.writable = true})
178   -> tensor<?x?xf32>
180   %0 = linalg.generic {
181       indexing_maps = [affine_map<(d0, d1) -> (d0)>,
182                        affine_map<(d0, d1) -> (d0, d1)>],
183       iterator_types = ["parallel", "parallel"]}
184       ins(%arg1 : tensor<?xi32>) outs(%arg2 : tensor<?x?xf32>) {
185       ^bb0(%arg3: i32, %arg4 : f32):
186         %iv1 = linalg.index 1 : index
187         %1 = arith.index_cast %arg3: i32 to index
188         %2 = tensor.extract %arg0[%1, %iv1] : tensor<?x?xf32>
189         linalg.yield %2 : f32
190       } -> tensor<?x?xf32>
191   return %0 : tensor<?x?xf32>
193 --------------------------------------------------------------------------------
195 (toplevel
196   (operation
197     (custom_operation
198       (func_dialect
199         (symbol_ref_id)
200         (func_arg_list
201           (value_use)
202           (type
203             (builtin_type
204               (tensor_type
205                 (dim_list
206                   (float_type)))))
207           (attribute
208             (dictionary_attribute
209               (attribute_entry
210                 (bare_id)
211                 (attribute_value
212                   (bool_literal)))))
213           (value_use)
214           (type
215             (builtin_type
216               (tensor_type
217                 (dim_list
218                   (integer_type)))))
219           (attribute
220             (dictionary_attribute
221               (attribute_entry
222                 (bare_id)
223                 (attribute_value
224                   (bool_literal)))))
225           (value_use)
226           (type
227             (builtin_type
228               (tensor_type
229                 (dim_list
230                   (float_type)))))
231           (attribute
232             (dictionary_attribute
233               (attribute_entry
234                 (bare_id)
235                 (attribute_value
236                   (bool_literal))))))
237         (func_return
238           (type_list_attr_parens
239             (type
240               (builtin_type
241                 (tensor_type
242                   (dim_list
243                     (float_type)))))))
244         (region
245           (entry_block
246             (operation
247               (op_result
248                 (value_use))
249               (custom_operation
250                 (linalg_dialect
251                   (attribute
252                     (dictionary_attribute
253                       (attribute_entry
254                         (bare_id)
255                         (attribute_value
256                           (builtin_attribute
257                             (affine_map
258                               (bare_id)
259                               (bare_id)
260                               (bare_id)))
261                           (builtin_attribute
262                             (affine_map
263                               (bare_id)
264                               (bare_id)
265                               (bare_id)
266                               (bare_id)))))
267                       (attribute_entry
268                         (bare_id)
269                         (attribute_value
270                           (string_literal)
271                           (string_literal)))))
272                   (value_use)
273                   (type
274                     (builtin_type
275                       (tensor_type
276                         (dim_list
277                           (integer_type)))))
278                   (value_use)
279                   (type
280                     (builtin_type
281                       (tensor_type
282                         (dim_list
283                           (float_type)))))
284                   (region
285                     (block
286                       (block_label
287                         (caret_id)
288                         (block_arg_list
289                           (value_use)
290                           (type
291                             (builtin_type
292                               (integer_type)))
293                           (value_use)
294                           (type
295                             (builtin_type
296                               (float_type)))))
297                       (operation
298                         (op_result
299                           (value_use))
300                         (custom_operation
301                           (linalg_dialect
302                             (integer_literal)
303                             (type
304                               (builtin_type
305                                 (index_type))))))
306                       (operation
307                         (op_result
308                           (value_use))
309                         (custom_operation
310                           (arith_dialect
311                             (value_use)
312                             (type
313                               (builtin_type
314                                 (integer_type)))
315                             (type
316                               (builtin_type
317                                 (index_type))))))
318                       (operation
319                         (op_result
320                           (value_use))
321                         (custom_operation
322                           (tensor_dialect
323                             (value_use)
324                             (value_use)
325                             (value_use)
326                             (type
327                               (builtin_type
328                                 (tensor_type
329                                   (dim_list
330                                     (float_type))))))))
331                       (operation
332                         (custom_operation
333                           (linalg_dialect
334                             (value_use)
335                             (type
336                               (builtin_type
337                                 (float_type))))))))
338                   (type
339                     (builtin_type
340                       (tensor_type
341                         (dim_list
342                           (float_type))))))))
343             (operation
344               (custom_operation
345                 (func_dialect
346                   (value_use)
347                   (type
348                     (builtin_type
349                       (tensor_type
350                         (dim_list
351                           (float_type))))))))))))))
353 ================================================================================
354 tensor.collapse_shape and tensor.expand_shape without reassocation
355 ================================================================================
356 func.func @tensor_reshape_zero_dim(%arg0 : tensor<1x1xf32>, %arg1 : tensor<f32>)
357     -> (tensor<f32>, tensor<1x1xf32>) {
358   %0 = tensor.collapse_shape %arg0 [] : tensor<1x1xf32> into tensor<f32>
359   %1 = tensor.expand_shape %0 [] : tensor<f32> into tensor<1x1xf32>
360   return %0, %1 : tensor<f32>, tensor<1x1xf32>
362 --------------------------------------------------------------------------------
364 (toplevel
365   (operation
366     (custom_operation
367       (func_dialect
368         (symbol_ref_id)
369         (func_arg_list
370           (value_use)
371           (type
372             (builtin_type
373               (tensor_type
374                 (dim_list
375                   (float_type)))))
376           (value_use)
377           (type
378             (builtin_type
379               (tensor_type
380                 (dim_list
381                   (float_type))))))
382         (func_return
383           (type_list_attr_parens
384             (type
385               (builtin_type
386                 (tensor_type
387                   (dim_list
388                     (float_type)))))
389             (type
390               (builtin_type
391                 (tensor_type
392                   (dim_list
393                     (float_type)))))))
394         (region
395           (entry_block
396             (operation
397               (op_result
398                 (value_use))
399               (custom_operation
400                 (tensor_dialect
401                   (value_use)
402                   (nested_idx_list)
403                   (type
404                     (builtin_type
405                       (tensor_type
406                         (dim_list
407                           (float_type)))))
408                   (type
409                     (builtin_type
410                       (tensor_type
411                         (dim_list
412                           (float_type))))))))
413             (operation
414               (op_result
415                 (value_use))
416               (custom_operation
417                 (tensor_dialect
418                   (value_use)
419                   (nested_idx_list)
420                   (type
421                     (builtin_type
422                       (tensor_type
423                         (dim_list
424                           (float_type)))))
425                   (type
426                     (builtin_type
427                       (tensor_type
428                         (dim_list
429                           (float_type))))))))
430             (operation
431               (custom_operation
432                 (func_dialect
433                   (value_use)
434                   (value_use)
435                   (type
436                     (builtin_type
437                       (tensor_type
438                         (dim_list
439                           (float_type)))))
440                   (type
441                     (builtin_type
442                       (tensor_type
443                         (dim_list
444                           (float_type))))))))))))))
446 ================================================================================
447 tensor.collapse_shape with reassocation
448 ================================================================================
449 func.func @legal_collapsing_reshape_dynamic_tensor
450   (%arg0: tensor<?x?x?x4x?xf32>) -> tensor<?x?x?xf32>
452   %0 = tensor.collapse_shape %arg0 [[0], [1], [2, 3, 4]] :
453     tensor<?x?x?x4x?xf32> into tensor<?x?x?xf32>
454   return %0 : tensor<?x?x?xf32>
456 --------------------------------------------------------------------------------
458 (toplevel
459   (operation
460     (custom_operation
461       (func_dialect
462         (symbol_ref_id)
463         (func_arg_list
464           (value_use)
465           (type
466             (builtin_type
467               (tensor_type
468                 (dim_list
469                   (float_type))))))
470         (func_return
471           (type_list_attr_parens
472             (type
473               (builtin_type
474                 (tensor_type
475                   (dim_list
476                     (float_type)))))))
477         (region
478           (entry_block
479             (operation
480               (op_result
481                 (value_use))
482               (custom_operation
483                 (tensor_dialect
484                   (value_use)
485                   (nested_idx_list
486                     (nested_idx_list
487                       (integer_literal))
488                     (nested_idx_list
489                       (integer_literal))
490                     (nested_idx_list
491                       (integer_literal)
492                       (integer_literal)
493                       (integer_literal)))
494                   (type
495                     (builtin_type
496                       (tensor_type
497                         (dim_list
498                           (float_type)))))
499                   (type
500                     (builtin_type
501                       (tensor_type
502                         (dim_list
503                           (float_type))))))))
504             (operation
505               (custom_operation
506                 (func_dialect
507                   (value_use)
508                   (type
509                     (builtin_type
510                       (tensor_type
511                         (dim_list
512                           (float_type))))))))))))))
514 ================================================================================
515 tensor.gather and tensor.scatter
516 ================================================================================
517 func.func @gather_scatter(%dest : tensor<4x5x6xf32>, %indices: tensor<1x3x2xindex>,
518   %indices_i32: tensor<1x3x2xi32>) {
519   %gathered = tensor.gather %dest[%indices_i32] gather_dims([1, 2]) unique:
520     (tensor<4x5x6xf32>, tensor<1x3x2xi32>) -> tensor<1x3x4x1x1xf32>
521   %rank_reduced_gathered = tensor.gather %dest[%indices] gather_dims([1, 2]) unique:
522     (tensor<4x5x6xf32>, tensor<1x3x2xindex>) -> tensor<1x3x4xf32>
524   %scattered = tensor.scatter %gathered into %dest[%indices]
525       scatter_dims([1, 2]) unique:
526     (tensor<1x3x4x1x1xf32>, tensor<4x5x6xf32>, tensor<1x3x2xindex>) -> tensor<4x5x6xf32>
527   %rank_reduced_scattered = tensor.scatter %rank_reduced_gathered into %dest[%indices_i32]
528       scatter_dims([1, 2]) unique:
529     (tensor<1x3x4xf32>, tensor<4x5x6xf32>, tensor<1x3x2xi32>) -> tensor<4x5x6xf32>
530   return
532 --------------------------------------------------------------------------------
534 (toplevel
535   (operation
536     (custom_operation
537       (func_dialect
538         (symbol_ref_id)
539         (func_arg_list
540           (value_use)
541           (type
542             (builtin_type
543               (tensor_type
544                 (dim_list
545                   (float_type)))))
546           (value_use)
547           (type
548             (builtin_type
549               (tensor_type
550                 (dim_list
551                   (index_type)))))
552           (value_use)
553           (type
554             (builtin_type
555               (tensor_type
556                 (dim_list
557                   (integer_type))))))
558         (region
559           (entry_block
560             (operation
561               (op_result
562                 (value_use))
563               (custom_operation
564                 (tensor_dialect
565                   (value_use)
566                   (value_use)
567                   (gather_dims_attr
568                     (integer_literal)
569                     (integer_literal))
570                   (unique_attr)
571                   (function_type
572                     (type
573                       (builtin_type
574                         (tensor_type
575                           (dim_list
576                             (float_type)))))
577                     (type
578                       (builtin_type
579                         (tensor_type
580                           (dim_list
581                             (integer_type)))))
582                     (type
583                       (builtin_type
584                         (tensor_type
585                           (dim_list
586                             (float_type)))))))))
587             (operation
588               (op_result
589                 (value_use))
590               (custom_operation
591                 (tensor_dialect
592                   (value_use)
593                   (value_use)
594                   (gather_dims_attr
595                     (integer_literal)
596                     (integer_literal))
597                   (unique_attr)
598                   (function_type
599                     (type
600                       (builtin_type
601                         (tensor_type
602                           (dim_list
603                             (float_type)))))
604                     (type
605                       (builtin_type
606                         (tensor_type
607                           (dim_list
608                             (index_type)))))
609                     (type
610                       (builtin_type
611                         (tensor_type
612                           (dim_list
613                             (float_type)))))))))
614             (operation
615               (op_result
616                 (value_use))
617               (custom_operation
618                 (tensor_dialect
619                   (value_use)
620                   (value_use)
621                   (value_use)
622                   (scatter_dims_attr
623                     (integer_literal)
624                     (integer_literal))
625                   (unique_attr)
626                   (function_type
627                     (type
628                       (builtin_type
629                         (tensor_type
630                           (dim_list
631                             (float_type)))))
632                     (type
633                       (builtin_type
634                         (tensor_type
635                           (dim_list
636                             (float_type)))))
637                     (type
638                       (builtin_type
639                         (tensor_type
640                           (dim_list
641                             (index_type)))))
642                     (type
643                       (builtin_type
644                         (tensor_type
645                           (dim_list
646                             (float_type)))))))))
647             (operation
648               (op_result
649                 (value_use))
650               (custom_operation
651                 (tensor_dialect
652                   (value_use)
653                   (value_use)
654                   (value_use)
655                   (scatter_dims_attr
656                     (integer_literal)
657                     (integer_literal))
658                   (unique_attr)
659                   (function_type
660                     (type
661                       (builtin_type
662                         (tensor_type
663                           (dim_list
664                             (float_type)))))
665                     (type
666                       (builtin_type
667                         (tensor_type
668                           (dim_list
669                             (float_type)))))
670                     (type
671                       (builtin_type
672                         (tensor_type
673                           (dim_list
674                             (integer_type)))))
675                     (type
676                       (builtin_type
677                         (tensor_type
678                           (dim_list
679                             (float_type)))))))))
680             (operation
681               (custom_operation
682                 (func_dialect)))))))))
684 ================================================================================
685 tensor.extract_slice
686 ================================================================================
687 func.func @slice(%t: tensor<8x16x4xf32>, %idx : index) {
688   %c0 = arith.constant 0 : index
689   %c1 = arith.constant 1 : index
690   %1 = tensor.extract_slice %t[%c0, %c0, %c0][%idx, %idx, %idx][%c1, %c1, %c1]
691     : tensor<8x16x4xf32> to tensor<?x?x?xf32>
692   %2 = tensor.extract_slice %t[0, 2, 0][4, 4, 4][1, 1, 1]
693     : tensor<8x16x4xf32> to tensor<4x4x4xf32>
694   %3 = tensor.extract_slice %t[0, 2, 0][4, 1, 4][1, 1, 1]
695     : tensor<8x16x4xf32> to tensor<4x4xf32>
697   return
699 --------------------------------------------------------------------------------
701 (toplevel
702   (operation
703     (custom_operation
704       (func_dialect
705         (symbol_ref_id)
706         (func_arg_list
707           (value_use)
708           (type
709             (builtin_type
710               (tensor_type
711                 (dim_list
712                   (float_type)))))
713           (value_use)
714           (type
715             (builtin_type
716               (index_type))))
717         (region
718           (entry_block
719             (operation
720               (op_result
721                 (value_use))
722               (custom_operation
723                 (arith_dialect
724                   (integer_literal)
725                   (type
726                     (builtin_type
727                       (index_type))))))
728             (operation
729               (op_result
730                 (value_use))
731               (custom_operation
732                 (arith_dialect
733                   (integer_literal)
734                   (type
735                     (builtin_type
736                       (index_type))))))
737             (operation
738               (op_result
739                 (value_use))
740               (custom_operation
741                 (tensor_dialect
742                   (value_use)
743                   (value_use)
744                   (value_use)
745                   (value_use)
746                   (value_use)
747                   (value_use)
748                   (value_use)
749                   (value_use)
750                   (value_use)
751                   (value_use)
752                   (type
753                     (builtin_type
754                       (tensor_type
755                         (dim_list
756                           (float_type)))))
757                   (type
758                     (builtin_type
759                       (tensor_type
760                         (dim_list
761                           (float_type))))))))
762             (operation
763               (op_result
764                 (value_use))
765               (custom_operation
766                 (tensor_dialect
767                   (value_use)
768                   (integer_literal)
769                   (integer_literal)
770                   (integer_literal)
771                   (integer_literal)
772                   (integer_literal)
773                   (integer_literal)
774                   (integer_literal)
775                   (integer_literal)
776                   (integer_literal)
777                   (type
778                     (builtin_type
779                       (tensor_type
780                         (dim_list
781                           (float_type)))))
782                   (type
783                     (builtin_type
784                       (tensor_type
785                         (dim_list
786                           (float_type))))))))
787             (operation
788               (op_result
789                 (value_use))
790               (custom_operation
791                 (tensor_dialect
792                   (value_use)
793                   (integer_literal)
794                   (integer_literal)
795                   (integer_literal)
796                   (integer_literal)
797                   (integer_literal)
798                   (integer_literal)
799                   (integer_literal)
800                   (integer_literal)
801                   (integer_literal)
802                   (type
803                     (builtin_type
804                       (tensor_type
805                         (dim_list
806                           (float_type)))))
807                   (type
808                     (builtin_type
809                       (tensor_type
810                         (dim_list
811                           (float_type))))))))
812             (operation
813               (custom_operation
814                 (func_dialect)))))))))
816 ================================================================================
817 tensor.insert_slice
818 ================================================================================
819 func.func @insert_slice(
820     %t: tensor<8x16x4xf32>,
821     %td: tensor<8x?x4xf32>,
822     %t2: tensor<16x32x8xf32>,
823     %t3: tensor<4x4xf32>,
824     %idx : index,
825     %sz : index) {
826   %c0 = arith.constant 0 : index
827   %c1 = arith.constant 1 : index
828   %1 = tensor.insert_slice %t into %t2[%c0, %c0, %c0][8, 16, 4][%c1, %c1, %c1]
829     : tensor<8x16x4xf32> into tensor<16x32x8xf32>
830   %2 = tensor.insert_slice %t into %t2[%c0, %idx, %c0][8, 16, 4][%c1, 1, %c1]
831     : tensor<8x16x4xf32> into tensor<16x32x8xf32>
832   %3 = tensor.insert_slice %t3 into %t[0, 2, 0][4, 1, 4][1, 1, 1]
833     : tensor<4x4xf32> into tensor<8x16x4xf32>
834   %4 = tensor.insert_slice %td into %t[0, %idx, 0][8, %sz, 4][1, 1, 1]
835     : tensor<8x?x4xf32> into tensor<8x16x4xf32>
837   return
839 --------------------------------------------------------------------------------
841 (toplevel
842   (operation
843     (custom_operation
844       (func_dialect
845         (symbol_ref_id)
846         (func_arg_list
847           (value_use)
848           (type
849             (builtin_type
850               (tensor_type
851                 (dim_list
852                   (float_type)))))
853           (value_use)
854           (type
855             (builtin_type
856               (tensor_type
857                 (dim_list
858                   (float_type)))))
859           (value_use)
860           (type
861             (builtin_type
862               (tensor_type
863                 (dim_list
864                   (float_type)))))
865           (value_use)
866           (type
867             (builtin_type
868               (tensor_type
869                 (dim_list
870                   (float_type)))))
871           (value_use)
872           (type
873             (builtin_type
874               (index_type)))
875           (value_use)
876           (type
877             (builtin_type
878               (index_type))))
879         (region
880           (entry_block
881             (operation
882               (op_result
883                 (value_use))
884               (custom_operation
885                 (arith_dialect
886                   (integer_literal)
887                   (type
888                     (builtin_type
889                       (index_type))))))
890             (operation
891               (op_result
892                 (value_use))
893               (custom_operation
894                 (arith_dialect
895                   (integer_literal)
896                   (type
897                     (builtin_type
898                       (index_type))))))
899             (operation
900               (op_result
901                 (value_use))
902               (custom_operation
903                 (tensor_dialect
904                   (value_use)
905                   (value_use)
906                   (value_use)
907                   (value_use)
908                   (value_use)
909                   (integer_literal)
910                   (integer_literal)
911                   (integer_literal)
912                   (value_use)
913                   (value_use)
914                   (value_use)
915                   (type
916                     (builtin_type
917                       (tensor_type
918                         (dim_list
919                           (float_type)))))
920                   (type
921                     (builtin_type
922                       (tensor_type
923                         (dim_list
924                           (float_type))))))))
925             (operation
926               (op_result
927                 (value_use))
928               (custom_operation
929                 (tensor_dialect
930                   (value_use)
931                   (value_use)
932                   (value_use)
933                   (value_use)
934                   (value_use)
935                   (integer_literal)
936                   (integer_literal)
937                   (integer_literal)
938                   (value_use)
939                   (integer_literal)
940                   (value_use)
941                   (type
942                     (builtin_type
943                       (tensor_type
944                         (dim_list
945                           (float_type)))))
946                   (type
947                     (builtin_type
948                       (tensor_type
949                         (dim_list
950                           (float_type))))))))
951             (operation
952               (op_result
953                 (value_use))
954               (custom_operation
955                 (tensor_dialect
956                   (value_use)
957                   (value_use)
958                   (integer_literal)
959                   (integer_literal)
960                   (integer_literal)
961                   (integer_literal)
962                   (integer_literal)
963                   (integer_literal)
964                   (integer_literal)
965                   (integer_literal)
966                   (integer_literal)
967                   (type
968                     (builtin_type
969                       (tensor_type
970                         (dim_list
971                           (float_type)))))
972                   (type
973                     (builtin_type
974                       (tensor_type
975                         (dim_list
976                           (float_type))))))))
977             (operation
978               (op_result
979                 (value_use))
980               (custom_operation
981                 (tensor_dialect
982                   (value_use)
983                   (value_use)
984                   (integer_literal)
985                   (value_use)
986                   (integer_literal)
987                   (integer_literal)
988                   (value_use)
989                   (integer_literal)
990                   (integer_literal)
991                   (integer_literal)
992                   (integer_literal)
993                   (type
994                     (builtin_type
995                       (tensor_type
996                         (dim_list
997                           (float_type)))))
998                   (type
999                     (builtin_type
1000                       (tensor_type
1001                         (dim_list
1002                           (float_type))))))))
1003             (operation
1004               (custom_operation
1005                 (func_dialect)))))))))
1007 ================================================================================
1008 tensor.rank, tensor.generate, tensor.yield, tensor.extract
1009 ================================================================================
1010 func.func @extract_from_tensor.generate(%idx: index, %tensor: tensor<*xf32>) -> index {
1011   %size = tensor.rank %tensor : tensor<*xf32>
1012   %0 = tensor.generate %size {
1013     ^bb0(%arg0: index):
1014     %1 = tensor.dim %tensor, %arg0 : tensor<*xf32>
1015     tensor.yield %1 : index
1016   } : tensor<?xindex>
1017   %1 = tensor.extract %0[%idx] : tensor<?xindex>
1018   return %1 : index
1020 --------------------------------------------------------------------------------
1022 (toplevel
1023   (operation
1024     (custom_operation
1025       (func_dialect
1026         (symbol_ref_id)
1027         (func_arg_list
1028           (value_use)
1029           (type
1030             (builtin_type
1031               (index_type)))
1032           (value_use)
1033           (type
1034             (builtin_type
1035               (tensor_type
1036                 (dim_list
1037                   (float_type))))))
1038         (func_return
1039           (type_list_attr_parens
1040             (type
1041               (builtin_type
1042                 (index_type)))))
1043         (region
1044           (entry_block
1045             (operation
1046               (op_result
1047                 (value_use))
1048               (custom_operation
1049                 (tensor_dialect
1050                   (value_use)
1051                   (type
1052                     (builtin_type
1053                       (tensor_type
1054                         (dim_list
1055                           (float_type))))))))
1056             (operation
1057               (op_result
1058                 (value_use))
1059               (custom_operation
1060                 (tensor_dialect
1061                   (value_use)
1062                   (region
1063                     (block
1064                       (block_label
1065                         (caret_id)
1066                         (block_arg_list
1067                           (value_use)
1068                           (type
1069                             (builtin_type
1070                               (index_type)))))
1071                       (operation
1072                         (op_result
1073                           (value_use))
1074                         (custom_operation
1075                           (tensor_dialect
1076                             (value_use)
1077                             (value_use)
1078                             (type
1079                               (builtin_type
1080                                 (tensor_type
1081                                   (dim_list
1082                                     (float_type))))))))
1083                       (operation
1084                         (custom_operation
1085                           (tensor_dialect
1086                             (value_use)
1087                             (type
1088                               (builtin_type
1089                                 (index_type))))))))
1090                   (type
1091                     (builtin_type
1092                       (tensor_type
1093                         (dim_list
1094                           (index_type))))))))
1095             (operation
1096               (op_result
1097                 (value_use))
1098               (custom_operation
1099                 (tensor_dialect
1100                   (value_use)
1101                   (value_use)
1102                   (type
1103                     (builtin_type
1104                       (tensor_type
1105                         (dim_list
1106                           (index_type))))))))
1107             (operation
1108               (custom_operation
1109                 (func_dialect
1110                   (value_use)
1111                   (type
1112                     (builtin_type
1113                       (index_type))))))))))))
1115 ================================================================================
1116 tensor.insert
1117 ================================================================================
1118 func.func @insert(%arg0: f32, %arg1: index, %arg2: tensor<?x?x?xf32>) {
1119   %0 = tensor.insert %arg0 into %arg2[%arg1, %arg1, %arg1] : tensor<?x?x?xf32>
1120   return
1122 --------------------------------------------------------------------------------
1124 (toplevel
1125   (operation
1126     (custom_operation
1127       (func_dialect
1128         (symbol_ref_id)
1129         (func_arg_list
1130           (value_use)
1131           (type
1132             (builtin_type
1133               (float_type)))
1134           (value_use)
1135           (type
1136             (builtin_type
1137               (index_type)))
1138           (value_use)
1139           (type
1140             (builtin_type
1141               (tensor_type
1142                 (dim_list
1143                   (float_type))))))
1144         (region
1145           (entry_block
1146             (operation
1147               (op_result
1148                 (value_use))
1149               (custom_operation
1150                 (tensor_dialect
1151                   (value_use)
1152                   (value_use)
1153                   (value_use)
1154                   (value_use)
1155                   (value_use)
1156                   (type
1157                     (builtin_type
1158                       (tensor_type
1159                         (dim_list
1160                           (float_type))))))))
1161             (operation
1162               (custom_operation
1163                 (func_dialect)))))))))
1165 ================================================================================
1166 tensor.from_elements and tensor.reshape
1167 ================================================================================
1168 func.func @tensor.reshape(%t1: tensor<?x10xf32>) -> tensor<2x2x5xf32> {
1169   %two = arith.constant 2 : i64
1170   %five = arith.constant 5 : i64
1171   %shape = tensor.from_elements %two, %two, %five : tensor<3xi64>
1172   %reshaped = tensor.reshape %t1(%shape) : (tensor<?x10xf32>, tensor<3xi64>) -> tensor<2x2x5xf32>
1173   return %reshaped : tensor<2x2x5xf32>
1175 --------------------------------------------------------------------------------
1177 (toplevel
1178   (operation
1179     (custom_operation
1180       (func_dialect
1181         (symbol_ref_id)
1182         (func_arg_list
1183           (value_use)
1184           (type
1185             (builtin_type
1186               (tensor_type
1187                 (dim_list
1188                   (float_type))))))
1189         (func_return
1190           (type_list_attr_parens
1191             (type
1192               (builtin_type
1193                 (tensor_type
1194                   (dim_list
1195                     (float_type)))))))
1196         (region
1197           (entry_block
1198             (operation
1199               (op_result
1200                 (value_use))
1201               (custom_operation
1202                 (arith_dialect
1203                   (integer_literal)
1204                   (type
1205                     (builtin_type
1206                       (integer_type))))))
1207             (operation
1208               (op_result
1209                 (value_use))
1210               (custom_operation
1211                 (arith_dialect
1212                   (integer_literal)
1213                   (type
1214                     (builtin_type
1215                       (integer_type))))))
1216             (operation
1217               (op_result
1218                 (value_use))
1219               (custom_operation
1220                 (tensor_dialect
1221                   (value_use)
1222                   (value_use)
1223                   (value_use)
1224                   (type
1225                     (builtin_type
1226                       (tensor_type
1227                         (dim_list
1228                           (integer_type))))))))
1229             (operation
1230               (op_result
1231                 (value_use))
1232               (custom_operation
1233                 (tensor_dialect
1234                   (value_use)
1235                   (value_use)
1236                   (function_type
1237                     (type
1238                       (builtin_type
1239                         (tensor_type
1240                           (dim_list
1241                             (float_type)))))
1242                     (type
1243                       (builtin_type
1244                         (tensor_type
1245                           (dim_list
1246                             (integer_type)))))
1247                     (type
1248                       (builtin_type
1249                         (tensor_type
1250                           (dim_list
1251                             (float_type)))))))))
1252             (operation
1253               (custom_operation
1254                 (func_dialect
1255                   (value_use)
1256                   (type
1257                     (builtin_type
1258                       (tensor_type
1259                         (dim_list
1260                           (float_type))))))))))))))
1262 ================================================================================
1263 tensor.pad
1264 ================================================================================
1265 func.func @pad_dynamic(%arg0: tensor<1x2x2x?xf32>, %low: index, %high: index,
1266                   %pad_value: f32) -> tensor<6x?x?x?xf32> {
1267   %0 = tensor.pad %arg0 low[2, %low, 3, 3] high[3, 3, %high, 2] {
1268     ^bb0(%arg1: index, %arg2: index, %arg3: index, %arg4: index):
1269       tensor.yield %pad_value : f32
1270     } : tensor<1x2x2x?xf32> to tensor<6x?x?x?xf32>
1271   return %0 : tensor<6x?x?x?xf32>
1274 func.func @pad_nofold_same_static_shape(%arg0: tensor<5x6xf32>, %a: index)
1275     -> tensor<5x6xf32> {
1276   %cst = arith.constant 0.000000e+00 : f32
1277   %0 = tensor.pad %arg0 nofold low[%a, 0] high[0, %a] {
1278         ^bb0(%arg1: index, %arg2: index):
1279           tensor.yield %cst : f32
1280   } : tensor<5x6xf32> to tensor<5x6xf32>
1281   return %0 : tensor<5x6xf32>
1283 --------------------------------------------------------------------------------
1285 (toplevel
1286   (operation
1287     (custom_operation
1288       (func_dialect
1289         (symbol_ref_id)
1290         (func_arg_list
1291           (value_use)
1292           (type
1293             (builtin_type
1294               (tensor_type
1295                 (dim_list
1296                   (float_type)))))
1297           (value_use)
1298           (type
1299             (builtin_type
1300               (index_type)))
1301           (value_use)
1302           (type
1303             (builtin_type
1304               (index_type)))
1305           (value_use)
1306           (type
1307             (builtin_type
1308               (float_type))))
1309         (func_return
1310           (type_list_attr_parens
1311             (type
1312               (builtin_type
1313                 (tensor_type
1314                   (dim_list
1315                     (float_type)))))))
1316         (region
1317           (entry_block
1318             (operation
1319               (op_result
1320                 (value_use))
1321               (custom_operation
1322                 (tensor_dialect
1323                   (value_use)
1324                   (integer_literal)
1325                   (value_use)
1326                   (integer_literal)
1327                   (integer_literal)
1328                   (integer_literal)
1329                   (integer_literal)
1330                   (value_use)
1331                   (integer_literal)
1332                   (region
1333                     (block
1334                       (block_label
1335                         (caret_id)
1336                         (block_arg_list
1337                           (value_use)
1338                           (type
1339                             (builtin_type
1340                               (index_type)))
1341                           (value_use)
1342                           (type
1343                             (builtin_type
1344                               (index_type)))
1345                           (value_use)
1346                           (type
1347                             (builtin_type
1348                               (index_type)))
1349                           (value_use)
1350                           (type
1351                             (builtin_type
1352                               (index_type)))))
1353                       (operation
1354                         (custom_operation
1355                           (tensor_dialect
1356                             (value_use)
1357                             (type
1358                               (builtin_type
1359                                 (float_type))))))))
1360                   (type
1361                     (builtin_type
1362                       (tensor_type
1363                         (dim_list
1364                           (float_type)))))
1365                   (type
1366                     (builtin_type
1367                       (tensor_type
1368                         (dim_list
1369                           (float_type))))))))
1370             (operation
1371               (custom_operation
1372                 (func_dialect
1373                   (value_use)
1374                   (type
1375                     (builtin_type
1376                       (tensor_type
1377                         (dim_list
1378                           (float_type)))))))))))))
1379   (operation
1380     (custom_operation
1381       (func_dialect
1382         (symbol_ref_id)
1383         (func_arg_list
1384           (value_use)
1385           (type
1386             (builtin_type
1387               (tensor_type
1388                 (dim_list
1389                   (float_type)))))
1390           (value_use)
1391           (type
1392             (builtin_type
1393               (index_type))))
1394         (func_return
1395           (type_list_attr_parens
1396             (type
1397               (builtin_type
1398                 (tensor_type
1399                   (dim_list
1400                     (float_type)))))))
1401         (region
1402           (entry_block
1403             (operation
1404               (op_result
1405                 (value_use))
1406               (custom_operation
1407                 (arith_dialect
1408                   (float_literal)
1409                   (type
1410                     (builtin_type
1411                       (float_type))))))
1412             (operation
1413               (op_result
1414                 (value_use))
1415               (custom_operation
1416                 (tensor_dialect
1417                   (value_use)
1418                   (nofold_attr)
1419                   (value_use)
1420                   (integer_literal)
1421                   (integer_literal)
1422                   (value_use)
1423                   (region
1424                     (block
1425                       (block_label
1426                         (caret_id)
1427                         (block_arg_list
1428                           (value_use)
1429                           (type
1430                             (builtin_type
1431                               (index_type)))
1432                           (value_use)
1433                           (type
1434                             (builtin_type
1435                               (index_type)))))
1436                       (operation
1437                         (custom_operation
1438                           (tensor_dialect
1439                             (value_use)
1440                             (type
1441                               (builtin_type
1442                                 (float_type))))))))
1443                   (type
1444                     (builtin_type
1445                       (tensor_type
1446                         (dim_list
1447                           (float_type)))))
1448                   (type
1449                     (builtin_type
1450                       (tensor_type
1451                         (dim_list
1452                           (float_type))))))))
1453             (operation
1454               (custom_operation
1455                 (func_dialect
1456                   (value_use)
1457                   (type
1458                     (builtin_type
1459                       (tensor_type
1460                         (dim_list
1461                           (float_type))))))))))))))
1463 ================================================================================
1464 tensor.splat
1465 ================================================================================
1466 func.func @test_splat_op(%s : f32) {
1467   %v = tensor.splat %s : tensor<8xf32>
1468   return
1470 --------------------------------------------------------------------------------
1472 (toplevel
1473   (operation
1474     (custom_operation
1475       (func_dialect
1476         (symbol_ref_id)
1477         (func_arg_list
1478           (value_use)
1479           (type
1480             (builtin_type
1481               (float_type))))
1482         (region
1483           (entry_block
1484             (operation
1485               (op_result
1486                 (value_use))
1487               (custom_operation
1488                 (tensor_dialect
1489                   (value_use)
1490                   (type
1491                     (builtin_type
1492                       (tensor_type
1493                         (dim_list
1494                           (float_type))))))))
1495             (operation
1496               (custom_operation
1497                 (func_dialect)))))))))
1499 ================================================================================
1500 tensor.reshape
1501 ================================================================================
1502 func.func @tensor_reshape(%unranked: tensor<*xf32>, %shape: tensor<1xi32>) {
1503   %dyn_vec = tensor.reshape %unranked(%shape)
1504                : (tensor<*xf32>, tensor<1xi32>) -> tensor<?xf32>
1505   return
1507 --------------------------------------------------------------------------------
1509 (toplevel
1510   (operation
1511     (custom_operation
1512       (func_dialect
1513         (symbol_ref_id)
1514         (func_arg_list
1515           (value_use)
1516           (type
1517             (builtin_type
1518               (tensor_type
1519                 (dim_list
1520                   (float_type)))))
1521           (value_use)
1522           (type
1523             (builtin_type
1524               (tensor_type
1525                 (dim_list
1526                   (integer_type))))))
1527         (region
1528           (entry_block
1529             (operation
1530               (op_result
1531                 (value_use))
1532               (custom_operation
1533                 (tensor_dialect
1534                   (value_use)
1535                   (value_use)
1536                   (function_type
1537                     (type
1538                       (builtin_type
1539                         (tensor_type
1540                           (dim_list
1541                             (float_type)))))
1542                     (type
1543                       (builtin_type
1544                         (tensor_type
1545                           (dim_list
1546                             (integer_type)))))
1547                     (type
1548                       (builtin_type
1549                         (tensor_type
1550                           (dim_list
1551                             (float_type)))))))))
1552             (operation
1553               (custom_operation
1554                 (func_dialect)))))))))
1556 ================================================================================
1557 tensor.pack and tensor.unpack
1558 ================================================================================
1559 func.func @pack_nc_to_ncnc(%source: tensor<128x256xf32>, %dest: tensor<4x16x32x16xf32>) -> tensor<128x256xf32> {
1560   %0 = tensor.pack %source inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %dest : tensor<128x256xf32> -> tensor<4x16x32x16xf32>
1561   %1 = tensor.empty() : tensor<128x256xf32>
1562   %2 = tensor.unpack %0 inner_dims_pos = [0, 1] inner_tiles = [32, 16] into %1 : tensor<4x16x32x16xf32> -> tensor<128x256xf32>
1563   return %2 : tensor<128x256xf32>
1565 --------------------------------------------------------------------------------
1567 (toplevel
1568   (operation
1569     (custom_operation
1570       (func_dialect
1571         (symbol_ref_id)
1572         (func_arg_list
1573           (value_use)
1574           (type
1575             (builtin_type
1576               (tensor_type
1577                 (dim_list
1578                   (float_type)))))
1579           (value_use)
1580           (type
1581             (builtin_type
1582               (tensor_type
1583                 (dim_list
1584                   (float_type))))))
1585         (func_return
1586           (type_list_attr_parens
1587             (type
1588               (builtin_type
1589                 (tensor_type
1590                   (dim_list
1591                     (float_type)))))))
1592         (region
1593           (entry_block
1594             (operation
1595               (op_result
1596                 (value_use))
1597               (custom_operation
1598                 (tensor_dialect
1599                   (value_use)
1600                   (inner_dims_pos_attr
1601                     (integer_literal)
1602                     (integer_literal))
1603                   (inner_tiles_attr
1604                     (integer_literal)
1605                     (integer_literal))
1606                   (value_use)
1607                   (function_type
1608                     (type
1609                       (builtin_type
1610                         (tensor_type
1611                           (dim_list
1612                             (float_type)))))
1613                     (type
1614                       (builtin_type
1615                         (tensor_type
1616                           (dim_list
1617                             (float_type)))))))))
1618             (operation
1619               (op_result
1620                 (value_use))
1621               (custom_operation
1622                 (tensor_dialect
1623                   (type
1624                     (builtin_type
1625                       (tensor_type
1626                         (dim_list
1627                           (float_type))))))))
1628             (operation
1629               (op_result
1630                 (value_use))
1631               (custom_operation
1632                 (tensor_dialect
1633                   (value_use)
1634                   (inner_dims_pos_attr
1635                     (integer_literal)
1636                     (integer_literal))
1637                   (inner_tiles_attr
1638                     (integer_literal)
1639                     (integer_literal))
1640                   (value_use)
1641                   (function_type
1642                     (type
1643                       (builtin_type
1644                         (tensor_type
1645                           (dim_list
1646                             (float_type)))))
1647                     (type
1648                       (builtin_type
1649                         (tensor_type
1650                           (dim_list
1651                             (float_type)))))))))
1652             (operation
1653               (custom_operation
1654                 (func_dialect
1655                   (value_use)
1656                   (type
1657                     (builtin_type
1658                       (tensor_type
1659                         (dim_list
1660                           (float_type))))))))))))))
1662 ================================================================================
1663 memref.alloc, memref.cast, and memref.copy
1664 ================================================================================
1665 func.func @memref_copy() {
1666   %0 = memref.alloc() : memref<2xf32>
1667   %1 = memref.cast %0 : memref<2xf32> to memref<*xf32>
1668   %2 = memref.alloc() : memref<2xf32>
1669   %3 = memref.cast %0 : memref<2xf32> to memref<*xf32>
1670   memref.copy %1, %3 : memref<*xf32> to memref<*xf32>
1671   return
1673 --------------------------------------------------------------------------------
1675 (toplevel
1676   (operation
1677     (custom_operation
1678       (func_dialect
1679         (symbol_ref_id)
1680         (func_arg_list)
1681         (region
1682           (entry_block
1683             (operation
1684               (op_result
1685                 (value_use))
1686               (custom_operation
1687                 (memref_dialect
1688                   (type
1689                     (builtin_type
1690                       (memref_type
1691                         (dim_list
1692                           (float_type))))))))
1693             (operation
1694               (op_result
1695                 (value_use))
1696               (custom_operation
1697                 (memref_dialect
1698                   (value_use)
1699                   (type
1700                     (builtin_type
1701                       (memref_type
1702                         (dim_list
1703                           (float_type)))))
1704                   (type
1705                     (builtin_type
1706                       (memref_type
1707                         (dim_list
1708                           (float_type))))))))
1709             (operation
1710               (op_result
1711                 (value_use))
1712               (custom_operation
1713                 (memref_dialect
1714                   (type
1715                     (builtin_type
1716                       (memref_type
1717                         (dim_list
1718                           (float_type))))))))
1719             (operation
1720               (op_result
1721                 (value_use))
1722               (custom_operation
1723                 (memref_dialect
1724                   (value_use)
1725                   (type
1726                     (builtin_type
1727                       (memref_type
1728                         (dim_list
1729                           (float_type)))))
1730                   (type
1731                     (builtin_type
1732                       (memref_type
1733                         (dim_list
1734                           (float_type))))))))
1735             (operation
1736               (custom_operation
1737                 (memref_dialect
1738                   (value_use)
1739                   (value_use)
1740                   (type
1741                     (builtin_type
1742                       (memref_type
1743                         (dim_list
1744                           (float_type)))))
1745                   (type
1746                     (builtin_type
1747                       (memref_type
1748                         (dim_list
1749                           (float_type))))))))
1750             (operation
1751               (custom_operation
1752                 (func_dialect)))))))))
1754 ================================================================================
1755 memref.expand_shape and memref.collapse_shape
1756 ================================================================================
1757 func.func @expand_collapse_shape_dynamic(%arg0: memref<?x?x?xf32>,
1758          %arg1: memref<?x?x?xf32, strided<[?, ?, 1], offset: 0>>,
1759          %arg2: memref<?x?x?xf32, strided<[?, ?, 1], offset: ?>>,
1760          %arg3: memref<?x42xf32, strided<[42, 1], offset: 0>>) {
1761   %0 = memref.collapse_shape %arg0 [[0, 1], [2]] :
1762     memref<?x?x?xf32> into memref<?x?xf32>
1763   %r0 = memref.expand_shape %0 [[0, 1], [2]] :
1764     memref<?x?xf32> into memref<?x4x?xf32>
1765   %1 = memref.collapse_shape %arg1 [[0, 1], [2]] :
1766     memref<?x?x?xf32, strided<[?, ?, 1], offset: 0>> into
1767     memref<?x?xf32, strided<[?, 1], offset: 0>>
1768   %r1 = memref.expand_shape %1 [[0, 1], [2]] :
1769     memref<?x?xf32, strided<[?, 1], offset: 0>> into
1770     memref<?x4x?xf32, strided<[?, ?, 1], offset: 0>>
1771   %2 = memref.collapse_shape %arg2 [[0, 1], [2]] :
1772     memref<?x?x?xf32, strided<[?, ?, 1], offset: ?>> into
1773     memref<?x?xf32, strided<[?, 1], offset: ?>>
1774   %r2 = memref.expand_shape %2 [[0, 1], [2]] :
1775     memref<?x?xf32, strided<[?, 1], offset: ?>> into
1776     memref<?x4x?xf32, strided<[?, ?, 1], offset: ?>>
1777   %3 = memref.collapse_shape %arg3 [[0, 1]] :
1778     memref<?x42xf32, strided<[42, 1], offset: 0>> into
1779     memref<?xf32, strided<[1]>>
1780   %r3 = memref.expand_shape %3 [[0, 1]] :
1781     memref<?xf32, strided<[1]>> into memref<?x42xf32>
1782   return
1784 --------------------------------------------------------------------------------
1786 (toplevel
1787   (operation
1788     (custom_operation
1789       (func_dialect
1790         (symbol_ref_id)
1791         (func_arg_list
1792           (value_use)
1793           (type
1794             (builtin_type
1795               (memref_type
1796                 (dim_list
1797                   (float_type)))))
1798           (value_use)
1799           (type
1800             (builtin_type
1801               (memref_type
1802                 (dim_list
1803                   (float_type))
1804                 (attribute_value
1805                   (builtin_attribute
1806                     (strided_layout
1807                       (integer_literal)))))))
1808           (value_use)
1809           (type
1810             (builtin_type
1811               (memref_type
1812                 (dim_list
1813                   (float_type))
1814                 (attribute_value
1815                   (builtin_attribute
1816                     (strided_layout))))))
1817           (value_use)
1818           (type
1819             (builtin_type
1820               (memref_type
1821                 (dim_list
1822                   (float_type))
1823                 (attribute_value
1824                   (builtin_attribute
1825                     (strided_layout
1826                       (integer_literal))))))))
1827         (region
1828           (entry_block
1829             (operation
1830               (op_result
1831                 (value_use))
1832               (custom_operation
1833                 (memref_dialect
1834                   (value_use)
1835                   (nested_idx_list
1836                     (nested_idx_list
1837                       (integer_literal)
1838                       (integer_literal))
1839                     (nested_idx_list
1840                       (integer_literal)))
1841                   (type
1842                     (builtin_type
1843                       (memref_type
1844                         (dim_list
1845                           (float_type)))))
1846                   (type
1847                     (builtin_type
1848                       (memref_type
1849                         (dim_list
1850                           (float_type))))))))
1851             (operation
1852               (op_result
1853                 (value_use))
1854               (custom_operation
1855                 (memref_dialect
1856                   (value_use)
1857                   (nested_idx_list
1858                     (nested_idx_list
1859                       (integer_literal)
1860                       (integer_literal))
1861                     (nested_idx_list
1862                       (integer_literal)))
1863                   (type
1864                     (builtin_type
1865                       (memref_type
1866                         (dim_list
1867                           (float_type)))))
1868                   (type
1869                     (builtin_type
1870                       (memref_type
1871                         (dim_list
1872                           (float_type))))))))
1873             (operation
1874               (op_result
1875                 (value_use))
1876               (custom_operation
1877                 (memref_dialect
1878                   (value_use)
1879                   (nested_idx_list
1880                     (nested_idx_list
1881                       (integer_literal)
1882                       (integer_literal))
1883                     (nested_idx_list
1884                       (integer_literal)))
1885                   (type
1886                     (builtin_type
1887                       (memref_type
1888                         (dim_list
1889                           (float_type))
1890                         (attribute_value
1891                           (builtin_attribute
1892                             (strided_layout
1893                               (integer_literal)))))))
1894                   (type
1895                     (builtin_type
1896                       (memref_type
1897                         (dim_list
1898                           (float_type))
1899                         (attribute_value
1900                           (builtin_attribute
1901                             (strided_layout
1902                               (integer_literal))))))))))
1903             (operation
1904               (op_result
1905                 (value_use))
1906               (custom_operation
1907                 (memref_dialect
1908                   (value_use)
1909                   (nested_idx_list
1910                     (nested_idx_list
1911                       (integer_literal)
1912                       (integer_literal))
1913                     (nested_idx_list
1914                       (integer_literal)))
1915                   (type
1916                     (builtin_type
1917                       (memref_type
1918                         (dim_list
1919                           (float_type))
1920                         (attribute_value
1921                           (builtin_attribute
1922                             (strided_layout
1923                               (integer_literal)))))))
1924                   (type
1925                     (builtin_type
1926                       (memref_type
1927                         (dim_list
1928                           (float_type))
1929                         (attribute_value
1930                           (builtin_attribute
1931                             (strided_layout
1932                               (integer_literal))))))))))
1933             (operation
1934               (op_result
1935                 (value_use))
1936               (custom_operation
1937                 (memref_dialect
1938                   (value_use)
1939                   (nested_idx_list
1940                     (nested_idx_list
1941                       (integer_literal)
1942                       (integer_literal))
1943                     (nested_idx_list
1944                       (integer_literal)))
1945                   (type
1946                     (builtin_type
1947                       (memref_type
1948                         (dim_list
1949                           (float_type))
1950                         (attribute_value
1951                           (builtin_attribute
1952                             (strided_layout))))))
1953                   (type
1954                     (builtin_type
1955                       (memref_type
1956                         (dim_list
1957                           (float_type))
1958                         (attribute_value
1959                           (builtin_attribute
1960                             (strided_layout)))))))))
1961             (operation
1962               (op_result
1963                 (value_use))
1964               (custom_operation
1965                 (memref_dialect
1966                   (value_use)
1967                   (nested_idx_list
1968                     (nested_idx_list
1969                       (integer_literal)
1970                       (integer_literal))
1971                     (nested_idx_list
1972                       (integer_literal)))
1973                   (type
1974                     (builtin_type
1975                       (memref_type
1976                         (dim_list
1977                           (float_type))
1978                         (attribute_value
1979                           (builtin_attribute
1980                             (strided_layout))))))
1981                   (type
1982                     (builtin_type
1983                       (memref_type
1984                         (dim_list
1985                           (float_type))
1986                         (attribute_value
1987                           (builtin_attribute
1988                             (strided_layout)))))))))
1989             (operation
1990               (op_result
1991                 (value_use))
1992               (custom_operation
1993                 (memref_dialect
1994                   (value_use)
1995                   (nested_idx_list
1996                     (nested_idx_list
1997                       (integer_literal)
1998                       (integer_literal)))
1999                   (type
2000                     (builtin_type
2001                       (memref_type
2002                         (dim_list
2003                           (float_type))
2004                         (attribute_value
2005                           (builtin_attribute
2006                             (strided_layout
2007                               (integer_literal)))))))
2008                   (type
2009                     (builtin_type
2010                       (memref_type
2011                         (dim_list
2012                           (float_type))
2013                         (attribute_value
2014                           (builtin_attribute
2015                             (strided_layout)))))))))
2016             (operation
2017               (op_result
2018                 (value_use))
2019               (custom_operation
2020                 (memref_dialect
2021                   (value_use)
2022                   (nested_idx_list
2023                     (nested_idx_list
2024                       (integer_literal)
2025                       (integer_literal)))
2026                   (type
2027                     (builtin_type
2028                       (memref_type
2029                         (dim_list
2030                           (float_type))
2031                         (attribute_value
2032                           (builtin_attribute
2033                             (strided_layout))))))
2034                   (type
2035                     (builtin_type
2036                       (memref_type
2037                         (dim_list
2038                           (float_type))))))))
2039             (operation
2040               (custom_operation
2041                 (func_dialect)))))))))
2043 ================================================================================
2044 memref.realloc
2045 ================================================================================
2046 func.func @memref_realloc_sd(%src : memref<2xf32>, %d : index) -> memref<?xf32>{
2047   %0 = memref.realloc %src(%d) : memref<2xf32> to memref<?xf32>
2048   return %0 : memref<?xf32>
2050 --------------------------------------------------------------------------------
2052 (toplevel
2053   (operation
2054     (custom_operation
2055       (func_dialect
2056         (symbol_ref_id)
2057         (func_arg_list
2058           (value_use)
2059           (type
2060             (builtin_type
2061               (memref_type
2062                 (dim_list
2063                   (float_type)))))
2064           (value_use)
2065           (type
2066             (builtin_type
2067               (index_type))))
2068         (func_return
2069           (type_list_attr_parens
2070             (type
2071               (builtin_type
2072                 (memref_type
2073                   (dim_list
2074                     (float_type)))))))
2075         (region
2076           (entry_block
2077             (operation
2078               (op_result
2079                 (value_use))
2080               (custom_operation
2081                 (memref_dialect
2082                   (value_use)
2083                   (value_use)
2084                   (type
2085                     (builtin_type
2086                       (memref_type
2087                         (dim_list
2088                           (float_type)))))
2089                   (type
2090                     (builtin_type
2091                       (memref_type
2092                         (dim_list
2093                           (float_type))))))))
2094             (operation
2095               (custom_operation
2096                 (func_dialect
2097                   (value_use)
2098                   (type
2099                     (builtin_type
2100                       (memref_type
2101                         (dim_list
2102                           (float_type))))))))))))))
2104 ================================================================================
2105 memref.prefetch
2106 ================================================================================
2107 func.func @prefetch_locality_hint(%i : index) {
2108   %0 = memref.alloc() : memref<10xf32>
2109   memref.prefetch %0[%i], read, locality<3>, data  : memref<10xf32>
2110   return
2112 --------------------------------------------------------------------------------
2114 (toplevel
2115   (operation
2116     (custom_operation
2117       (func_dialect
2118         (symbol_ref_id)
2119         (func_arg_list
2120           (value_use)
2121           (type
2122             (builtin_type
2123               (index_type))))
2124         (region
2125           (entry_block
2126             (operation
2127               (op_result
2128                 (value_use))
2129               (custom_operation
2130                 (memref_dialect
2131                   (type
2132                     (builtin_type
2133                       (memref_type
2134                         (dim_list
2135                           (float_type))))))))
2136             (operation
2137               (custom_operation
2138                 (memref_dialect
2139                   (value_use)
2140                   (value_use)
2141                   (isWrite_attr)
2142                   (localityHint_attr
2143                     (integer_literal))
2144                   (isDataCache_attr)
2145                   (type
2146                     (builtin_type
2147                       (memref_type
2148                         (dim_list
2149                           (float_type))))))))
2150             (operation
2151               (custom_operation
2152                 (func_dialect)))))))))
2154 ================================================================================
2155 memref.rank
2156 ================================================================================
2157 func.func @rank(%t : memref<4x4x?xf32>) {
2158   %0 = memref.rank %t : memref<4x4x?xf32>
2159   return
2161 --------------------------------------------------------------------------------
2163 (toplevel
2164   (operation
2165     (custom_operation
2166       (func_dialect
2167         (symbol_ref_id)
2168         (func_arg_list
2169           (value_use)
2170           (type
2171             (builtin_type
2172               (memref_type
2173                 (dim_list
2174                   (float_type))))))
2175         (region
2176           (entry_block
2177             (operation
2178               (op_result
2179                 (value_use))
2180               (custom_operation
2181                 (memref_dialect
2182                   (value_use)
2183                   (type
2184                     (builtin_type
2185                       (memref_type
2186                         (dim_list
2187                           (float_type))))))))
2188             (operation
2189               (custom_operation
2190                 (func_dialect)))))))))
2192 ================================================================================
2193 memref.store
2194 ================================================================================
2195 func.func @truncation_spillover(%arg0 : memref<?xi32>) -> index {
2196     %c0 = arith.constant 0 : index
2197     %c1 = arith.constant 1 : index
2198     %c2 = arith.constant 2 : index
2199     %c49 = arith.constant 49 : index
2200     %0 = scf.for %arg1 = %c0 to %c2 step %c1 iter_args(%arg2 = %c0) -> index {
2201         %1 = arith.divsi %arg2, %c49 : index
2202         %2 = arith.index_cast %1 : index to i32
2203         memref.store %2, %arg0[%c0] : memref<?xi32>
2204         %3 = arith.addi %arg2, %arg1 : index
2205         scf.yield %3 : index
2206     }
2207   func.return %0 : index
2209 --------------------------------------------------------------------------------
2211 (toplevel
2212   (operation
2213     (custom_operation
2214       (func_dialect
2215         (symbol_ref_id)
2216         (func_arg_list
2217           (value_use)
2218           (type
2219             (builtin_type
2220               (memref_type
2221                 (dim_list
2222                   (integer_type))))))
2223         (func_return
2224           (type_list_attr_parens
2225             (type
2226               (builtin_type
2227                 (index_type)))))
2228         (region
2229           (entry_block
2230             (operation
2231               (op_result
2232                 (value_use))
2233               (custom_operation
2234                 (arith_dialect
2235                   (integer_literal)
2236                   (type
2237                     (builtin_type
2238                       (index_type))))))
2239             (operation
2240               (op_result
2241                 (value_use))
2242               (custom_operation
2243                 (arith_dialect
2244                   (integer_literal)
2245                   (type
2246                     (builtin_type
2247                       (index_type))))))
2248             (operation
2249               (op_result
2250                 (value_use))
2251               (custom_operation
2252                 (arith_dialect
2253                   (integer_literal)
2254                   (type
2255                     (builtin_type
2256                       (index_type))))))
2257             (operation
2258               (op_result
2259                 (value_use))
2260               (custom_operation
2261                 (arith_dialect
2262                   (integer_literal)
2263                   (type
2264                     (builtin_type
2265                       (index_type))))))
2266             (operation
2267               (op_result
2268                 (value_use))
2269               (custom_operation
2270                 (scf_dialect
2271                   (value_use)
2272                   (value_use)
2273                   (value_use)
2274                   (value_use)
2275                   (value_use)
2276                   (value_use)
2277                   (type
2278                     (builtin_type
2279                       (index_type)))
2280                   (region
2281                     (entry_block
2282                       (operation
2283                         (op_result
2284                           (value_use))
2285                         (custom_operation
2286                           (arith_dialect
2287                             (value_use)
2288                             (value_use)
2289                             (type
2290                               (builtin_type
2291                                 (index_type))))))
2292                       (operation
2293                         (op_result
2294                           (value_use))
2295                         (custom_operation
2296                           (arith_dialect
2297                             (value_use)
2298                             (type
2299                               (builtin_type
2300                                 (index_type)))
2301                             (type
2302                               (builtin_type
2303                                 (integer_type))))))
2304                       (operation
2305                         (custom_operation
2306                           (memref_dialect
2307                             (value_use)
2308                             (value_use)
2309                             (value_use)
2310                             (type
2311                               (builtin_type
2312                                 (memref_type
2313                                   (dim_list
2314                                     (integer_type))))))))
2315                       (operation
2316                         (op_result
2317                           (value_use))
2318                         (custom_operation
2319                           (arith_dialect
2320                             (value_use)
2321                             (value_use)
2322                             (type
2323                               (builtin_type
2324                                 (index_type))))))
2325                       (operation
2326                         (custom_operation
2327                           (scf_dialect
2328                             (value_use)
2329                             (type
2330                               (builtin_type
2331                                 (index_type)))))))))))
2332             (operation
2333               (custom_operation
2334                 (func_dialect
2335                   (value_use)
2336                   (type
2337                     (builtin_type
2338                       (index_type))))))))))))
2340 ================================================================================
2341 memref.reinterpret_cast
2342 ================================================================================
2343 func.func @memref_reinterpret_cast_static_to_dynamic_sizes(%in: memref<?xf32>)
2344     -> memref<10x?xf32, strided<[?, 1], offset: ?>> {
2345   %out = memref.reinterpret_cast %in to
2346            offset: [1], sizes: [10, 10], strides: [1, 1]
2347            : memref<?xf32> to memref<10x?xf32, strided<[?, 1], offset: ?>>
2348   return %out : memref<10x?xf32, strided<[?, 1], offset: ?>>
2350 --------------------------------------------------------------------------------
2352 (toplevel
2353   (operation
2354     (custom_operation
2355       (func_dialect
2356         (symbol_ref_id)
2357         (func_arg_list
2358           (value_use)
2359           (type
2360             (builtin_type
2361               (memref_type
2362                 (dim_list
2363                   (float_type))))))
2364         (func_return
2365           (type_list_attr_parens
2366             (type
2367               (builtin_type
2368                 (memref_type
2369                   (dim_list
2370                     (float_type))
2371                   (attribute_value
2372                     (builtin_attribute
2373                       (strided_layout))))))))
2374         (region
2375           (entry_block
2376             (operation
2377               (op_result
2378                 (value_use))
2379               (custom_operation
2380                 (memref_dialect
2381                   (value_use)
2382                   (integer_literal)
2383                   (integer_literal)
2384                   (integer_literal)
2385                   (integer_literal)
2386                   (integer_literal)
2387                   (type
2388                     (builtin_type
2389                       (memref_type
2390                         (dim_list
2391                           (float_type)))))
2392                   (type
2393                     (builtin_type
2394                       (memref_type
2395                         (dim_list
2396                           (float_type))
2397                         (attribute_value
2398                           (builtin_attribute
2399                             (strided_layout)))))))))
2400             (operation
2401               (custom_operation
2402                 (func_dialect
2403                   (value_use)
2404                   (type
2405                     (builtin_type
2406                       (memref_type
2407                         (dim_list
2408                           (float_type))
2409                         (attribute_value
2410                           (builtin_attribute
2411                             (strided_layout)))))))))))))))
2413 ================================================================================
2414 cf.assert
2415 ================================================================================
2416 func.func @assert(%arg : i1) {
2417   cf.assert %arg, "Some message in case this assertion fails."
2418   return
2420 --------------------------------------------------------------------------------
2422 (toplevel
2423   (operation
2424     (custom_operation
2425       (func_dialect
2426         (symbol_ref_id)
2427         (func_arg_list
2428           (value_use)
2429           (type
2430             (builtin_type
2431               (integer_type))))
2432         (region
2433           (entry_block
2434             (operation
2435               (custom_operation
2436                 (cf_dialect
2437                   (value_use)
2438                   (string_literal))))
2439             (operation
2440               (custom_operation
2441                 (func_dialect)))))))))
2443 ================================================================================
2444 vector.splat
2445 ================================================================================
2446 func.func @signExtendConstantSplat() -> vector<4xi16> {
2447   %c-2 = arith.constant -2 : i8
2448   %splat = vector.splat %c-2 : vector<4xi8>
2449   %ext = arith.extsi %splat : vector<4xi8> to vector<4xi16>
2450   return %ext : vector<4xi16>
2452 --------------------------------------------------------------------------------
2454 (toplevel
2455   (operation
2456     (custom_operation
2457       (func_dialect
2458         (symbol_ref_id)
2459         (func_arg_list)
2460         (func_return
2461           (type_list_attr_parens
2462             (type
2463               (builtin_type
2464                 (vector_type
2465                   (vector_dim_list)
2466                   (integer_type))))))
2467         (region
2468           (entry_block
2469             (operation
2470               (op_result
2471                 (value_use))
2472               (custom_operation
2473                 (arith_dialect
2474                   (integer_literal)
2475                   (type
2476                     (builtin_type
2477                       (integer_type))))))
2478             (operation
2479               (op_result
2480                 (value_use))
2481               (custom_operation
2482                 (vector_dialect
2483                   (value_use)
2484                   (type
2485                     (builtin_type
2486                       (vector_type
2487                         (vector_dim_list)
2488                         (integer_type)))))))
2489             (operation
2490               (op_result
2491                 (value_use))
2492               (custom_operation
2493                 (arith_dialect
2494                   (value_use)
2495                   (type
2496                     (builtin_type
2497                       (vector_type
2498                         (vector_dim_list)
2499                         (integer_type))))
2500                   (type
2501                     (builtin_type
2502                       (vector_type
2503                         (vector_dim_list)
2504                         (integer_type)))))))
2505             (operation
2506               (custom_operation
2507                 (func_dialect
2508                   (value_use)
2509                   (type
2510                     (builtin_type
2511                       (vector_type
2512                         (vector_dim_list)
2513                         (integer_type)))))))))))))
2515 ================================================================================
2516 arith.cmpi with string parameter
2517 ================================================================================
2518 func.func @notCmpEQ(%arg0: i8, %arg1: i8) -> i1 {
2519   %true = arith.constant true
2520   %cmp = arith.cmpi "eq", %arg0, %arg1 : i8
2521   %ncmp = arith.xori %cmp, %true : i1
2522   return %ncmp : i1
2524 --------------------------------------------------------------------------------
2526 (toplevel
2527   (operation
2528     (custom_operation
2529       (func_dialect
2530         (symbol_ref_id)
2531         (func_arg_list
2532           (value_use)
2533           (type
2534             (builtin_type
2535               (integer_type)))
2536           (value_use)
2537           (type
2538             (builtin_type
2539               (integer_type))))
2540         (func_return
2541           (type_list_attr_parens
2542             (type
2543               (builtin_type
2544                 (integer_type)))))
2545         (region
2546           (entry_block
2547             (operation
2548               (op_result
2549                 (value_use))
2550               (custom_operation
2551                 (arith_dialect
2552                   (bool_literal))))
2553             (operation
2554               (op_result
2555                 (value_use))
2556               (custom_operation
2557                 (arith_dialect
2558                   (string_literal)
2559                   (value_use)
2560                   (value_use)
2561                   (type
2562                     (builtin_type
2563                       (integer_type))))))
2564             (operation
2565               (op_result
2566                 (value_use))
2567               (custom_operation
2568                 (arith_dialect
2569                   (value_use)
2570                   (value_use)
2571                   (type
2572                     (builtin_type
2573                       (integer_type))))))
2574             (operation
2575               (custom_operation
2576                 (func_dialect
2577                   (value_use)
2578                   (type
2579                     (builtin_type
2580                       (integer_type))))))))))))
2582 ================================================================================
2583 bufferization.alloc_tensor
2584 ================================================================================
2585 func.func @test_alloc_tensor_op(%t: tensor<?x5xf32>, %sz: index)
2586   -> tensor<?x5xf32>
2588   %0 = bufferization.alloc_tensor(%sz) : tensor<?x5xf32>
2589   %1 = bufferization.alloc_tensor() copy(%t) : tensor<?x5xf32>
2590   %2 = bufferization.alloc_tensor() : tensor<5x6xf32>
2591   %3 = bufferization.alloc_tensor(%sz, %sz) : tensor<?x?xf32>
2592   %4 = bufferization.alloc_tensor() copy(%t) {escape = true} : tensor<?x5xf32>
2593   %5 = bufferization.alloc_tensor() copy(%t) {escape = false} : tensor<?x5xf32>
2594   %c100 = arith.constant 100 : index
2595   %6 = bufferization.alloc_tensor() size_hint=%c100 : tensor<100x100xf64, #CSR>
2596   %7 = bufferization.alloc_tensor(%sz) {memory_space = "foo"} : tensor<?xf32>
2597   return %1 : tensor<?x5xf32>
2599 --------------------------------------------------------------------------------
2601 (toplevel
2602   (operation
2603     (custom_operation
2604       (func_dialect
2605         (symbol_ref_id)
2606         (func_arg_list
2607           (value_use)
2608           (type
2609             (builtin_type
2610               (tensor_type
2611                 (dim_list
2612                   (float_type)))))
2613           (value_use)
2614           (type
2615             (builtin_type
2616               (index_type))))
2617         (func_return
2618           (type_list_attr_parens
2619             (type
2620               (builtin_type
2621                 (tensor_type
2622                   (dim_list
2623                     (float_type)))))))
2624         (region
2625           (entry_block
2626             (operation
2627               (op_result
2628                 (value_use))
2629               (custom_operation
2630                 (bufferization_dialect
2631                   (value_use)
2632                   (type
2633                     (builtin_type
2634                       (tensor_type
2635                         (dim_list
2636                           (float_type))))))))
2637             (operation
2638               (op_result
2639                 (value_use))
2640               (custom_operation
2641                 (bufferization_dialect
2642                   (value_use)
2643                   (type
2644                     (builtin_type
2645                       (tensor_type
2646                         (dim_list
2647                           (float_type))))))))
2648             (operation
2649               (op_result
2650                 (value_use))
2651               (custom_operation
2652                 (bufferization_dialect
2653                   (type
2654                     (builtin_type
2655                       (tensor_type
2656                         (dim_list
2657                           (float_type))))))))
2658             (operation
2659               (op_result
2660                 (value_use))
2661               (custom_operation
2662                 (bufferization_dialect
2663                   (value_use)
2664                   (value_use)
2665                   (type
2666                     (builtin_type
2667                       (tensor_type
2668                         (dim_list
2669                           (float_type))))))))
2670             (operation
2671               (op_result
2672                 (value_use))
2673               (custom_operation
2674                 (bufferization_dialect
2675                   (value_use)
2676                   (attribute
2677                     (dictionary_attribute
2678                       (attribute_entry
2679                         (bare_id)
2680                         (attribute_value
2681                           (bool_literal)))))
2682                   (type
2683                     (builtin_type
2684                       (tensor_type
2685                         (dim_list
2686                           (float_type))))))))
2687             (operation
2688               (op_result
2689                 (value_use))
2690               (custom_operation
2691                 (bufferization_dialect
2692                   (value_use)
2693                   (attribute
2694                     (dictionary_attribute
2695                       (attribute_entry
2696                         (bare_id)
2697                         (attribute_value
2698                           (bool_literal)))))
2699                   (type
2700                     (builtin_type
2701                       (tensor_type
2702                         (dim_list
2703                           (float_type))))))))
2704             (operation
2705               (op_result
2706                 (value_use))
2707               (custom_operation
2708                 (arith_dialect
2709                   (integer_literal)
2710                   (type
2711                     (builtin_type
2712                       (index_type))))))
2713             (operation
2714               (op_result
2715                 (value_use))
2716               (custom_operation
2717                 (bufferization_dialect
2718                   (value_use)
2719                   (type
2720                     (builtin_type
2721                       (tensor_type
2722                         (dim_list
2723                           (float_type))
2724                         (tensor_encoding
2725                           (attribute_value
2726                             (attribute_alias)))))))))
2727             (operation
2728               (op_result
2729                 (value_use))
2730               (custom_operation
2731                 (bufferization_dialect
2732                   (value_use)
2733                   (attribute
2734                     (dictionary_attribute
2735                       (attribute_entry
2736                         (bare_id)
2737                         (attribute_value
2738                           (string_literal)))))
2739                   (type
2740                     (builtin_type
2741                       (tensor_type
2742                         (dim_list
2743                           (float_type))))))))
2744             (operation
2745               (custom_operation
2746                 (func_dialect
2747                   (value_use)
2748                   (type
2749                     (builtin_type
2750                       (tensor_type
2751                         (dim_list
2752                           (float_type))))))))))))))
2754 ================================================================================
2755 vector.transfer_read and vector.transfer_write
2756 ================================================================================
2757 func.func @vector_transfer_ops(%arg0: memref<?x?xf32>,
2758                           %arg1 : memref<?x?xvector<4x3xf32>>,
2759                           %arg2 : memref<?x?xvector<4x3xi32>>,
2760                           %arg3 : memref<?x?xvector<4x3xindex>>,
2761                           %arg4 : memref<?x?x?xf32>) {
2762   %c3 = arith.constant 3 : index
2763   %cst = arith.constant 3.0 : f32
2764   %f0 = arith.constant 0.0 : f32
2765   %c0 = arith.constant 0 : i32
2766   %i0 = arith.constant 0 : index
2767   %i1 = arith.constant 1 : i1
2769   %vf0 = vector.splat %f0 : vector<4x3xf32>
2770   %v0 = vector.splat %c0 : vector<4x3xi32>
2771   %vi0 = vector.splat %i0 : vector<4x3xindex>
2772   %m = arith.constant dense<[0, 0, 1, 0, 1]> : vector<5xi1>
2773   %m2 = vector.splat %i1 : vector<4x5xi1>
2774   %0 = vector.transfer_read %arg0[%c3, %c3], %f0 {permutation_map = affine_map<(d0, d1)->(d0)>} : memref<?x?xf32>, vector<128xf32>
2775   %1 = vector.transfer_read %arg0[%c3, %c3], %f0 {permutation_map = affine_map<(d0, d1)->(d1, d0)>} : memref<?x?xf32>, vector<3x7xf32>
2776   %2 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d0)>} : memref<?x?xf32>,  vector<128xf32>
2777   %3 = vector.transfer_read %arg0[%c3, %c3], %cst {permutation_map = affine_map<(d0, d1)->(d1)>} : memref<?x?xf32>,  vector<128xf32>
2778   %4 = vector.transfer_read %arg1[%c3, %c3], %vf0 {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : memref<?x?xvector<4x3xf32>>, vector<1x1x4x3xf32>
2779   %5 = vector.transfer_read %arg1[%c3, %c3], %vf0 {in_bounds = [false, true]} : memref<?x?xvector<4x3xf32>>, vector<1x1x4x3xf32>
2780   %6 = vector.transfer_read %arg2[%c3, %c3], %v0 : memref<?x?xvector<4x3xi32>>, vector<5x24xi8>
2781   %7 = vector.transfer_read %arg3[%c3, %c3], %vi0 : memref<?x?xvector<4x3xindex>>, vector<5x48xi8>
2782   %8 = vector.transfer_read %arg0[%c3, %c3], %f0, %m : memref<?x?xf32>, vector<5xf32>
2783   %9 = vector.transfer_read %arg4[%c3, %c3, %c3], %f0, %m2 {permutation_map = affine_map<(d0, d1, d2)->(d1, d0, 0)>} : memref<?x?x?xf32>, vector<5x4x8xf32>
2785   vector.transfer_write %0, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0)>} : vector<128xf32>, memref<?x?xf32>
2786   vector.transfer_write %1, %arg0[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d1, d0)>} : vector<3x7xf32>, memref<?x?xf32>
2787   vector.transfer_write %4, %arg1[%c3, %c3] {permutation_map = affine_map<(d0, d1)->(d0, d1)>} : vector<1x1x4x3xf32>, memref<?x?xvector<4x3xf32>>
2788   vector.transfer_write %5, %arg1[%c3, %c3] {in_bounds = [false, false]} : vector<1x1x4x3xf32>, memref<?x?xvector<4x3xf32>>
2789   vector.transfer_write %6, %arg2[%c3, %c3] : vector<5x24xi8>, memref<?x?xvector<4x3xi32>>
2790   vector.transfer_write %7, %arg3[%c3, %c3] : vector<5x48xi8>, memref<?x?xvector<4x3xindex>>
2791   vector.transfer_write %8, %arg0[%c3, %c3], %m : vector<5xf32>, memref<?x?xf32>
2793   return
2795 --------------------------------------------------------------------------------
2797 (toplevel
2798   (operation
2799     (custom_operation
2800       (func_dialect
2801         (symbol_ref_id)
2802         (func_arg_list
2803           (value_use)
2804           (type
2805             (builtin_type
2806               (memref_type
2807                 (dim_list
2808                   (float_type)))))
2809           (value_use)
2810           (type
2811             (builtin_type
2812               (memref_type
2813                 (dim_list
2814                   (vector_type
2815                     (vector_dim_list)
2816                     (float_type))))))
2817           (value_use)
2818           (type
2819             (builtin_type
2820               (memref_type
2821                 (dim_list
2822                   (vector_type
2823                     (vector_dim_list)
2824                     (integer_type))))))
2825           (value_use)
2826           (type
2827             (builtin_type
2828               (memref_type
2829                 (dim_list
2830                   (vector_type
2831                     (vector_dim_list)
2832                     (index_type))))))
2833           (value_use)
2834           (type
2835             (builtin_type
2836               (memref_type
2837                 (dim_list
2838                   (float_type))))))
2839         (region
2840           (entry_block
2841             (operation
2842               (op_result
2843                 (value_use))
2844               (custom_operation
2845                 (arith_dialect
2846                   (integer_literal)
2847                   (type
2848                     (builtin_type
2849                       (index_type))))))
2850             (operation
2851               (op_result
2852                 (value_use))
2853               (custom_operation
2854                 (arith_dialect
2855                   (float_literal)
2856                   (type
2857                     (builtin_type
2858                       (float_type))))))
2859             (operation
2860               (op_result
2861                 (value_use))
2862               (custom_operation
2863                 (arith_dialect
2864                   (float_literal)
2865                   (type
2866                     (builtin_type
2867                       (float_type))))))
2868             (operation
2869               (op_result
2870                 (value_use))
2871               (custom_operation
2872                 (arith_dialect
2873                   (integer_literal)
2874                   (type
2875                     (builtin_type
2876                       (integer_type))))))
2877             (operation
2878               (op_result
2879                 (value_use))
2880               (custom_operation
2881                 (arith_dialect
2882                   (integer_literal)
2883                   (type
2884                     (builtin_type
2885                       (index_type))))))
2886             (operation
2887               (op_result
2888                 (value_use))
2889               (custom_operation
2890                 (arith_dialect
2891                   (integer_literal)
2892                   (type
2893                     (builtin_type
2894                       (integer_type))))))
2895             (operation
2896               (op_result
2897                 (value_use))
2898               (custom_operation
2899                 (vector_dialect
2900                   (value_use)
2901                   (type
2902                     (builtin_type
2903                       (vector_type
2904                         (vector_dim_list)
2905                         (float_type)))))))
2906             (operation
2907               (op_result
2908                 (value_use))
2909               (custom_operation
2910                 (vector_dialect
2911                   (value_use)
2912                   (type
2913                     (builtin_type
2914                       (vector_type
2915                         (vector_dim_list)
2916                         (integer_type)))))))
2917             (operation
2918               (op_result
2919                 (value_use))
2920               (custom_operation
2921                 (vector_dialect
2922                   (value_use)
2923                   (type
2924                     (builtin_type
2925                       (vector_type
2926                         (vector_dim_list)
2927                         (index_type)))))))
2928             (operation
2929               (op_result
2930                 (value_use))
2931               (custom_operation
2932                 (arith_dialect
2933                   (tensor_literal
2934                     (nested_idx_list
2935                       (integer_literal)
2936                       (integer_literal)
2937                       (integer_literal)
2938                       (integer_literal)
2939                       (integer_literal)))
2940                   (type
2941                     (builtin_type
2942                       (vector_type
2943                         (vector_dim_list)
2944                         (integer_type)))))))
2945             (operation
2946               (op_result
2947                 (value_use))
2948               (custom_operation
2949                 (vector_dialect
2950                   (value_use)
2951                   (type
2952                     (builtin_type
2953                       (vector_type
2954                         (vector_dim_list)
2955                         (integer_type)))))))
2956             (operation
2957               (op_result
2958                 (value_use))
2959               (custom_operation
2960                 (vector_dialect
2961                   (value_use)
2962                   (value_use)
2963                   (value_use)
2964                   (value_use)
2965                   (attribute
2966                     (dictionary_attribute
2967                       (attribute_entry
2968                         (bare_id)
2969                         (attribute_value
2970                           (builtin_attribute
2971                             (affine_map
2972                               (bare_id)
2973                               (bare_id)
2974                               (bare_id)))))))
2975                   (type
2976                     (builtin_type
2977                       (memref_type
2978                         (dim_list
2979                           (float_type)))))
2980                   (type
2981                     (builtin_type
2982                       (vector_type
2983                         (vector_dim_list)
2984                         (float_type)))))))
2985             (operation
2986               (op_result
2987                 (value_use))
2988               (custom_operation
2989                 (vector_dialect
2990                   (value_use)
2991                   (value_use)
2992                   (value_use)
2993                   (value_use)
2994                   (attribute
2995                     (dictionary_attribute
2996                       (attribute_entry
2997                         (bare_id)
2998                         (attribute_value
2999                           (builtin_attribute
3000                             (affine_map
3001                               (bare_id)
3002                               (bare_id)
3003                               (bare_id)
3004                               (bare_id)))))))
3005                   (type
3006                     (builtin_type
3007                       (memref_type
3008                         (dim_list
3009                           (float_type)))))
3010                   (type
3011                     (builtin_type
3012                       (vector_type
3013                         (vector_dim_list)
3014                         (float_type)))))))
3015             (operation
3016               (op_result
3017                 (value_use))
3018               (custom_operation
3019                 (vector_dialect
3020                   (value_use)
3021                   (value_use)
3022                   (value_use)
3023                   (value_use)
3024                   (attribute
3025                     (dictionary_attribute
3026                       (attribute_entry
3027                         (bare_id)
3028                         (attribute_value
3029                           (builtin_attribute
3030                             (affine_map
3031                               (bare_id)
3032                               (bare_id)
3033                               (bare_id)))))))
3034                   (type
3035                     (builtin_type
3036                       (memref_type
3037                         (dim_list
3038                           (float_type)))))
3039                   (type
3040                     (builtin_type
3041                       (vector_type
3042                         (vector_dim_list)
3043                         (float_type)))))))
3044             (operation
3045               (op_result
3046                 (value_use))
3047               (custom_operation
3048                 (vector_dialect
3049                   (value_use)
3050                   (value_use)
3051                   (value_use)
3052                   (value_use)
3053                   (attribute
3054                     (dictionary_attribute
3055                       (attribute_entry
3056                         (bare_id)
3057                         (attribute_value
3058                           (builtin_attribute
3059                             (affine_map
3060                               (bare_id)
3061                               (bare_id)
3062                               (bare_id)))))))
3063                   (type
3064                     (builtin_type
3065                       (memref_type
3066                         (dim_list
3067                           (float_type)))))
3068                   (type
3069                     (builtin_type
3070                       (vector_type
3071                         (vector_dim_list)
3072                         (float_type)))))))
3073             (operation
3074               (op_result
3075                 (value_use))
3076               (custom_operation
3077                 (vector_dialect
3078                   (value_use)
3079                   (value_use)
3080                   (value_use)
3081                   (value_use)
3082                   (attribute
3083                     (dictionary_attribute
3084                       (attribute_entry
3085                         (bare_id)
3086                         (attribute_value
3087                           (builtin_attribute
3088                             (affine_map
3089                               (bare_id)
3090                               (bare_id)
3091                               (bare_id)
3092                               (bare_id)))))))
3093                   (type
3094                     (builtin_type
3095                       (memref_type
3096                         (dim_list
3097                           (vector_type
3098                             (vector_dim_list)
3099                             (float_type))))))
3100                   (type
3101                     (builtin_type
3102                       (vector_type
3103                         (vector_dim_list)
3104                         (float_type)))))))
3105             (operation
3106               (op_result
3107                 (value_use))
3108               (custom_operation
3109                 (vector_dialect
3110                   (value_use)
3111                   (value_use)
3112                   (value_use)
3113                   (value_use)
3114                   (attribute
3115                     (dictionary_attribute
3116                       (attribute_entry
3117                         (bare_id)
3118                         (attribute_value
3119                           (bool_literal)
3120                           (bool_literal)))))
3121                   (type
3122                     (builtin_type
3123                       (memref_type
3124                         (dim_list
3125                           (vector_type
3126                             (vector_dim_list)
3127                             (float_type))))))
3128                   (type
3129                     (builtin_type
3130                       (vector_type
3131                         (vector_dim_list)
3132                         (float_type)))))))
3133             (operation
3134               (op_result
3135                 (value_use))
3136               (custom_operation
3137                 (vector_dialect
3138                   (value_use)
3139                   (value_use)
3140                   (value_use)
3141                   (value_use)
3142                   (type
3143                     (builtin_type
3144                       (memref_type
3145                         (dim_list
3146                           (vector_type
3147                             (vector_dim_list)
3148                             (integer_type))))))
3149                   (type
3150                     (builtin_type
3151                       (vector_type
3152                         (vector_dim_list)
3153                         (integer_type)))))))
3154             (operation
3155               (op_result
3156                 (value_use))
3157               (custom_operation
3158                 (vector_dialect
3159                   (value_use)
3160                   (value_use)
3161                   (value_use)
3162                   (value_use)
3163                   (type
3164                     (builtin_type
3165                       (memref_type
3166                         (dim_list
3167                           (vector_type
3168                             (vector_dim_list)
3169                             (index_type))))))
3170                   (type
3171                     (builtin_type
3172                       (vector_type
3173                         (vector_dim_list)
3174                         (integer_type)))))))
3175             (operation
3176               (op_result
3177                 (value_use))
3178               (custom_operation
3179                 (vector_dialect
3180                   (value_use)
3181                   (value_use)
3182                   (value_use)
3183                   (value_use)
3184                   (value_use)
3185                   (type
3186                     (builtin_type
3187                       (memref_type
3188                         (dim_list
3189                           (float_type)))))
3190                   (type
3191                     (builtin_type
3192                       (vector_type
3193                         (vector_dim_list)
3194                         (float_type)))))))
3195             (operation
3196               (op_result
3197                 (value_use))
3198               (custom_operation
3199                 (vector_dialect
3200                   (value_use)
3201                   (value_use)
3202                   (value_use)
3203                   (value_use)
3204                   (value_use)
3205                   (value_use)
3206                   (attribute
3207                     (dictionary_attribute
3208                       (attribute_entry
3209                         (bare_id)
3210                         (attribute_value
3211                           (builtin_attribute
3212                             (affine_map
3213                               (bare_id)
3214                               (bare_id)
3215                               (bare_id)
3216                               (bare_id)
3217                               (bare_id)
3218                               (integer_literal)))))))
3219                   (type
3220                     (builtin_type
3221                       (memref_type
3222                         (dim_list
3223                           (float_type)))))
3224                   (type
3225                     (builtin_type
3226                       (vector_type
3227                         (vector_dim_list)
3228                         (float_type)))))))
3229             (operation
3230               (custom_operation
3231                 (vector_dialect
3232                   (value_use)
3233                   (value_use)
3234                   (value_use)
3235                   (value_use)
3236                   (attribute
3237                     (dictionary_attribute
3238                       (attribute_entry
3239                         (bare_id)
3240                         (attribute_value
3241                           (builtin_attribute
3242                             (affine_map
3243                               (bare_id)
3244                               (bare_id)
3245                               (bare_id)))))))
3246                   (type
3247                     (builtin_type
3248                       (vector_type
3249                         (vector_dim_list)
3250                         (float_type))))
3251                   (type
3252                     (builtin_type
3253                       (memref_type
3254                         (dim_list
3255                           (float_type))))))))
3256             (operation
3257               (custom_operation
3258                 (vector_dialect
3259                   (value_use)
3260                   (value_use)
3261                   (value_use)
3262                   (value_use)
3263                   (attribute
3264                     (dictionary_attribute
3265                       (attribute_entry
3266                         (bare_id)
3267                         (attribute_value
3268                           (builtin_attribute
3269                             (affine_map
3270                               (bare_id)
3271                               (bare_id)
3272                               (bare_id)
3273                               (bare_id)))))))
3274                   (type
3275                     (builtin_type
3276                       (vector_type
3277                         (vector_dim_list)
3278                         (float_type))))
3279                   (type
3280                     (builtin_type
3281                       (memref_type
3282                         (dim_list
3283                           (float_type))))))))
3284             (operation
3285               (custom_operation
3286                 (vector_dialect
3287                   (value_use)
3288                   (value_use)
3289                   (value_use)
3290                   (value_use)
3291                   (attribute
3292                     (dictionary_attribute
3293                       (attribute_entry
3294                         (bare_id)
3295                         (attribute_value
3296                           (builtin_attribute
3297                             (affine_map
3298                               (bare_id)
3299                               (bare_id)
3300                               (bare_id)
3301                               (bare_id)))))))
3302                   (type
3303                     (builtin_type
3304                       (vector_type
3305                         (vector_dim_list)
3306                         (float_type))))
3307                   (type
3308                     (builtin_type
3309                       (memref_type
3310                         (dim_list
3311                           (vector_type
3312                             (vector_dim_list)
3313                             (float_type)))))))))
3314             (operation
3315               (custom_operation
3316                 (vector_dialect
3317                   (value_use)
3318                   (value_use)
3319                   (value_use)
3320                   (value_use)
3321                   (attribute
3322                     (dictionary_attribute
3323                       (attribute_entry
3324                         (bare_id)
3325                         (attribute_value
3326                           (bool_literal)
3327                           (bool_literal)))))
3328                   (type
3329                     (builtin_type
3330                       (vector_type
3331                         (vector_dim_list)
3332                         (float_type))))
3333                   (type
3334                     (builtin_type
3335                       (memref_type
3336                         (dim_list
3337                           (vector_type
3338                             (vector_dim_list)
3339                             (float_type)))))))))
3340             (operation
3341               (custom_operation
3342                 (vector_dialect
3343                   (value_use)
3344                   (value_use)
3345                   (value_use)
3346                   (value_use)
3347                   (type
3348                     (builtin_type
3349                       (vector_type
3350                         (vector_dim_list)
3351                         (integer_type))))
3352                   (type
3353                     (builtin_type
3354                       (memref_type
3355                         (dim_list
3356                           (vector_type
3357                             (vector_dim_list)
3358                             (integer_type)))))))))
3359             (operation
3360               (custom_operation
3361                 (vector_dialect
3362                   (value_use)
3363                   (value_use)
3364                   (value_use)
3365                   (value_use)
3366                   (type
3367                     (builtin_type
3368                       (vector_type
3369                         (vector_dim_list)
3370                         (integer_type))))
3371                   (type
3372                     (builtin_type
3373                       (memref_type
3374                         (dim_list
3375                           (vector_type
3376                             (vector_dim_list)
3377                             (index_type)))))))))
3378             (operation
3379               (custom_operation
3380                 (vector_dialect
3381                   (value_use)
3382                   (value_use)
3383                   (value_use)
3384                   (value_use)
3385                   (value_use)
3386                   (type
3387                     (builtin_type
3388                       (vector_type
3389                         (vector_dim_list)
3390                         (float_type))))
3391                   (type
3392                     (builtin_type
3393                       (memref_type
3394                         (dim_list
3395                           (float_type))))))))
3396             (operation
3397               (custom_operation
3398                 (func_dialect)))))))))