1 ================================================================================
2 func.func with result attribute
3 ================================================================================
4 func.func @example_fn_result() -> (f64 {dialectName.attrName = 0 : i64})
5 --------------------------------------------------------------------------------
14 (type_list_attr_parens
26 (integer_type)))))))))))))
28 ================================================================================
29 func.func with argument attribute
30 ================================================================================
31 func.func @example_fn_arg(%x: i32 {swift.self = unit})
32 --------------------------------------------------------------------------------
49 (unit_literal))))))))))
51 ================================================================================
52 strided attribute in memref
53 ================================================================================
54 func.func @dot_view(%arg0: memref<?xf32, strided<[1], offset: ?>>,
55 %arg1: memref<?xf32, strided<[1], offset: ?>>, %arg2: memref<f32>) {
56 linalg.dot ins(%arg0, %arg1 : memref<?xf32, strided<[1], offset: ?>>,
57 memref<?xf32, strided<[1], offset: ?>>)
58 outs(%arg2: memref<f32>)
61 --------------------------------------------------------------------------------
107 (strided_layout))))))
115 (strided_layout))))))
124 (func_dialect)))))))))
126 ================================================================================
127 dense attribute in linalg.depthwise_conv_1d_nwc_wcm
128 ================================================================================
129 func.func @depthwise_conv_1d_nwc_wcm(%input: tensor<1x12x8xf32>, %filter: tensor<3x8x8xf32>)
130 -> tensor<1x10x8x8xf32> {
131 %zero = arith.constant 0.000000e+00 : f32
132 %init = tensor.empty() : tensor<1x10x8x8xf32>
133 %fill = linalg.fill ins(%zero : f32) outs(%init : tensor<1x10x8x8xf32>) -> tensor<1x10x8x8xf32>
134 %0 = linalg.depthwise_conv_1d_nwc_wcm {dilations = dense<1> : tensor<1xi64>,
135 strides = dense<1> : tensor<1xi64>}
136 ins(%input, %filter : tensor<1x12x8xf32>, tensor<3x8x8xf32>)
137 outs(%fill : tensor<1x10x8x8xf32>) -> tensor<1x10x8x8xf32>
138 return %0 : tensor<1x10x8x8xf32>
140 --------------------------------------------------------------------------------
161 (type_list_attr_parens
214 (dictionary_attribute
234 (integer_type)))))))))
266 (float_type))))))))))))))
268 ================================================================================
269 fastmath attribute in arith
270 ================================================================================
271 func.func @fastmath(%arg0: f32, %arg1: f32, %arg2: i32) {
272 %0 = arith.addf %arg0, %arg1 fastmath<fast> : f32
273 %1 = arith.subf %arg0, %arg1 fastmath<fast> : f32
274 %2 = arith.mulf %arg0, %arg1 fastmath<fast> : f32
275 %3 = arith.divf %arg0, %arg1 fastmath<fast> : f32
276 %4 = arith.remf %arg0, %arg1 fastmath<fast> : f32
277 %5 = arith.negf %arg0 fastmath<fast> : f32
278 %6 = arith.addf %arg0, %arg1 fastmath<none> : f32
279 %7 = arith.addf %arg0, %arg1 fastmath<nnan,ninf> : f32
280 %8 = arith.mulf %arg0, %arg1 fastmath<reassoc,nnan,ninf,nsz,arcp,contract,afn> : f32
283 --------------------------------------------------------------------------------
405 (func_dialect)))))))))
407 ================================================================================
408 Generic function bracketed attributes
409 ================================================================================
411 }) {sym_name = "qux", function_type = !llvm.func<void (ptr<i64>, i64)>,
412 arg_attrs = [{llvm.noalias}, {}], xxx = {yyy = 42}} : () -> ()
413 --------------------------------------------------------------------------------
421 (dictionary_attribute
434 (pretty_dialect_item_body
435 (pretty_dialect_item_body)))))))
439 (dictionary_attribute
442 (dictionary_attribute)))
446 (dictionary_attribute
450 (integer_literal))))))))
453 ================================================================================
454 linalg.generic with attributes using attribute aliases
455 ================================================================================
456 #map0 = affine_map<(d0, d1) -> (d0, d1)>
457 #map1 = affine_map<(d0, d1) -> (d0)>
458 #map2 = affine_map<(d0) -> (d0)>
460 func.func @add_broadcast_mul_fusion(%arg0: tensor<?xf32>, %arg1 : tensor<?xf32>,
461 %arg2 : tensor<?x?xf32>) -> tensor<?x?xf32>
463 %c0 = arith.constant 0 : index
464 %c1 = arith.constant 1 : index
465 %0 = tensor.dim %arg0, %c0 : tensor<?xf32>
466 %1 = tensor.empty(%0) : tensor<?xf32>
467 %2 = linalg.generic {indexing_maps = [#map2, #map2, #map2], iterator_types = ["parallel"]}
468 ins(%arg0, %arg1 : tensor<?xf32>, tensor<?xf32>)
469 outs(%1 : tensor<?xf32>) {
470 ^bb0(%arg3: f32, %arg4: f32, %arg5: f32):
471 %3 = arith.addf %arg3, %arg4 : f32
472 linalg.yield %3 : f32
474 %3 = tensor.dim %arg2, %c1 : tensor<?x?xf32>
475 %4 = tensor.empty(%0, %3) : tensor<?x?xf32>
476 %5 = linalg.generic {indexing_maps = [#map1, #map0, #map0], iterator_types = ["parallel", "parallel"]}
477 ins(%2, %arg2 : tensor<?xf32>, tensor<?x?xf32>)
478 outs(%4 : tensor<?x?xf32>){
479 ^bb0(%arg5: f32, %arg6: f32, %arg7: f32):
480 %6 = arith.mulf %arg5, %arg6 : f32
481 linalg.yield %6 : f32
483 return %5 : tensor<?x?xf32>
485 --------------------------------------------------------------------------------
533 (type_list_attr_parens
588 (dictionary_attribute
686 (dictionary_attribute
763 (float_type))))))))))))))
765 ================================================================================
766 linalg.generic with attribute alias
767 ================================================================================
768 #map0 = affine_map<() -> ()>
771 indexing_maps = [#map0, #map0, #map0],
775 func.func @main() -> (tensor<i32>) attributes {} {
776 %c0 = arith.constant 0 : i32
777 %0 = tensor.from_elements %c0 : tensor<i32>
778 %c10 = arith.constant 10 : i32
779 %1 = tensor.from_elements %c10 : tensor<i32>
780 cf.br ^bb1(%0 : tensor<i32>)
782 ^bb1(%2: tensor<i32>): // 2 preds: ^bb0, ^bb2
783 %3 = tensor.empty() : tensor<i1>
784 %4 = linalg.generic #attrs
785 ins(%2, %1 : tensor<i32>, tensor<i32>)
786 outs(%3 : tensor<i1>) {
787 ^bb0(%arg0: i32, %arg1: i32, %arg2: i1):
788 %8 = arith.cmpi slt, %arg0, %arg1 : i32
791 %5 = tensor.extract %4[] : tensor<i1>
792 cf.cond_br %5, ^bb2(%2 : tensor<i32>), ^bb3(%2 : tensor<i32>)
794 ^bb2(%6: tensor<i32>): // pred: ^bb1
795 %7 = tensor.empty() : tensor<i32>
796 %8 = linalg.generic #attrs
797 ins(%6, %6 : tensor<i32>, tensor<i32>)
798 outs(%7 : tensor<i32>) {
799 ^bb0(%arg0: i32, %arg1: i32, %arg2: i32):
800 %9 = arith.addi %arg0, %arg1 : i32
801 linalg.yield %9 : i32
803 cf.br ^bb3(%8 : tensor<i32>)
805 ^bb3(%10: tensor<i32>): // pred: ^bb1
806 return %10 : tensor<i32>
808 --------------------------------------------------------------------------------
817 (dictionary_attribute
826 (attribute_value)))))
833 (type_list_attr_parens
840 (dictionary_attribute))
862 (integer_type))))))))
882 (integer_type))))))))
893 (integer_type))))))))))
914 (integer_type))))))))
973 (integer_type))))))))
978 (integer_type))))))))
989 (integer_type))))))))
1009 (integer_type))))))))))
1019 (integer_type)))))))
1030 (integer_type))))))))
1089 (integer_type))))))))
1094 (integer_type))))))))
1105 (integer_type))))))))))
1115 (integer_type)))))))
1125 (integer_type))))))))))))))
1127 ================================================================================
1128 linalg.generic with inline attributes
1129 ================================================================================
1130 func.func @copy_view(%arg0: memref<?xf32, strided<[1], offset: ?>>,
1131 %arg1: memref<?xf32, strided<[1], offset: ?>>) {
1133 iterator_types = ["parallel"],
1134 indexing_maps = [ affine_map<(i) -> (i)>, affine_map<(i) -> (i)>] }
1135 ins(%arg0: memref<?xf32, strided<[1], offset: ?>>)
1136 outs(%arg1: memref<?xf32, strided<[1], offset: ?>>) {
1137 ^bb0(%a: f32, %b: f32):
1138 linalg.yield %a : f32
1142 --------------------------------------------------------------------------------
1158 (strided_layout))))))
1167 (strided_layout)))))))
1174 (dictionary_attribute
1198 (strided_layout))))))
1207 (strided_layout))))))
1227 (float_type)))))))))))
1230 (func_dialect)))))))))
1232 ================================================================================
1233 linalg.broadcast with inline attributes, without dictionary tokens
1234 ================================================================================
1235 func.func @broadcast(%input: tensor<8x32xf32>,
1236 %init: tensor<8x16x32xf32>) -> tensor<8x16x32xf32> {
1237 %bcast = linalg.broadcast
1238 ins(%input:tensor<8x32xf32>)
1239 outs(%init:tensor<8x16x32xf32>)
1241 func.return %bcast : tensor<8x16x32xf32>
1243 --------------------------------------------------------------------------------
1264 (type_list_attr_parens
1289 (bare_attribute_entry
1292 (integer_literal))))))
1301 (float_type))))))))))))))